Skip to content

Commit

Permalink
Reformatted lint & exclude sections
Browse files Browse the repository at this point in the history
  • Loading branch information
cdoremus committed May 28, 2024
1 parent beef84a commit c7319d8
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 107 deletions.
21 changes: 21 additions & 0 deletions components/wc/LitHelloWC.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* This class does not work properly with Fresh at this point (June, 2024),
* This code is here as a simple Lit decorator example to use once browsers
* or Deno supports transpiling decorators to browser-compatible JavaScript.
*
* To use this on a Fresh page, make sure this file is exported in the main.ts
* file and that it is referenced in the lit.tsx route file (uncomment
* the commented code).
*/

import { html, LitElement } from "npm:lit";
import { customElement, property } from "npm:lit/decorators.js";

@customElement("hello-world")
export class HelloWorld extends LitElement {
@property()
name?: string = "world";

render() {
return html`<p>Hello ${this.name}!</p>`;
}
}
3 changes: 2 additions & 1 deletion components/wc/TableWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class MyTable extends HTMLElement {
text-align: center;
}
div {
font-size:2rem;
color: red;
font-size:1.5rem;
font-weight:900;
}
`;
Expand Down
3 changes: 2 additions & 1 deletion components/wc/TemplatedWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export class TemplatedWC extends HTMLElement {
const template = document.querySelector("#template-wc");
shadow.innerHTML = `<style>${this.css}</style>`;
// @ts-ignore bad error: "content does not exist on type element"
shadow.appendChild(template!.content.cloneNode(true));
// shadow.appendChild(template!.content.cloneNode(true));
shadow.appendChild(template!.content);
// this.innerHTML = template!.content.toString();
}
}
Expand Down
1 change: 1 addition & 0 deletions components/wc/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from "./TableWC.ts";
export * from "./FormWC.ts";
export * from "./TemplatedWC.ts";
export * from "./UsingNpmLib.js";
// export * from "./LitHelloWC.ts";
15 changes: 12 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
"preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
"lint": { "rules": { "tags": ["fresh", "recommended"] } },
"exclude": ["**/_fresh/*"],
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"exclude": [
"**/_fresh/*"
],
"nodeModulesDir": true,
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.6.8/",
Expand All @@ -29,4 +38,4 @@
"jsxImportSource": "preact",
"experimentalDecorators": true
}
}
}
18 changes: 11 additions & 7 deletions routes/lit.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
export default function LitPage() {
return (
<div class="px-4 py-8 mx-auto bg-[#86efac]">
<div class="text-4xl font-bold">Lit Web Components</div>
<hr />
<div>
<div class="text-4xl font-bold">Lit Web Components</div>
<hr />
<div>
<h2>Greeting Component</h2>
<my-lit-message message="Greetings from a custom element!">
</my-lit-message>
</div>
<h2>Greeting Component</h2>
<my-lit-message message="Greetings from a custom element!">
</my-lit-message>
</div>
<div>
<h2>Custom Alert Web Component</h2>
<custom-alert>This is a dismissible message</custom-alert>
</div>
{
/* <div>
<h2>Lit Hello World Using Decorators</h2>
<hello-world></hello-world>
</div> */
}
</div>
);
}
Loading

0 comments on commit c7319d8

Please sign in to comment.