Skip to content

Commit

Permalink
Upgrade to Fresh 1.6.8; ran deno fmt; other tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cdoremus committed Mar 23, 2024
1 parent 947f052 commit c53ae94
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 33 deletions.
2 changes: 0 additions & 2 deletions components/wc/CounterWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ class CounterWC extends HTMLElement {
}
}
customElements.define("counter-wc", CounterWC);

export default CounterWC;
2 changes: 0 additions & 2 deletions components/wc/HelloWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,3 @@ class HelloWC extends HTMLElement {
}
}
customElements.define("hello-wc", HelloWC);

export default HelloWC;
2 changes: 0 additions & 2 deletions components/wc/LitCounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,3 @@ customElements.define(
"lit-counter",
LitCounter,
);

export default LitCounter;
7 changes: 0 additions & 7 deletions components/wc/MyLitMessage.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { css, html, LitElement } from "https://esm.sh/lit@3.1.0";
// import {
// customElement,
// property,
// } from "https://esm.sh/lit@3.1.0/decorators.js";

/* TS errors are ignored in the build */
// @customElement("my-lit-message")
// @ts-ignore LSP does not recognize LitElement syntax
export class MyLitMessage extends LitElement {
// @property()
// Properties are the component attributes
static get properties(): { message: string } {
return {
Expand Down
12 changes: 0 additions & 12 deletions components/wc/TemplatedWC.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
// Define the component's template in code
// const template = document.createElement("template");
// template.setAttribute("id", "template-wc");
// template!.innerHTML = `
// <div class="container">
// <span id="title">This is inside the template</span>
// <slot></slot>
// <slot name="slot2"></slot>
// <slot name="slot3"></slot>
// </div>
// `;

export class TemplatedWC extends HTMLElement {
css = `
div.container {
Expand Down
2 changes: 1 addition & 1 deletion components/wc/UsingNpmLib.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* How to use a library in a web component - change-case here.
*/
// 'npm:' specifier does not work since Deno is not processing this
// 'npm:' specifier does not work since Deno is not processing this file
import * as changeCase from "https://esm.sh/change-case@5.4.3";

class UsingNpmLib extends HTMLElement {
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"exclude": ["**/_fresh/*"],
"nodeModulesDir": true,
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.6.7/",
"$fresh/": "https://deno.land/x/fresh@1.6.8/",
"preact": "https://esm.sh/preact@10.19.6",
"preact/": "https://esm.sh/preact@10.19.6/",
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.2",
Expand Down
7 changes: 3 additions & 4 deletions routes/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppProps } from "$fresh/server.ts";
import { PageProps } from "$fresh/server.ts";

export default function App({ Component }: AppProps) {
export default function App({ Component }: PageProps) {
return (
<html>
<head>
Expand All @@ -16,9 +16,8 @@ export default function App({ Component }: AppProps) {
src="https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js"
>
</script>
<script src="https://unpkg.com/two-up-element@1"></script>
<script src="https://unpkg.com/two-up-element@1" type="module"></script>
</head>
{/* <body class="m-x-5 md:m-x-50 m-y-0 pt-4 mx-auto max-w-screen-lg bg-blue-100"> */}
<body class="bg-blue-400">
<header>
<div class="title">
Expand Down
1 change: 0 additions & 1 deletion static/wc/wc.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ l2?.({ LitElement: t });

// components/wc/MyLitMessage.ts
var MyLitMessage = class extends t {
// @property()
// Properties are the component attributes
static get properties() {
return {
Expand Down
2 changes: 1 addition & 1 deletion types/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Definitions of web component types with emphasis on extending
* JSX.IntrinsicElements. This is required to be able to use a custom
* element in a .tsx page without showing errors in vscode.
* element in a .tsx page without showing TypeScript errors in vscode.
*/
import { JSX } from "preact";
import { LitElement } from "https://esm.sh/lit@3.1.0";
Expand Down

0 comments on commit c53ae94

Please sign in to comment.