@panomc/theme-core 1.3.0-dev.3 → 1.3.0-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,6 +48,15 @@ const defaultExportSpecs = new Set([
48
48
  // (and a warning) so the generator keeps working; it fills in on the next run.
49
49
  const pendingSpecs = new Set(["@panomc/sdk/controllers"]);
50
50
 
51
+ // Exports that are live `let` bindings in their module and get their value only after the
52
+ // shim has run: `svelte/internal/client` sets `window` / `document` in `init_operations()` on
53
+ // the first mount. A `const` copy would stay `undefined` forever (compiled `<svelte:window>` /
54
+ // `<svelte:document>` read them, so such a plugin page failed to mount). Once set they are the
55
+ // browser's own globals, so the shim falls back to those.
56
+ const liveGlobalFallbacks = {
57
+ "svelte/internal/client": { window: "globalThis.window", document: "globalThis.document" },
58
+ };
59
+
51
60
  const identifierRe = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
52
61
 
53
62
  // Names that parse as IdentifierName but cannot be declared with `const` — they must
@@ -133,6 +142,8 @@ function renderShim(spec, exportNames) {
133
142
  for (const name of exportNames) {
134
143
  if (name === "default") {
135
144
  lines.push(`export default m.default;`);
145
+ } else if (liveGlobalFallbacks[spec]?.[name]) {
146
+ lines.push(`export const ${name} = m.${name} ?? ${liveGlobalFallbacks[spec][name]};`);
136
147
  } else if (identifierRe.test(name) && !reservedWords.has(name)) {
137
148
  lines.push(`export const ${name} = m.${name};`);
138
149
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panomc/theme-core",
3
- "version": "1.3.0-dev.3",
3
+ "version": "1.3.0-dev.4",
4
4
  "description": "The Pano theme engine: hooks factories, plugin engine, headless page controllers, default views and the theme CLI. Themes depend on this package instead of forking vanilla-theme.",
5
5
  "author": "PanoMC",
6
6
  "pano": {
@@ -61,7 +61,7 @@
61
61
  "@fortawesome/fontawesome-free": "^6.7.2"
62
62
  },
63
63
  "peerDependencies": {
64
- "@panomc/sdk": "^2.0.0-dev.3",
64
+ "@panomc/sdk": "^2.0.0-dev.4",
65
65
  "@sveltejs/adapter-node": "^6.0.0",
66
66
  "@sveltejs/kit": "^3.1.0",
67
67
  "@sveltejs/vite-plugin-svelte": "^7.3.1",
@@ -71,7 +71,7 @@
71
71
  "vite": "^8.3.4"
72
72
  },
73
73
  "devDependencies": {
74
- "@panomc/sdk": "2.0.0-dev.3",
74
+ "@panomc/sdk": "2.0.0-dev.4",
75
75
  "@sveltejs/adapter-node": "^6.0.0",
76
76
  "@sveltejs/kit": "^3.1.0",
77
77
  "@sveltejs/vite-plugin-svelte": "^7.3.1",