From e59a6233f156213168da0f5172572253420d7a46 Mon Sep 17 00:00:00 2001
From: Elliott Marquez <5981958+e111077@users.noreply.github.com>
Date: Fri, 19 Jul 2024 15:34:30 -0700
Subject: [PATCH] [WIP] lit cheat sheet
---
.../lit-cheat-sheet/add-styles/index.html | 3 +
.../lit-cheat-sheet/add-styles/my-element.ts | 18 +
.../lit-cheat-sheet/add-styles/project.json | 8 +
.../lit-cheat-sheet/classes/index.html | 3 +
.../lit-cheat-sheet/classes/my-element.ts | 29 ++
.../lit-cheat-sheet/classes/project.json | 8 +
.../lit-cheat-sheet/conditionals/index.html | 3 +
.../conditionals/my-element.ts | 26 +
.../lit-cheat-sheet/conditionals/project.json | 8 +
.../css-shadow-parts/index.html | 24 +
.../css-shadow-parts/my-element.ts | 18 +
.../css-shadow-parts/project.json | 8 +
.../lit-cheat-sheet/data-up/game-player.ts | 18 +
.../lit-cheat-sheet/data-up/index.html | 3 +
.../lit-cheat-sheet/data-up/project.json | 9 +
.../lit-cheat-sheet/data-up/score-board.ts | 20 +
.../lit-cheat-sheet/define/hello-world.ts | 9 +
.../lit-cheat-sheet/define/index.html | 3 +
.../lit-cheat-sheet/define/project.json | 8 +
.../event-listeners/index.html | 3 +
.../event-listeners/my-element.ts | 47 ++
.../event-listeners/project.json | 8 +
.../export-part/another-element.ts | 12 +
.../lit-cheat-sheet/export-part/index.html | 12 +
.../lit-cheat-sheet/export-part/my-element.ts | 10 +
.../lit-cheat-sheet/export-part/project.json | 9 +
.../lit-cheat-sheet/expressions/index.html | 3 +
.../lit-cheat-sheet/expressions/my-element.ts | 62 +++
.../lit-cheat-sheet/expressions/project.json | 8 +
.../host-global-listeners/index.html | 3 +
.../host-global-listeners/my-element.ts | 55 ++
.../host-global-listeners/project.json | 8 +
.../import/another-component.ts | 9 +
.../lit-cheat-sheet/import/hello-world.ts | 10 +
.../lit-cheat-sheet/import/index.html | 3 +
.../lit-cheat-sheet/import/project.json | 9 +
.../inheriting-custom-props/index.html | 21 +
.../inheriting-custom-props/my-element.ts | 17 +
.../inheriting-custom-props/project.json | 8 +
.../lit-cheat-sheet/pass-data-down/id-card.ts | 20 +
.../lit-cheat-sheet/pass-data-down/index.html | 3 +
.../pass-data-down/my-wallet.ts | 12 +
.../pass-data-down/project.json | 9 +
.../lit-cheat-sheet/render-lists/index.html | 3 +
.../render-lists/my-element.ts | 25 +
.../lit-cheat-sheet/render-lists/project.json | 8 +
.../lit-cheat-sheet/repeat/index.html | 3 +
.../lit-cheat-sheet/repeat/my-element.ts | 38 ++
.../lit-cheat-sheet/repeat/project.json | 8 +
.../lit-cheat-sheet/scope-styles/index.html | 4 +
.../scope-styles/my-element.ts | 15 +
.../lit-cheat-sheet/scope-styles/project.json | 8 +
.../shadow-root-options/index.html | 3 +
.../shadow-root-options/my-element.ts | 28 +
.../shadow-root-options/project.json | 8 +
.../share-styles-import/another-element.ts | 14 +
.../share-styles-import/index.html | 5 +
.../share-styles-import/my-element.ts | 19 +
.../share-styles-import/project.json | 11 +
.../share-styles-import/shared-styles.ts | 17 +
.../turn-off-shadow-dom/index.html | 7 +
.../turn-off-shadow-dom/my-element.ts | 16 +
.../turn-off-shadow-dom/project.json | 8 +
.../update-complete/index.html | 3 +
.../update-complete/my-element.ts | 34 ++
.../update-complete/project.json | 8 +
.../lit-cheat-sheet/virtualizer/index.html | 3 +
.../lit-cheat-sheet/virtualizer/my-element.ts | 23 +
.../lit-cheat-sheet/virtualizer/project.json | 8 +
.../site/_includes/articles.html | 1 +
.../site/articles/article/lit-cheat-sheet.md | 488 ++++++++++++++++++
packages/lit-dev-content/site/css/docs.css | 4 +-
.../site/images/articles/lit_cheat_sheet.jpg | Bin 0 -> 12249 bytes
.../images/articles/lit_cheat_sheet_2x.jpg | Bin 0 -> 21484 bytes
.../src/components/litdev-example.ts | 69 ++-
packages/lit-dev-server/src/server.ts | 10 +
.../src/playground-plugin/plugin.ts | 36 +-
77 files changed, 1494 insertions(+), 28 deletions(-)
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/add-styles/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/add-styles/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/add-styles/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/classes/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/classes/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/classes/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/conditionals/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/conditionals/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/conditionals/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/css-shadow-parts/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/css-shadow-parts/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/css-shadow-parts/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/data-up/game-player.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/data-up/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/data-up/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/data-up/score-board.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/define/hello-world.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/define/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/define/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/event-listeners/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/event-listeners/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/event-listeners/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/export-part/another-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/export-part/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/export-part/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/export-part/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/expressions/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/expressions/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/expressions/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/host-global-listeners/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/host-global-listeners/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/host-global-listeners/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/another-component.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/hello-world.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/inheriting-custom-props/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/inheriting-custom-props/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/inheriting-custom-props/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/id-card.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/my-wallet.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/render-lists/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/render-lists/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/render-lists/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/repeat/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/repeat/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/repeat/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/shadow-root-options/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/shadow-root-options/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/shadow-root-options/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/another-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/shared-styles.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/turn-off-shadow-dom/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/turn-off-shadow-dom/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/turn-off-shadow-dom/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/update-complete/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/update-complete/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/update-complete/project.json
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/virtualizer/index.html
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/virtualizer/my-element.ts
create mode 100644 packages/lit-dev-content/samples/articles/lit-cheat-sheet/virtualizer/project.json
create mode 100644 packages/lit-dev-content/site/articles/article/lit-cheat-sheet.md
create mode 100644 packages/lit-dev-content/site/images/articles/lit_cheat_sheet.jpg
create mode 100644 packages/lit-dev-content/site/images/articles/lit_cheat_sheet_2x.jpg
diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/add-styles/index.html b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/add-styles/index.html
new file mode 100644
index 000000000..57a0c9aca
--- /dev/null
+++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/add-styles/index.html
@@ -0,0 +1,3 @@
+
+
+
I'm blue
Hello!
`; + } + + static styles = css` + .red { + color: red; + } + .blue { + color: blue; + } + `; +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/classes/project.json b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/classes/project.json new file mode 100644 index 000000000..816404c3d --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/classes/project.json @@ -0,0 +1,8 @@ +{ + "extends": "/samples/v3-base.json", + "files": { + "my-element.ts": {}, + "index.html": {} + }, + "previewHeight": "100px" +} diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/conditionals/index.html b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/conditionals/index.html new file mode 100644 index 000000000..57a0c9aca --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/conditionals/index.html @@ -0,0 +1,3 @@ + + +Some text
`; + + if (this.someBoolean) { + someText = html`Some other text
`; + } + + return html` + +Some other text
` : html`Some text
`} +This is in a shadow root!
`; + } +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/css-shadow-parts/project.json b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/css-shadow-parts/project.json new file mode 100644 index 000000000..875a71aaf --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/css-shadow-parts/project.json @@ -0,0 +1,8 @@ +{ + "extends": "/samples/v3-base.json", + "files": { + "my-element.ts": {}, + "index.html": {} + }, + "previewHeight": "120px" +} diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/data-up/game-player.ts b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/data-up/game-player.ts new file mode 100644 index 000000000..fdfdab6a8 --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/data-up/game-player.ts @@ -0,0 +1,18 @@ +import { html, LitElement } from 'lit'; +import { customElement } from 'lit/decorators.js'; + +export type ScoreEvent = CustomEventHello, world!
`; + } +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/define/index.html b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/define/index.html new file mode 100644 index 000000000..c53974764 --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/define/index.html @@ -0,0 +1,3 @@ + + +${this.htmlText}+
Something in this component was focused
` : ''} + ${this.clickedOutside ? html`Something was clicked OUTSIDE this component
` : ''} + `; + } + + connectedCallback(): void { + super.connectedCallback(); + + // Only want to do this in the browser since the server doesn't have the + // concept of events or document. + if (!isServer) { + document.addEventListener('click', this.onDocumentClick); + this.addEventListener('focusin', this.onFocusin); + this.addEventListener('focusout', this.onFocusout); + } + } + + disconnectedCallback() { + super.disconnectedCallback(); + + if (!isServer) { + // clean up to prevent memory leaks + document.removeEventListener('click', this.onDocumentClick); + // Garbage should also take care of removing these, but it's good practice + this.removeEventListener('focusin', this.onFocusin); + this.removeEventListener('focusout', this.onFocusout); + } + } + + // Should be an arrow function and not a class method to ensure `this` is + // bound correctly. + private onFocusin = () => { + this.focusedWithin = true; + }; + + private onFocusout = () => { + this.focusedWithin = false; + }; + + private onDocumentClick = (e: MouseEvent) => { + const path = e.composedPath(); + this.clickedOutside = !path.includes(this); + }; +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/host-global-listeners/project.json b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/host-global-listeners/project.json new file mode 100644 index 000000000..875a71aaf --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/host-global-listeners/project.json @@ -0,0 +1,8 @@ +{ + "extends": "/samples/v3-base.json", + "files": { + "my-element.ts": {}, + "index.html": {} + }, + "previewHeight": "120px" +} diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/another-component.ts b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/another-component.ts new file mode 100644 index 000000000..375269012 --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/another-component.ts @@ -0,0 +1,9 @@ +import { html, LitElement } from 'lit'; +import { customElement } from 'lit/decorators.js'; + +@customElement('another-component') +export class AnotherComponent extends LitElement { + render() { + return html`(I'm another component.)`; + } +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/hello-world.ts b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/hello-world.ts new file mode 100644 index 000000000..de5f2dccf --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/import/hello-world.ts @@ -0,0 +1,10 @@ +import { html, LitElement } from 'lit'; +import { customElement } from 'lit/decorators.js'; +import './another-component.js' + +@customElement('hello-world') +export class HelloWorld extends LitElement { + render() { + return html`Hello, world!This is in a shadow root!
`; + } +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/inheriting-custom-props/project.json b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/inheriting-custom-props/project.json new file mode 100644 index 000000000..875a71aaf --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/inheriting-custom-props/project.json @@ -0,0 +1,8 @@ +{ + "extends": "/samples/v3-base.json", + "files": { + "my-element.ts": {}, + "index.html": {} + }, + "previewHeight": "120px" +} diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/id-card.ts b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/id-card.ts new file mode 100644 index 000000000..b7a427e95 --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/id-card.ts @@ -0,0 +1,20 @@ +import { html, LitElement } from 'lit'; +import { customElement, property } from 'lit/decorators.js'; + +@customElement('id-card') +export class IdCard extends LitElement { + @property() name = ''; + @property({ type: Number }) age = 0; + @property({ type: Boolean }) programmer = false; + + render() { + return html` +Age: ${this.age}
+ + `; + } +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/index.html b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/index.html new file mode 100644 index 000000000..d5f0f24d5 --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/pass-data-down/index.html @@ -0,0 +1,3 @@ + + +A list of names that include the letter "e" (rendering an Array)
+My unique fruits (rendering a Set)
+Things to do today:
+ + +I'm also a p, but I'm not blue.
\ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/my-element.ts b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/my-element.ts new file mode 100644 index 000000000..65dae1c97 --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/my-element.ts @@ -0,0 +1,15 @@ +import { html, LitElement, css } from 'lit'; +import { customElement } from 'lit/decorators.js'; + +@customElement('my-element') +export class MyElement extends LitElement { + render() { + return html`I'm blue
`; + } + + static styles = css` + p { + color: blue; + } + `; +} \ No newline at end of file diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/project.json b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/project.json new file mode 100644 index 000000000..816404c3d --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/scope-styles/project.json @@ -0,0 +1,8 @@ +{ + "extends": "/samples/v3-base.json", + "files": { + "my-element.ts": {}, + "index.html": {} + }, + "previewHeight": "100px" +} diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/shadow-root-options/index.html b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/shadow-root-options/index.html new file mode 100644 index 000000000..57a0c9aca --- /dev/null +++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/shadow-root-options/index.html @@ -0,0 +1,3 @@ + + +
+ Calling focus on this element will focus the first focusable element in
+ its shadow root thanks to delegatesFocus: true
. Just try
+ clicking on this text and see how the input is focused instead.
+
<code>
element shares styles with the <my-element>
element.
+ `;
+ }
+}
\ No newline at end of file
diff --git a/packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/index.html b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/index.html
new file mode 100644
index 000000000..239e0f7ef
--- /dev/null
+++ b/packages/lit-dev-content/samples/articles/lit-cheat-sheet/share-styles-import/index.html
@@ -0,0 +1,5 @@
+
+
+
+<code>
element shares styles with the <another-element>
element.
+ I am overriding the <code>
element in this <p>
tag.
This is not rendered in a shadow root
+Styles from index.html
will leak in and static styles
do not apply
${this.sizeInfo}
+@customElement
customElements.define
@customElement
customElements.define
@property()
instead of @state()
static properties = {propName: {state: false}}
>PNuhNaUZ2k@=oWv6KE|nEEfa_un(*PqIu$3YhRe z@!6kfbeg>vljKR!aR9sjHzP*juT-Oxy#I5>u1Te(|@~_#%~Pa98)~Z42zEWRFL;1-7Z9iO^v@HD%U&)7Gf= z&24i3o&L|)x33E~yLosSG}^a_SK&j*hx-6)^H$0hP7{Oy{FIelKDriwa%2b+X7t6N zrAJ8Vv `8+Fwdt0$ zTgm1M`euEM1r-DaNfJUG_a3<=;c~k>d^}f!jxN$&g&-Yh6A)gr*Ce`to;%ee5O_{z z7!eX24=ZcUOOc|8??HKjHkxdcod#9h^$2a@wcd!UeX@fHRF*IvQ7t`)=&}c^$gE`` z-1k<91bT$w5TCb^gvxj6A`!`l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?Se~m4TDf#Bz*hi% ze35k^kYA8tDMDTT3W|>psa+eas>M(9z&sE`7t(^B!w2AUcdL!lpx?*+Z2|%y`&WK# z;g{IU6ic6QfPujhxoFBeHS~@}jkU~x(-<@9$hq&YmO*uZZxjftr+P3KIiLCqpFl2+ zNl((89ve*sMiyXqfxFejZ>H%Jx7EnOXOBKQj1`B8m<`he1fs>|%w9s9>_{7VK5lVV zC>^zfe~fxA6}Qs1Q8WNu<%)j2o)KsnlP|cs`;)ewrVdAHdK3~?2z2P1s$arBi~rPq zwJ!IWA$0E0lVE=H5K{Q5d%4Zggku89;A-#~h +B-B^Pcy zateZuy=ysW5&jzDu?=dv7#hmay8M`jvs|fSaOZPiM?3XnYY9i)w2i<_y0H9{o#o^E z&+p`y`*{b9LP8D!cMCb@WZB}x-LS!+)Ylik!zVQ>dZN|y*b-qipstwd$E&`2W6!Hn zNzoFIL-ESvrSJF+gxGmt=6Q0G+p#!3cXe6k^jC3gKzy1YzX(cqy;NzmUZ~2}`jBE_ z^(5xjBhr^=V~yQA(ox<+t^2+~;Rw5IAsy*+U>(~z@CN&w-posd )0){Wn9M}q(_y6hFX#VM|I+g3f vbt^`7Kmrs~@8(g%JrjN?`0(Oo)uO0T--GiblDps|0%4$cR5xe8P4NE$(?2*| literal 0 HcmV?d00001 diff --git a/packages/lit-dev-content/site/images/articles/lit_cheat_sheet_2x.jpg b/packages/lit-dev-content/site/images/articles/lit_cheat_sheet_2x.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e8d88d89d8cb1a532a77b69f745744de23d4951a GIT binary patch literal 21484 zcmeIac{tT=_b9%}kSL-QnKKnKhHXyDl%e5aM`7D!w%O*H%w!0u$j~4>61zfWYM@OS z%9M=JM&@~*&ibh5dEf8(z3=(H*YBL`I{%!m>v`Ir&*#3^z3w%yb+5Z l5BiE-)H}Qd0GH!QvdO-FYmnZS0(t`KHUO`FQNCl=+NL>PhIioVK>L z)AA))U-Z?#g!6U4p{@8-Rd|%V6##&fwL6x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Yq187sTWfT| zyui?Bm;9#npB>HkYVR0qRnXM35)0Q2AYrM)6c%+_&=Qc!s6HU`?FhDF*XrZHN)LIH z2an9D?StU8?jX=tyaC4>2_p7)&4J=3@(DV=c+7#D`e63!gy6wz;^1khYfz9=fw)jS z lA7A&|>-!IlM!N&-nZzjbEs-H&*0GK|B`W<>oD z^hFKSlQAq;2_jqKP5WWNk6;3YL-!Lk&lMJ8(+iUnnfS-vAGHh!07J45P_zd9OVKDC zIX1`L>c#HRn6%M#tzbqjh;z0aQs 9}cj%s`HmrFY8m)Qv9Li4s!<+UsHdTP)c5YW6N;U >(juifOSI^P{mZO+yv zq&j!M#!Q)dr)W9^S~V~(7rtw$tJ4M|w5mYd;nkbI8FZH2_-2<84{T3fT)?n2_ulQ| zOV_D|3m=DsX!LRKQ`1*oJh!r>JTRO4zQ}yv)vNbQ1S*0)70<7@{0zjt)4$BU@4@Tk z0i+CP6UZF6zW({^p$LyK#x0LdrxBMG3anp{_%1_x$OTZSaBK$rvy=btAG`TaXmDej Z`#@o{LzZ3L2v82CeMVp7sk+7W{{d(&h;IM@ literal 0 HcmV?d00001 diff --git a/packages/lit-dev-content/src/components/litdev-example.ts b/packages/lit-dev-content/src/components/litdev-example.ts index 705d58556..6dbc2d222 100644 --- a/packages/lit-dev-content/src/components/litdev-example.ts +++ b/packages/lit-dev-content/src/components/litdev-example.ts @@ -5,7 +5,7 @@ */ import {LitElement, html, css, nothing} from 'lit'; -import {property} from 'lit/decorators.js'; +import {property, state} from 'lit/decorators.js'; import {styleMap} from 'lit/directives/style-map.js'; import {ifDefined} from 'lit/directives/if-defined.js'; import { @@ -110,6 +110,23 @@ export class LitDevExample extends LitElement { @property() project?: string; + /** + * Whether to load the project on intersection with the viewport. + */ + @property({type: Boolean}) + lazy = false; + + /** + * Whether or not to load the project. Setting Lazy to true will re-initialize + * this value to `false`. We would want to do this so that we do not load the + * large TS worker file until the user has scrolled to the example. This is + * something we would want to do if we want to have the server cache the + * worker. Otherwise every example on the page would load the worker at the + * same time and none of them would be cached. + */ + @state() + private loadProject = true; + /** * Name of file in project to display. * If no file is provided, we show the tab-bar with all project files. @@ -143,6 +160,12 @@ export class LitDevExample extends LitElement { this.requestUpdate(); }; + willUpdate() { + if (!this.hasUpdated) { + this.loadProject = !this.lazy; + } + } + render() { if (!this.project) { return nothing; @@ -162,17 +185,23 @@ export class LitDevExample extends LitElement { mode === 'ts' ? this.filename : this.filename?.replace(/.ts$/, '.js'); return html` - - + ${this.loadProject + ? // We need to conditionally render this because playground-project + // will load its serviceworker on firstUpdated + html`+ ` + : nothing}${showTabBar ? html`` : nothing} @@ -184,15 +213,35 @@ export class LitDevExample extends LitElement { - + `; } + + firstUpdated() { + if (this.lazy) { + const io = new IntersectionObserver( + (entries) => { + if (entries[0].isIntersecting) { + this.loadProject = true; + io.disconnect(); + } + }, + { + rootMargin: '40px', + } + ); + + io.observe(this); + } + } } customElements.define('litdev-example', LitDevExample); diff --git a/packages/lit-dev-server/src/server.ts b/packages/lit-dev-server/src/server.ts index c3b71cf67..23da80b89 100644 --- a/packages/lit-dev-server/src/server.ts +++ b/packages/lit-dev-server/src/server.ts @@ -92,6 +92,16 @@ app.use( if (path.includes('/fonts/')) { res.setHeader('Cache-Control', 'max-age=31536000'); } + if (path.includes('/playground-typescript-worker.js')) { + // This is a huge file, so we want to cache the request for 2 minutes + // which should basically handle a page with multiple playgrounds. + // Then after those two minutes, it will use the same cached file for a + // day while it revalidates the cache in the background. + res.setHeader( + 'Cache-Control', + 'max-age=120, stale-while-revalidate=86400' + ); + } }, }) ); diff --git a/packages/lit-dev-tools-cjs/src/playground-plugin/plugin.ts b/packages/lit-dev-tools-cjs/src/playground-plugin/plugin.ts index e9fa8c5c9..5fd291e3d 100644 --- a/packages/lit-dev-tools-cjs/src/playground-plugin/plugin.ts +++ b/packages/lit-dev-tools-cjs/src/playground-plugin/plugin.ts @@ -163,31 +163,35 @@ export const playgroundPlugin = ( (code: string, lang: 'js' | 'ts' | 'html' | 'css') => render(code, lang) ); - eleventyConfig.addShortcode('playground-ide', async (project: string) => { - if (!project) { - throw new Error( - `Invalid playground-ide invocation.` + - `Usage {% playground-ide "path/to/project" %}` + eleventyConfig.addShortcode( + 'playground-ide', + async (project: string, lazy = false) => { + if (!project) { + throw new Error( + `Invalid playground-ide invocation.` + + `Usage {% playground-ide "path/to/project" %}` + ); + } + project = trimTrailingSlash(project); + const config = await readProjectConfig(project); + const firstFilename = Object.keys(config.files ?? {})[0]; + const numVisibleLines = await getNumVisibleLinesForProjectFile( + project, + firstFilename ); - } - project = trimTrailingSlash(project); - const config = await readProjectConfig(project); - const firstFilename = Object.keys(config.files ?? {})[0]; - const numVisibleLines = await getNumVisibleLinesForProjectFile( - project, - firstFilename - ); - const previewHeight = config.previewHeight ?? '120px'; - return ` + const previewHeight = config.previewHeight ?? '120px'; + return ` `.trim(); - }); + } + ); type LitProjectConfig = ProjectManifest & { previewHeight?: string;