diff --git a/packages/lit-dev-content/.eleventy.js b/packages/lit-dev-content/.eleventy.js
index 69242ca4a..bb5d25305 100644
--- a/packages/lit-dev-content/.eleventy.js
+++ b/packages/lit-dev-content/.eleventy.js
@@ -527,16 +527,10 @@ ${content}
return ``;
});
- /**
- * Inline the Rollup-bundled version of a JavaScript module. Path is relative
- * to ./rollupout.
- *
- * In dev mode, instead directly import the module, which has already been
- * symlinked directly to the TypeScript output directory.
- */
- eleventyConfig.addShortcode('inlinejs', (path) => {
+ const inlineJs = (path, type) => {
+ const typeAttribute = type ? ` type="${type}"` : '';
if (DEV) {
- return ``;
+ return ``;
}
// Note we must trim before hashing, because our html-minifier will trim
// inline script trailing newlines, and otherwise our hash will be wrong.
@@ -544,7 +538,25 @@ ${content}
const hash =
'sha256-' + crypto.createHash('sha256').update(script).digest('base64');
cspInlineScriptHashes.add(hash);
- return ``;
+ return ``;
+ };
+
+ /**
+ * Inline the Rollup-bundled version of a JavaScript module. Path is relative
+ * to ./rollupout.
+ *
+ * In dev mode, instead directly import the module, which has already been
+ * symlinked directly to the TypeScript output directory.
+ */
+ eleventyConfig.addShortcode('inlinejs', (path) => {
+ return inlineJs(path, 'module');
+ });
+
+ /**
+ * Inline a parser-blocking classic script.
+ */
+ eleventyConfig.addShortcode('inlineclassicjs', (path) => {
+ return inlineJs(path);
});
eleventyConfig.addNunjucksAsyncShortcode('algoliaid', async () => {
diff --git a/packages/lit-dev-content/rollup.config.js b/packages/lit-dev-content/rollup.config.js
index a5a1f3094..7e1b6131c 100644
--- a/packages/lit-dev-content/rollup.config.js
+++ b/packages/lit-dev-content/rollup.config.js
@@ -35,6 +35,7 @@ export default [
// lit-hydrate-support MUST be loaded first to make sure lit hydration
// helpers are bundled before LitElement attempts to use hydration support
'lib/global/lit-hydrate-support.js',
+ 'lib/global/theme-worker.js',
'lib/components/copy-button.js',
'lib/components/litdev-banner.js',
'lib/components/litdev-drawer.js',
@@ -151,7 +152,8 @@ export default [
// the asynchronously-loaded module bundles above.
{
input: [
- 'lib/global/apply-saved-theme.js',
+ 'lib/global/apply-session-theme.js',
+ 'lib/global/initialize-theme.js',
'lib/global/apply-mods.js',
'lib/global/initialize-typescript-mode.js',
'lib/global/mobile-drawer.js',
diff --git a/packages/lit-dev-content/site/_includes/default.html b/packages/lit-dev-content/site/_includes/default.html
index 2dd961279..a46d9b1fb 100644
--- a/packages/lit-dev-content/site/_includes/default.html
+++ b/packages/lit-dev-content/site/_includes/default.html
@@ -15,7 +15,7 @@
- {% inlinejs "global/apply-saved-theme.js" %}
+ {% inlinejs "global/initialize-theme.js" %}
{% inlinecss "colors.css" %}
{% inlinecss "global.css" %}
@@ -75,6 +75,7 @@
{% include 'header.html' %}
+ {% inlineclassicjs "global/apply-session-theme.js" %}
{% if selectedVersion !== latestVersion %}
diff --git a/packages/lit-dev-content/site/_includes/header.html b/packages/lit-dev-content/site/_includes/header.html
index da634b79f..4c66276ab 100644
--- a/packages/lit-dev-content/site/_includes/header.html
+++ b/packages/lit-dev-content/site/_includes/header.html
@@ -17,9 +17,12 @@
diff --git a/packages/lit-dev-content/site/playground/index.html b/packages/lit-dev-content/site/playground/index.html
index 1566310ef..7f32d3eef 100644
--- a/packages/lit-dev-content/site/playground/index.html
+++ b/packages/lit-dev-content/site/playground/index.html
@@ -55,21 +55,22 @@ {{ section.name }}
diff --git a/packages/lit-dev-content/src/components/litdev-drawer.ts b/packages/lit-dev-content/src/components/litdev-drawer.ts
index 34fcc1554..f98689399 100644
--- a/packages/lit-dev-content/src/components/litdev-drawer.ts
+++ b/packages/lit-dev-content/src/components/litdev-drawer.ts
@@ -22,6 +22,7 @@ const closeIcon = html`