everything-dev 1.33.2 → 1.33.3

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.
package/dist/ui/head.cjs CHANGED
@@ -4,13 +4,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  function getThemeInitScript() {
5
5
  return { children: "(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();" };
6
6
  }
7
- function getHydrateScript(runtimeConfig, containerName = "ui", hydratePath = "./Hydrate") {
7
+ function getHydrateScript(runtimeConfig, containerName = "ui", hydratePath = "./Hydrate", cspNonce) {
8
8
  return { children: `
9
+ window.__CSP_NONCE__=${JSON.stringify(cspNonce)};
9
10
  window.__RUNTIME_CONFIG__=${JSON.stringify(runtimeConfig)};
10
11
  function __hydrate(){
11
- var container = window['${containerName}'];
12
- if (!container) {
13
- console.warn('[Hydrate] Container not ready yet, waiting...');
12
+ if (window.__EVERYTHING_DEV_HYDRATE_PROMISE__) {
13
+ return;
14
+ }
15
+ var container = window['${containerName}'];
16
+ if (!container) {
17
+ console.warn('[Hydrate] Container not ready yet, waiting...');
14
18
  window.__hydrateRetry = window.__hydrateRetry || 0;
15
19
  if (window.__hydrateRetry < 10) {
16
20
  window.__hydrateRetry++;
@@ -33,17 +37,13 @@ function getHydrateScript(runtimeConfig, containerName = "ui", hydratePath = "./
33
37
  `.trim() };
34
38
  }
35
39
  function getRemoteScripts(options) {
36
- const { runtimeConfig, containerName, hydratePath, integrity } = options;
40
+ const { runtimeConfig, containerName, hydratePath, integrity, cspNonce } = options;
37
41
  const entryScript = { src: `${runtimeConfig?.assetsUrl?.replace(/\/$/, "") ?? ""}/remoteEntry.js${integrity ? `?v=${encodeURIComponent(integrity)}` : ""}` };
38
42
  if (integrity) {
39
43
  entryScript.integrity = integrity;
40
44
  entryScript.crossOrigin = "anonymous";
41
45
  }
42
- return [
43
- entryScript,
44
- getThemeInitScript(),
45
- getHydrateScript(runtimeConfig, containerName, hydratePath)
46
- ];
46
+ return [entryScript, getHydrateScript(runtimeConfig, containerName, hydratePath, cspNonce)];
47
47
  }
48
48
  function getBaseStyles() {
49
49
  return `
@@ -1 +1 @@
1
- {"version":3,"file":"head.cjs","names":[],"sources":["../../src/ui/head.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\nimport type { HeadScript } from \"./types\";\n\nexport interface RemoteScriptsOptions {\n runtimeConfig?: Partial<ClientRuntimeConfig>;\n containerName?: string;\n hydratePath?: string;\n integrity?: string;\n}\n\nexport function getThemeInitScript(): HeadScript {\n return {\n children:\n \"(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();\",\n };\n}\n\nexport function getHydrateScript(\n runtimeConfig: Partial<ClientRuntimeConfig> | undefined,\n containerName = \"ui\",\n hydratePath = \"./Hydrate\",\n): HeadScript {\n return {\n children: `\n window.__RUNTIME_CONFIG__=${JSON.stringify(runtimeConfig)};\n function __hydrate(){\n var container = window['${containerName}'];\n if (!container) {\n console.warn('[Hydrate] Container not ready yet, waiting...');\n window.__hydrateRetry = window.__hydrateRetry || 0;\n if (window.__hydrateRetry < 10) {\n window.__hydrateRetry++;\n setTimeout(__hydrate, 100);\n return;\n }\n console.error('[Hydrate] Container not found after 10 retries');\n return;\n }\n console.log('[Hydrate] Container available, starting init...');\n container.init({}).then(function(){\n return container.get('${hydratePath}');\n }).then(function(mod){\n return mod().hydrate();\n }).catch(function(e){\n console.error('[Hydrate] Failed:', e);\n });\n }\n if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',__hydrate);}else{__hydrate();}\n \t\t`.trim(),\n };\n}\n\nexport function getRemoteScripts(options: RemoteScriptsOptions): HeadScript[] {\n const { runtimeConfig, containerName, hydratePath, integrity } = options;\n const assetsUrl = runtimeConfig?.assetsUrl?.replace(/\\/$/, \"\");\n const entryScript: HeadScript = {\n src: `${assetsUrl ?? \"\"}/remoteEntry.js${integrity ? `?v=${encodeURIComponent(integrity)}` : \"\"}`,\n };\n if (integrity) {\n entryScript.integrity = integrity;\n entryScript.crossOrigin = \"anonymous\";\n }\n return [\n entryScript,\n getThemeInitScript(),\n getHydrateScript(runtimeConfig, containerName, hydratePath),\n ];\n}\n\nexport function getBaseStyles(): string {\n return `\n*, *::before, *::after { box-sizing: border-box; }\nhtml { height: 100%; height: 100dvh; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light dark; }\nbody { min-height: 100%; min-height: 100dvh; margin: 0; background-color: var(--background); color: var(--foreground); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }\n#root { min-height: 100vh; }\n@supports (min-height: 100dvh) { #root { min-height: 100dvh; } }\n `.trim();\n}\n"],"mappings":";;;AAUA,SAAgB,qBAAiC;AAC/C,QAAO,EACL,UACE,yLACH;;AAGH,SAAgB,iBACd,eACA,gBAAgB,MAChB,cAAc,aACF;AACZ,QAAO,EACL,UAAU;6BACe,KAAK,UAAU,cAAc,CAAC;;4BAE/B,cAAc;;;;;;;;;;;;;;4BAcd,YAAY;;;;;;;;KAQnC,MAAM,EACR;;AAGH,SAAgB,iBAAiB,SAA6C;CAC5E,MAAM,EAAE,eAAe,eAAe,aAAa,cAAc;CAEjE,MAAM,cAA0B,EAC9B,KAAK,GAFW,eAAe,WAAW,QAAQ,OAAO,GAAG,IAEvC,GAAG,iBAAiB,YAAY,MAAM,mBAAmB,UAAU,KAAK,MAC9F;AACD,KAAI,WAAW;AACb,cAAY,YAAY;AACxB,cAAY,cAAc;;AAE5B,QAAO;EACL;EACA,oBAAoB;EACpB,iBAAiB,eAAe,eAAe,YAAY;EAC5D;;AAGH,SAAgB,gBAAwB;AACtC,QAAO;;;;;;IAML,MAAM"}
1
+ {"version":3,"file":"head.cjs","names":[],"sources":["../../src/ui/head.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\nimport type { HeadScript } from \"./types\";\n\nexport interface RemoteScriptsOptions {\n runtimeConfig?: Partial<ClientRuntimeConfig>;\n containerName?: string;\n hydratePath?: string;\n integrity?: string;\n cspNonce?: string;\n}\n\nexport function getThemeInitScript(): HeadScript {\n return {\n children:\n \"(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();\",\n };\n}\n\nexport function getHydrateScript(\n runtimeConfig: Partial<ClientRuntimeConfig> | undefined,\n containerName = \"ui\",\n hydratePath = \"./Hydrate\",\n cspNonce?: string,\n): HeadScript {\n return {\n children: `\n window.__CSP_NONCE__=${JSON.stringify(cspNonce)};\n window.__RUNTIME_CONFIG__=${JSON.stringify(runtimeConfig)};\n function __hydrate(){\n if (window.__EVERYTHING_DEV_HYDRATE_PROMISE__) {\n return;\n }\n var container = window['${containerName}'];\n if (!container) {\n console.warn('[Hydrate] Container not ready yet, waiting...');\n window.__hydrateRetry = window.__hydrateRetry || 0;\n if (window.__hydrateRetry < 10) {\n window.__hydrateRetry++;\n setTimeout(__hydrate, 100);\n return;\n }\n console.error('[Hydrate] Container not found after 10 retries');\n return;\n }\n console.log('[Hydrate] Container available, starting init...');\n container.init({}).then(function(){\n return container.get('${hydratePath}');\n }).then(function(mod){\n return mod().hydrate();\n }).catch(function(e){\n console.error('[Hydrate] Failed:', e);\n });\n }\n if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',__hydrate);}else{__hydrate();}\n \t\t`.trim(),\n };\n}\n\nexport function getRemoteScripts(options: RemoteScriptsOptions): HeadScript[] {\n const { runtimeConfig, containerName, hydratePath, integrity, cspNonce } = options;\n const assetsUrl = runtimeConfig?.assetsUrl?.replace(/\\/$/, \"\");\n const entryScript: HeadScript = {\n src: `${assetsUrl ?? \"\"}/remoteEntry.js${integrity ? `?v=${encodeURIComponent(integrity)}` : \"\"}`,\n };\n if (integrity) {\n entryScript.integrity = integrity;\n entryScript.crossOrigin = \"anonymous\";\n }\n return [entryScript, getHydrateScript(runtimeConfig, containerName, hydratePath, cspNonce)];\n}\n\nexport function getBaseStyles(): string {\n return `\n*, *::before, *::after { box-sizing: border-box; }\nhtml { height: 100%; height: 100dvh; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light dark; }\nbody { min-height: 100%; min-height: 100dvh; margin: 0; background-color: var(--background); color: var(--foreground); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }\n#root { min-height: 100vh; }\n@supports (min-height: 100dvh) { #root { min-height: 100dvh; } }\n `.trim();\n}\n"],"mappings":";;;AAWA,SAAgB,qBAAiC;AAC/C,QAAO,EACL,UACE,yLACH;;AAGH,SAAgB,iBACd,eACA,gBAAgB,MAChB,cAAc,aACd,UACY;AACZ,QAAO,EACL,UAAU;wBACU,KAAK,UAAU,SAAS,CAAC;6BACpB,KAAK,UAAU,cAAc,CAAC;;;;;6BAK9B,cAAc;;;;;;;;;;;;;;4BAcf,YAAY;;;;;;;;KAQnC,MAAM,EACR;;AAGH,SAAgB,iBAAiB,SAA6C;CAC5E,MAAM,EAAE,eAAe,eAAe,aAAa,WAAW,aAAa;CAE3E,MAAM,cAA0B,EAC9B,KAAK,GAFW,eAAe,WAAW,QAAQ,OAAO,GAAG,IAEvC,GAAG,iBAAiB,YAAY,MAAM,mBAAmB,UAAU,KAAK,MAC9F;AACD,KAAI,WAAW;AACb,cAAY,YAAY;AACxB,cAAY,cAAc;;AAE5B,QAAO,CAAC,aAAa,iBAAiB,eAAe,eAAe,aAAa,SAAS,CAAC;;AAG7F,SAAgB,gBAAwB;AACtC,QAAO;;;;;;IAML,MAAM"}
@@ -7,9 +7,10 @@ interface RemoteScriptsOptions {
7
7
  containerName?: string;
8
8
  hydratePath?: string;
9
9
  integrity?: string;
10
+ cspNonce?: string;
10
11
  }
11
12
  declare function getThemeInitScript(): HeadScript;
12
- declare function getHydrateScript(runtimeConfig: Partial<ClientRuntimeConfig> | undefined, containerName?: string, hydratePath?: string): HeadScript;
13
+ declare function getHydrateScript(runtimeConfig: Partial<ClientRuntimeConfig> | undefined, containerName?: string, hydratePath?: string, cspNonce?: string): HeadScript;
13
14
  declare function getRemoteScripts(options: RemoteScriptsOptions): HeadScript[];
14
15
  declare function getBaseStyles(): string;
15
16
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"head.d.cts","names":[],"sources":["../../src/ui/head.ts"],"mappings":";;;;UAGiB,oBAAA;EACf,aAAA,GAAgB,OAAA,CAAQ,mBAAA;EACxB,aAAA;EACA,WAAA;EACA,SAAA;AAAA;AAAA,iBAGc,kBAAA,CAAA,GAAsB,UAAA;AAAA,iBAOtB,gBAAA,CACd,aAAA,EAAe,OAAA,CAAQ,mBAAA,eACvB,aAAA,WACA,WAAA,YACC,UAAA;AAAA,iBA+Ba,gBAAA,CAAiB,OAAA,EAAS,oBAAA,GAAuB,UAAA;AAAA,iBAiBjD,aAAA,CAAA"}
1
+ {"version":3,"file":"head.d.cts","names":[],"sources":["../../src/ui/head.ts"],"mappings":";;;;UAGiB,oBAAA;EACf,aAAA,GAAgB,OAAA,CAAQ,mBAAA;EACxB,aAAA;EACA,WAAA;EACA,SAAA;EACA,QAAA;AAAA;AAAA,iBAGc,kBAAA,CAAA,GAAsB,UAAA;AAAA,iBAOtB,gBAAA,CACd,aAAA,EAAe,OAAA,CAAQ,mBAAA,eACvB,aAAA,WACA,WAAA,WACA,QAAA,YACC,UAAA;AAAA,iBAmCa,gBAAA,CAAiB,OAAA,EAAS,oBAAA,GAAuB,UAAA;AAAA,iBAajD,aAAA,CAAA"}
@@ -7,9 +7,10 @@ interface RemoteScriptsOptions {
7
7
  containerName?: string;
8
8
  hydratePath?: string;
9
9
  integrity?: string;
10
+ cspNonce?: string;
10
11
  }
11
12
  declare function getThemeInitScript(): HeadScript;
12
- declare function getHydrateScript(runtimeConfig: Partial<ClientRuntimeConfig> | undefined, containerName?: string, hydratePath?: string): HeadScript;
13
+ declare function getHydrateScript(runtimeConfig: Partial<ClientRuntimeConfig> | undefined, containerName?: string, hydratePath?: string, cspNonce?: string): HeadScript;
13
14
  declare function getRemoteScripts(options: RemoteScriptsOptions): HeadScript[];
14
15
  declare function getBaseStyles(): string;
15
16
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"head.d.mts","names":[],"sources":["../../src/ui/head.ts"],"mappings":";;;;UAGiB,oBAAA;EACf,aAAA,GAAgB,OAAA,CAAQ,mBAAA;EACxB,aAAA;EACA,WAAA;EACA,SAAA;AAAA;AAAA,iBAGc,kBAAA,CAAA,GAAsB,UAAA;AAAA,iBAOtB,gBAAA,CACd,aAAA,EAAe,OAAA,CAAQ,mBAAA,eACvB,aAAA,WACA,WAAA,YACC,UAAA;AAAA,iBA+Ba,gBAAA,CAAiB,OAAA,EAAS,oBAAA,GAAuB,UAAA;AAAA,iBAiBjD,aAAA,CAAA"}
1
+ {"version":3,"file":"head.d.mts","names":[],"sources":["../../src/ui/head.ts"],"mappings":";;;;UAGiB,oBAAA;EACf,aAAA,GAAgB,OAAA,CAAQ,mBAAA;EACxB,aAAA;EACA,WAAA;EACA,SAAA;EACA,QAAA;AAAA;AAAA,iBAGc,kBAAA,CAAA,GAAsB,UAAA;AAAA,iBAOtB,gBAAA,CACd,aAAA,EAAe,OAAA,CAAQ,mBAAA,eACvB,aAAA,WACA,WAAA,WACA,QAAA,YACC,UAAA;AAAA,iBAmCa,gBAAA,CAAiB,OAAA,EAAS,oBAAA,GAAuB,UAAA;AAAA,iBAajD,aAAA,CAAA"}
package/dist/ui/head.mjs CHANGED
@@ -2,13 +2,17 @@
2
2
  function getThemeInitScript() {
3
3
  return { children: "(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();" };
4
4
  }
5
- function getHydrateScript(runtimeConfig, containerName = "ui", hydratePath = "./Hydrate") {
5
+ function getHydrateScript(runtimeConfig, containerName = "ui", hydratePath = "./Hydrate", cspNonce) {
6
6
  return { children: `
7
+ window.__CSP_NONCE__=${JSON.stringify(cspNonce)};
7
8
  window.__RUNTIME_CONFIG__=${JSON.stringify(runtimeConfig)};
8
9
  function __hydrate(){
9
- var container = window['${containerName}'];
10
- if (!container) {
11
- console.warn('[Hydrate] Container not ready yet, waiting...');
10
+ if (window.__EVERYTHING_DEV_HYDRATE_PROMISE__) {
11
+ return;
12
+ }
13
+ var container = window['${containerName}'];
14
+ if (!container) {
15
+ console.warn('[Hydrate] Container not ready yet, waiting...');
12
16
  window.__hydrateRetry = window.__hydrateRetry || 0;
13
17
  if (window.__hydrateRetry < 10) {
14
18
  window.__hydrateRetry++;
@@ -31,17 +35,13 @@ function getHydrateScript(runtimeConfig, containerName = "ui", hydratePath = "./
31
35
  `.trim() };
32
36
  }
33
37
  function getRemoteScripts(options) {
34
- const { runtimeConfig, containerName, hydratePath, integrity } = options;
38
+ const { runtimeConfig, containerName, hydratePath, integrity, cspNonce } = options;
35
39
  const entryScript = { src: `${runtimeConfig?.assetsUrl?.replace(/\/$/, "") ?? ""}/remoteEntry.js${integrity ? `?v=${encodeURIComponent(integrity)}` : ""}` };
36
40
  if (integrity) {
37
41
  entryScript.integrity = integrity;
38
42
  entryScript.crossOrigin = "anonymous";
39
43
  }
40
- return [
41
- entryScript,
42
- getThemeInitScript(),
43
- getHydrateScript(runtimeConfig, containerName, hydratePath)
44
- ];
44
+ return [entryScript, getHydrateScript(runtimeConfig, containerName, hydratePath, cspNonce)];
45
45
  }
46
46
  function getBaseStyles() {
47
47
  return `
@@ -1 +1 @@
1
- {"version":3,"file":"head.mjs","names":[],"sources":["../../src/ui/head.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\nimport type { HeadScript } from \"./types\";\n\nexport interface RemoteScriptsOptions {\n runtimeConfig?: Partial<ClientRuntimeConfig>;\n containerName?: string;\n hydratePath?: string;\n integrity?: string;\n}\n\nexport function getThemeInitScript(): HeadScript {\n return {\n children:\n \"(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();\",\n };\n}\n\nexport function getHydrateScript(\n runtimeConfig: Partial<ClientRuntimeConfig> | undefined,\n containerName = \"ui\",\n hydratePath = \"./Hydrate\",\n): HeadScript {\n return {\n children: `\n window.__RUNTIME_CONFIG__=${JSON.stringify(runtimeConfig)};\n function __hydrate(){\n var container = window['${containerName}'];\n if (!container) {\n console.warn('[Hydrate] Container not ready yet, waiting...');\n window.__hydrateRetry = window.__hydrateRetry || 0;\n if (window.__hydrateRetry < 10) {\n window.__hydrateRetry++;\n setTimeout(__hydrate, 100);\n return;\n }\n console.error('[Hydrate] Container not found after 10 retries');\n return;\n }\n console.log('[Hydrate] Container available, starting init...');\n container.init({}).then(function(){\n return container.get('${hydratePath}');\n }).then(function(mod){\n return mod().hydrate();\n }).catch(function(e){\n console.error('[Hydrate] Failed:', e);\n });\n }\n if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',__hydrate);}else{__hydrate();}\n \t\t`.trim(),\n };\n}\n\nexport function getRemoteScripts(options: RemoteScriptsOptions): HeadScript[] {\n const { runtimeConfig, containerName, hydratePath, integrity } = options;\n const assetsUrl = runtimeConfig?.assetsUrl?.replace(/\\/$/, \"\");\n const entryScript: HeadScript = {\n src: `${assetsUrl ?? \"\"}/remoteEntry.js${integrity ? `?v=${encodeURIComponent(integrity)}` : \"\"}`,\n };\n if (integrity) {\n entryScript.integrity = integrity;\n entryScript.crossOrigin = \"anonymous\";\n }\n return [\n entryScript,\n getThemeInitScript(),\n getHydrateScript(runtimeConfig, containerName, hydratePath),\n ];\n}\n\nexport function getBaseStyles(): string {\n return `\n*, *::before, *::after { box-sizing: border-box; }\nhtml { height: 100%; height: 100dvh; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light dark; }\nbody { min-height: 100%; min-height: 100dvh; margin: 0; background-color: var(--background); color: var(--foreground); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }\n#root { min-height: 100vh; }\n@supports (min-height: 100dvh) { #root { min-height: 100dvh; } }\n `.trim();\n}\n"],"mappings":";AAUA,SAAgB,qBAAiC;AAC/C,QAAO,EACL,UACE,yLACH;;AAGH,SAAgB,iBACd,eACA,gBAAgB,MAChB,cAAc,aACF;AACZ,QAAO,EACL,UAAU;6BACe,KAAK,UAAU,cAAc,CAAC;;4BAE/B,cAAc;;;;;;;;;;;;;;4BAcd,YAAY;;;;;;;;KAQnC,MAAM,EACR;;AAGH,SAAgB,iBAAiB,SAA6C;CAC5E,MAAM,EAAE,eAAe,eAAe,aAAa,cAAc;CAEjE,MAAM,cAA0B,EAC9B,KAAK,GAFW,eAAe,WAAW,QAAQ,OAAO,GAAG,IAEvC,GAAG,iBAAiB,YAAY,MAAM,mBAAmB,UAAU,KAAK,MAC9F;AACD,KAAI,WAAW;AACb,cAAY,YAAY;AACxB,cAAY,cAAc;;AAE5B,QAAO;EACL;EACA,oBAAoB;EACpB,iBAAiB,eAAe,eAAe,YAAY;EAC5D;;AAGH,SAAgB,gBAAwB;AACtC,QAAO;;;;;;IAML,MAAM"}
1
+ {"version":3,"file":"head.mjs","names":[],"sources":["../../src/ui/head.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\nimport type { HeadScript } from \"./types\";\n\nexport interface RemoteScriptsOptions {\n runtimeConfig?: Partial<ClientRuntimeConfig>;\n containerName?: string;\n hydratePath?: string;\n integrity?: string;\n cspNonce?: string;\n}\n\nexport function getThemeInitScript(): HeadScript {\n return {\n children:\n \"(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();\",\n };\n}\n\nexport function getHydrateScript(\n runtimeConfig: Partial<ClientRuntimeConfig> | undefined,\n containerName = \"ui\",\n hydratePath = \"./Hydrate\",\n cspNonce?: string,\n): HeadScript {\n return {\n children: `\n window.__CSP_NONCE__=${JSON.stringify(cspNonce)};\n window.__RUNTIME_CONFIG__=${JSON.stringify(runtimeConfig)};\n function __hydrate(){\n if (window.__EVERYTHING_DEV_HYDRATE_PROMISE__) {\n return;\n }\n var container = window['${containerName}'];\n if (!container) {\n console.warn('[Hydrate] Container not ready yet, waiting...');\n window.__hydrateRetry = window.__hydrateRetry || 0;\n if (window.__hydrateRetry < 10) {\n window.__hydrateRetry++;\n setTimeout(__hydrate, 100);\n return;\n }\n console.error('[Hydrate] Container not found after 10 retries');\n return;\n }\n console.log('[Hydrate] Container available, starting init...');\n container.init({}).then(function(){\n return container.get('${hydratePath}');\n }).then(function(mod){\n return mod().hydrate();\n }).catch(function(e){\n console.error('[Hydrate] Failed:', e);\n });\n }\n if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',__hydrate);}else{__hydrate();}\n \t\t`.trim(),\n };\n}\n\nexport function getRemoteScripts(options: RemoteScriptsOptions): HeadScript[] {\n const { runtimeConfig, containerName, hydratePath, integrity, cspNonce } = options;\n const assetsUrl = runtimeConfig?.assetsUrl?.replace(/\\/$/, \"\");\n const entryScript: HeadScript = {\n src: `${assetsUrl ?? \"\"}/remoteEntry.js${integrity ? `?v=${encodeURIComponent(integrity)}` : \"\"}`,\n };\n if (integrity) {\n entryScript.integrity = integrity;\n entryScript.crossOrigin = \"anonymous\";\n }\n return [entryScript, getHydrateScript(runtimeConfig, containerName, hydratePath, cspNonce)];\n}\n\nexport function getBaseStyles(): string {\n return `\n*, *::before, *::after { box-sizing: border-box; }\nhtml { height: 100%; height: 100dvh; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light dark; }\nbody { min-height: 100%; min-height: 100dvh; margin: 0; background-color: var(--background); color: var(--foreground); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }\n#root { min-height: 100vh; }\n@supports (min-height: 100dvh) { #root { min-height: 100dvh; } }\n `.trim();\n}\n"],"mappings":";AAWA,SAAgB,qBAAiC;AAC/C,QAAO,EACL,UACE,yLACH;;AAGH,SAAgB,iBACd,eACA,gBAAgB,MAChB,cAAc,aACd,UACY;AACZ,QAAO,EACL,UAAU;wBACU,KAAK,UAAU,SAAS,CAAC;6BACpB,KAAK,UAAU,cAAc,CAAC;;;;;6BAK9B,cAAc;;;;;;;;;;;;;;4BAcf,YAAY;;;;;;;;KAQnC,MAAM,EACR;;AAGH,SAAgB,iBAAiB,SAA6C;CAC5E,MAAM,EAAE,eAAe,eAAe,aAAa,WAAW,aAAa;CAE3E,MAAM,cAA0B,EAC9B,KAAK,GAFW,eAAe,WAAW,QAAQ,OAAO,GAAG,IAEvC,GAAG,iBAAiB,YAAY,MAAM,mBAAmB,UAAU,KAAK,MAC9F;AACD,KAAI,WAAW;AACb,cAAY,YAAY;AACxB,cAAY,cAAc;;AAE5B,QAAO,CAAC,aAAa,iBAAiB,eAAe,eAAe,aAAa,SAAS,CAAC;;AAG7F,SAAgB,gBAAwB;AACtC,QAAO;;;;;;IAML,MAAM"}
package/dist/ui/index.cjs CHANGED
@@ -13,6 +13,7 @@ exports.collectHeadData = require_ui_router.collectHeadData;
13
13
  exports.createDotIconSvg = require_ui_metadata.createDotIconSvg;
14
14
  exports.createPngIcoBuffer = require_ui_metadata.createPngIcoBuffer;
15
15
  exports.getBaseStyles = require_ui_head.getBaseStyles;
16
+ exports.getCspNonce = require_ui_runtime.getCspNonce;
16
17
  exports.getHydrateScript = require_ui_head.getHydrateScript;
17
18
  exports.getLinkKey = require_ui_router.getLinkKey;
18
19
  exports.getMetaKey = require_ui_router.getMetaKey;
@@ -3,5 +3,5 @@ import { CreateRouterOptions, HeadData, HeadLink, HeadMeta, HeadScript, RenderOp
3
3
  import { RemoteScriptsOptions, getBaseStyles, getHydrateScript, getRemoteScripts, getThemeInitScript } from "./head.cjs";
4
4
  import { DotIconSvgOptions, SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, SocialImageMetaOptions, createDotIconSvg, createPngIcoBuffer, getSocialImageMeta } from "./metadata.cjs";
5
5
  import { collectHeadData, getLinkKey, getMetaKey, getScriptKey } from "./router.cjs";
6
- import { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getRuntimeConfig } from "./runtime.cjs";
7
- export { ClientRuntimeInfo, CreateRouterOptions, DotIconSvgOptions, HeadData, HeadLink, HeadMeta, HeadScript, RemoteScriptsOptions, RenderOptions, RenderOptionsWithApi, RenderResult, RouterContext, RouterContextWithApi, RouterModule, SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, SocialImageMetaOptions, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, collectHeadData, createDotIconSvg, createPngIcoBuffer, getBaseStyles, getHydrateScript, getLinkKey, getMetaKey, getRemoteScripts, getRuntimeConfig, getScriptKey, getSocialImageMeta, getThemeInitScript };
6
+ import { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getCspNonce, getRuntimeConfig } from "./runtime.cjs";
7
+ export { ClientRuntimeInfo, CreateRouterOptions, DotIconSvgOptions, HeadData, HeadLink, HeadMeta, HeadScript, RemoteScriptsOptions, RenderOptions, RenderOptionsWithApi, RenderResult, RouterContext, RouterContextWithApi, RouterModule, SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, SocialImageMetaOptions, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, collectHeadData, createDotIconSvg, createPngIcoBuffer, getBaseStyles, getCspNonce, getHydrateScript, getLinkKey, getMetaKey, getRemoteScripts, getRuntimeConfig, getScriptKey, getSocialImageMeta, getThemeInitScript };
@@ -3,5 +3,5 @@ import { CreateRouterOptions, HeadData, HeadLink, HeadMeta, HeadScript, RenderOp
3
3
  import { RemoteScriptsOptions, getBaseStyles, getHydrateScript, getRemoteScripts, getThemeInitScript } from "./head.mjs";
4
4
  import { DotIconSvgOptions, SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, SocialImageMetaOptions, createDotIconSvg, createPngIcoBuffer, getSocialImageMeta } from "./metadata.mjs";
5
5
  import { collectHeadData, getLinkKey, getMetaKey, getScriptKey } from "./router.mjs";
6
- import { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getRuntimeConfig } from "./runtime.mjs";
7
- export { ClientRuntimeInfo, CreateRouterOptions, DotIconSvgOptions, HeadData, HeadLink, HeadMeta, HeadScript, RemoteScriptsOptions, RenderOptions, RenderOptionsWithApi, RenderResult, RouterContext, RouterContextWithApi, RouterModule, SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, SocialImageMetaOptions, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, collectHeadData, createDotIconSvg, createPngIcoBuffer, getBaseStyles, getHydrateScript, getLinkKey, getMetaKey, getRemoteScripts, getRuntimeConfig, getScriptKey, getSocialImageMeta, getThemeInitScript };
6
+ import { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getCspNonce, getRuntimeConfig } from "./runtime.mjs";
7
+ export { ClientRuntimeInfo, CreateRouterOptions, DotIconSvgOptions, HeadData, HeadLink, HeadMeta, HeadScript, RemoteScriptsOptions, RenderOptions, RenderOptionsWithApi, RenderResult, RouterContext, RouterContextWithApi, RouterModule, SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, SocialImageMetaOptions, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, collectHeadData, createDotIconSvg, createPngIcoBuffer, getBaseStyles, getCspNonce, getHydrateScript, getLinkKey, getMetaKey, getRemoteScripts, getRuntimeConfig, getScriptKey, getSocialImageMeta, getThemeInitScript };
package/dist/ui/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getBaseStyles, getHydrateScript, getRemoteScripts, getThemeInitScript } from "./head.mjs";
2
2
  import { SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, createDotIconSvg, createPngIcoBuffer, getSocialImageMeta } from "./metadata.mjs";
3
3
  import { collectHeadData, getLinkKey, getMetaKey, getScriptKey } from "./router.mjs";
4
- import { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getRuntimeConfig } from "./runtime.mjs";
4
+ import { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getCspNonce, getRuntimeConfig } from "./runtime.mjs";
5
5
 
6
- export { SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, collectHeadData, createDotIconSvg, createPngIcoBuffer, getBaseStyles, getHydrateScript, getLinkKey, getMetaKey, getRemoteScripts, getRuntimeConfig, getScriptKey, getSocialImageMeta, getThemeInitScript };
6
+ export { SOCIAL_IMAGE_HEIGHT, SOCIAL_IMAGE_WIDTH, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, collectHeadData, createDotIconSvg, createPngIcoBuffer, getBaseStyles, getCspNonce, getHydrateScript, getLinkKey, getMetaKey, getRemoteScripts, getRuntimeConfig, getScriptKey, getSocialImageMeta, getThemeInitScript };
@@ -6,6 +6,10 @@ function getRuntimeConfig() {
6
6
  if (!window.__RUNTIME_CONFIG__) throw new Error("Missing runtime config");
7
7
  return window.__RUNTIME_CONFIG__;
8
8
  }
9
+ function getCspNonce() {
10
+ if (typeof window === "undefined") return;
11
+ return window.__CSP_NONCE__;
12
+ }
9
13
  function buildRuntimeHref(pathname, runtimeConfig) {
10
14
  const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? "/";
11
15
  if (basePath === "/") return pathname;
@@ -23,5 +27,6 @@ function buildPublishedGatewayHref(accountId, gatewayId) {
23
27
  exports.buildPublishedAccountHref = buildPublishedAccountHref;
24
28
  exports.buildPublishedGatewayHref = buildPublishedGatewayHref;
25
29
  exports.buildRuntimeHref = buildRuntimeHref;
30
+ exports.getCspNonce = getCspNonce;
26
31
  exports.getRuntimeConfig = getRuntimeConfig;
27
32
  //# sourceMappingURL=runtime.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.cjs","names":[],"sources":["../../src/ui/runtime.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\n\nexport type { ClientRuntimeInfo } from \"../types\";\n\ndeclare global {\n interface Window {\n __RUNTIME_CONFIG__?: ClientRuntimeConfig;\n }\n}\n\nexport function getRuntimeConfig(): ClientRuntimeConfig {\n if (typeof window === \"undefined\") {\n throw new Error(\"Runtime config is only available in the browser\");\n }\n\n if (!window.__RUNTIME_CONFIG__) {\n throw new Error(\"Missing runtime config\");\n }\n\n return window.__RUNTIME_CONFIG__;\n}\n\nexport function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {\n const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? \"/\";\n if (basePath === \"/\") {\n return pathname;\n }\n\n if (!pathname.startsWith(\"/\")) {\n return `${basePath}/${pathname}`;\n }\n\n return pathname === \"/\" ? basePath : `${basePath}${pathname}`;\n}\n\nexport function buildPublishedAccountHref(accountId: string) {\n return `/apps/${encodeURIComponent(accountId)}`;\n}\n\nexport function buildPublishedGatewayHref(accountId: string, gatewayId: string) {\n return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;\n}\n"],"mappings":";;;AAUA,SAAgB,mBAAwC;AACtD,KAAI,OAAO,WAAW,YACpB,OAAM,IAAI,MAAM,kDAAkD;AAGpE,KAAI,CAAC,OAAO,mBACV,OAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAO,OAAO;;AAGhB,SAAgB,iBAAiB,UAAkB,eAA8C;CAC/F,MAAM,WAAW,eAAe,SAAS,mBAAmB;AAC5D,KAAI,aAAa,IACf,QAAO;AAGT,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,QAAO,GAAG,SAAS,GAAG;AAGxB,QAAO,aAAa,MAAM,WAAW,GAAG,WAAW;;AAGrD,SAAgB,0BAA0B,WAAmB;AAC3D,QAAO,SAAS,mBAAmB,UAAU;;AAG/C,SAAgB,0BAA0B,WAAmB,WAAmB;AAC9E,QAAO,GAAG,0BAA0B,UAAU,CAAC,GAAG,mBAAmB,UAAU"}
1
+ {"version":3,"file":"runtime.cjs","names":[],"sources":["../../src/ui/runtime.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\n\nexport type { ClientRuntimeInfo } from \"../types\";\n\ndeclare global {\n interface Window {\n __RUNTIME_CONFIG__?: ClientRuntimeConfig;\n __CSP_NONCE__?: string;\n }\n}\n\nexport function getRuntimeConfig(): ClientRuntimeConfig {\n if (typeof window === \"undefined\") {\n throw new Error(\"Runtime config is only available in the browser\");\n }\n\n if (!window.__RUNTIME_CONFIG__) {\n throw new Error(\"Missing runtime config\");\n }\n\n return window.__RUNTIME_CONFIG__;\n}\n\nexport function getCspNonce() {\n if (typeof window === \"undefined\") {\n return undefined;\n }\n\n return window.__CSP_NONCE__;\n}\n\nexport function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {\n const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? \"/\";\n if (basePath === \"/\") {\n return pathname;\n }\n\n if (!pathname.startsWith(\"/\")) {\n return `${basePath}/${pathname}`;\n }\n\n return pathname === \"/\" ? basePath : `${basePath}${pathname}`;\n}\n\nexport function buildPublishedAccountHref(accountId: string) {\n return `/apps/${encodeURIComponent(accountId)}`;\n}\n\nexport function buildPublishedGatewayHref(accountId: string, gatewayId: string) {\n return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;\n}\n"],"mappings":";;;AAWA,SAAgB,mBAAwC;AACtD,KAAI,OAAO,WAAW,YACpB,OAAM,IAAI,MAAM,kDAAkD;AAGpE,KAAI,CAAC,OAAO,mBACV,OAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAO,OAAO;;AAGhB,SAAgB,cAAc;AAC5B,KAAI,OAAO,WAAW,YACpB;AAGF,QAAO,OAAO;;AAGhB,SAAgB,iBAAiB,UAAkB,eAA8C;CAC/F,MAAM,WAAW,eAAe,SAAS,mBAAmB;AAC5D,KAAI,aAAa,IACf,QAAO;AAGT,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,QAAO,GAAG,SAAS,GAAG;AAGxB,QAAO,aAAa,MAAM,WAAW,GAAG,WAAW;;AAGrD,SAAgB,0BAA0B,WAAmB;AAC3D,QAAO,SAAS,mBAAmB,UAAU;;AAG/C,SAAgB,0BAA0B,WAAmB,WAAmB;AAC9E,QAAO,GAAG,0BAA0B,UAAU,CAAC,GAAG,mBAAmB,UAAU"}
@@ -4,12 +4,14 @@ import { ClientRuntimeConfig, ClientRuntimeInfo } from "../types.cjs";
4
4
  declare global {
5
5
  interface Window {
6
6
  __RUNTIME_CONFIG__?: ClientRuntimeConfig;
7
+ __CSP_NONCE__?: string;
7
8
  }
8
9
  }
9
10
  declare function getRuntimeConfig(): ClientRuntimeConfig;
11
+ declare function getCspNonce(): string | undefined;
10
12
  declare function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>): string;
11
13
  declare function buildPublishedAccountHref(accountId: string): string;
12
14
  declare function buildPublishedGatewayHref(accountId: string, gatewayId: string): string;
13
15
  //#endregion
14
- export { type ClientRuntimeInfo, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getRuntimeConfig };
16
+ export { type ClientRuntimeInfo, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getCspNonce, getRuntimeConfig };
15
17
  //# sourceMappingURL=runtime.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.cts","names":[],"sources":["../../src/ui/runtime.ts"],"mappings":";;;QAIQ,MAAA;EAAA,UACI,MAAA;IACR,kBAAA,GAAqB,mBAAA;EAAA;AAAA;AAAA,iBAIT,gBAAA,CAAA,GAAoB,mBAAA;AAAA,iBAYpB,gBAAA,CAAiB,QAAA,UAAkB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;AAAA,iBAa3D,yBAAA,CAA0B,SAAA;AAAA,iBAI1B,yBAAA,CAA0B,SAAA,UAAmB,SAAA"}
1
+ {"version":3,"file":"runtime.d.cts","names":[],"sources":["../../src/ui/runtime.ts"],"mappings":";;;QAIQ,MAAA;EAAA,UACI,MAAA;IACR,kBAAA,GAAqB,mBAAA;IACrB,aAAA;EAAA;AAAA;AAAA,iBAIY,gBAAA,CAAA,GAAoB,mBAAA;AAAA,iBAYpB,WAAA,CAAA;AAAA,iBAQA,gBAAA,CAAiB,QAAA,UAAkB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;AAAA,iBAa3D,yBAAA,CAA0B,SAAA;AAAA,iBAI1B,yBAAA,CAA0B,SAAA,UAAmB,SAAA"}
@@ -4,12 +4,14 @@ import { ClientRuntimeConfig, ClientRuntimeInfo } from "../types.mjs";
4
4
  declare global {
5
5
  interface Window {
6
6
  __RUNTIME_CONFIG__?: ClientRuntimeConfig;
7
+ __CSP_NONCE__?: string;
7
8
  }
8
9
  }
9
10
  declare function getRuntimeConfig(): ClientRuntimeConfig;
11
+ declare function getCspNonce(): string | undefined;
10
12
  declare function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>): string;
11
13
  declare function buildPublishedAccountHref(accountId: string): string;
12
14
  declare function buildPublishedGatewayHref(accountId: string, gatewayId: string): string;
13
15
  //#endregion
14
- export { type ClientRuntimeInfo, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getRuntimeConfig };
16
+ export { type ClientRuntimeInfo, buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getCspNonce, getRuntimeConfig };
15
17
  //# sourceMappingURL=runtime.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.mts","names":[],"sources":["../../src/ui/runtime.ts"],"mappings":";;;QAIQ,MAAA;EAAA,UACI,MAAA;IACR,kBAAA,GAAqB,mBAAA;EAAA;AAAA;AAAA,iBAIT,gBAAA,CAAA,GAAoB,mBAAA;AAAA,iBAYpB,gBAAA,CAAiB,QAAA,UAAkB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;AAAA,iBAa3D,yBAAA,CAA0B,SAAA;AAAA,iBAI1B,yBAAA,CAA0B,SAAA,UAAmB,SAAA"}
1
+ {"version":3,"file":"runtime.d.mts","names":[],"sources":["../../src/ui/runtime.ts"],"mappings":";;;QAIQ,MAAA;EAAA,UACI,MAAA;IACR,kBAAA,GAAqB,mBAAA;IACrB,aAAA;EAAA;AAAA;AAAA,iBAIY,gBAAA,CAAA,GAAoB,mBAAA;AAAA,iBAYpB,WAAA,CAAA;AAAA,iBAQA,gBAAA,CAAiB,QAAA,UAAkB,aAAA,GAAgB,OAAA,CAAQ,mBAAA;AAAA,iBAa3D,yBAAA,CAA0B,SAAA;AAAA,iBAI1B,yBAAA,CAA0B,SAAA,UAAmB,SAAA"}
@@ -4,6 +4,10 @@ function getRuntimeConfig() {
4
4
  if (!window.__RUNTIME_CONFIG__) throw new Error("Missing runtime config");
5
5
  return window.__RUNTIME_CONFIG__;
6
6
  }
7
+ function getCspNonce() {
8
+ if (typeof window === "undefined") return;
9
+ return window.__CSP_NONCE__;
10
+ }
7
11
  function buildRuntimeHref(pathname, runtimeConfig) {
8
12
  const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? "/";
9
13
  if (basePath === "/") return pathname;
@@ -18,5 +22,5 @@ function buildPublishedGatewayHref(accountId, gatewayId) {
18
22
  }
19
23
 
20
24
  //#endregion
21
- export { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getRuntimeConfig };
25
+ export { buildPublishedAccountHref, buildPublishedGatewayHref, buildRuntimeHref, getCspNonce, getRuntimeConfig };
22
26
  //# sourceMappingURL=runtime.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../src/ui/runtime.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\n\nexport type { ClientRuntimeInfo } from \"../types\";\n\ndeclare global {\n interface Window {\n __RUNTIME_CONFIG__?: ClientRuntimeConfig;\n }\n}\n\nexport function getRuntimeConfig(): ClientRuntimeConfig {\n if (typeof window === \"undefined\") {\n throw new Error(\"Runtime config is only available in the browser\");\n }\n\n if (!window.__RUNTIME_CONFIG__) {\n throw new Error(\"Missing runtime config\");\n }\n\n return window.__RUNTIME_CONFIG__;\n}\n\nexport function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {\n const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? \"/\";\n if (basePath === \"/\") {\n return pathname;\n }\n\n if (!pathname.startsWith(\"/\")) {\n return `${basePath}/${pathname}`;\n }\n\n return pathname === \"/\" ? basePath : `${basePath}${pathname}`;\n}\n\nexport function buildPublishedAccountHref(accountId: string) {\n return `/apps/${encodeURIComponent(accountId)}`;\n}\n\nexport function buildPublishedGatewayHref(accountId: string, gatewayId: string) {\n return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;\n}\n"],"mappings":";AAUA,SAAgB,mBAAwC;AACtD,KAAI,OAAO,WAAW,YACpB,OAAM,IAAI,MAAM,kDAAkD;AAGpE,KAAI,CAAC,OAAO,mBACV,OAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAO,OAAO;;AAGhB,SAAgB,iBAAiB,UAAkB,eAA8C;CAC/F,MAAM,WAAW,eAAe,SAAS,mBAAmB;AAC5D,KAAI,aAAa,IACf,QAAO;AAGT,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,QAAO,GAAG,SAAS,GAAG;AAGxB,QAAO,aAAa,MAAM,WAAW,GAAG,WAAW;;AAGrD,SAAgB,0BAA0B,WAAmB;AAC3D,QAAO,SAAS,mBAAmB,UAAU;;AAG/C,SAAgB,0BAA0B,WAAmB,WAAmB;AAC9E,QAAO,GAAG,0BAA0B,UAAU,CAAC,GAAG,mBAAmB,UAAU"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../src/ui/runtime.ts"],"sourcesContent":["import type { ClientRuntimeConfig } from \"../types\";\n\nexport type { ClientRuntimeInfo } from \"../types\";\n\ndeclare global {\n interface Window {\n __RUNTIME_CONFIG__?: ClientRuntimeConfig;\n __CSP_NONCE__?: string;\n }\n}\n\nexport function getRuntimeConfig(): ClientRuntimeConfig {\n if (typeof window === \"undefined\") {\n throw new Error(\"Runtime config is only available in the browser\");\n }\n\n if (!window.__RUNTIME_CONFIG__) {\n throw new Error(\"Missing runtime config\");\n }\n\n return window.__RUNTIME_CONFIG__;\n}\n\nexport function getCspNonce() {\n if (typeof window === \"undefined\") {\n return undefined;\n }\n\n return window.__CSP_NONCE__;\n}\n\nexport function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {\n const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? \"/\";\n if (basePath === \"/\") {\n return pathname;\n }\n\n if (!pathname.startsWith(\"/\")) {\n return `${basePath}/${pathname}`;\n }\n\n return pathname === \"/\" ? basePath : `${basePath}${pathname}`;\n}\n\nexport function buildPublishedAccountHref(accountId: string) {\n return `/apps/${encodeURIComponent(accountId)}`;\n}\n\nexport function buildPublishedGatewayHref(accountId: string, gatewayId: string) {\n return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;\n}\n"],"mappings":";AAWA,SAAgB,mBAAwC;AACtD,KAAI,OAAO,WAAW,YACpB,OAAM,IAAI,MAAM,kDAAkD;AAGpE,KAAI,CAAC,OAAO,mBACV,OAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAO,OAAO;;AAGhB,SAAgB,cAAc;AAC5B,KAAI,OAAO,WAAW,YACpB;AAGF,QAAO,OAAO;;AAGhB,SAAgB,iBAAiB,UAAkB,eAA8C;CAC/F,MAAM,WAAW,eAAe,SAAS,mBAAmB;AAC5D,KAAI,aAAa,IACf,QAAO;AAGT,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,QAAO,GAAG,SAAS,GAAG;AAGxB,QAAO,aAAa,MAAM,WAAW,GAAG,WAAW;;AAGrD,SAAgB,0BAA0B,WAAmB;AAC3D,QAAO,SAAS,mBAAmB,UAAU;;AAG/C,SAAgB,0BAA0B,WAAmB,WAAmB;AAC9E,QAAO,GAAG,0BAA0B,UAAU,CAAC,GAAG,mBAAmB,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "everything-dev",
3
- "version": "1.33.2",
3
+ "version": "1.33.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"