@astrojs/lit
Advanced tools
Comparing version 0.0.2 to 0.1.0
# @astrojs/lit | ||
## 0.1.0 | ||
### Minor Changes | ||
- [`2bb6a06e`](https://github.com/withastro/astro/commit/2bb6a06ebb449aa3fec6414754c8a248ca4721ef) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Welcome to the Astro v1.0.0 Beta! Read the [official announcement](https://astro.build/blog/astro-1-beta-release/) for more details. | ||
## 0.0.2 | ||
@@ -4,0 +10,0 @@ |
async function polyfill() { | ||
const { hydrateShadowRoots } = await import('@webcomponents/template-shadowroot/template-shadowroot.js'); | ||
const { hydrateShadowRoots } = await import( | ||
'@webcomponents/template-shadowroot/template-shadowroot.js' | ||
); | ||
hydrateShadowRoots(document.body); | ||
} | ||
const polyfillCheckEl = new DOMParser().parseFromString(`<p><template shadowroot="open"></template></p>`, 'text/html', { includeShadowRoots: true }).querySelector('p'); | ||
const polyfillCheckEl = new DOMParser() | ||
.parseFromString(`<p><template shadowroot="open"></template></p>`, 'text/html', { | ||
includeShadowRoots: true, | ||
}) | ||
.querySelector('p'); | ||
@@ -8,0 +14,0 @@ if (!polyfillCheckEl || !polyfillCheckEl.shadowRoot) { |
@@ -11,3 +11,4 @@ /** @license Copyright 2020 Google LLC (BSD-3-Clause) */ | ||
let t = document.createElement('div'); | ||
(t.innerHTML = '<div><template shadowroot="open"></template></div>'), (d = !!t.firstElementChild.shadowRoot); | ||
(t.innerHTML = '<div><template shadowroot="open"></template></div>'), | ||
(d = !!t.firstElementChild.shadowRoot); | ||
} | ||
@@ -22,3 +23,5 @@ return d; | ||
u = i(() => { | ||
(p = (t) => t.parentElement === null), (c = (t) => t.tagName === 'TEMPLATE'), (f = (t) => t.nodeType === Node.ELEMENT_NODE); | ||
(p = (t) => t.parentElement === null), | ||
(c = (t) => t.tagName === 'TEMPLATE'), | ||
(f = (t) => t.nodeType === Node.ELEMENT_NODE); | ||
}); | ||
@@ -57,3 +60,4 @@ var h, | ||
} | ||
let l = (n = e.parentElement) === null || n === void 0 ? void 0 : n.nextElementSibling; | ||
let l = | ||
(n = e.parentElement) === null || n === void 0 ? void 0 : n.nextElementSibling; | ||
if (l != null) { | ||
@@ -81,3 +85,7 @@ (e = l), o !== void 0 && o.parentElement.removeChild(o); | ||
} | ||
var x = new DOMParser().parseFromString('<p><template shadowroot="open"></template></p>', 'text/html', { includeShadowRoots: !0 }).querySelector('p'); | ||
var x = new DOMParser() | ||
.parseFromString('<p><template shadowroot="open"></template></p>', 'text/html', { | ||
includeShadowRoots: !0, | ||
}) | ||
.querySelector('p'); | ||
(!x || !x.shadowRoot) && g(); |
@@ -14,3 +14,8 @@ import { readFileSync } from "node:fs"; | ||
ssr: { | ||
external: ["lit-element/lit-element.js", "@lit-labs/ssr/lib/install-global-dom-shim.js", "@lit-labs/ssr/lib/render-lit-html.js", "@lit-labs/ssr/lib/lit-element-renderer.js"] | ||
external: [ | ||
"lit-element/lit-element.js", | ||
"@lit-labs/ssr/lib/install-global-dom-shim.js", | ||
"@lit-labs/ssr/lib/render-lit-html.js", | ||
"@lit-labs/ssr/lib/lit-element-renderer.js" | ||
] | ||
} | ||
@@ -17,0 +22,0 @@ }; |
{ | ||
"name": "@astrojs/lit", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Use Lit components within Astro", | ||
@@ -29,6 +29,6 @@ "type": "module", | ||
"dependencies": { | ||
"@lit-labs/ssr": "^2.0.4" | ||
"@lit-labs/ssr": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"astro": "0.25.0", | ||
"astro": "1.0.0-beta.6", | ||
"astro-scripts": "0.0.2" | ||
@@ -35,0 +35,0 @@ }, |
@@ -16,3 +16,8 @@ import { readFileSync } from 'node:fs'; | ||
ssr: { | ||
external: ['lit-element/lit-element.js', '@lit-labs/ssr/lib/install-global-dom-shim.js', '@lit-labs/ssr/lib/render-lit-html.js', '@lit-labs/ssr/lib/lit-element-renderer.js'], | ||
external: [ | ||
'lit-element/lit-element.js', | ||
'@lit-labs/ssr/lib/install-global-dom-shim.js', | ||
'@lit-labs/ssr/lib/render-lit-html.js', | ||
'@lit-labs/ssr/lib/lit-element-renderer.js', | ||
], | ||
}, | ||
@@ -28,3 +33,6 @@ }; | ||
// Inject the necessary polyfills on every page (inlined for speed). | ||
injectScript('head-inline', readFileSync(new URL('../client-shim.min.js', import.meta.url), { encoding: 'utf-8' })); | ||
injectScript( | ||
'head-inline', | ||
readFileSync(new URL('../client-shim.min.js', import.meta.url), { encoding: 'utf-8' }) | ||
); | ||
// Inject the hydration code, before a component is hydrated. | ||
@@ -31,0 +39,0 @@ injectScript('before-hydration', `import '@astrojs/lit/hydration-support.js';`); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21481
14
269
Updated@lit-labs/ssr@^2.1.0