sygnal 6.2.0 → 6.4.0

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/README.md +3 -1
  3. package/dist/ai.cjs.js +36 -0
  4. package/dist/ai.cjs.js.map +1 -1
  5. package/dist/ai.esm.js +1 -1
  6. package/dist/astro/index.cjs.js +69 -3
  7. package/dist/astro/index.cjs.js.map +1 -1
  8. package/dist/astro/index.mjs +69 -3
  9. package/dist/astro/index.mjs.map +1 -1
  10. package/dist/astro/server.cjs.js +3 -3
  11. package/dist/astro/server.cjs.js.map +1 -1
  12. package/dist/astro/server.mjs +3 -3
  13. package/dist/astro/server.mjs.map +1 -1
  14. package/dist/diagnostics.cjs.js +211 -11
  15. package/dist/diagnostics.cjs.js.map +1 -1
  16. package/dist/diagnostics.esm.js +211 -11
  17. package/dist/diagnostics.esm.js.map +1 -1
  18. package/dist/guide/agent.md +7 -1
  19. package/dist/guide/ai-cards.md +319 -0
  20. package/dist/guide/ai-chat.md +4 -0
  21. package/dist/guide/ai-compose.md +881 -0
  22. package/dist/guide/ai-decisions.md +16 -0
  23. package/dist/guide/http.md +1 -0
  24. package/dist/guide/mcp-apps.md +59 -4
  25. package/dist/index.cjs.js +5704 -350
  26. package/dist/index.cjs.js.map +1 -1
  27. package/dist/index.d.ts +647 -10
  28. package/dist/index.esm.js +5694 -350
  29. package/dist/index.esm.js.map +1 -1
  30. package/dist/sygnal.min.js +1 -1
  31. package/dist/sygnal.min.js.map +1 -1
  32. package/dist/vike/config/package.json +1 -1
  33. package/dist/vike/onRenderClient.cjs.js +3 -2
  34. package/dist/vike/onRenderClient.cjs.js.map +1 -1
  35. package/dist/vike/onRenderClient.mjs +3 -2
  36. package/dist/vike/onRenderClient.mjs.map +1 -1
  37. package/dist/vite/plugin.cjs.js +69 -3
  38. package/dist/vite/plugin.cjs.js.map +1 -1
  39. package/dist/vite/plugin.mjs +69 -3
  40. package/dist/vite/plugin.mjs.map +1 -1
  41. package/llms.txt +7 -5
  42. package/package.json +2 -1
  43. package/src/ai.d.ts +642 -7
  44. package/src/ai.ts +6 -0
  45. package/src/collection.ts +2 -1
  46. package/src/core/instance.ts +6 -3
  47. package/src/core/markers/lazy.ts +7 -3
  48. package/src/core/markers/portal.ts +5 -2
  49. package/src/core/markers/suspense.ts +3 -2
  50. package/src/core/markers/transition.ts +6 -3
  51. package/src/core/registry.ts +9 -5
  52. package/src/cycle/dom/IsolateModule.ts +25 -22
  53. package/src/extra/ai/chat/behavior.ts +354 -81
  54. package/src/extra/ai/chat/driver.ts +7 -4
  55. package/src/extra/ai/compose/agent.ts +55 -0
  56. package/src/extra/ai/compose/ask.ts +147 -0
  57. package/src/extra/ai/compose/behavior.ts +183 -0
  58. package/src/extra/ai/compose/catalog.ts +211 -0
  59. package/src/extra/ai/compose/composed.ts +61 -0
  60. package/src/extra/ai/compose/decisions.ts +1649 -0
  61. package/src/extra/ai/compose/diag.ts +33 -0
  62. package/src/extra/ai/compose/index.ts +23 -0
  63. package/src/extra/ai/compose/layout.ts +441 -0
  64. package/src/extra/ai/compose/llm.ts +1120 -0
  65. package/src/extra/ai/compose/render.ts +159 -0
  66. package/src/extra/ai/compose/testing.ts +71 -0
  67. package/src/extra/ai/compose/types.ts +159 -0
  68. package/src/extra/ai/decide.ts +97 -1
  69. package/src/extra/ai/index.ts +6 -1
  70. package/src/extra/diagnostics/checks/dom.ts +10 -2
  71. package/src/extra/diagnostics/checks/next.ts +103 -3
  72. package/src/extra/diagnostics/checks/persist.ts +4 -2
  73. package/src/extra/diagnostics/checks/wiring.ts +14 -6
  74. package/src/extra/diagnostics/codes.ts +59 -0
  75. package/src/extra/fetchDriver.ts +58 -27
  76. package/src/extra/lens.ts +15 -0
  77. package/src/extra/pwa.ts +3 -1
  78. package/src/extra/reducers.ts +10 -4
  79. package/src/extra/ssr.ts +3 -3
  80. package/src/extra/testing.ts +2 -0
  81. package/src/extra/widget.ts +3 -3
  82. package/src/index.d.ts +50 -2
  83. package/src/index.ts +8 -0
  84. package/src/lazy.ts +3 -2
  85. package/src/portal.ts +5 -2
  86. package/src/pragma/index.ts +2 -1
  87. package/src/suspense.ts +5 -2
  88. package/src/switchable.ts +2 -1
  89. package/src/transition.ts +5 -2
  90. package/src/vike/onRenderClient.ts +3 -2
  91. package/src/vite/plugin.ts +63 -2
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sygnal",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }
@@ -98,7 +98,8 @@ function componentVNode(comp, key, stateField, children, compInitialState) {
98
98
  children,
99
99
  text: undefined,
100
100
  elm: undefined,
101
- key: '__vike_' + key + '__',
101
+ // no vnode key: it would be the instance identity (D456); `id` is (G-207)
102
+ key: undefined,
102
103
  };
103
104
  }
104
105
  /**
@@ -127,7 +128,7 @@ function pageChildVNode(pageState, stateField = 'page') {
127
128
  children: [],
128
129
  text: undefined,
129
130
  elm: undefined,
130
- key: '__vike_page__',
131
+ key: undefined,
131
132
  };
132
133
  }
133
134
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"onRenderClient.cjs.js","sources":["../../src/extra/owned.ts","../../src/vike/onRenderClient.ts"],"sourcesContent":["/**\n * PLAN-4.5 G-275: marks an initial state that a wrapper built from its caller's values (an\n * element's host props, Vike's pageContext.data or hydrated state, renderComponent's\n * initialState option). The dev statics freeze (D152, checks/statics.ts) leaves a marked object\n * and everything in it alone: the caller may still change those values. A non-enumerable symbol\n * key: spreads, JSON and Object.keys don't see it.\n */\nexport const OWNED = Symbol.for('sygnal.owned')\n\nexport const owned = <T>(v: T): T => {\n // G-289: an object that refuses the key (a Proxy) is returned as is\n try { if (v && typeof v == 'object' && Object.isExtensible(v)) Object.defineProperty(v, OWNED, {value: 1}) } catch {}\n return v\n}\n\n/**\n * G-289: owned() of a shallow copy of a plain object or array (the caller's own object stays\n * unmarked: it may be a component's static, which the freeze must still cover, or sealed, which\n * can't be marked); anything else as owned()\n */\nexport const ownedCopy = <T>(v: T): T => {\n const p = v && typeof v == 'object' ? Object.getPrototypeOf(v) : 0\n return owned(Array.isArray(v) ? [...v] as any : p == Object.prototype || p === null ? {...v} : v)\n}\n","/**\n * Vike client-side render hook for Sygnal.\n *\n * On first page load (hydration): reads server-serialized state and\n * boots the Sygnal app via run().\n *\n * On client-side navigation with a Layout/Wrapper: the Layout and Wrapper\n * stay mounted and only the Page sub-component is hot-swapped. Layout and\n * Wrapper state persists across navigations. Without either, the app is\n * disposed and recreated.\n *\n * Nesting order: Wrapper > Layout > Page\n * - Wrappers are outermost (context providers, state management)\n * - Layouts are inside wrappers (visual structure, navigation chrome)\n * - Page is innermost (route-specific content, swapped on navigation)\n */\n\n// Import from the package entry so rollup externalizes it\n// @ts-ignore — resolved at runtime via package exports\nimport { run } from 'sygnal'\nimport { owned } from '../extra/owned'\n\ndeclare global {\n interface Window {\n __VIKE_SYGNAL_STATE__?: any\n }\n}\n\ninterface PageContext {\n Page: any\n data?: any\n routeParams?: Record<string, string>\n urlPathname?: string\n isHydration?: boolean\n /** PLAN-3 5-5 (H-7): the queryCache() snapshot a loader seeded (see onRenderHtml) */\n queryCache?: any\n config: {\n Layout?: any | any[]\n Wrapper?: any | any[]\n title?: string\n ssr?: boolean\n drivers?: Record<string, (sink: any) => any>\n // PLAN-4 GS-11: the app-level error hook (not Vike's own onError)\n sygnalOnError?: (error: any, info: any) => void\n }\n}\n\n/** Track the running Sygnal app for disposal on navigation */\nlet currentApp: { sources: any; sinks: any; dispose: () => void } | null = null\n\n/**\n * Mutable references read by the wrapper's view function.\n * Updated on navigation to swap the Page without disposing the Layout.\n */\nlet currentPage: any = null\nlet currentPageName: string = ''\nlet currentPageData: any = {}\nlet currentRouteParams: any = {}\nlet currentUrlPathname: string = ''\nlet pageNavCounter: number = 0\n\n/**\n * PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',\n * layout_1 → 'l1', page → 'p'. Given as the nested vnode's `id` prop, so the Page's uid is\n * 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the same root\n * (renderToString's `uid`), so server and client ids match. (Same helper in onRenderHtml.ts.)\n */\nfunction uidPart(key: string): string {\n return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1)\n}\n\n/**\n * PLAN-4.6 R4 (04 §3.11): the core instantiates a component from the vnode's `data.c`, a\n * component function, and reads its statics there (no options object). A shell component or a\n * Page is wrapped once (a per-app / per-navigation function) with the statics the options\n * gave the 5.x core: isolatedState, and the initial state.\n */\nconst shellFns = new WeakMap<any, any>()\nfunction shellFn(comp: any, initialState: any, cache = true): any {\n let f = cache ? shellFns.get(comp) : undefined\n if (!f) {\n f = Object.assign((p: any) => comp(p), comp, { isolatedState: true, initialState })\n try { Object.defineProperty(f, 'name', { value: comp.name, configurable: true }) } catch (_) {}\n if (cache) shellFns.set(comp, f)\n }\n return f\n}\nlet pageFn: any, pageFnNav = -1\n\n/**\n * Build a component vnode that matches what the JSX pragma produces.\n */\nfunction componentVNode(comp: any, key: string, stateField: any, children: any[], compInitialState?: any): any {\n const name = comp.componentName || comp.name || 'FUNCTION_COMPONENT'\n return {\n sel: name,\n data: {\n c: shellFn(comp, owned(comp.initialState)),\n props: {\n state: stateField,\n // G-207: the uid() base, as onRenderHtml gives this shell component (see uidPart)\n id: uidPart(key),\n },\n },\n children,\n text: undefined,\n elm: undefined,\n key: '__vike_' + key + '__',\n }\n}\n\n/**\n * Build a vnode for the current Page as a child of the Layout.\n * Reads from mutable `currentPage` / `currentPageName` so the wrapper\n * view picks up the new Page component on navigation without being recreated.\n */\nfunction pageChildVNode(pageState: any, stateField: any = 'page'): any {\n // a new function per navigation, so the Page is made again even when both pages are the same\n // function (e.g. 'Page'); the nav counter in `sel` keeps the vnodes apart\n const sel = currentPageName + '__nav' + pageNavCounter\n if (pageFnNav !== pageNavCounter) { pageFnNav = pageNavCounter; pageFn = shellFn(currentPage, undefined, false) }\n return {\n sel,\n data: {\n c: pageFn,\n props: {\n state: stateField,\n // G-207: the Page's uid() base, as onRenderHtml gives it (the same across navigations)\n id: uidPart('page'),\n },\n },\n children: [],\n text: undefined,\n elm: undefined,\n key: '__vike_page__',\n }\n}\n\n/**\n * Create a synthetic wrapper component that nests Page inside Layout(s)\n * inside Wrapper(s).\n *\n * Nesting order: Wrapper(s) > Layout(s) > Page\n *\n * The wrapper's view reads `currentPage` from the mutable closure, so\n * on client-side navigation only the Page sub-component changes while\n * the Layout and Wrapper stay mounted with their state preserved.\n */\nfunction createLayoutWrapper(wrappers: any[], layouts: any[], Page: any): any {\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n\n // Combined shell = wrappers (outermost) + layouts (innermost around Page).\n // D50: the root state holds every slice as a sibling, as in 5.4.0 but with the Page at the\n // root too: { wrapper_0, ..., layout_0, ..., page }. A component's `state` prop selects from\n // its parent component's state, and the shell components are nested in each other, so each\n // one (and the Page) gets a { get, set } lens onto its own ROOT slice: an outer component's\n // reducer replacing its state can't wipe the inner slices (R2-2), and no view sees another\n // component's slice.\n const keys = shellKeys(wrappers, layouts)\n const shell = [...wrappers, ...layouts].map((comp: any, i: number) => ({ comp, key: keys[i] }))\n\n // The latest root state. Only the outermost lens gets the root itself; the nested lenses get\n // their parent shell component's state. In both directions the outermost lens runs first and\n // synchronously (state: root -> outer get -> inner get; a reducer: outer get, inner get, inner\n // set, outer set), so the nested lenses read and write through `root`.\n let root: any = {}\n const rootLens = (key: string, outermost: boolean, fresh: boolean) => ({\n get: (state: any) => {\n if (outermost) root = state || {}\n const slice = root[key]\n // a shell slice is a new object on every root state, so the components nested in the\n // shell component see every change (their state stream drops repeated objects)\n return fresh && slice && typeof slice === 'object' && !Array.isArray(slice) ? { ...slice } : slice\n },\n set: (state: any, slice: any) => {\n root = { ...root, [key]: slice }\n // a nested lens returns a changed parent state, so the parent's lens writes `root` back\n return outermost ? root : { ...state }\n },\n })\n const lenses = keys.map((key, i) => rootLens(key, i === 0, true))\n const pageLens = rootLens('page', false, false)\n\n function LayoutWrapperView({ state }: any) {\n if (shell.length === 0) {\n // No wrappers or layouts — render Page directly\n return pageChildVNode(state.page)\n }\n\n const lastIdx = shell.length - 1\n let inner: any = componentVNode(\n shell[lastIdx].comp,\n shell[lastIdx].key,\n lenses[lastIdx],\n [pageChildVNode(state.page, pageLens)],\n state[shell[lastIdx].key]\n )\n\n // Wrap with outer shell components\n for (let i = lastIdx - 1; i >= 0; i--) {\n inner = componentVNode(shell[i].comp, shell[i].key, lenses[i], [inner], state[shell[i].key])\n }\n\n // Wrap in a plain div so the view returns a regular DOM vnode.\n // Sub-component vnodes at the root position are not processed correctly\n // by the rendering pipeline — they must be children of a DOM element.\n return {\n sel: 'div',\n data: { attrs: { id: 'vike-shell' } },\n children: [inner],\n text: undefined,\n elm: undefined,\n key: '__vike_shell__',\n }\n }\n\n LayoutWrapperView.componentName = 'VikeLayoutWrapper'\n // run() names the root by `name` first\n try { Object.defineProperty(LayoutWrapperView, 'name', { value: 'VikeLayoutWrapper', configurable: true }) } catch (_) {}\n\n // The wrapper's initial state: a sibling slice for each shell component and the Page.\n // Must match onRenderHtml's serialized state.\n const initialState: any = {}\n shell.forEach(({ comp, key }: any) => { initialState[key] = { ...(comp.initialState || {}) } })\n initialState.page = Page.initialState || {}\n // G-275: owned (built from the hydrated state and pageContext.data: never frozen in dev)\n LayoutWrapperView.initialState = root = owned(initialState)\n\n // Context uses mutable references so navigation updates are picked up.\n // Wrapper and Layout contexts are merged once; page-level context\n // (pageData, routeParams, urlPathname) reads from mutable variables\n // updated on each navigation.\n const shellContext: any = {}\n shell.forEach(({ comp }: any) => {\n if (comp.context) {\n Object.assign(shellContext, comp.context)\n }\n })\n\n LayoutWrapperView.context = {\n ...shellContext,\n ...(Page.context || {}),\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n return LayoutWrapperView\n}\n\n/** State keys of the shell components, outermost first: wrapper_0, ..., layout_0, ... */\nfunction shellKeys(wrappers: any[], layouts: any[]): string[] {\n return [\n ...wrappers.map((_: any, i: number) => 'wrapper_' + i),\n ...layouts.map((_: any, i: number) => 'layout_' + i),\n ]\n}\n\n/**\n * Normalize a cumulative config value into an array of functions.\n */\nfunction toComponentArray(val: any): any[] {\n if (!val) return []\n return (Array.isArray(val) ? val : [val]).filter((c: any) => typeof c === 'function')\n}\n\nexport function onRenderClient(pageContext: PageContext) {\n const { Page, config } = pageContext\n const data = pageContext.data || {}\n\n const wrappers = toComponentArray(config.Wrapper)\n const layouts = toComponentArray(config.Layout)\n const hasShell = wrappers.length > 0 || layouts.length > 0\n\n // The shell is wrappers (outermost) + layouts; their state slices and the Page's are\n // siblings at the root (D50).\n const shell = shellKeys(wrappers, layouts)\n\n // PLAN-3 5-5 (H-7): seed the caches of the fetch drivers (makeFetchDriver({ cache: queryCache() })\n // exposes it as driver.cache) before the page renders, so its resources start at 'success'\n if (pageContext.queryCache) {\n for (const d of Object.values(config.drivers || {})) (d as any)?.cache?.hydrate?.(pageContext.queryCache)\n }\n\n // Update mutable context references (used by the wrapper's context functions)\n currentPageData = data\n currentRouteParams = pageContext.routeParams || {}\n // urlPathname is built in on the client with Client Routing (G-046: it is\n // not in passToClient); fall back to the location with Server Routing.\n currentUrlPathname = pageContext.urlPathname\n || (typeof window !== 'undefined' && window.location ? window.location.pathname : '')\n\n // --- Shell path: hot-swap Page, keep Layout/Wrapper alive ---\n if (hasShell) {\n if (currentApp) {\n // Client-side navigation: swap the Page without disposing the shell.\n // PLAN-3 5-4b: a router given Vike's navigate() (makeRouter({ routes, navigate })) re-reads\n // the route on this event; sent before the swap, so the new Page declares after it\n if (typeof window !== 'undefined') window.dispatchEvent?.(new Event('sygnal:navigate'))\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n pageNavCounter++\n\n const newPageState = { ...(Page.initialState || {}), ...data }\n // replace the page slice, keeping every shell slice (G-106, D50)\n const swapPage = (state: any) => ({ ...state, page: newPageState })\n // (PLAN-4.6 core: through the runtime API, 04 §3.11)\n const rt = (currentApp as any).__runtime\n rt?.setState('root', swapPage)\n } else {\n // First load: read hydrated state or build from initialState\n let initialState: any\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n } else {\n initialState = null\n }\n\n if (initialState && initialState[shell[shell.length - 1]] !== undefined) {\n // Hydrated shell state: sibling slices (D50), or the 5.4.0 shape with the Page state\n // under the innermost shell slice (R2-9) — distribute the slices to each component\n const allShellComps = [...wrappers, ...layouts]\n let pageState = initialState.page\n shell.forEach((key: string, i: number) => {\n let slice = initialState[key]\n if (slice === undefined) return\n if (i === shell.length - 1 && slice && 'page' in slice) {\n const { page, ...rest } = slice\n if (pageState === undefined) pageState = page\n slice = rest\n }\n allShellComps[i].initialState = owned(slice)\n })\n Page.initialState = owned(pageState || { ...(Page.initialState || {}), ...data })\n } else {\n // SPA mode or client-side first navigation\n Page.initialState = owned({ ...(Page.initialState || {}), ...data })\n }\n\n // Inject page-level context into Page (for SSR renderToString compat)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n const Component = createLayoutWrapper(wrappers, layouts, Page)\n\n try {\n // 3-B2: `__vike` marks the shell's components (Page, Layouts, Wrappers: sub-components of\n // the shell root) for the dev entry, whose SYG224 then says persist() isn't supported there\n currentApp = run(Component, { ...config.drivers, __vike: () => 1 }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // --- No shell path: dispose and recreate ---\n } else {\n if (currentApp) {\n currentApp.dispose()\n currentApp = null\n }\n\n let initialState: any\n // 3-B2: the server's state is here when the page hydrates its HTML\n let serverState = false\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n serverState = true\n } else {\n initialState = { ...(Page.initialState || {}), ...data }\n }\n\n Page.initialState = owned(initialState)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n try {\n // 3-B2: the Page is the root, so its persist() restores after the first render when this\n // is a hydration (`__hydrate`), keeping that render equal to the server's HTML. A client-side\n // navigation isn't one, though the previous page's markup is still in #page-view\n const hydrating = pageContext.isHydration ?? serverState\n currentApp = run(Page, { ...config.drivers, __hydrate: () => hydrating }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // Update document title on client navigation\n if (config.title) {\n document.title = config.title\n }\n}\n"],"names":["run"],"mappings":";;;;AAAA;;;;;;AAMG;AACI,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;AAExC,MAAM,KAAK,GAAG,CAAI,CAAI,KAAO;;AAElC,IAAA,IAAI;AAAE,QAAA,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;AAAE,YAAA,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC,CAAC,CAAA;KAAE;IAAC,MAAM,GAAE;AACrH,IAAA,OAAO,CAAC,CA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AAA,YAAY,GAAG,EAAE,IAAI,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAA;SACzD;AAED,QAAA,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,IAAI,CAAC,OAAO;AACf,YAAA,QAAQ,EAAE,MAAM,eAAe;AAC/B,YAAA,WAAW,EAAE,MAAM,kBAAkB;AACrC,YAAA,WAAW,EAAE,MAAM,kBAAkB;SACtC,CAAA;AAED,QAAA,IAAI;;;;AAIF,YAAA,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,IAAI,WAAW,CAAA;AACxD,YAAA,UAAU,GAAGA,UAAG,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,CAAQ,CAAA;SAC9I;QAAC,OAAO,GAAQ,EAAE;AACjB,YAAA,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAA;YACxD,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;YACtD,IAAI,SAAS,EAAE;gBACb,SAAS,CAAC,SAAS,GAAG,CAAA;;AAEb,eAAA,EAAA,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAA;eAC5B,CAAA;aACR;SACF;KACF;;AAGD,IAAA,IAAI,MAAM,CAAC,KAAK,EAAE;AAChB,QAAA,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;KAC9B;AACH;;;;"}
1
+ {"version":3,"file":"onRenderClient.cjs.js","sources":["../../src/extra/owned.ts","../../src/vike/onRenderClient.ts"],"sourcesContent":["/**\n * PLAN-4.5 G-275: marks an initial state that a wrapper built from its caller's values (an\n * element's host props, Vike's pageContext.data or hydrated state, renderComponent's\n * initialState option). The dev statics freeze (D152, checks/statics.ts) leaves a marked object\n * and everything in it alone: the caller may still change those values. A non-enumerable symbol\n * key: spreads, JSON and Object.keys don't see it.\n */\nexport const OWNED = Symbol.for('sygnal.owned')\n\nexport const owned = <T>(v: T): T => {\n // G-289: an object that refuses the key (a Proxy) is returned as is\n try { if (v && typeof v == 'object' && Object.isExtensible(v)) Object.defineProperty(v, OWNED, {value: 1}) } catch {}\n return v\n}\n\n/**\n * G-289: owned() of a shallow copy of a plain object or array (the caller's own object stays\n * unmarked: it may be a component's static, which the freeze must still cover, or sealed, which\n * can't be marked); anything else as owned()\n */\nexport const ownedCopy = <T>(v: T): T => {\n const p = v && typeof v == 'object' ? Object.getPrototypeOf(v) : 0\n return owned(Array.isArray(v) ? [...v] as any : p == Object.prototype || p === null ? {...v} : v)\n}\n","/**\n * Vike client-side render hook for Sygnal.\n *\n * On first page load (hydration): reads server-serialized state and\n * boots the Sygnal app via run().\n *\n * On client-side navigation with a Layout/Wrapper: the Layout and Wrapper\n * stay mounted and only the Page sub-component is hot-swapped. Layout and\n * Wrapper state persists across navigations. Without either, the app is\n * disposed and recreated.\n *\n * Nesting order: Wrapper > Layout > Page\n * - Wrappers are outermost (context providers, state management)\n * - Layouts are inside wrappers (visual structure, navigation chrome)\n * - Page is innermost (route-specific content, swapped on navigation)\n */\n\n// Import from the package entry so rollup externalizes it\n// @ts-ignore — resolved at runtime via package exports\nimport { run } from 'sygnal'\nimport { owned } from '../extra/owned'\n\ndeclare global {\n interface Window {\n __VIKE_SYGNAL_STATE__?: any\n }\n}\n\ninterface PageContext {\n Page: any\n data?: any\n routeParams?: Record<string, string>\n urlPathname?: string\n isHydration?: boolean\n /** PLAN-3 5-5 (H-7): the queryCache() snapshot a loader seeded (see onRenderHtml) */\n queryCache?: any\n config: {\n Layout?: any | any[]\n Wrapper?: any | any[]\n title?: string\n ssr?: boolean\n drivers?: Record<string, (sink: any) => any>\n // PLAN-4 GS-11: the app-level error hook (not Vike's own onError)\n sygnalOnError?: (error: any, info: any) => void\n }\n}\n\n/** Track the running Sygnal app for disposal on navigation */\nlet currentApp: { sources: any; sinks: any; dispose: () => void } | null = null\n\n/**\n * Mutable references read by the wrapper's view function.\n * Updated on navigation to swap the Page without disposing the Layout.\n */\nlet currentPage: any = null\nlet currentPageName: string = ''\nlet currentPageData: any = {}\nlet currentRouteParams: any = {}\nlet currentUrlPathname: string = ''\nlet pageNavCounter: number = 0\n\n/**\n * PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',\n * layout_1 → 'l1', page → 'p'. Given as the nested vnode's `id` prop, so the Page's uid is\n * 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the same root\n * (renderToString's `uid`), so server and client ids match. (Same helper in onRenderHtml.ts.)\n */\nfunction uidPart(key: string): string {\n return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1)\n}\n\n/**\n * PLAN-4.6 R4 (04 §3.11): the core instantiates a component from the vnode's `data.c`, a\n * component function, and reads its statics there (no options object). A shell component or a\n * Page is wrapped once (a per-app / per-navigation function) with the statics the options\n * gave the 5.x core: isolatedState, and the initial state.\n */\nconst shellFns = new WeakMap<any, any>()\nfunction shellFn(comp: any, initialState: any, cache = true): any {\n let f = cache ? shellFns.get(comp) : undefined\n if (!f) {\n f = Object.assign((p: any) => comp(p), comp, { isolatedState: true, initialState })\n try { Object.defineProperty(f, 'name', { value: comp.name, configurable: true }) } catch (_) {}\n if (cache) shellFns.set(comp, f)\n }\n return f\n}\nlet pageFn: any, pageFnNav = -1\n\n/**\n * Build a component vnode that matches what the JSX pragma produces.\n */\nfunction componentVNode(comp: any, key: string, stateField: any, children: any[], compInitialState?: any): any {\n const name = comp.componentName || comp.name || 'FUNCTION_COMPONENT'\n return {\n sel: name,\n data: {\n c: shellFn(comp, owned(comp.initialState)),\n props: {\n state: stateField,\n // G-207: the uid() base, as onRenderHtml gives this shell component (see uidPart)\n id: uidPart(key),\n },\n },\n children,\n text: undefined,\n elm: undefined,\n // no vnode key: it would be the instance identity (D456); `id` is (G-207)\n key: undefined,\n }\n}\n\n/**\n * Build a vnode for the current Page as a child of the Layout.\n * Reads from mutable `currentPage` / `currentPageName` so the wrapper\n * view picks up the new Page component on navigation without being recreated.\n */\nfunction pageChildVNode(pageState: any, stateField: any = 'page'): any {\n // a new function per navigation, so the Page is made again even when both pages are the same\n // function (e.g. 'Page'); the nav counter in `sel` keeps the vnodes apart\n const sel = currentPageName + '__nav' + pageNavCounter\n if (pageFnNav !== pageNavCounter) { pageFnNav = pageNavCounter; pageFn = shellFn(currentPage, undefined, false) }\n return {\n sel,\n data: {\n c: pageFn,\n props: {\n state: stateField,\n // G-207: the Page's uid() base, as onRenderHtml gives it (the same across navigations)\n id: uidPart('page'),\n },\n },\n children: [],\n text: undefined,\n elm: undefined,\n key: undefined,\n }\n}\n\n/**\n * Create a synthetic wrapper component that nests Page inside Layout(s)\n * inside Wrapper(s).\n *\n * Nesting order: Wrapper(s) > Layout(s) > Page\n *\n * The wrapper's view reads `currentPage` from the mutable closure, so\n * on client-side navigation only the Page sub-component changes while\n * the Layout and Wrapper stay mounted with their state preserved.\n */\nfunction createLayoutWrapper(wrappers: any[], layouts: any[], Page: any): any {\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n\n // Combined shell = wrappers (outermost) + layouts (innermost around Page).\n // D50: the root state holds every slice as a sibling, as in 5.4.0 but with the Page at the\n // root too: { wrapper_0, ..., layout_0, ..., page }. A component's `state` prop selects from\n // its parent component's state, and the shell components are nested in each other, so each\n // one (and the Page) gets a { get, set } lens onto its own ROOT slice: an outer component's\n // reducer replacing its state can't wipe the inner slices (R2-2), and no view sees another\n // component's slice.\n const keys = shellKeys(wrappers, layouts)\n const shell = [...wrappers, ...layouts].map((comp: any, i: number) => ({ comp, key: keys[i] }))\n\n // The latest root state. Only the outermost lens gets the root itself; the nested lenses get\n // their parent shell component's state. In both directions the outermost lens runs first and\n // synchronously (state: root -> outer get -> inner get; a reducer: outer get, inner get, inner\n // set, outer set), so the nested lenses read and write through `root`.\n let root: any = {}\n const rootLens = (key: string, outermost: boolean, fresh: boolean) => ({\n get: (state: any) => {\n if (outermost) root = state || {}\n const slice = root[key]\n // a shell slice is a new object on every root state, so the components nested in the\n // shell component see every change (their state stream drops repeated objects)\n return fresh && slice && typeof slice === 'object' && !Array.isArray(slice) ? { ...slice } : slice\n },\n set: (state: any, slice: any) => {\n root = { ...root, [key]: slice }\n // a nested lens returns a changed parent state, so the parent's lens writes `root` back\n return outermost ? root : { ...state }\n },\n })\n const lenses = keys.map((key, i) => rootLens(key, i === 0, true))\n const pageLens = rootLens('page', false, false)\n\n function LayoutWrapperView({ state }: any) {\n if (shell.length === 0) {\n // No wrappers or layouts — render Page directly\n return pageChildVNode(state.page)\n }\n\n const lastIdx = shell.length - 1\n let inner: any = componentVNode(\n shell[lastIdx].comp,\n shell[lastIdx].key,\n lenses[lastIdx],\n [pageChildVNode(state.page, pageLens)],\n state[shell[lastIdx].key]\n )\n\n // Wrap with outer shell components\n for (let i = lastIdx - 1; i >= 0; i--) {\n inner = componentVNode(shell[i].comp, shell[i].key, lenses[i], [inner], state[shell[i].key])\n }\n\n // Wrap in a plain div so the view returns a regular DOM vnode.\n // Sub-component vnodes at the root position are not processed correctly\n // by the rendering pipeline — they must be children of a DOM element.\n return {\n sel: 'div',\n data: { attrs: { id: 'vike-shell' } },\n children: [inner],\n text: undefined,\n elm: undefined,\n key: '__vike_shell__',\n }\n }\n\n LayoutWrapperView.componentName = 'VikeLayoutWrapper'\n // run() names the root by `name` first\n try { Object.defineProperty(LayoutWrapperView, 'name', { value: 'VikeLayoutWrapper', configurable: true }) } catch (_) {}\n\n // The wrapper's initial state: a sibling slice for each shell component and the Page.\n // Must match onRenderHtml's serialized state.\n const initialState: any = {}\n shell.forEach(({ comp, key }: any) => { initialState[key] = { ...(comp.initialState || {}) } })\n initialState.page = Page.initialState || {}\n // G-275: owned (built from the hydrated state and pageContext.data: never frozen in dev)\n LayoutWrapperView.initialState = root = owned(initialState)\n\n // Context uses mutable references so navigation updates are picked up.\n // Wrapper and Layout contexts are merged once; page-level context\n // (pageData, routeParams, urlPathname) reads from mutable variables\n // updated on each navigation.\n const shellContext: any = {}\n shell.forEach(({ comp }: any) => {\n if (comp.context) {\n Object.assign(shellContext, comp.context)\n }\n })\n\n LayoutWrapperView.context = {\n ...shellContext,\n ...(Page.context || {}),\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n return LayoutWrapperView\n}\n\n/** State keys of the shell components, outermost first: wrapper_0, ..., layout_0, ... */\nfunction shellKeys(wrappers: any[], layouts: any[]): string[] {\n return [\n ...wrappers.map((_: any, i: number) => 'wrapper_' + i),\n ...layouts.map((_: any, i: number) => 'layout_' + i),\n ]\n}\n\n/**\n * Normalize a cumulative config value into an array of functions.\n */\nfunction toComponentArray(val: any): any[] {\n if (!val) return []\n return (Array.isArray(val) ? val : [val]).filter((c: any) => typeof c === 'function')\n}\n\nexport function onRenderClient(pageContext: PageContext) {\n const { Page, config } = pageContext\n const data = pageContext.data || {}\n\n const wrappers = toComponentArray(config.Wrapper)\n const layouts = toComponentArray(config.Layout)\n const hasShell = wrappers.length > 0 || layouts.length > 0\n\n // The shell is wrappers (outermost) + layouts; their state slices and the Page's are\n // siblings at the root (D50).\n const shell = shellKeys(wrappers, layouts)\n\n // PLAN-3 5-5 (H-7): seed the caches of the fetch drivers (makeFetchDriver({ cache: queryCache() })\n // exposes it as driver.cache) before the page renders, so its resources start at 'success'\n if (pageContext.queryCache) {\n for (const d of Object.values(config.drivers || {})) (d as any)?.cache?.hydrate?.(pageContext.queryCache)\n }\n\n // Update mutable context references (used by the wrapper's context functions)\n currentPageData = data\n currentRouteParams = pageContext.routeParams || {}\n // urlPathname is built in on the client with Client Routing (G-046: it is\n // not in passToClient); fall back to the location with Server Routing.\n currentUrlPathname = pageContext.urlPathname\n || (typeof window !== 'undefined' && window.location ? window.location.pathname : '')\n\n // --- Shell path: hot-swap Page, keep Layout/Wrapper alive ---\n if (hasShell) {\n if (currentApp) {\n // Client-side navigation: swap the Page without disposing the shell.\n // PLAN-3 5-4b: a router given Vike's navigate() (makeRouter({ routes, navigate })) re-reads\n // the route on this event; sent before the swap, so the new Page declares after it\n if (typeof window !== 'undefined') window.dispatchEvent?.(new Event('sygnal:navigate'))\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n pageNavCounter++\n\n const newPageState = { ...(Page.initialState || {}), ...data }\n // replace the page slice, keeping every shell slice (G-106, D50)\n const swapPage = (state: any) => ({ ...state, page: newPageState })\n // (PLAN-4.6 core: through the runtime API, 04 §3.11)\n const rt = (currentApp as any).__runtime\n rt?.setState('root', swapPage)\n } else {\n // First load: read hydrated state or build from initialState\n let initialState: any\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n } else {\n initialState = null\n }\n\n if (initialState && initialState[shell[shell.length - 1]] !== undefined) {\n // Hydrated shell state: sibling slices (D50), or the 5.4.0 shape with the Page state\n // under the innermost shell slice (R2-9) — distribute the slices to each component\n const allShellComps = [...wrappers, ...layouts]\n let pageState = initialState.page\n shell.forEach((key: string, i: number) => {\n let slice = initialState[key]\n if (slice === undefined) return\n if (i === shell.length - 1 && slice && 'page' in slice) {\n const { page, ...rest } = slice\n if (pageState === undefined) pageState = page\n slice = rest\n }\n allShellComps[i].initialState = owned(slice)\n })\n Page.initialState = owned(pageState || { ...(Page.initialState || {}), ...data })\n } else {\n // SPA mode or client-side first navigation\n Page.initialState = owned({ ...(Page.initialState || {}), ...data })\n }\n\n // Inject page-level context into Page (for SSR renderToString compat)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n const Component = createLayoutWrapper(wrappers, layouts, Page)\n\n try {\n // 3-B2: `__vike` marks the shell's components (Page, Layouts, Wrappers: sub-components of\n // the shell root) for the dev entry, whose SYG224 then says persist() isn't supported there\n currentApp = run(Component, { ...config.drivers, __vike: () => 1 }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // --- No shell path: dispose and recreate ---\n } else {\n if (currentApp) {\n currentApp.dispose()\n currentApp = null\n }\n\n let initialState: any\n // 3-B2: the server's state is here when the page hydrates its HTML\n let serverState = false\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n serverState = true\n } else {\n initialState = { ...(Page.initialState || {}), ...data }\n }\n\n Page.initialState = owned(initialState)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n try {\n // 3-B2: the Page is the root, so its persist() restores after the first render when this\n // is a hydration (`__hydrate`), keeping that render equal to the server's HTML. A client-side\n // navigation isn't one, though the previous page's markup is still in #page-view\n const hydrating = pageContext.isHydration ?? serverState\n currentApp = run(Page, { ...config.drivers, __hydrate: () => hydrating }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // Update document title on client navigation\n if (config.title) {\n document.title = config.title\n }\n}\n"],"names":["run"],"mappings":";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G,CAAA;;AAEb,eAAA,EAAA,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAA;eAC5B,CAAA;aACR;SACF;KACF;;AAGD,IAAA,IAAI,MAAM,CAAC,KAAK,EAAE;AAChB,QAAA,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;KAC9B;AACH;;;;"}
@@ -96,7 +96,8 @@ function componentVNode(comp, key, stateField, children, compInitialState) {
96
96
  children,
97
97
  text: undefined,
98
98
  elm: undefined,
99
- key: '__vike_' + key + '__',
99
+ // no vnode key: it would be the instance identity (D456); `id` is (G-207)
100
+ key: undefined,
100
101
  };
101
102
  }
102
103
  /**
@@ -125,7 +126,7 @@ function pageChildVNode(pageState, stateField = 'page') {
125
126
  children: [],
126
127
  text: undefined,
127
128
  elm: undefined,
128
- key: '__vike_page__',
129
+ key: undefined,
129
130
  };
130
131
  }
131
132
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"onRenderClient.mjs","sources":["../../src/extra/owned.ts","../../src/vike/onRenderClient.ts"],"sourcesContent":["/**\n * PLAN-4.5 G-275: marks an initial state that a wrapper built from its caller's values (an\n * element's host props, Vike's pageContext.data or hydrated state, renderComponent's\n * initialState option). The dev statics freeze (D152, checks/statics.ts) leaves a marked object\n * and everything in it alone: the caller may still change those values. A non-enumerable symbol\n * key: spreads, JSON and Object.keys don't see it.\n */\nexport const OWNED = Symbol.for('sygnal.owned')\n\nexport const owned = <T>(v: T): T => {\n // G-289: an object that refuses the key (a Proxy) is returned as is\n try { if (v && typeof v == 'object' && Object.isExtensible(v)) Object.defineProperty(v, OWNED, {value: 1}) } catch {}\n return v\n}\n\n/**\n * G-289: owned() of a shallow copy of a plain object or array (the caller's own object stays\n * unmarked: it may be a component's static, which the freeze must still cover, or sealed, which\n * can't be marked); anything else as owned()\n */\nexport const ownedCopy = <T>(v: T): T => {\n const p = v && typeof v == 'object' ? Object.getPrototypeOf(v) : 0\n return owned(Array.isArray(v) ? [...v] as any : p == Object.prototype || p === null ? {...v} : v)\n}\n","/**\n * Vike client-side render hook for Sygnal.\n *\n * On first page load (hydration): reads server-serialized state and\n * boots the Sygnal app via run().\n *\n * On client-side navigation with a Layout/Wrapper: the Layout and Wrapper\n * stay mounted and only the Page sub-component is hot-swapped. Layout and\n * Wrapper state persists across navigations. Without either, the app is\n * disposed and recreated.\n *\n * Nesting order: Wrapper > Layout > Page\n * - Wrappers are outermost (context providers, state management)\n * - Layouts are inside wrappers (visual structure, navigation chrome)\n * - Page is innermost (route-specific content, swapped on navigation)\n */\n\n// Import from the package entry so rollup externalizes it\n// @ts-ignore — resolved at runtime via package exports\nimport { run } from 'sygnal'\nimport { owned } from '../extra/owned'\n\ndeclare global {\n interface Window {\n __VIKE_SYGNAL_STATE__?: any\n }\n}\n\ninterface PageContext {\n Page: any\n data?: any\n routeParams?: Record<string, string>\n urlPathname?: string\n isHydration?: boolean\n /** PLAN-3 5-5 (H-7): the queryCache() snapshot a loader seeded (see onRenderHtml) */\n queryCache?: any\n config: {\n Layout?: any | any[]\n Wrapper?: any | any[]\n title?: string\n ssr?: boolean\n drivers?: Record<string, (sink: any) => any>\n // PLAN-4 GS-11: the app-level error hook (not Vike's own onError)\n sygnalOnError?: (error: any, info: any) => void\n }\n}\n\n/** Track the running Sygnal app for disposal on navigation */\nlet currentApp: { sources: any; sinks: any; dispose: () => void } | null = null\n\n/**\n * Mutable references read by the wrapper's view function.\n * Updated on navigation to swap the Page without disposing the Layout.\n */\nlet currentPage: any = null\nlet currentPageName: string = ''\nlet currentPageData: any = {}\nlet currentRouteParams: any = {}\nlet currentUrlPathname: string = ''\nlet pageNavCounter: number = 0\n\n/**\n * PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',\n * layout_1 → 'l1', page → 'p'. Given as the nested vnode's `id` prop, so the Page's uid is\n * 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the same root\n * (renderToString's `uid`), so server and client ids match. (Same helper in onRenderHtml.ts.)\n */\nfunction uidPart(key: string): string {\n return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1)\n}\n\n/**\n * PLAN-4.6 R4 (04 §3.11): the core instantiates a component from the vnode's `data.c`, a\n * component function, and reads its statics there (no options object). A shell component or a\n * Page is wrapped once (a per-app / per-navigation function) with the statics the options\n * gave the 5.x core: isolatedState, and the initial state.\n */\nconst shellFns = new WeakMap<any, any>()\nfunction shellFn(comp: any, initialState: any, cache = true): any {\n let f = cache ? shellFns.get(comp) : undefined\n if (!f) {\n f = Object.assign((p: any) => comp(p), comp, { isolatedState: true, initialState })\n try { Object.defineProperty(f, 'name', { value: comp.name, configurable: true }) } catch (_) {}\n if (cache) shellFns.set(comp, f)\n }\n return f\n}\nlet pageFn: any, pageFnNav = -1\n\n/**\n * Build a component vnode that matches what the JSX pragma produces.\n */\nfunction componentVNode(comp: any, key: string, stateField: any, children: any[], compInitialState?: any): any {\n const name = comp.componentName || comp.name || 'FUNCTION_COMPONENT'\n return {\n sel: name,\n data: {\n c: shellFn(comp, owned(comp.initialState)),\n props: {\n state: stateField,\n // G-207: the uid() base, as onRenderHtml gives this shell component (see uidPart)\n id: uidPart(key),\n },\n },\n children,\n text: undefined,\n elm: undefined,\n key: '__vike_' + key + '__',\n }\n}\n\n/**\n * Build a vnode for the current Page as a child of the Layout.\n * Reads from mutable `currentPage` / `currentPageName` so the wrapper\n * view picks up the new Page component on navigation without being recreated.\n */\nfunction pageChildVNode(pageState: any, stateField: any = 'page'): any {\n // a new function per navigation, so the Page is made again even when both pages are the same\n // function (e.g. 'Page'); the nav counter in `sel` keeps the vnodes apart\n const sel = currentPageName + '__nav' + pageNavCounter\n if (pageFnNav !== pageNavCounter) { pageFnNav = pageNavCounter; pageFn = shellFn(currentPage, undefined, false) }\n return {\n sel,\n data: {\n c: pageFn,\n props: {\n state: stateField,\n // G-207: the Page's uid() base, as onRenderHtml gives it (the same across navigations)\n id: uidPart('page'),\n },\n },\n children: [],\n text: undefined,\n elm: undefined,\n key: '__vike_page__',\n }\n}\n\n/**\n * Create a synthetic wrapper component that nests Page inside Layout(s)\n * inside Wrapper(s).\n *\n * Nesting order: Wrapper(s) > Layout(s) > Page\n *\n * The wrapper's view reads `currentPage` from the mutable closure, so\n * on client-side navigation only the Page sub-component changes while\n * the Layout and Wrapper stay mounted with their state preserved.\n */\nfunction createLayoutWrapper(wrappers: any[], layouts: any[], Page: any): any {\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n\n // Combined shell = wrappers (outermost) + layouts (innermost around Page).\n // D50: the root state holds every slice as a sibling, as in 5.4.0 but with the Page at the\n // root too: { wrapper_0, ..., layout_0, ..., page }. A component's `state` prop selects from\n // its parent component's state, and the shell components are nested in each other, so each\n // one (and the Page) gets a { get, set } lens onto its own ROOT slice: an outer component's\n // reducer replacing its state can't wipe the inner slices (R2-2), and no view sees another\n // component's slice.\n const keys = shellKeys(wrappers, layouts)\n const shell = [...wrappers, ...layouts].map((comp: any, i: number) => ({ comp, key: keys[i] }))\n\n // The latest root state. Only the outermost lens gets the root itself; the nested lenses get\n // their parent shell component's state. In both directions the outermost lens runs first and\n // synchronously (state: root -> outer get -> inner get; a reducer: outer get, inner get, inner\n // set, outer set), so the nested lenses read and write through `root`.\n let root: any = {}\n const rootLens = (key: string, outermost: boolean, fresh: boolean) => ({\n get: (state: any) => {\n if (outermost) root = state || {}\n const slice = root[key]\n // a shell slice is a new object on every root state, so the components nested in the\n // shell component see every change (their state stream drops repeated objects)\n return fresh && slice && typeof slice === 'object' && !Array.isArray(slice) ? { ...slice } : slice\n },\n set: (state: any, slice: any) => {\n root = { ...root, [key]: slice }\n // a nested lens returns a changed parent state, so the parent's lens writes `root` back\n return outermost ? root : { ...state }\n },\n })\n const lenses = keys.map((key, i) => rootLens(key, i === 0, true))\n const pageLens = rootLens('page', false, false)\n\n function LayoutWrapperView({ state }: any) {\n if (shell.length === 0) {\n // No wrappers or layouts — render Page directly\n return pageChildVNode(state.page)\n }\n\n const lastIdx = shell.length - 1\n let inner: any = componentVNode(\n shell[lastIdx].comp,\n shell[lastIdx].key,\n lenses[lastIdx],\n [pageChildVNode(state.page, pageLens)],\n state[shell[lastIdx].key]\n )\n\n // Wrap with outer shell components\n for (let i = lastIdx - 1; i >= 0; i--) {\n inner = componentVNode(shell[i].comp, shell[i].key, lenses[i], [inner], state[shell[i].key])\n }\n\n // Wrap in a plain div so the view returns a regular DOM vnode.\n // Sub-component vnodes at the root position are not processed correctly\n // by the rendering pipeline — they must be children of a DOM element.\n return {\n sel: 'div',\n data: { attrs: { id: 'vike-shell' } },\n children: [inner],\n text: undefined,\n elm: undefined,\n key: '__vike_shell__',\n }\n }\n\n LayoutWrapperView.componentName = 'VikeLayoutWrapper'\n // run() names the root by `name` first\n try { Object.defineProperty(LayoutWrapperView, 'name', { value: 'VikeLayoutWrapper', configurable: true }) } catch (_) {}\n\n // The wrapper's initial state: a sibling slice for each shell component and the Page.\n // Must match onRenderHtml's serialized state.\n const initialState: any = {}\n shell.forEach(({ comp, key }: any) => { initialState[key] = { ...(comp.initialState || {}) } })\n initialState.page = Page.initialState || {}\n // G-275: owned (built from the hydrated state and pageContext.data: never frozen in dev)\n LayoutWrapperView.initialState = root = owned(initialState)\n\n // Context uses mutable references so navigation updates are picked up.\n // Wrapper and Layout contexts are merged once; page-level context\n // (pageData, routeParams, urlPathname) reads from mutable variables\n // updated on each navigation.\n const shellContext: any = {}\n shell.forEach(({ comp }: any) => {\n if (comp.context) {\n Object.assign(shellContext, comp.context)\n }\n })\n\n LayoutWrapperView.context = {\n ...shellContext,\n ...(Page.context || {}),\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n return LayoutWrapperView\n}\n\n/** State keys of the shell components, outermost first: wrapper_0, ..., layout_0, ... */\nfunction shellKeys(wrappers: any[], layouts: any[]): string[] {\n return [\n ...wrappers.map((_: any, i: number) => 'wrapper_' + i),\n ...layouts.map((_: any, i: number) => 'layout_' + i),\n ]\n}\n\n/**\n * Normalize a cumulative config value into an array of functions.\n */\nfunction toComponentArray(val: any): any[] {\n if (!val) return []\n return (Array.isArray(val) ? val : [val]).filter((c: any) => typeof c === 'function')\n}\n\nexport function onRenderClient(pageContext: PageContext) {\n const { Page, config } = pageContext\n const data = pageContext.data || {}\n\n const wrappers = toComponentArray(config.Wrapper)\n const layouts = toComponentArray(config.Layout)\n const hasShell = wrappers.length > 0 || layouts.length > 0\n\n // The shell is wrappers (outermost) + layouts; their state slices and the Page's are\n // siblings at the root (D50).\n const shell = shellKeys(wrappers, layouts)\n\n // PLAN-3 5-5 (H-7): seed the caches of the fetch drivers (makeFetchDriver({ cache: queryCache() })\n // exposes it as driver.cache) before the page renders, so its resources start at 'success'\n if (pageContext.queryCache) {\n for (const d of Object.values(config.drivers || {})) (d as any)?.cache?.hydrate?.(pageContext.queryCache)\n }\n\n // Update mutable context references (used by the wrapper's context functions)\n currentPageData = data\n currentRouteParams = pageContext.routeParams || {}\n // urlPathname is built in on the client with Client Routing (G-046: it is\n // not in passToClient); fall back to the location with Server Routing.\n currentUrlPathname = pageContext.urlPathname\n || (typeof window !== 'undefined' && window.location ? window.location.pathname : '')\n\n // --- Shell path: hot-swap Page, keep Layout/Wrapper alive ---\n if (hasShell) {\n if (currentApp) {\n // Client-side navigation: swap the Page without disposing the shell.\n // PLAN-3 5-4b: a router given Vike's navigate() (makeRouter({ routes, navigate })) re-reads\n // the route on this event; sent before the swap, so the new Page declares after it\n if (typeof window !== 'undefined') window.dispatchEvent?.(new Event('sygnal:navigate'))\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n pageNavCounter++\n\n const newPageState = { ...(Page.initialState || {}), ...data }\n // replace the page slice, keeping every shell slice (G-106, D50)\n const swapPage = (state: any) => ({ ...state, page: newPageState })\n // (PLAN-4.6 core: through the runtime API, 04 §3.11)\n const rt = (currentApp as any).__runtime\n rt?.setState('root', swapPage)\n } else {\n // First load: read hydrated state or build from initialState\n let initialState: any\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n } else {\n initialState = null\n }\n\n if (initialState && initialState[shell[shell.length - 1]] !== undefined) {\n // Hydrated shell state: sibling slices (D50), or the 5.4.0 shape with the Page state\n // under the innermost shell slice (R2-9) — distribute the slices to each component\n const allShellComps = [...wrappers, ...layouts]\n let pageState = initialState.page\n shell.forEach((key: string, i: number) => {\n let slice = initialState[key]\n if (slice === undefined) return\n if (i === shell.length - 1 && slice && 'page' in slice) {\n const { page, ...rest } = slice\n if (pageState === undefined) pageState = page\n slice = rest\n }\n allShellComps[i].initialState = owned(slice)\n })\n Page.initialState = owned(pageState || { ...(Page.initialState || {}), ...data })\n } else {\n // SPA mode or client-side first navigation\n Page.initialState = owned({ ...(Page.initialState || {}), ...data })\n }\n\n // Inject page-level context into Page (for SSR renderToString compat)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n const Component = createLayoutWrapper(wrappers, layouts, Page)\n\n try {\n // 3-B2: `__vike` marks the shell's components (Page, Layouts, Wrappers: sub-components of\n // the shell root) for the dev entry, whose SYG224 then says persist() isn't supported there\n currentApp = run(Component, { ...config.drivers, __vike: () => 1 }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // --- No shell path: dispose and recreate ---\n } else {\n if (currentApp) {\n currentApp.dispose()\n currentApp = null\n }\n\n let initialState: any\n // 3-B2: the server's state is here when the page hydrates its HTML\n let serverState = false\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n serverState = true\n } else {\n initialState = { ...(Page.initialState || {}), ...data }\n }\n\n Page.initialState = owned(initialState)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n try {\n // 3-B2: the Page is the root, so its persist() restores after the first render when this\n // is a hydration (`__hydrate`), keeping that render equal to the server's HTML. A client-side\n // navigation isn't one, though the previous page's markup is still in #page-view\n const hydrating = pageContext.isHydration ?? serverState\n currentApp = run(Page, { ...config.drivers, __hydrate: () => hydrating }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // Update document title on client navigation\n if (config.title) {\n document.title = config.title\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;;;AAMG;AACI,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;AAExC,MAAM,KAAK,GAAG,CAAI,CAAI,KAAO;;AAElC,IAAA,IAAI;AAAE,QAAA,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;AAAE,YAAA,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC,CAAC,CAAA;KAAE;IAAC,MAAM,GAAE;AACrH,IAAA,OAAO,CAAC,CAAA;AACV,CAAC;;ACbD;;;;;;;;;;;;;;;AAeG;AAEH;AACA;AA6BA;AACA,IAAI,UAAU,GAA6D,IAAI,CAAA;AAE/E;;;AAGG;AACH,IAAI,WAAW,GAAQ,I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,CAAC,YAAY,CAAC,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,IAAI,CAAC,OAAO;AACf,YAAA,QAAQ,EAAE,MAAM,eAAe;AAC/B,YAAA,WAAW,EAAE,MAAM,kBAAkB;AACrC,YAAA,WAAW,EAAE,MAAM,kBAAkB;SACtC,CAAA;AAED,QAAA,IAAI;;;;AAIF,YAAA,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,IAAI,WAAW,CAAA;AACxD,YAAA,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,CAAQ,CAAA;SAC9I;QAAC,OAAO,GAAQ,EAAE;AACjB,YAAA,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAA;YACxD,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;YACtD,IAAI,SAAS,EAAE;gBACb,SAAS,CAAC,SAAS,GAAG,CAAA;;AAEb,eAAA,EAAA,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAA;eAC5B,CAAA;aACR;SACF;KACF;;AAGD,IAAA,IAAI,MAAM,CAAC,KAAK,EAAE;AAChB,QAAA,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;KAC9B;AACH;;;;"}
1
+ {"version":3,"file":"onRenderClient.mjs","sources":["../../src/extra/owned.ts","../../src/vike/onRenderClient.ts"],"sourcesContent":["/**\n * PLAN-4.5 G-275: marks an initial state that a wrapper built from its caller's values (an\n * element's host props, Vike's pageContext.data or hydrated state, renderComponent's\n * initialState option). The dev statics freeze (D152, checks/statics.ts) leaves a marked object\n * and everything in it alone: the caller may still change those values. A non-enumerable symbol\n * key: spreads, JSON and Object.keys don't see it.\n */\nexport const OWNED = Symbol.for('sygnal.owned')\n\nexport const owned = <T>(v: T): T => {\n // G-289: an object that refuses the key (a Proxy) is returned as is\n try { if (v && typeof v == 'object' && Object.isExtensible(v)) Object.defineProperty(v, OWNED, {value: 1}) } catch {}\n return v\n}\n\n/**\n * G-289: owned() of a shallow copy of a plain object or array (the caller's own object stays\n * unmarked: it may be a component's static, which the freeze must still cover, or sealed, which\n * can't be marked); anything else as owned()\n */\nexport const ownedCopy = <T>(v: T): T => {\n const p = v && typeof v == 'object' ? Object.getPrototypeOf(v) : 0\n return owned(Array.isArray(v) ? [...v] as any : p == Object.prototype || p === null ? {...v} : v)\n}\n","/**\n * Vike client-side render hook for Sygnal.\n *\n * On first page load (hydration): reads server-serialized state and\n * boots the Sygnal app via run().\n *\n * On client-side navigation with a Layout/Wrapper: the Layout and Wrapper\n * stay mounted and only the Page sub-component is hot-swapped. Layout and\n * Wrapper state persists across navigations. Without either, the app is\n * disposed and recreated.\n *\n * Nesting order: Wrapper > Layout > Page\n * - Wrappers are outermost (context providers, state management)\n * - Layouts are inside wrappers (visual structure, navigation chrome)\n * - Page is innermost (route-specific content, swapped on navigation)\n */\n\n// Import from the package entry so rollup externalizes it\n// @ts-ignore — resolved at runtime via package exports\nimport { run } from 'sygnal'\nimport { owned } from '../extra/owned'\n\ndeclare global {\n interface Window {\n __VIKE_SYGNAL_STATE__?: any\n }\n}\n\ninterface PageContext {\n Page: any\n data?: any\n routeParams?: Record<string, string>\n urlPathname?: string\n isHydration?: boolean\n /** PLAN-3 5-5 (H-7): the queryCache() snapshot a loader seeded (see onRenderHtml) */\n queryCache?: any\n config: {\n Layout?: any | any[]\n Wrapper?: any | any[]\n title?: string\n ssr?: boolean\n drivers?: Record<string, (sink: any) => any>\n // PLAN-4 GS-11: the app-level error hook (not Vike's own onError)\n sygnalOnError?: (error: any, info: any) => void\n }\n}\n\n/** Track the running Sygnal app for disposal on navigation */\nlet currentApp: { sources: any; sinks: any; dispose: () => void } | null = null\n\n/**\n * Mutable references read by the wrapper's view function.\n * Updated on navigation to swap the Page without disposing the Layout.\n */\nlet currentPage: any = null\nlet currentPageName: string = ''\nlet currentPageData: any = {}\nlet currentRouteParams: any = {}\nlet currentUrlPathname: string = ''\nlet pageNavCounter: number = 0\n\n/**\n * PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',\n * layout_1 → 'l1', page → 'p'. Given as the nested vnode's `id` prop, so the Page's uid is\n * 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the same root\n * (renderToString's `uid`), so server and client ids match. (Same helper in onRenderHtml.ts.)\n */\nfunction uidPart(key: string): string {\n return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1)\n}\n\n/**\n * PLAN-4.6 R4 (04 §3.11): the core instantiates a component from the vnode's `data.c`, a\n * component function, and reads its statics there (no options object). A shell component or a\n * Page is wrapped once (a per-app / per-navigation function) with the statics the options\n * gave the 5.x core: isolatedState, and the initial state.\n */\nconst shellFns = new WeakMap<any, any>()\nfunction shellFn(comp: any, initialState: any, cache = true): any {\n let f = cache ? shellFns.get(comp) : undefined\n if (!f) {\n f = Object.assign((p: any) => comp(p), comp, { isolatedState: true, initialState })\n try { Object.defineProperty(f, 'name', { value: comp.name, configurable: true }) } catch (_) {}\n if (cache) shellFns.set(comp, f)\n }\n return f\n}\nlet pageFn: any, pageFnNav = -1\n\n/**\n * Build a component vnode that matches what the JSX pragma produces.\n */\nfunction componentVNode(comp: any, key: string, stateField: any, children: any[], compInitialState?: any): any {\n const name = comp.componentName || comp.name || 'FUNCTION_COMPONENT'\n return {\n sel: name,\n data: {\n c: shellFn(comp, owned(comp.initialState)),\n props: {\n state: stateField,\n // G-207: the uid() base, as onRenderHtml gives this shell component (see uidPart)\n id: uidPart(key),\n },\n },\n children,\n text: undefined,\n elm: undefined,\n // no vnode key: it would be the instance identity (D456); `id` is (G-207)\n key: undefined,\n }\n}\n\n/**\n * Build a vnode for the current Page as a child of the Layout.\n * Reads from mutable `currentPage` / `currentPageName` so the wrapper\n * view picks up the new Page component on navigation without being recreated.\n */\nfunction pageChildVNode(pageState: any, stateField: any = 'page'): any {\n // a new function per navigation, so the Page is made again even when both pages are the same\n // function (e.g. 'Page'); the nav counter in `sel` keeps the vnodes apart\n const sel = currentPageName + '__nav' + pageNavCounter\n if (pageFnNav !== pageNavCounter) { pageFnNav = pageNavCounter; pageFn = shellFn(currentPage, undefined, false) }\n return {\n sel,\n data: {\n c: pageFn,\n props: {\n state: stateField,\n // G-207: the Page's uid() base, as onRenderHtml gives it (the same across navigations)\n id: uidPart('page'),\n },\n },\n children: [],\n text: undefined,\n elm: undefined,\n key: undefined,\n }\n}\n\n/**\n * Create a synthetic wrapper component that nests Page inside Layout(s)\n * inside Wrapper(s).\n *\n * Nesting order: Wrapper(s) > Layout(s) > Page\n *\n * The wrapper's view reads `currentPage` from the mutable closure, so\n * on client-side navigation only the Page sub-component changes while\n * the Layout and Wrapper stay mounted with their state preserved.\n */\nfunction createLayoutWrapper(wrappers: any[], layouts: any[], Page: any): any {\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n\n // Combined shell = wrappers (outermost) + layouts (innermost around Page).\n // D50: the root state holds every slice as a sibling, as in 5.4.0 but with the Page at the\n // root too: { wrapper_0, ..., layout_0, ..., page }. A component's `state` prop selects from\n // its parent component's state, and the shell components are nested in each other, so each\n // one (and the Page) gets a { get, set } lens onto its own ROOT slice: an outer component's\n // reducer replacing its state can't wipe the inner slices (R2-2), and no view sees another\n // component's slice.\n const keys = shellKeys(wrappers, layouts)\n const shell = [...wrappers, ...layouts].map((comp: any, i: number) => ({ comp, key: keys[i] }))\n\n // The latest root state. Only the outermost lens gets the root itself; the nested lenses get\n // their parent shell component's state. In both directions the outermost lens runs first and\n // synchronously (state: root -> outer get -> inner get; a reducer: outer get, inner get, inner\n // set, outer set), so the nested lenses read and write through `root`.\n let root: any = {}\n const rootLens = (key: string, outermost: boolean, fresh: boolean) => ({\n get: (state: any) => {\n if (outermost) root = state || {}\n const slice = root[key]\n // a shell slice is a new object on every root state, so the components nested in the\n // shell component see every change (their state stream drops repeated objects)\n return fresh && slice && typeof slice === 'object' && !Array.isArray(slice) ? { ...slice } : slice\n },\n set: (state: any, slice: any) => {\n root = { ...root, [key]: slice }\n // a nested lens returns a changed parent state, so the parent's lens writes `root` back\n return outermost ? root : { ...state }\n },\n })\n const lenses = keys.map((key, i) => rootLens(key, i === 0, true))\n const pageLens = rootLens('page', false, false)\n\n function LayoutWrapperView({ state }: any) {\n if (shell.length === 0) {\n // No wrappers or layouts — render Page directly\n return pageChildVNode(state.page)\n }\n\n const lastIdx = shell.length - 1\n let inner: any = componentVNode(\n shell[lastIdx].comp,\n shell[lastIdx].key,\n lenses[lastIdx],\n [pageChildVNode(state.page, pageLens)],\n state[shell[lastIdx].key]\n )\n\n // Wrap with outer shell components\n for (let i = lastIdx - 1; i >= 0; i--) {\n inner = componentVNode(shell[i].comp, shell[i].key, lenses[i], [inner], state[shell[i].key])\n }\n\n // Wrap in a plain div so the view returns a regular DOM vnode.\n // Sub-component vnodes at the root position are not processed correctly\n // by the rendering pipeline — they must be children of a DOM element.\n return {\n sel: 'div',\n data: { attrs: { id: 'vike-shell' } },\n children: [inner],\n text: undefined,\n elm: undefined,\n key: '__vike_shell__',\n }\n }\n\n LayoutWrapperView.componentName = 'VikeLayoutWrapper'\n // run() names the root by `name` first\n try { Object.defineProperty(LayoutWrapperView, 'name', { value: 'VikeLayoutWrapper', configurable: true }) } catch (_) {}\n\n // The wrapper's initial state: a sibling slice for each shell component and the Page.\n // Must match onRenderHtml's serialized state.\n const initialState: any = {}\n shell.forEach(({ comp, key }: any) => { initialState[key] = { ...(comp.initialState || {}) } })\n initialState.page = Page.initialState || {}\n // G-275: owned (built from the hydrated state and pageContext.data: never frozen in dev)\n LayoutWrapperView.initialState = root = owned(initialState)\n\n // Context uses mutable references so navigation updates are picked up.\n // Wrapper and Layout contexts are merged once; page-level context\n // (pageData, routeParams, urlPathname) reads from mutable variables\n // updated on each navigation.\n const shellContext: any = {}\n shell.forEach(({ comp }: any) => {\n if (comp.context) {\n Object.assign(shellContext, comp.context)\n }\n })\n\n LayoutWrapperView.context = {\n ...shellContext,\n ...(Page.context || {}),\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n return LayoutWrapperView\n}\n\n/** State keys of the shell components, outermost first: wrapper_0, ..., layout_0, ... */\nfunction shellKeys(wrappers: any[], layouts: any[]): string[] {\n return [\n ...wrappers.map((_: any, i: number) => 'wrapper_' + i),\n ...layouts.map((_: any, i: number) => 'layout_' + i),\n ]\n}\n\n/**\n * Normalize a cumulative config value into an array of functions.\n */\nfunction toComponentArray(val: any): any[] {\n if (!val) return []\n return (Array.isArray(val) ? val : [val]).filter((c: any) => typeof c === 'function')\n}\n\nexport function onRenderClient(pageContext: PageContext) {\n const { Page, config } = pageContext\n const data = pageContext.data || {}\n\n const wrappers = toComponentArray(config.Wrapper)\n const layouts = toComponentArray(config.Layout)\n const hasShell = wrappers.length > 0 || layouts.length > 0\n\n // The shell is wrappers (outermost) + layouts; their state slices and the Page's are\n // siblings at the root (D50).\n const shell = shellKeys(wrappers, layouts)\n\n // PLAN-3 5-5 (H-7): seed the caches of the fetch drivers (makeFetchDriver({ cache: queryCache() })\n // exposes it as driver.cache) before the page renders, so its resources start at 'success'\n if (pageContext.queryCache) {\n for (const d of Object.values(config.drivers || {})) (d as any)?.cache?.hydrate?.(pageContext.queryCache)\n }\n\n // Update mutable context references (used by the wrapper's context functions)\n currentPageData = data\n currentRouteParams = pageContext.routeParams || {}\n // urlPathname is built in on the client with Client Routing (G-046: it is\n // not in passToClient); fall back to the location with Server Routing.\n currentUrlPathname = pageContext.urlPathname\n || (typeof window !== 'undefined' && window.location ? window.location.pathname : '')\n\n // --- Shell path: hot-swap Page, keep Layout/Wrapper alive ---\n if (hasShell) {\n if (currentApp) {\n // Client-side navigation: swap the Page without disposing the shell.\n // PLAN-3 5-4b: a router given Vike's navigate() (makeRouter({ routes, navigate })) re-reads\n // the route on this event; sent before the swap, so the new Page declares after it\n if (typeof window !== 'undefined') window.dispatchEvent?.(new Event('sygnal:navigate'))\n currentPage = Page\n currentPageName = Page.componentName || Page.name || 'VikePageComponent'\n pageNavCounter++\n\n const newPageState = { ...(Page.initialState || {}), ...data }\n // replace the page slice, keeping every shell slice (G-106, D50)\n const swapPage = (state: any) => ({ ...state, page: newPageState })\n // (PLAN-4.6 core: through the runtime API, 04 §3.11)\n const rt = (currentApp as any).__runtime\n rt?.setState('root', swapPage)\n } else {\n // First load: read hydrated state or build from initialState\n let initialState: any\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n } else {\n initialState = null\n }\n\n if (initialState && initialState[shell[shell.length - 1]] !== undefined) {\n // Hydrated shell state: sibling slices (D50), or the 5.4.0 shape with the Page state\n // under the innermost shell slice (R2-9) — distribute the slices to each component\n const allShellComps = [...wrappers, ...layouts]\n let pageState = initialState.page\n shell.forEach((key: string, i: number) => {\n let slice = initialState[key]\n if (slice === undefined) return\n if (i === shell.length - 1 && slice && 'page' in slice) {\n const { page, ...rest } = slice\n if (pageState === undefined) pageState = page\n slice = rest\n }\n allShellComps[i].initialState = owned(slice)\n })\n Page.initialState = owned(pageState || { ...(Page.initialState || {}), ...data })\n } else {\n // SPA mode or client-side first navigation\n Page.initialState = owned({ ...(Page.initialState || {}), ...data })\n }\n\n // Inject page-level context into Page (for SSR renderToString compat)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n const Component = createLayoutWrapper(wrappers, layouts, Page)\n\n try {\n // 3-B2: `__vike` marks the shell's components (Page, Layouts, Wrappers: sub-components of\n // the shell root) for the dev entry, whose SYG224 then says persist() isn't supported there\n currentApp = run(Component, { ...config.drivers, __vike: () => 1 }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // --- No shell path: dispose and recreate ---\n } else {\n if (currentApp) {\n currentApp.dispose()\n currentApp = null\n }\n\n let initialState: any\n // 3-B2: the server's state is here when the page hydrates its HTML\n let serverState = false\n if (typeof window !== 'undefined' && window.__VIKE_SYGNAL_STATE__ !== undefined) {\n initialState = window.__VIKE_SYGNAL_STATE__\n delete window.__VIKE_SYGNAL_STATE__\n serverState = true\n } else {\n initialState = { ...(Page.initialState || {}), ...data }\n }\n\n Page.initialState = owned(initialState)\n Page.context = {\n ...Page.context,\n pageData: () => currentPageData,\n routeParams: () => currentRouteParams,\n urlPathname: () => currentUrlPathname,\n }\n\n try {\n // 3-B2: the Page is the root, so its persist() restores after the first render when this\n // is a hydration (`__hydrate`), keeping that render equal to the server's HTML. A client-side\n // navigation isn't one, though the previous page's markup is still in #page-view\n const hydrating = pageContext.isHydration ?? serverState\n currentApp = run(Page, { ...config.drivers, __hydrate: () => hydrating }, { mountPoint: '#page-view', onError: config.sygnalOnError }) as any\n } catch (err: any) {\n console.error('[sygnal/vike] Client render error:', err)\n const container = document.getElementById('page-view')\n if (container) {\n container.innerHTML = `<div data-sygnal-error style=\"padding:2rem;color:#e74c3c;font-family:monospace\">\n <h2>Render Error</h2>\n <pre>${String(err.message || err)}</pre>\n </div>`\n }\n }\n }\n\n // Update document title on client navigation\n if (config.title) {\n document.title = config.title\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;;;AAMG;AACI,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;AAExC,MAAM,KAAK,GAAG,CAAI,CAAI,KAAO;;AAElC,IAAA,IAAI;A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;AAChB,QAAA,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;KAC9B;AACH;;;;"}
@@ -742,6 +742,12 @@ if (import.meta.hot) installMcpBridge(import.meta.hot, { agentTools, confirm: ${
742
742
  * /__sygnal/mcp (./mcp.ts: streamable HTTP, loopback / local Host / local Origin only)
743
743
  * and the dev entries also import 'virtual:sygnal/mcp', which connects the page over the
744
744
  * HMR channel (installMcpBridge from 'sygnal/devtools'). Never in `vite build` or Vitest.
745
+ * 11. SYG103 view words (dev server with diagnostics on; never `vite build`, SSR or Vitest): a
746
+ * module that sets `X.intent` or `X.uses` gets a tail registering, for each such X, the
747
+ * words of its string literals and of the relative modules it imports, in
748
+ * `globalThis.__SYGNAL_VIEW_TOKENS__`. The runtime SYG103 check then takes a selector drawn
749
+ * by a view helper (`{state.open && panel()}`) as conditionally rendered, as it does for
750
+ * markup in the view function itself (see viewTokensTail).
745
751
  *
746
752
  * Why not Vite's `define`? Vite's dependency optimizer does not apply user
747
753
  * `define` replacements to pre-bundled dependencies (only process.env.NODE_ENV),
@@ -979,9 +985,20 @@ function sygnal(options = {}) {
979
985
  transform(code, id, opts) {
980
986
  // SYG666 (PLAN-5 W-2): an adapter entry imported without its optional peers; every mode
981
987
  const adapters = adapterImports(this, code, id);
982
- if (adapters)
983
- return checkPeers(this, adapters, id).then(() => devTransform.call(this, code, id, opts));
984
- return devTransform.call(this, code, id, opts);
988
+ const result = adapters
989
+ ? checkPeers(this, adapters, id).then(() => devTransform.call(this, code, id, opts))
990
+ : devTransform.call(this, code, id, opts);
991
+ // 11. the words SYG103 may take as conditionally rendered markup (dev server, diagnostics on)
992
+ const tokens = isServe && !isVitest && devOn && !opts?.ssr ? viewTokensTail(this, code, id) : null;
993
+ if (!tokens)
994
+ return result;
995
+ return Promise.all([result, tokens]).then(([r, tail]) => {
996
+ if (!tail)
997
+ return r;
998
+ if (r == null)
999
+ return withSourcemap(code, [], tail, id);
1000
+ return typeof r == 'string' ? r + tail : { ...r, code: r.code + tail };
1001
+ });
985
1002
  },
986
1003
  };
987
1004
  function devTransform(code, id, opts) {
@@ -1064,6 +1081,55 @@ function sygnal(options = {}) {
1064
1081
  return done();
1065
1082
  }
1066
1083
  }
1084
+ // 11. SYG103 (the dev runtime check of an intent selector that never matched) lets a selector
1085
+ // through as conditionally rendered when its words appear in the component's view; the runtime
1086
+ // can read only the view function's own source. A component module (one that sets `X.intent` or
1087
+ // `X.uses`) gets, in dev, a tail registering for each such component the words of its string
1088
+ // literals and those of the relative modules it imports, where view helpers live
1089
+ // (globalThis.__SYGNAL_VIEW_TOKENS__, a WeakMap read by checks/dom.ts).
1090
+ const COMPONENT_WITH_SELECTORS_RE = /(?:^|[^\w$.])([A-Z][\w$]*)\.(?:intent|uses)\s*=(?!=)/g;
1091
+ const STRING_RE = /(['"])((?:\\.|(?!\1)[^\\\n])*)\1|`((?:\\[\s\S]|[^\\`])*)`/g;
1092
+ const RELATIVE_IMPORT_RE = /(?:\bfrom|\bimport)\s*\(?\s*(['"])(\.{1,2}\/[^'"]+)\1/g;
1093
+ // A string that is itself a selector ('.save', '#id', 'form.ask', '[data-x]') or a path / URL: its
1094
+ // words aren't markup (the intent's own DOM.click('.svae') would otherwise vouch for its typo)
1095
+ const NOT_MARKUP_RE = /(?:^|[\s>+~,(])[\w-]*[.#[][\w-]|^\s*(?:\/|[\w+-]+:\/\/)/;
1096
+ /** the class / id / tag-like words in a module's string and template literals (comments skipped) */
1097
+ function stringWords(code, into) {
1098
+ for (const m of blankOut(code, false).matchAll(STRING_RE)) {
1099
+ const text = m[2] ?? m[3] ?? '';
1100
+ if (NOT_MARKUP_RE.test(text))
1101
+ continue;
1102
+ for (const w of text.match(/[A-Za-z_][\w-]*/g) || [])
1103
+ into.add(w);
1104
+ }
1105
+ }
1106
+ function viewTokensTail(ctx, code, id) {
1107
+ const file = cleanId(id);
1108
+ if (!/\.[jt]sx?$/.test(file) || id.includes('node_modules') || id.startsWith('\0'))
1109
+ return null;
1110
+ const names = new Set();
1111
+ for (const m of blankOut(code, true).matchAll(COMPONENT_WITH_SELECTORS_RE))
1112
+ names.add(m[1]);
1113
+ if (!names.size)
1114
+ return null;
1115
+ const words = new Set();
1116
+ stringWords(code, words);
1117
+ const specs = new Set(Array.from(blankOut(code, false).matchAll(RELATIVE_IMPORT_RE), m => m[2]));
1118
+ return Promise.all([...specs].map(async (spec) => {
1119
+ try {
1120
+ const r = await ctx.resolve(spec, id);
1121
+ const dep = r && !r.external && cleanId(r.id);
1122
+ if (!dep || !/\.[cm]?[jt]sx?$/.test(dep) || dep.includes('node_modules'))
1123
+ return;
1124
+ ctx.addWatchFile?.(dep);
1125
+ stringWords(await fs.promises.readFile(dep, 'utf8'), words);
1126
+ }
1127
+ catch (_) { /* unreadable: its words are just not added */ }
1128
+ })).then(() => {
1129
+ const comps = [...names].map(n => `typeof ${n} == 'function' && ${n}`).join(', ');
1130
+ return `\n;(() => { try { const m = globalThis.__SYGNAL_VIEW_TOKENS__ ||= new WeakMap(), t = ${JSON.stringify([...words].join(' '))}; for (const c of [${comps}]) if (c) m.set(c, t) } catch (_) {} })();\n`;
1131
+ });
1132
+ }
1067
1133
  // PLAN-5 W-2 (D209): the adapter entries and the optional peer dependencies each one imports
1068
1134
  // (the Zag packages pinned together: they depend on each other's exact versions)
1069
1135
  const ZAG = '~1.45.0';