sygnal 6.5.0 → 7.0.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.
- package/CHANGELOG.md +156 -0
- package/README.md +2 -0
- package/dist/astro/index.cjs.js +423 -27
- package/dist/astro/index.cjs.js.map +1 -1
- package/dist/astro/index.mjs +423 -27
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/server.cjs.js.map +1 -1
- package/dist/astro/server.mjs.map +1 -1
- package/dist/devtools.cjs.js +141 -3
- package/dist/devtools.cjs.js.map +1 -1
- package/dist/devtools.esm.js +141 -4
- package/dist/devtools.esm.js.map +1 -1
- package/dist/diagnostics.cjs.js +169 -14
- package/dist/diagnostics.cjs.js.map +1 -1
- package/dist/diagnostics.esm.js +168 -15
- package/dist/diagnostics.esm.js.map +1 -1
- package/dist/guide/accessibility.md +2 -0
- package/dist/guide/ai-chat.md +6 -6
- package/dist/guide/behaviors.md +1 -1
- package/dist/guide/element-commands.md +4 -2
- package/dist/guide/forms-reference.md +89 -3
- package/dist/guide/forms.md +8 -8
- package/dist/guide/http.md +77 -7
- package/dist/guide/migrating-to-7.md +314 -0
- package/dist/guide/recipes/ai-summarize.md +2 -1
- package/dist/guide/recipes/i18n.md +1 -1
- package/dist/guide/ui/tabs.md +5 -4
- package/dist/guide/ui/tooltip.md +24 -0
- package/dist/index.cjs.js +781 -320
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +319 -43
- package/dist/index.esm.js +781 -320
- package/dist/index.esm.js.map +1 -1
- package/dist/sygnal.min.js +1 -1
- package/dist/sygnal.min.js.map +1 -1
- package/dist/ui.cjs.js +96 -11
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +96 -12
- package/dist/ui.esm.js.map +1 -1
- package/dist/vike/config/package.json +1 -1
- package/dist/vike/onRenderClient.cjs.js +63 -43
- package/dist/vike/onRenderClient.cjs.js.map +1 -1
- package/dist/vike/onRenderClient.mjs +63 -43
- package/dist/vike/onRenderClient.mjs.map +1 -1
- package/dist/vike/onRenderHtml.cjs.js +21 -25
- package/dist/vike/onRenderHtml.cjs.js.map +1 -1
- package/dist/vike/onRenderHtml.mjs +21 -25
- package/dist/vike/onRenderHtml.mjs.map +1 -1
- package/dist/vite/plugin.cjs.js +410 -27
- package/dist/vite/plugin.cjs.js.map +1 -1
- package/dist/vite/plugin.mjs +410 -27
- package/dist/vite/plugin.mjs.map +1 -1
- package/llms.txt +17 -16
- package/package.json +1 -1
- package/src/astro/index.d.ts +8 -0
- package/src/astro/index.ts +18 -0
- package/src/core/actions.ts +28 -21
- package/src/core/define.ts +2 -0
- package/src/core/hooks.ts +8 -2
- package/src/core/hosts/collection.ts +4 -3
- package/src/core/instance.ts +60 -16
- package/src/core/runtime.ts +5 -1
- package/src/core/view.ts +2 -0
- package/src/cycle/dom/utils.ts +4 -2
- package/src/devtools.d.ts +13 -0
- package/src/devtools.ts +3 -0
- package/src/extra/ai/chat/behavior.ts +3 -3
- package/src/extra/ai/commandBar.ts +3 -3
- package/src/extra/ai/compose/behavior.ts +3 -3
- package/src/extra/ai/transports/shared.ts +8 -2
- package/src/extra/behaviors.ts +21 -0
- package/src/extra/devGraph.ts +111 -0
- package/src/extra/devMcp.ts +1 -1
- package/src/extra/devtools.ts +18 -0
- package/src/extra/diagnostics/checks/fetch.ts +21 -1
- package/src/extra/diagnostics/checks/forms.ts +4 -3
- package/src/extra/diagnostics/checks/index.ts +2 -1
- package/src/extra/diagnostics/checks/inspect.ts +68 -6
- package/src/extra/diagnostics/checks/next.ts +3 -0
- package/src/extra/diagnostics/checks/public.d.ts +133 -12
- package/src/extra/diagnostics/checks/timingAudit.ts +47 -0
- package/src/extra/diagnostics/codes.ts +19 -0
- package/src/extra/fetchDriver.ts +112 -7
- package/src/extra/fetchEventSource.ts +113 -0
- package/src/extra/form.ts +68 -26
- package/src/extra/formHelpers.ts +3 -1
- package/src/extra/lens.ts +3 -2
- package/src/extra/queryCache.ts +4 -3
- package/src/extra/socketDriver.ts +10 -4
- package/src/extra/testing.ts +68 -11
- package/src/index.d.ts +199 -30
- package/src/index.ts +1 -0
- package/src/shared.ts +3 -0
- package/src/ui/dialog.ts +3 -2
- package/src/ui/tooltips.ts +92 -0
- package/src/ui.d.ts +35 -0
- package/src/ui.ts +1 -0
- package/src/vike/onRenderClient.ts +44 -46
- package/src/vike/onRenderHtml.ts +5 -26
- package/src/vike/shell.ts +33 -0
- package/src/vite/graph.ts +255 -0
- package/src/vite/mcp.ts +3 -3
- package/src/vite/plugin.d.ts +19 -0
- package/src/vite/plugin.ts +144 -25
|
@@ -20,6 +20,23 @@ const owned = (v) => {
|
|
|
20
20
|
return v;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
const comps = (val) => (val ? (Array.isArray(val) ? val : [val]) : []).filter((c) => typeof c === 'function');
|
|
24
|
+
function shellOf(config) {
|
|
25
|
+
return [
|
|
26
|
+
...comps(config.Wrapper).reverse().map((comp, i) => ({ comp, key: 'wrapper_' + i })),
|
|
27
|
+
...comps(config.Layout).reverse().map((comp, i) => ({ comp, key: 'layout_' + i })),
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',
|
|
32
|
+
* layout_1 → 'l1', page → 'p'. onRenderClient gives it as the nested vnode's `id` prop, so the
|
|
33
|
+
* Page's uid is 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the
|
|
34
|
+
* same root (renderToString's `uid`), so server and client ids match.
|
|
35
|
+
*/
|
|
36
|
+
function uidPart(key) {
|
|
37
|
+
return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1);
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
/**
|
|
24
41
|
* Vike client-side render hook for Sygnal.
|
|
25
42
|
*
|
|
@@ -35,11 +52,16 @@ const owned = (v) => {
|
|
|
35
52
|
* - Wrappers are outermost (context providers, state management)
|
|
36
53
|
* - Layouts are inside wrappers (visual structure, navigation chrome)
|
|
37
54
|
* - Page is innermost (route-specific content, swapped on navigation)
|
|
55
|
+
* Cumulative Layouts / Wrappers nest the root's outermost (G-803, see shell.ts). Navigating to a
|
|
56
|
+
* page with another shell (pages/admin/+Layout) keeps the shell components both pages share
|
|
57
|
+
* mounted, from the outside in, and adds or removes the rest.
|
|
38
58
|
*/
|
|
39
59
|
// Import from the package entry so rollup externalizes it
|
|
40
60
|
// @ts-ignore — resolved at runtime via package exports
|
|
41
61
|
/** Track the running Sygnal app for disposal on navigation */
|
|
42
62
|
let currentApp = null;
|
|
63
|
+
/** G-803: the running shell, outermost first (read by the wrapper's view); null: an app without one */
|
|
64
|
+
let currentShell = null;
|
|
43
65
|
/**
|
|
44
66
|
* Mutable references read by the wrapper's view function.
|
|
45
67
|
* Updated on navigation to swap the Page without disposing the Layout.
|
|
@@ -50,15 +72,6 @@ let currentPageData = {};
|
|
|
50
72
|
let currentRouteParams = {};
|
|
51
73
|
let currentUrlPathname = '';
|
|
52
74
|
let pageNavCounter = 0;
|
|
53
|
-
/**
|
|
54
|
-
* PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',
|
|
55
|
-
* layout_1 → 'l1', page → 'p'. Given as the nested vnode's `id` prop, so the Page's uid is
|
|
56
|
-
* 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the same root
|
|
57
|
-
* (renderToString's `uid`), so server and client ids match. (Same helper in onRenderHtml.ts.)
|
|
58
|
-
*/
|
|
59
|
-
function uidPart(key) {
|
|
60
|
-
return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1);
|
|
61
|
-
}
|
|
62
75
|
/**
|
|
63
76
|
* PLAN-4.6 R4 (04 §3.11): the core instantiates a component from the vnode's `data.c`, a
|
|
64
77
|
* component function, and reads its statics there (no options object). A shell component or a
|
|
@@ -137,11 +150,11 @@ function pageChildVNode(pageState, stateField = 'page') {
|
|
|
137
150
|
*
|
|
138
151
|
* Nesting order: Wrapper(s) > Layout(s) > Page
|
|
139
152
|
*
|
|
140
|
-
* The wrapper's view reads `currentPage` from the mutable closure, so
|
|
141
|
-
* on client-side navigation only the Page sub-component
|
|
142
|
-
* the Layout and Wrapper stay mounted with their state preserved.
|
|
153
|
+
* The wrapper's view reads `currentPage` and `currentShell` from the mutable closure, so
|
|
154
|
+
* on client-side navigation only the Page sub-component (and the shell components the new page
|
|
155
|
+
* doesn't share) change while the Layout and Wrapper stay mounted with their state preserved.
|
|
143
156
|
*/
|
|
144
|
-
function createLayoutWrapper(
|
|
157
|
+
function createLayoutWrapper(Page) {
|
|
145
158
|
currentPage = Page;
|
|
146
159
|
currentPageName = Page.componentName || Page.name || 'VikePageComponent';
|
|
147
160
|
// Combined shell = wrappers (outermost) + layouts (innermost around Page).
|
|
@@ -151,8 +164,6 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
151
164
|
// one (and the Page) gets a { get, set } lens onto its own ROOT slice: an outer component's
|
|
152
165
|
// reducer replacing its state can't wipe the inner slices (R2-2), and no view sees another
|
|
153
166
|
// component's slice.
|
|
154
|
-
const keys = shellKeys(wrappers, layouts);
|
|
155
|
-
const shell = [...wrappers, ...layouts].map((comp, i) => ({ comp, key: keys[i] }));
|
|
156
167
|
// The latest root state. Only the outermost lens gets the root itself; the nested lenses get
|
|
157
168
|
// their parent shell component's state. In both directions the outermost lens runs first and
|
|
158
169
|
// synchronously (state: root -> outer get -> inner get; a reducer: outer get, inner get, inner
|
|
@@ -173,18 +184,21 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
173
184
|
return outermost ? root : { ...state };
|
|
174
185
|
},
|
|
175
186
|
});
|
|
176
|
-
|
|
187
|
+
// one lens per key and place (outermost or not), the same object on every render
|
|
188
|
+
const lenses = {};
|
|
189
|
+
const lensOf = (key, outermost) => { var _a; return (lenses[_a = key + outermost] || (lenses[_a] = rootLens(key, outermost, true))); };
|
|
177
190
|
const pageLens = rootLens('page', false, false);
|
|
178
191
|
function LayoutWrapperView({ state }) {
|
|
192
|
+
const shell = currentShell || [];
|
|
179
193
|
if (shell.length === 0) {
|
|
180
194
|
// No wrappers or layouts — render Page directly
|
|
181
195
|
return pageChildVNode(state.page);
|
|
182
196
|
}
|
|
183
197
|
const lastIdx = shell.length - 1;
|
|
184
|
-
let inner = componentVNode(shell[lastIdx].comp, shell[lastIdx].key,
|
|
198
|
+
let inner = componentVNode(shell[lastIdx].comp, shell[lastIdx].key, lensOf(shell[lastIdx].key, lastIdx === 0), [pageChildVNode(state.page, pageLens)], state[shell[lastIdx].key]);
|
|
185
199
|
// Wrap with outer shell components
|
|
186
200
|
for (let i = lastIdx - 1; i >= 0; i--) {
|
|
187
|
-
inner = componentVNode(shell[i].comp, shell[i].key,
|
|
201
|
+
inner = componentVNode(shell[i].comp, shell[i].key, lensOf(shell[i].key, i === 0), [inner], state[shell[i].key]);
|
|
188
202
|
}
|
|
189
203
|
// Wrap in a plain div so the view returns a regular DOM vnode.
|
|
190
204
|
// Sub-component vnodes at the root position are not processed correctly
|
|
@@ -207,6 +221,7 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
207
221
|
// The wrapper's initial state: a sibling slice for each shell component and the Page.
|
|
208
222
|
// Must match onRenderHtml's serialized state.
|
|
209
223
|
const initialState = {};
|
|
224
|
+
const shell = currentShell || [];
|
|
210
225
|
shell.forEach(({ comp, key }) => { initialState[key] = { ...(comp.initialState || {}) }; });
|
|
211
226
|
initialState.page = Page.initialState || {};
|
|
212
227
|
// G-275: owned (built from the hydrated state and pageContext.data: never frozen in dev)
|
|
@@ -230,30 +245,19 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
230
245
|
};
|
|
231
246
|
return LayoutWrapperView;
|
|
232
247
|
}
|
|
233
|
-
/** State keys of the shell components, outermost first: wrapper_0, ..., layout_0, ... */
|
|
234
|
-
function shellKeys(wrappers, layouts) {
|
|
235
|
-
return [
|
|
236
|
-
...wrappers.map((_, i) => 'wrapper_' + i),
|
|
237
|
-
...layouts.map((_, i) => 'layout_' + i),
|
|
238
|
-
];
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Normalize a cumulative config value into an array of functions.
|
|
242
|
-
*/
|
|
243
|
-
function toComponentArray(val) {
|
|
244
|
-
if (!val)
|
|
245
|
-
return [];
|
|
246
|
-
return (Array.isArray(val) ? val : [val]).filter((c) => typeof c === 'function');
|
|
247
|
-
}
|
|
248
248
|
function onRenderClient(pageContext) {
|
|
249
249
|
const { Page, config } = pageContext;
|
|
250
250
|
const data = pageContext.data || {};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
251
|
+
// The shell, outermost first (G-803: Vike lists cumulative configs closest first); the state
|
|
252
|
+
// slices of its components and the Page's are siblings at the root (D50)
|
|
253
|
+
const parts = shellOf(config);
|
|
254
|
+
const hasShell = parts.length > 0;
|
|
255
|
+
const shell = parts.map(p => p.key);
|
|
256
|
+
// a shell page after a page without one (or the reverse, below): a new app
|
|
257
|
+
if (hasShell && currentApp && !currentShell) {
|
|
258
|
+
currentApp.dispose();
|
|
259
|
+
currentApp = null;
|
|
260
|
+
}
|
|
257
261
|
// PLAN-3 5-5 (H-7): seed the caches of the fetch drivers (makeFetchDriver({ cache: queryCache() })
|
|
258
262
|
// exposes it as driver.cache) before the page renders, so its resources start at 'success'
|
|
259
263
|
if (pageContext.queryCache) {
|
|
@@ -279,8 +283,22 @@ function onRenderClient(pageContext) {
|
|
|
279
283
|
currentPageName = Page.componentName || Page.name || 'VikePageComponent';
|
|
280
284
|
pageNavCounter++;
|
|
281
285
|
const newPageState = { ...(Page.initialState || {}), ...data };
|
|
282
|
-
// replace the page slice, keeping every shell slice (G-106, D50)
|
|
283
|
-
|
|
286
|
+
// replace the page slice, keeping every shell slice (G-106, D50). G-803: a page with another
|
|
287
|
+
// shell keeps the slices of the components it shares at the same place (key) and starts the
|
|
288
|
+
// others from their initialState
|
|
289
|
+
const old = currentShell;
|
|
290
|
+
const same = parts.length === old.length && parts.every((p, i) => p.comp === old[i].comp);
|
|
291
|
+
let swapPage = (state) => ({ ...state, page: newPageState });
|
|
292
|
+
if (!same) {
|
|
293
|
+
currentShell = parts;
|
|
294
|
+
swapPage = (state) => {
|
|
295
|
+
const next = { page: newPageState };
|
|
296
|
+
for (const { comp, key } of parts) {
|
|
297
|
+
next[key] = old.some(o => o.key === key && o.comp === comp) ? state[key] : { ...(comp.initialState || {}) };
|
|
298
|
+
}
|
|
299
|
+
return next;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
284
302
|
// (PLAN-4.6 core: through the runtime API, 04 §3.11)
|
|
285
303
|
const rt = currentApp.__runtime;
|
|
286
304
|
rt?.setState('root', swapPage);
|
|
@@ -298,7 +316,7 @@ function onRenderClient(pageContext) {
|
|
|
298
316
|
if (initialState && initialState[shell[shell.length - 1]] !== undefined) {
|
|
299
317
|
// Hydrated shell state: sibling slices (D50), or the 5.4.0 shape with the Page state
|
|
300
318
|
// under the innermost shell slice (R2-9) — distribute the slices to each component
|
|
301
|
-
const allShellComps =
|
|
319
|
+
const allShellComps = parts.map(p => p.comp);
|
|
302
320
|
let pageState = initialState.page;
|
|
303
321
|
shell.forEach((key, i) => {
|
|
304
322
|
let slice = initialState[key];
|
|
@@ -325,7 +343,8 @@ function onRenderClient(pageContext) {
|
|
|
325
343
|
routeParams: () => currentRouteParams,
|
|
326
344
|
urlPathname: () => currentUrlPathname,
|
|
327
345
|
};
|
|
328
|
-
|
|
346
|
+
currentShell = parts;
|
|
347
|
+
const Component = createLayoutWrapper(Page);
|
|
329
348
|
try {
|
|
330
349
|
// 3-B2: `__vike` marks the shell's components (Page, Layouts, Wrappers: sub-components of
|
|
331
350
|
// the shell root) for the dev entry, whose SYG224 then says persist() isn't supported there
|
|
@@ -349,6 +368,7 @@ function onRenderClient(pageContext) {
|
|
|
349
368
|
currentApp.dispose();
|
|
350
369
|
currentApp = null;
|
|
351
370
|
}
|
|
371
|
+
currentShell = null;
|
|
352
372
|
let initialState;
|
|
353
373
|
// 3-B2: the server's state is here when the page hydrates its HTML
|
|
354
374
|
let serverState = false;
|
|
@@ -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 // 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":";;;;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,IAAI,CAAA;AAC3B,IAAI,eAAe,GAAW,EAAE,CAAA;AAChC,IAAI,eAAe,GAAQ,EAAE,CAAA;AAC7B,IAAI,kBAAkB,GAAQ,EAAE,CAAA;AAChC,IAAI,kBAAkB,GAAW,EAAE,CAAA;AACnC,IAAI,cAAc,GAAW,CAAC,CAAA;AAE9B;;;;;AAKG;AACH,SAAS,OAAO,CAAC,GAAW,EAAA;AAC1B,IAAA,OAAO,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAC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AAO,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/shell.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 * G-803: the shell components of a page (its Wrappers and Layouts), outermost first, with their\n * state keys. Shared by onRenderHtml and onRenderClient so the server and the client nest them\n * the same way.\n *\n * Vike's cumulative configs (`Layout` and `Wrapper` are, see +config.ts) list the values closest\n * to the page first: pages/admin/+Layout before pages/+Layout (vike's resolveVikeConfigInternal:\n * sortAfterInheritanceOrder puts the longer inheritance root first). So the root's come last, and\n * the shell reverses each list: every Wrapper outside every Layout (as vike-react), and within each\n * the root's outermost. Keys count from the outside in (wrapper_0, ..., layout_0, ...), so a root\n * Layout keeps `layout_0` on every page, nested or not.\n */\nexport interface ShellPart { comp: any; key: string }\n\nconst comps = (val: any): any[] =>\n (val ? (Array.isArray(val) ? val : [val]) : []).filter((c: any) => typeof c === 'function')\n\nexport function shellOf(config: { Wrapper?: any; Layout?: any }): ShellPart[] {\n return [\n ...comps(config.Wrapper).reverse().map((comp, i) => ({ comp, key: 'wrapper_' + i })),\n ...comps(config.Layout).reverse().map((comp, i) => ({ comp, key: 'layout_' + i })),\n ]\n}\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'. onRenderClient gives it as the nested vnode's `id` prop, so the\n * Page's uid is 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the\n * same root (renderToString's `uid`), so server and client ids match.\n */\nexport function uidPart(key: string): string {\n return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1)\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 * Cumulative Layouts / Wrappers nest the root's outermost (G-803, see shell.ts). Navigating to a\n * page with another shell (pages/admin/+Layout) keeps the shell components both pages share\n * mounted, from the outside in, and adds or removes the rest.\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'\nimport { shellOf, uidPart, type ShellPart } from './shell'\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/** G-803: the running shell, outermost first (read by the wrapper's view); null: an app without one */\nlet currentShell: ShellPart[] | 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.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` and `currentShell` from the mutable closure, so\n * on client-side navigation only the Page sub-component (and the shell components the new page\n * doesn't share) change while the Layout and Wrapper stay mounted with their state preserved.\n */\nfunction createLayoutWrapper(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 // 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 // one lens per key and place (outermost or not), the same object on every render\n const lenses: Record<string, any> = {}\n const lensOf = (key: string, outermost: boolean) => (lenses[key + outermost] ||= rootLens(key, outermost, true))\n const pageLens = rootLens('page', false, false)\n\n function LayoutWrapperView({ state }: any) {\n const shell = currentShell || []\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 lensOf(shell[lastIdx].key, lastIdx === 0),\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, lensOf(shell[i].key, i === 0), [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 const shell = currentShell || []\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\nexport function onRenderClient(pageContext: PageContext) {\n const { Page, config } = pageContext\n const data = pageContext.data || {}\n\n // The shell, outermost first (G-803: Vike lists cumulative configs closest first); the state\n // slices of its components and the Page's are siblings at the root (D50)\n const parts = shellOf(config)\n const hasShell = parts.length > 0\n const shell = parts.map(p => p.key)\n\n // a shell page after a page without one (or the reverse, below): a new app\n if (hasShell && currentApp && !currentShell) { currentApp.dispose(); currentApp = null }\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). G-803: a page with another\n // shell keeps the slices of the components it shares at the same place (key) and starts the\n // others from their initialState\n const old = currentShell!\n const same = parts.length === old.length && parts.every((p, i) => p.comp === old[i].comp)\n let swapPage = (state: any) => ({ ...state, page: newPageState })\n if (!same) {\n currentShell = parts\n swapPage = (state: any) => {\n const next: any = { page: newPageState }\n for (const { comp, key } of parts) {\n next[key] = old.some(o => o.key === key && o.comp === comp) ? state[key] : { ...(comp.initialState || {}) }\n }\n return next\n }\n }\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 = parts.map(p => p.comp)\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 currentShell = parts\n const Component = createLayoutWrapper(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 currentShell = null\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,CAAA;AACV,CAAC;;ACCD,MAAM,KAAK,GAAG,CAAC,GAAQ,KACrB,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,CAAM,KAAK,OAAO,CAAC,KAAK,UAAU,CAAC,CAAA;AAEvF,SAAU,OAAO,CAAC,MAAuC,EAAA;IAC7D,OAAO;AACL,QAAA,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,CAAC,EAAE,CAAC,CAAC;AACpF,QAAA,GAAG,KAA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,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;;;;"}
|
|
@@ -18,6 +18,23 @@ const owned = (v) => {
|
|
|
18
18
|
return v;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
const comps = (val) => (val ? (Array.isArray(val) ? val : [val]) : []).filter((c) => typeof c === 'function');
|
|
22
|
+
function shellOf(config) {
|
|
23
|
+
return [
|
|
24
|
+
...comps(config.Wrapper).reverse().map((comp, i) => ({ comp, key: 'wrapper_' + i })),
|
|
25
|
+
...comps(config.Layout).reverse().map((comp, i) => ({ comp, key: 'layout_' + i })),
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',
|
|
30
|
+
* layout_1 → 'l1', page → 'p'. onRenderClient gives it as the nested vnode's `id` prop, so the
|
|
31
|
+
* Page's uid is 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the
|
|
32
|
+
* same root (renderToString's `uid`), so server and client ids match.
|
|
33
|
+
*/
|
|
34
|
+
function uidPart(key) {
|
|
35
|
+
return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1);
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
/**
|
|
22
39
|
* Vike client-side render hook for Sygnal.
|
|
23
40
|
*
|
|
@@ -33,11 +50,16 @@ const owned = (v) => {
|
|
|
33
50
|
* - Wrappers are outermost (context providers, state management)
|
|
34
51
|
* - Layouts are inside wrappers (visual structure, navigation chrome)
|
|
35
52
|
* - Page is innermost (route-specific content, swapped on navigation)
|
|
53
|
+
* Cumulative Layouts / Wrappers nest the root's outermost (G-803, see shell.ts). Navigating to a
|
|
54
|
+
* page with another shell (pages/admin/+Layout) keeps the shell components both pages share
|
|
55
|
+
* mounted, from the outside in, and adds or removes the rest.
|
|
36
56
|
*/
|
|
37
57
|
// Import from the package entry so rollup externalizes it
|
|
38
58
|
// @ts-ignore — resolved at runtime via package exports
|
|
39
59
|
/** Track the running Sygnal app for disposal on navigation */
|
|
40
60
|
let currentApp = null;
|
|
61
|
+
/** G-803: the running shell, outermost first (read by the wrapper's view); null: an app without one */
|
|
62
|
+
let currentShell = null;
|
|
41
63
|
/**
|
|
42
64
|
* Mutable references read by the wrapper's view function.
|
|
43
65
|
* Updated on navigation to swap the Page without disposing the Layout.
|
|
@@ -48,15 +70,6 @@ let currentPageData = {};
|
|
|
48
70
|
let currentRouteParams = {};
|
|
49
71
|
let currentUrlPathname = '';
|
|
50
72
|
let pageNavCounter = 0;
|
|
51
|
-
/**
|
|
52
|
-
* PLAN-4 G-207: the uid() path part of a shell component or the Page: wrapper_0 → 'w0',
|
|
53
|
-
* layout_1 → 'l1', page → 'p'. Given as the nested vnode's `id` prop, so the Page's uid is
|
|
54
|
-
* 'u-w0-l0-p' however the shell nests it; onRenderHtml renders each one with the same root
|
|
55
|
-
* (renderToString's `uid`), so server and client ids match. (Same helper in onRenderHtml.ts.)
|
|
56
|
-
*/
|
|
57
|
-
function uidPart(key) {
|
|
58
|
-
return key == 'page' ? 'p' : key[0] + key.slice(key.indexOf('_') + 1);
|
|
59
|
-
}
|
|
60
73
|
/**
|
|
61
74
|
* PLAN-4.6 R4 (04 §3.11): the core instantiates a component from the vnode's `data.c`, a
|
|
62
75
|
* component function, and reads its statics there (no options object). A shell component or a
|
|
@@ -135,11 +148,11 @@ function pageChildVNode(pageState, stateField = 'page') {
|
|
|
135
148
|
*
|
|
136
149
|
* Nesting order: Wrapper(s) > Layout(s) > Page
|
|
137
150
|
*
|
|
138
|
-
* The wrapper's view reads `currentPage` from the mutable closure, so
|
|
139
|
-
* on client-side navigation only the Page sub-component
|
|
140
|
-
* the Layout and Wrapper stay mounted with their state preserved.
|
|
151
|
+
* The wrapper's view reads `currentPage` and `currentShell` from the mutable closure, so
|
|
152
|
+
* on client-side navigation only the Page sub-component (and the shell components the new page
|
|
153
|
+
* doesn't share) change while the Layout and Wrapper stay mounted with their state preserved.
|
|
141
154
|
*/
|
|
142
|
-
function createLayoutWrapper(
|
|
155
|
+
function createLayoutWrapper(Page) {
|
|
143
156
|
currentPage = Page;
|
|
144
157
|
currentPageName = Page.componentName || Page.name || 'VikePageComponent';
|
|
145
158
|
// Combined shell = wrappers (outermost) + layouts (innermost around Page).
|
|
@@ -149,8 +162,6 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
149
162
|
// one (and the Page) gets a { get, set } lens onto its own ROOT slice: an outer component's
|
|
150
163
|
// reducer replacing its state can't wipe the inner slices (R2-2), and no view sees another
|
|
151
164
|
// component's slice.
|
|
152
|
-
const keys = shellKeys(wrappers, layouts);
|
|
153
|
-
const shell = [...wrappers, ...layouts].map((comp, i) => ({ comp, key: keys[i] }));
|
|
154
165
|
// The latest root state. Only the outermost lens gets the root itself; the nested lenses get
|
|
155
166
|
// their parent shell component's state. In both directions the outermost lens runs first and
|
|
156
167
|
// synchronously (state: root -> outer get -> inner get; a reducer: outer get, inner get, inner
|
|
@@ -171,18 +182,21 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
171
182
|
return outermost ? root : { ...state };
|
|
172
183
|
},
|
|
173
184
|
});
|
|
174
|
-
|
|
185
|
+
// one lens per key and place (outermost or not), the same object on every render
|
|
186
|
+
const lenses = {};
|
|
187
|
+
const lensOf = (key, outermost) => { var _a; return (lenses[_a = key + outermost] || (lenses[_a] = rootLens(key, outermost, true))); };
|
|
175
188
|
const pageLens = rootLens('page', false, false);
|
|
176
189
|
function LayoutWrapperView({ state }) {
|
|
190
|
+
const shell = currentShell || [];
|
|
177
191
|
if (shell.length === 0) {
|
|
178
192
|
// No wrappers or layouts — render Page directly
|
|
179
193
|
return pageChildVNode(state.page);
|
|
180
194
|
}
|
|
181
195
|
const lastIdx = shell.length - 1;
|
|
182
|
-
let inner = componentVNode(shell[lastIdx].comp, shell[lastIdx].key,
|
|
196
|
+
let inner = componentVNode(shell[lastIdx].comp, shell[lastIdx].key, lensOf(shell[lastIdx].key, lastIdx === 0), [pageChildVNode(state.page, pageLens)], state[shell[lastIdx].key]);
|
|
183
197
|
// Wrap with outer shell components
|
|
184
198
|
for (let i = lastIdx - 1; i >= 0; i--) {
|
|
185
|
-
inner = componentVNode(shell[i].comp, shell[i].key,
|
|
199
|
+
inner = componentVNode(shell[i].comp, shell[i].key, lensOf(shell[i].key, i === 0), [inner], state[shell[i].key]);
|
|
186
200
|
}
|
|
187
201
|
// Wrap in a plain div so the view returns a regular DOM vnode.
|
|
188
202
|
// Sub-component vnodes at the root position are not processed correctly
|
|
@@ -205,6 +219,7 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
205
219
|
// The wrapper's initial state: a sibling slice for each shell component and the Page.
|
|
206
220
|
// Must match onRenderHtml's serialized state.
|
|
207
221
|
const initialState = {};
|
|
222
|
+
const shell = currentShell || [];
|
|
208
223
|
shell.forEach(({ comp, key }) => { initialState[key] = { ...(comp.initialState || {}) }; });
|
|
209
224
|
initialState.page = Page.initialState || {};
|
|
210
225
|
// G-275: owned (built from the hydrated state and pageContext.data: never frozen in dev)
|
|
@@ -228,30 +243,19 @@ function createLayoutWrapper(wrappers, layouts, Page) {
|
|
|
228
243
|
};
|
|
229
244
|
return LayoutWrapperView;
|
|
230
245
|
}
|
|
231
|
-
/** State keys of the shell components, outermost first: wrapper_0, ..., layout_0, ... */
|
|
232
|
-
function shellKeys(wrappers, layouts) {
|
|
233
|
-
return [
|
|
234
|
-
...wrappers.map((_, i) => 'wrapper_' + i),
|
|
235
|
-
...layouts.map((_, i) => 'layout_' + i),
|
|
236
|
-
];
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Normalize a cumulative config value into an array of functions.
|
|
240
|
-
*/
|
|
241
|
-
function toComponentArray(val) {
|
|
242
|
-
if (!val)
|
|
243
|
-
return [];
|
|
244
|
-
return (Array.isArray(val) ? val : [val]).filter((c) => typeof c === 'function');
|
|
245
|
-
}
|
|
246
246
|
function onRenderClient(pageContext) {
|
|
247
247
|
const { Page, config } = pageContext;
|
|
248
248
|
const data = pageContext.data || {};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
249
|
+
// The shell, outermost first (G-803: Vike lists cumulative configs closest first); the state
|
|
250
|
+
// slices of its components and the Page's are siblings at the root (D50)
|
|
251
|
+
const parts = shellOf(config);
|
|
252
|
+
const hasShell = parts.length > 0;
|
|
253
|
+
const shell = parts.map(p => p.key);
|
|
254
|
+
// a shell page after a page without one (or the reverse, below): a new app
|
|
255
|
+
if (hasShell && currentApp && !currentShell) {
|
|
256
|
+
currentApp.dispose();
|
|
257
|
+
currentApp = null;
|
|
258
|
+
}
|
|
255
259
|
// PLAN-3 5-5 (H-7): seed the caches of the fetch drivers (makeFetchDriver({ cache: queryCache() })
|
|
256
260
|
// exposes it as driver.cache) before the page renders, so its resources start at 'success'
|
|
257
261
|
if (pageContext.queryCache) {
|
|
@@ -277,8 +281,22 @@ function onRenderClient(pageContext) {
|
|
|
277
281
|
currentPageName = Page.componentName || Page.name || 'VikePageComponent';
|
|
278
282
|
pageNavCounter++;
|
|
279
283
|
const newPageState = { ...(Page.initialState || {}), ...data };
|
|
280
|
-
// replace the page slice, keeping every shell slice (G-106, D50)
|
|
281
|
-
|
|
284
|
+
// replace the page slice, keeping every shell slice (G-106, D50). G-803: a page with another
|
|
285
|
+
// shell keeps the slices of the components it shares at the same place (key) and starts the
|
|
286
|
+
// others from their initialState
|
|
287
|
+
const old = currentShell;
|
|
288
|
+
const same = parts.length === old.length && parts.every((p, i) => p.comp === old[i].comp);
|
|
289
|
+
let swapPage = (state) => ({ ...state, page: newPageState });
|
|
290
|
+
if (!same) {
|
|
291
|
+
currentShell = parts;
|
|
292
|
+
swapPage = (state) => {
|
|
293
|
+
const next = { page: newPageState };
|
|
294
|
+
for (const { comp, key } of parts) {
|
|
295
|
+
next[key] = old.some(o => o.key === key && o.comp === comp) ? state[key] : { ...(comp.initialState || {}) };
|
|
296
|
+
}
|
|
297
|
+
return next;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
282
300
|
// (PLAN-4.6 core: through the runtime API, 04 §3.11)
|
|
283
301
|
const rt = currentApp.__runtime;
|
|
284
302
|
rt?.setState('root', swapPage);
|
|
@@ -296,7 +314,7 @@ function onRenderClient(pageContext) {
|
|
|
296
314
|
if (initialState && initialState[shell[shell.length - 1]] !== undefined) {
|
|
297
315
|
// Hydrated shell state: sibling slices (D50), or the 5.4.0 shape with the Page state
|
|
298
316
|
// under the innermost shell slice (R2-9) — distribute the slices to each component
|
|
299
|
-
const allShellComps =
|
|
317
|
+
const allShellComps = parts.map(p => p.comp);
|
|
300
318
|
let pageState = initialState.page;
|
|
301
319
|
shell.forEach((key, i) => {
|
|
302
320
|
let slice = initialState[key];
|
|
@@ -323,7 +341,8 @@ function onRenderClient(pageContext) {
|
|
|
323
341
|
routeParams: () => currentRouteParams,
|
|
324
342
|
urlPathname: () => currentUrlPathname,
|
|
325
343
|
};
|
|
326
|
-
|
|
344
|
+
currentShell = parts;
|
|
345
|
+
const Component = createLayoutWrapper(Page);
|
|
327
346
|
try {
|
|
328
347
|
// 3-B2: `__vike` marks the shell's components (Page, Layouts, Wrappers: sub-components of
|
|
329
348
|
// the shell root) for the dev entry, whose SYG224 then says persist() isn't supported there
|
|
@@ -347,6 +366,7 @@ function onRenderClient(pageContext) {
|
|
|
347
366
|
currentApp.dispose();
|
|
348
367
|
currentApp = null;
|
|
349
368
|
}
|
|
369
|
+
currentShell = null;
|
|
350
370
|
let initialState;
|
|
351
371
|
// 3-B2: the server's state is here when the page hydrates its HTML
|
|
352
372
|
let serverState = false;
|