-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Lit support in the static build (#2370)
* [ci] collect stats * [ci] update lockfile (#2388) Co-authored-by: FredKSchott <[email protected]> * Fixes for blog and docs examples (#2373) * Fixes for blog and docs examples * Adds a changeset * Upgrade the compiler version * Use a global style tag * Skip on windows temporarily * [ci] yarn format * Fixes Lit support in the static build * Adds a changeset * test * Upgrade lit-labs/ssr * Conditional * Testing again * remove debugging code * changeset Co-authored-by: FredKSchott <[email protected]> Co-authored-by: Fred K. Schott <[email protected]>
- Loading branch information
1 parent
6a7c5aa
commit a796753
Showing
11 changed files
with
114 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/renderer-lit': patch | ||
--- | ||
|
||
Makes the renderer compatible with the static build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes support for Lit within the static build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/astro/test/fixtures/static-build-frameworks/src/components/LCounter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { LitElement, html } from 'lit'; | ||
|
||
export const tagName = 'my-counter'; | ||
|
||
class Counter extends LitElement { | ||
static get properties() { | ||
return { | ||
count: { | ||
type: Number, | ||
}, | ||
}; | ||
} | ||
|
||
constructor() { | ||
super(); | ||
this.count = 0; | ||
} | ||
|
||
increment() { | ||
this.count++; | ||
} | ||
|
||
render() { | ||
return html` | ||
<div> | ||
<p>Count: ${this.count}</p> | ||
<button type="button" @click=${this.increment}>Increment</button> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
customElements.define(tagName, Counter); |
12 changes: 12 additions & 0 deletions
12
packages/astro/test/fixtures/static-build-frameworks/src/pages/lit.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
import '../components/LCounter.js'; | ||
--- | ||
<html> | ||
<head> | ||
<title>Testing</title> | ||
</head> | ||
<body> | ||
<h1>Testing</h1> | ||
<my-counter client:load></my-counter> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import '@lit-labs/ssr/lib/install-global-dom-shim.js'; | ||
import { installWindowOnGlobal } from "@lit-labs/ssr/lib/dom-shim.js"; | ||
installWindowOnGlobal(); | ||
|
||
window.global = window; | ||
document.getElementsByTagName = () => []; |
Oops, something went wrong.