@absolutejs/absolute 0.20.0-beta.54 → 0.20.0-beta.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +25 -4
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +25 -4
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +56 -9
- package/dist/build.js.map +10 -9
- package/dist/cli/config/server.js +4 -1
- package/dist/client/index.js +126 -7
- package/dist/client/index.js.map +8 -6
- package/dist/index.js +279 -232
- package/dist/index.js.map +12 -11
- package/dist/islands/index.js +17 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +19 -3
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +17 -2
- package/dist/react/server.js.map +5 -4
- package/dist/src/client/browserTranslation.d.ts +19 -0
- package/dist/src/client/index.d.ts +1 -0
- package/dist/src/core/browserTranslation.d.ts +6 -0
- package/dist/src/ember/browser.d.ts +0 -16
- package/dist/src/vue/browser.d.ts +1 -0
- package/dist/src/vue/browserTranslation.d.ts +5 -0
- package/dist/src/vue/index.d.ts +1 -0
- package/dist/svelte/index.js +19 -3
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +17 -2
- package/dist/svelte/server.js.map +5 -4
- package/dist/vue/browser.js +96 -1
- package/dist/vue/browser.js.map +5 -3
- package/dist/vue/index.js +114 -3
- package/dist/vue/index.js.map +8 -5
- package/dist/vue/server.js +17 -2
- package/dist/vue/server.js.map +5 -4
- package/package.json +7 -7
package/dist/vue/browser.js
CHANGED
|
@@ -126,6 +126,82 @@ var init_islandMarkupAttributes = __esm(() => {
|
|
|
126
126
|
init_islands();
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
+
// src/client/browserTranslation.ts
|
|
130
|
+
var translationRestorer = (restore, hasTranslation) => Object.assign(restore, { hasTranslation }), emptyTranslationRestorer = () => translationRestorer(() => {
|
|
131
|
+
return;
|
|
132
|
+
}, false), textNodeAt = (parent, index) => {
|
|
133
|
+
const node = parent.childNodes[index];
|
|
134
|
+
return node instanceof Text ? node : undefined;
|
|
135
|
+
}, visitElements = (root, visit) => {
|
|
136
|
+
visit(root);
|
|
137
|
+
for (const element of root.querySelectorAll("*"))
|
|
138
|
+
visit(element);
|
|
139
|
+
}, elementPath = (root, element) => {
|
|
140
|
+
const path = [];
|
|
141
|
+
let current = element;
|
|
142
|
+
while (current !== root) {
|
|
143
|
+
const parent = current.parentElement;
|
|
144
|
+
if (parent === null)
|
|
145
|
+
return null;
|
|
146
|
+
path.unshift([...parent.children].indexOf(current));
|
|
147
|
+
current = parent;
|
|
148
|
+
}
|
|
149
|
+
return path;
|
|
150
|
+
}, elementAtPath = (root, path) => {
|
|
151
|
+
let current = root;
|
|
152
|
+
for (const index of path) {
|
|
153
|
+
const child = current.children[index];
|
|
154
|
+
if (!(child instanceof Element))
|
|
155
|
+
return null;
|
|
156
|
+
current = child;
|
|
157
|
+
}
|
|
158
|
+
return current;
|
|
159
|
+
}, captureSsrTextBaselines = (root) => {
|
|
160
|
+
if (root === null || typeof window === "undefined")
|
|
161
|
+
return;
|
|
162
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap;
|
|
163
|
+
visitElements(root, (element) => {
|
|
164
|
+
const text = new Map;
|
|
165
|
+
for (const [index, node] of [...element.childNodes].entries()) {
|
|
166
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
167
|
+
text.set(index, node.nodeValue ?? "");
|
|
168
|
+
}
|
|
169
|
+
if (text.size > 0)
|
|
170
|
+
baselines.set(element, text);
|
|
171
|
+
});
|
|
172
|
+
window.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;
|
|
173
|
+
}, prepareBrowserTranslationHydration = (root) => {
|
|
174
|
+
if (root === null || typeof window === "undefined")
|
|
175
|
+
return emptyTranslationRestorer();
|
|
176
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;
|
|
177
|
+
if (baselines === undefined)
|
|
178
|
+
return emptyTranslationRestorer();
|
|
179
|
+
const translated = [];
|
|
180
|
+
visitElements(root, (element) => {
|
|
181
|
+
const text = baselines.get(element);
|
|
182
|
+
const path = elementPath(root, element);
|
|
183
|
+
if (text === undefined || path === null)
|
|
184
|
+
return;
|
|
185
|
+
for (const [index, baseline] of text) {
|
|
186
|
+
const node = textNodeAt(element, index);
|
|
187
|
+
if (node === undefined || node.data === baseline)
|
|
188
|
+
continue;
|
|
189
|
+
translated.push({ baseline, index, path, translated: node.data });
|
|
190
|
+
node.data = baseline;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return translationRestorer(() => {
|
|
194
|
+
for (const snapshot of translated) {
|
|
195
|
+
const parent = elementAtPath(root, snapshot.path);
|
|
196
|
+
if (parent === null)
|
|
197
|
+
continue;
|
|
198
|
+
const node = textNodeAt(parent, snapshot.index);
|
|
199
|
+
if (node !== undefined && node.data === snapshot.baseline)
|
|
200
|
+
node.data = snapshot.translated;
|
|
201
|
+
}
|
|
202
|
+
}, translated.length > 0);
|
|
203
|
+
};
|
|
204
|
+
|
|
129
205
|
// src/vue/Island.browser.ts
|
|
130
206
|
import { defineComponent, h } from "vue";
|
|
131
207
|
|
|
@@ -463,6 +539,22 @@ var useIslandStore = (store, selector) => {
|
|
|
463
539
|
});
|
|
464
540
|
return state;
|
|
465
541
|
};
|
|
542
|
+
// src/vue/browserTranslation.ts
|
|
543
|
+
var preserveBrowserTranslation = (strategy) => {
|
|
544
|
+
const translatedStrategy = (hydrate, forEachElement) => strategy(() => {
|
|
545
|
+
const restore = [];
|
|
546
|
+
forEachElement((element) => {
|
|
547
|
+
restore.push(prepareBrowserTranslationHydration(element));
|
|
548
|
+
});
|
|
549
|
+
try {
|
|
550
|
+
hydrate();
|
|
551
|
+
} finally {
|
|
552
|
+
for (const apply of restore)
|
|
553
|
+
apply();
|
|
554
|
+
}
|
|
555
|
+
}, forEachElement);
|
|
556
|
+
return translatedStrategy;
|
|
557
|
+
};
|
|
466
558
|
// src/vue/defineVuePage.ts
|
|
467
559
|
var defineRoutes = (routes) => routes;
|
|
468
560
|
var defineVueSetupApp = (hook) => hook;
|
|
@@ -486,11 +578,14 @@ var applyVueRouterRedirect = (router, requestedUrl, setRedirect, status = DEFAUL
|
|
|
486
578
|
export {
|
|
487
579
|
Island,
|
|
488
580
|
applyVueRouterRedirect,
|
|
581
|
+
captureSsrTextBaselines,
|
|
489
582
|
createTypedIsland,
|
|
490
583
|
defineRoutes,
|
|
491
584
|
defineVueSetupApp,
|
|
585
|
+
prepareBrowserTranslationHydration,
|
|
586
|
+
preserveBrowserTranslation,
|
|
492
587
|
useIslandStore
|
|
493
588
|
};
|
|
494
589
|
|
|
495
|
-
//# debugId=
|
|
590
|
+
//# debugId=9EB4175AFA85AC1964756E2164756E21
|
|
496
591
|
//# sourceMappingURL=browser.js.map
|
package/dist/vue/browser.js.map
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/core/islandManifest.ts", "../src/core/islands.ts", "../src/core/islandMarkupAttributes.ts", "../src/vue/Island.browser.ts", "../src/client/preserveIslandMarkup.ts", "../src/core/normalizeIslandProps.ts", "../src/vue/createIsland.browser.ts", "../src/vue/useIslandStore.ts", "../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts", "../src/vue/defineVuePage.ts", "../src/vue/routerRedirectProviders.ts"],
|
|
3
|
+
"sources": ["../src/core/islandManifest.ts", "../src/core/islands.ts", "../src/core/islandMarkupAttributes.ts", "../src/client/browserTranslation.ts", "../src/vue/Island.browser.ts", "../src/client/preserveIslandMarkup.ts", "../src/core/normalizeIslandProps.ts", "../src/vue/createIsland.browser.ts", "../src/vue/useIslandStore.ts", "../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts", "../src/vue/browserTranslation.ts", "../src/vue/defineVuePage.ts", "../src/vue/routerRedirectProviders.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { IslandFramework } from '../../types/island';\n\nconst toIslandFrameworkSegment = (framework: IslandFramework) =>\n\tframework[0]?.toUpperCase() + framework.slice(1);\n\nconst collectFrameworkIslands = (\n\tmanifest: Record<string, string>,\n\tprefix: string\n) => {\n\tconst entries: Record<string, string> = {};\n\tlet found = false;\n\n\tfor (const [key, value] of Object.entries(manifest)) {\n\t\tif (!key.startsWith(prefix)) continue;\n\n\t\tconst component = key.slice(prefix.length);\n\t\tif (!component) continue;\n\n\t\tentries[component] = value;\n\t\tfound = true;\n\t}\n\n\treturn found ? entries : undefined;\n};\n\nexport const getIslandManifestEntries = (manifest: Record<string, string>) => {\n\tconst islands: Partial<Record<IslandFramework, Record<string, string>>> =\n\t\t{};\n\tconst frameworks: IslandFramework[] = ['react', 'svelte', 'vue', 'angular'];\n\n\tfor (const framework of frameworks) {\n\t\tconst prefix = `Island${toIslandFrameworkSegment(framework)}`;\n\t\tconst entries = collectFrameworkIslands(manifest, prefix);\n\t\tif (entries) islands[framework] = entries;\n\t}\n\n\treturn islands;\n};\nexport const getIslandManifestKey = (\n\tframework: IslandFramework,\n\tcomponent: string\n) => `Island${toIslandFrameworkSegment(framework)}${component}`;\n",
|
|
6
6
|
"import type {\n\tIslandComponentDefinition,\n\tIslandRegistry,\n\tIslandRegistryInput\n} from '../../types/island';\n\nexport const defineIslandComponent = <Component>(\n\tcomponent: Component,\n\toptions: {\n\t\texport?: string;\n\t\tsource: string;\n\t}\n): IslandComponentDefinition<Component> => ({\n\tcomponent,\n\texport: options.export,\n\tsource: options.source\n});\nexport const defineIslandRegistry = <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T>\n) => registry;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nexport const getIslandBuildReference = <Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) => {\n\tif (!isIslandComponentDefinition(component)) return null;\n\n\treturn {\n\t\texport: component.export,\n\t\tsource: component.source\n\t};\n};\nexport const isIslandComponentDefinition = <Component>(\n\tvalue: Component | IslandComponentDefinition<Component>\n): value is IslandComponentDefinition<Component> =>\n\tisRecord(value) &&\n\t'component' in value &&\n\t'source' in value &&\n\ttypeof value.source === 'string';\n\nexport function getIslandComponent<Component>(component: Component): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: IslandComponentDefinition<Component>\n): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) {\n\tif (isIslandComponentDefinition(component)) {\n\t\treturn component.component;\n\t}\n\n\treturn component;\n}\nexport const parseIslandProps = (rawProps: string | null) => {\n\tif (!rawProps) return {};\n\n\treturn JSON.parse(rawProps);\n};\nexport const serializeIslandProps = (props: unknown) =>\n\tJSON.stringify(props ?? {});\n\nexport {\n\tgetIslandManifestEntries,\n\tgetIslandManifestKey\n} from './islandManifest';\n",
|
|
7
7
|
"import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { serializeIslandProps } from './islands';\n\ntype IslandMarkerAttributes = {\n\t'data-component': string;\n\t'data-framework': string;\n\t'data-hydrate': string;\n\t'data-island': 'true';\n\t'data-island-id'?: string;\n\t'data-props': string;\n};\n\nexport const getIslandMarkerAttributes = (\n\tprops: RuntimeIslandRenderProps,\n\tislandId?: string\n): IslandMarkerAttributes => ({\n\t'data-component': props.component,\n\t'data-framework': props.framework,\n\t'data-hydrate': props.hydrate ?? 'load',\n\t'data-island': 'true',\n\t...(islandId ? { 'data-island-id': islandId } : {}),\n\t'data-props': serializeIslandProps(props.props)\n});\n\nconst escapeHtmlAttribute = (value: string) =>\n\tvalue\n\t\t.replaceAll('&', '&')\n\t\t.replaceAll('\"', '"')\n\t\t.replaceAll('<', '<')\n\t\t.replaceAll('>', '>');\n\nexport const serializeIslandAttributes = (attributes: Record<string, string>) =>\n\tObject.entries(attributes)\n\t\t.map(([key, value]) => `${key}=\"${escapeHtmlAttribute(value)}\"`)\n\t\t.join(' ');\n",
|
|
8
|
+
"type TextBaseline = ReadonlyMap<number, string>;\ntype SsrTextBaselines = WeakMap<Element, TextBaseline>;\n\ndeclare global {\n\t// Window augmentation requires interface declaration merging.\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n\tinterface Window {\n\t\t__ABSOLUTE_SSR_TEXT_BASELINES__?: SsrTextBaselines;\n\t}\n}\n\ntype TranslatedText = {\n\tbaseline: string;\n\tindex: number;\n\tpath: number[];\n\ttranslated: string;\n};\n\nconst translationRestorer = (restore: () => void, hasTranslation: boolean) =>\n\tObject.assign(restore, { hasTranslation });\n\nconst emptyTranslationRestorer = () =>\n\ttranslationRestorer(() => undefined, false);\n\nconst textNodeAt = (parent: Element, index: number) => {\n\tconst node = parent.childNodes[index];\n\n\treturn node instanceof Text ? node : undefined;\n};\n\nconst visitElements = (root: Element, visit: (element: Element) => void) => {\n\tvisit(root);\n\tfor (const element of root.querySelectorAll('*')) visit(element);\n};\n\nconst elementPath = (root: Element, element: Element) => {\n\tconst path: number[] = [];\n\tlet current = element;\n\twhile (current !== root) {\n\t\tconst parent = current.parentElement;\n\t\tif (parent === null) return null;\n\t\tpath.unshift([...parent.children].indexOf(current));\n\t\tcurrent = parent;\n\t}\n\n\treturn path;\n};\n\nconst elementAtPath = (root: Element, path: number[]) => {\n\tlet current = root;\n\tfor (const index of path) {\n\t\tconst child = current.children[index];\n\t\tif (!(child instanceof Element)) return null;\n\t\tcurrent = child;\n\t}\n\n\treturn current;\n};\n\n/** Capture server-authored text before client modules load. Absolute page\n * handlers install the same snapshot inline; this export supports custom\n * documents and non-standard bootstraps. */\nexport const captureSsrTextBaselines = (root: Element | null) => {\n\tif (root === null || typeof window === 'undefined') return;\n\tconst baselines: SsrTextBaselines =\n\t\twindow.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap();\n\tvisitElements(root, (element) => {\n\t\tconst text = new Map<number, string>();\n\t\tfor (const [index, node] of [...element.childNodes].entries()) {\n\t\t\tif (node.nodeType === Node.TEXT_NODE)\n\t\t\t\ttext.set(index, node.nodeValue ?? '');\n\t\t}\n\t\tif (text.size > 0) baselines.set(element, text);\n\t});\n\twindow.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;\n};\n\n/** Temporarily restore server text while a framework attaches to SSR DOM,\n * then reapply translated text. Paths preserve translations even when a\n * framework replaces nodes while mounting. Genuine server/client mismatches\n * are left unchanged. */\nexport const prepareBrowserTranslationHydration = (root: Element | null) => {\n\tif (root === null || typeof window === 'undefined')\n\t\treturn emptyTranslationRestorer();\n\tconst baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;\n\tif (baselines === undefined) return emptyTranslationRestorer();\n\tconst translated: TranslatedText[] = [];\n\tvisitElements(root, (element) => {\n\t\tconst text = baselines.get(element);\n\t\tconst path = elementPath(root, element);\n\t\tif (text === undefined || path === null) return;\n\t\tfor (const [index, baseline] of text) {\n\t\t\tconst node = textNodeAt(element, index);\n\t\t\tif (node === undefined || node.data === baseline) continue;\n\t\t\ttranslated.push({ baseline, index, path, translated: node.data });\n\t\t\tnode.data = baseline;\n\t\t}\n\t});\n\n\treturn translationRestorer(() => {\n\t\tfor (const snapshot of translated) {\n\t\t\tconst parent = elementAtPath(root, snapshot.path);\n\t\t\tif (parent === null) continue;\n\t\t\tconst node = textNodeAt(parent, snapshot.index);\n\t\t\tif (node !== undefined && node.data === snapshot.baseline)\n\t\t\t\tnode.data = snapshot.translated;\n\t\t}\n\t}, translated.length > 0);\n};\n",
|
|
8
9
|
"import { defineComponent, h } from 'vue';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\nimport { normalizeRuntimeIslandRenderProps } from '../core/normalizeIslandProps';\n\nexport const Island = defineComponent({\n\tname: 'AbsoluteIsland',\n\tprops: {\n\t\tcomponent: {\n\t\t\trequired: true,\n\t\t\ttype: String\n\t\t},\n\t\tframework: {\n\t\t\trequired: true,\n\t\t\ttype: String\n\t\t},\n\t\thydrate: {\n\t\t\trequired: false,\n\t\t\ttype: String\n\t\t},\n\t\t/* Accept either an object or a JSON-serialized string — see\n\t\t the SSR `Island.ts` for the rationale. */\n\t\tprops: {\n\t\t\trequired: false,\n\t\t\ttype: [Object, String]\n\t\t}\n\t},\n\tsetup(rawProps) {\n\t\tconst props = normalizeRuntimeIslandRenderProps(rawProps);\n\n\t\treturn () => {\n\t\t\tconst { attributes, innerHTML } = preserveIslandMarkup(props);\n\n\t\t\treturn h('div', {\n\t\t\t\t...attributes,\n\t\t\t\t'data-allow-mismatch': '',\n\t\t\t\tinnerHTML\n\t\t\t});\n\t\t};\n\t}\n});\n",
|
|
9
10
|
"import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\n\ntype PreservedIslandMarkup = {\n\tattributes: Record<string, string>;\n\tinnerHTML: string;\n};\n\ntype IslandMarkerElement = HTMLElement & {\n\tdataset: DOMStringMap & {\n\t\tcomponent?: string;\n\t\tframework?: string;\n\t\thydrate?: string;\n\t\tisland?: string;\n\t\tislandId?: string;\n\t\tprops?: string;\n\t};\n};\n\nconst getSnapshotMap = () => {\n\tif (typeof window === 'undefined') {\n\t\treturn null;\n\t}\n\n\twindow.__ABS_SERVER_ISLAND_HTML__ ??= new Map<\n\t\tstring,\n\t\tPreservedIslandMarkup[]\n\t>();\n\n\treturn window.__ABS_SERVER_ISLAND_HTML__;\n};\n\nconst getIslandSignature = (props: RuntimeIslandRenderProps) => {\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn [\n\t\tattributes['data-component'],\n\t\tattributes['data-framework'],\n\t\tattributes['data-hydrate'],\n\t\tattributes['data-props']\n\t].join('::');\n};\n\nconst isMatchingIslandElement = (\n\telement: Element,\n\tprops: RuntimeIslandRenderProps\n): element is IslandMarkerElement => {\n\tif (!(element instanceof HTMLElement)) {\n\t\treturn false;\n\t}\n\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn (\n\t\telement.dataset.island === 'true' &&\n\t\telement.dataset.component === attributes['data-component'] &&\n\t\telement.dataset.framework === attributes['data-framework'] &&\n\t\t(element.dataset.hydrate ?? 'load') === attributes['data-hydrate'] &&\n\t\t(element.dataset.props ?? '{}') === attributes['data-props']\n\t);\n};\n\nconst snapshotIslandElement = (\n\telement: HTMLElement,\n\tsnapshotMap: Map<string, PreservedIslandMarkup[]>\n) => {\n\tconst signature = [\n\t\telement.dataset.component,\n\t\telement.dataset.framework,\n\t\telement.dataset.hydrate ?? 'load',\n\t\telement.dataset.props ?? '{}'\n\t].join('::');\n\tconst existing = snapshotMap.get(signature) ?? [];\n\tconst attributes = Object.fromEntries(\n\t\telement\n\t\t\t.getAttributeNames()\n\t\t\t.map((name) => [name, element.getAttribute(name) ?? ''])\n\t);\n\texisting.push({\n\t\tattributes,\n\t\tinnerHTML: element.innerHTML\n\t});\n\tsnapshotMap.set(signature, existing);\n};\n\nexport const initializeIslandMarkupSnapshot = () => {\n\tif (typeof document === 'undefined') {\n\t\treturn;\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tif (!snapshotMap || snapshotMap.size > 0) {\n\t\treturn;\n\t}\n\n\tconst elements = Array.from(\n\t\tdocument.querySelectorAll<HTMLElement>('[data-island=\"true\"]')\n\t);\n\tfor (const element of elements) {\n\t\tsnapshotIslandElement(element, snapshotMap);\n\t}\n};\n\nexport const preserveIslandMarkup = (props: RuntimeIslandRenderProps) => {\n\tif (typeof document === 'undefined') {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tconst signature = getIslandSignature(props);\n\t// Islands that share a signature (same component, framework, hydrate mode\n\t// and serialized props) produce byte-identical SSR markup, so the first\n\t// captured snapshot is correct for every instance. Returning it\n\t// unconditionally keeps this stateless: React may call the component many\n\t// times during a single hydration (StrictMode double-render, hydration\n\t// retries, mismatch regeneration), and a per-call claim counter would run\n\t// past the snapshot list and yield empty markup — making the host render\n\t// `dangerouslySetInnerHTML={{ __html: '' }}` and wipe the island's\n\t// server-rendered DOM before the island runtime can hydrate it.\n\tconst snapshotCandidate = snapshotMap?.get(signature)?.[0];\n\tif (snapshotCandidate) {\n\t\treturn snapshotCandidate;\n\t}\n\n\t// Snapshot not captured yet (the island runtime module hasn't evaluated):\n\t// fall back to reading the live SSR DOM directly.\n\tconst liveCandidate = Array.from(\n\t\tdocument.querySelectorAll('[data-island=\"true\"]')\n\t).find((element) => isMatchingIslandElement(element, props));\n\tif (!liveCandidate) {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\treturn {\n\t\tattributes: Object.fromEntries(\n\t\t\tliveCandidate\n\t\t\t\t.getAttributeNames()\n\t\t\t\t.map((name) => [name, liveCandidate.getAttribute(name) ?? ''])\n\t\t),\n\t\tinnerHTML: liveCandidate.innerHTML\n\t};\n};\n",
|
|
10
11
|
"import type { IslandFramework, IslandHydrate } from '../../types/island';\n\n/* `<Island>` (Vue/Svelte/React/Angular component form) historically took\n `props` as an object, while `<absolute-island>` (custom-element form\n used in HTML/HTMX hosts) takes `props` as a JSON-serialized string.\n The two surfaces have the same mental model — \"render an island\" —\n but a value that's valid in one shape would silently break in the\n other. This helper normalizes whichever shape arrives at runtime. */\nconst EMPTY_PROPS: Record<string, unknown> = {};\n\nconst ISLAND_FRAMEWORKS: readonly IslandFramework[] = [\n\t'react',\n\t'svelte',\n\t'vue',\n\t'angular',\n\t'ember'\n];\n\nconst ISLAND_HYDRATE_MODES: readonly IslandHydrate[] = [\n\t'load',\n\t'idle',\n\t'visible',\n\t'none'\n];\n\nconst isIslandFramework = (value: string): value is IslandFramework =>\n\tISLAND_FRAMEWORKS.some((framework) => framework === value);\n\nconst isIslandHydrate = (value: string): value is IslandHydrate =>\n\tISLAND_HYDRATE_MODES.some((mode) => mode === value);\n\ntype RawIslandProps = {\n\tcomponent: string;\n\tframework: string;\n\thydrate?: string | undefined;\n\tprops: unknown;\n};\n\nexport const normalizeRuntimeIslandRenderProps = (raw: RawIslandProps) => {\n\tconst { component, framework, hydrate, props } = raw;\n\tif (!isIslandFramework(framework)) {\n\t\tthrow new Error(`Unknown island framework: \"${framework}\".`);\n\t}\n\n\tif (hydrate !== undefined && !isIslandHydrate(hydrate)) {\n\t\tthrow new Error(`Unknown island hydrate mode: \"${hydrate}\".`);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tframework,\n\t\thydrate,\n\t\tprops: normalizeIslandProps(props)\n\t};\n};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst safeJsonParseObject = (raw: string) => {\n\tconst trimmed = raw.trim();\n\tif (!trimmed) return EMPTY_PROPS;\n\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(trimmed);\n\n\t\treturn isPlainObject(parsed) ? parsed : EMPTY_PROPS;\n\t} catch {\n\t\treturn EMPTY_PROPS;\n\t}\n};\n\nexport const normalizeIslandProps = (value: unknown) => {\n\tif (typeof value === 'string') return safeJsonParseObject(value);\n\tif (isPlainObject(value)) return value;\n\n\treturn EMPTY_PROPS;\n};\n",
|
|
@@ -13,10 +14,11 @@
|
|
|
13
14
|
"const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n",
|
|
14
15
|
"const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if (!connectionInfo) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst findCallerName = (stack) => {\n var _a, _b;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return (_b = /.+ (.+) .+/.exec(callerLine)) == null ? void 0 : _b[1];\n};\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n api.devtools = {\n cleanup: () => {\n if (connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n removeStoreFromTrackedConnections(options.name, store);\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n connection.subscribe((message) => {\n var _a;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n }\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (state, replace) => {\n savedSetState(state, replace);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (migration instanceof Promise) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n",
|
|
15
16
|
"import { createStore, type StateCreator, type StoreApi } from 'zustand/vanilla';\nimport { combine } from 'zustand/middleware';\n\nexport type IslandStoreState = object;\ntype IslandStoreSnapshot = Record<string, unknown>;\ntype IslandStoreShape<\n\tTState extends IslandStoreState,\n\tTActions extends object\n> = Omit<TState, keyof TActions> & TActions;\nexport type IslandStateSnapshot = Record<string, IslandStoreSnapshot>;\ntype AnyIslandStore = StoreApi<object>;\ntype IslandStoreInstance = {\n\tapplyExternalSnapshot: (snapshot: IslandStoreSnapshot) => void;\n\tstore: AnyIslandStore;\n};\n\nexport const ABSOLUTE_ISLAND_STATE = '__ABS_ISLAND_STATE__';\nexport const ABSOLUTE_ISLAND_STORES = '__ABS_ISLAND_STORES__';\n\ndeclare global {\n\tvar __ABS_ISLAND_STATE__: IslandStateSnapshot | undefined;\n\tvar __ABS_ISLAND_STORES__:\n\t\t| Map<string, Set<IslandStoreInstance>>\n\t\t| undefined;\n}\n\nconst getIslandStoreSnapshot = () => {\n\tglobalThis.__ABS_ISLAND_STATE__ ??= {};\n\n\treturn globalThis.__ABS_ISLAND_STATE__;\n};\n\nconst getIslandStores = () => {\n\tglobalThis.__ABS_ISLAND_STORES__ ??= new Map();\n\n\treturn globalThis.__ABS_ISLAND_STORES__;\n};\n\nconst isSerializableValue = (value: unknown) =>\n\ttypeof value !== 'function' && value !== undefined;\n\nconst toSerializableState = <T extends object>(state: T) =>\n\tObject.fromEntries(\n\t\tObject.entries(state).filter(([, value]) => isSerializableValue(value))\n\t);\n\nconst applySnapshot = <T extends object>(\n\tstore: StoreApi<T>,\n\tsnapshot: IslandStoreSnapshot | undefined\n) => {\n\tif (!snapshot) {\n\t\treturn;\n\t}\n\n\tstore.setState({\n\t\t...store.getState(),\n\t\t...snapshot\n\t});\n};\n\nconst getPeerStores = (\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => [...storeInstances].filter((peer) => peer.store !== ownerStore);\n\nconst syncIslandSnapshot = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tstate: IslandStoreShape<TState, TActions>,\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => {\n\tconst nextSnapshot = toSerializableState(state);\n\tgetIslandStoreSnapshot()[storeId] = nextSnapshot;\n\n\tfor (const peerStore of getPeerStores(storeInstances, ownerStore)) {\n\t\tpeerStore.applyExternalSnapshot(nextSnapshot);\n\t}\n};\n\nexport const createIslandStore = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tinitialState: TState,\n\tcreateState: StateCreator<TState, [], [], TActions>\n) => {\n\tconst store = createStore(combine(initialState, createState));\n\tconst stores = getIslandStores();\n\tconst storeInstances =\n\t\tstores.get(storeId) ?? new Set<IslandStoreInstance>();\n\tconst initialSnapshot = getIslandStoreSnapshot()[storeId];\n\tapplySnapshot(store, initialSnapshot);\n\tlet isApplyingExternalSnapshot = false;\n\n\tconst applyExternalSnapshot = (snapshot: IslandStoreSnapshot) => {\n\t\tisApplyingExternalSnapshot = true;\n\t\tapplySnapshot(store, snapshot);\n\t};\n\n\tstoreInstances.add({\n\t\tapplyExternalSnapshot,\n\t\tstore\n\t});\n\tstores.set(storeId, storeInstances);\n\n\tsyncIslandSnapshot(storeId, store.getState(), storeInstances, store);\n\tstore.subscribe((state) => {\n\t\tif (isApplyingExternalSnapshot) {\n\t\t\tisApplyingExternalSnapshot = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tsyncIslandSnapshot(storeId, state, storeInstances, store);\n\t});\n\n\treturn store;\n};\nexport const getIslandStoreServerSnapshot = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getInitialState());\nconst applySnapshotToStoreInstances = (\n\tstoreId: string,\n\tinstances: Set<IslandStoreInstance>,\n\tsnapshot: IslandStateSnapshot\n) => {\n\tfor (const instance of instances) {\n\t\tinstance.applyExternalSnapshot(snapshot[storeId] ?? {});\n\t}\n};\n\nexport const initializeIslandStores = (state: IslandStateSnapshot) => {\n\tconst currentSnapshot = getIslandStoreSnapshot();\n\tconst nextSnapshot: IslandStateSnapshot = {\n\t\t...state,\n\t\t...currentSnapshot\n\t};\n\n\tglobalThis.__ABS_ISLAND_STATE__ = nextSnapshot;\n\n\tfor (const [storeId, store] of getIslandStores()) {\n\t\tapplySnapshotToStoreInstances(storeId, store, nextSnapshot);\n\t}\n};\nexport const readIslandStore = <TState extends IslandStoreState, TSelected>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getState());\nexport const resetIslandStoreForTesting = () => {\n\tdelete globalThis.__ABS_ISLAND_STATE__;\n\tdelete globalThis.__ABS_ISLAND_STORES__;\n};\nexport const subscribeIslandStore = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected,\n\tlistener: (value: TSelected) => void\n) => {\n\tlet currentSelection = selector(store.getState());\n\n\treturn store.subscribe((state) => {\n\t\tconst nextSelection = selector(state);\n\t\tif (Object.is(nextSelection, currentSelection)) {\n\t\t\treturn;\n\t\t}\n\n\t\tcurrentSelection = nextSelection;\n\t\tlistener(nextSelection);\n\t});\n};\n",
|
|
17
|
+
"import type { HydrationStrategy } from 'vue';\nimport { prepareBrowserTranslationHydration } from '../client/browserTranslation';\n\nexport {\n\tcaptureSsrTextBaselines,\n\tprepareBrowserTranslationHydration\n} from '../client/browserTranslation';\n\n/** Wrap a Vue lazy-hydration strategy so text changed by browser translation\n * after the SSR snapshot neither triggers a mismatch nor gets reset. */\nexport const preserveBrowserTranslation = (strategy: HydrationStrategy) => {\n\tconst translatedStrategy: HydrationStrategy = (hydrate, forEachElement) =>\n\t\tstrategy(() => {\n\t\t\tconst restore: Array<() => void> = [];\n\t\t\tforEachElement((element) => {\n\t\t\t\trestore.push(prepareBrowserTranslationHydration(element));\n\t\t\t});\n\t\t\ttry {\n\t\t\t\thydrate();\n\t\t\t} finally {\n\t\t\t\tfor (const apply of restore) apply();\n\t\t\t}\n\t\t}, forEachElement);\n\n\treturn translatedStrategy;\n};\n",
|
|
16
18
|
"import type { VueRoutes, VueSetupApp } from '../../types/vue';\n\n/** Identity helper that types a Vue page's `setupApp` export without\n * forcing the user to `import type { VueSetupApp }` every time. Use as\n * `export const setupApp = defineVueSetupApp(async (app, ctx) => { ... });` */\nexport const defineRoutes = <T extends VueRoutes>(routes: T) => routes;\nexport const defineVueSetupApp = (hook: VueSetupApp) => hook;\n",
|
|
17
19
|
"/**\n * vue-router redirect bridge for SSR.\n *\n * vue-router doesn't expose Angular-style providers, but it doesn't need\n * them — after `await router.push(url); await router.isReady()`, the\n * router's `currentRoute.value.fullPath` reflects the final destination\n * after every guard, redirect rule, and `next('/foo')` call has run.\n *\n * If that final path differs from the URL the server received, a redirect\n * happened. The Vue page handler exposes a `setRedirect` callback in the\n * `setupApp` context so the user's setup hook can short-circuit the\n * render and emit a 302 instead of producing HTML for a route the user\n * never asked for.\n *\n * Usage:\n *\n * import { applyVueRouterRedirect } from '@absolutejs/absolute/vue';\n *\n * export const setupApp = async (app, { url, isServer, setRedirect }) => {\n * const router = createRouter({ ... });\n * app.use(router);\n * if (isServer) await router.push(url);\n * await router.isReady();\n * if (isServer) applyVueRouterRedirect(router, url, setRedirect);\n * };\n */\n\n// Structural shape of the only fields we read from a vue-router instance.\n// Avoids depending on `vue-router` types — the user installs vue-router\n// themselves; the absolutejs package shouldn't pull it into every consumer's\n// type-check just for one helper.\ntype VueRouterLike = {\n\tcurrentRoute: { value: { fullPath: string } };\n};\n\nconst DEFAULT_REDIRECT_STATUS = 302;\n\nconst normalisePathname = (raw: string) => {\n\ttry {\n\t\tconst parsed = new URL(raw, 'http://placeholder.local/');\n\n\t\treturn `${parsed.pathname}${parsed.search}`;\n\t} catch {\n\t\treturn raw;\n\t}\n};\n\n/**\n * Compare the requested URL against vue-router's current resolved path\n * after `router.push(url); await router.isReady()`. If different — a\n * guard redirected, a redirect rule fired, or the user manually\n * navigated inside `setupApp` — invoke `setRedirect` so the Vue page\n * handler emits an HTTP redirect instead of rendering.\n *\n * Status defaults to `302`. Pass a different status (e.g. `301` or `308`)\n * for permanent redirects.\n */\nexport const applyVueRouterRedirect = (\n\trouter: VueRouterLike,\n\trequestedUrl: string,\n\tsetRedirect: (location: string, status?: number) => void,\n\tstatus: number = DEFAULT_REDIRECT_STATUS\n) => {\n\tconst finalPath = router.currentRoute.value.fullPath;\n\tconst requestedPath = normalisePathname(requestedUrl);\n\tif (finalPath === requestedPath) return;\n\tsetRedirect(finalPath, status);\n};\n"
|
|
18
20
|
],
|
|
19
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEM,2BAA2B,CAAC,cACjC,UAAU,IAAI,YAAY,IAAI,UAAU,MAAM,CAAC,GAE1C,0BAA0B,CAC/B,UACA,WACI;AAAA,EACJ,MAAM,UAAkC,CAAC;AAAA,EACzC,IAAI,QAAQ;AAAA,EAEZ,YAAY,KAAK,UAAU,OAAO,QAAQ,QAAQ,GAAG;AAAA,IACpD,IAAI,CAAC,IAAI,WAAW,MAAM;AAAA,MAAG;AAAA,IAE7B,MAAM,YAAY,IAAI,MAAM,OAAO,MAAM;AAAA,IACzC,IAAI,CAAC;AAAA,MAAW;AAAA,IAEhB,QAAQ,aAAa;AAAA,IACrB,QAAQ;AAAA,EACT;AAAA,EAEA,OAAO,QAAQ,UAAU;AAAA,GAGb,2BAA2B,CAAC,aAAqC;AAAA,EAC7E,MAAM,UACL,CAAC;AAAA,EACF,MAAM,aAAgC,CAAC,SAAS,UAAU,OAAO,SAAS;AAAA,EAE1E,WAAW,aAAa,YAAY;AAAA,IACnC,MAAM,SA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756E2164756E21",
|
|
21
23
|
"names": []
|
|
22
24
|
}
|
package/dist/vue/index.js
CHANGED
|
@@ -1586,6 +1586,20 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
|
|
|
1586
1586
|
</html>`;
|
|
1587
1587
|
};
|
|
1588
1588
|
|
|
1589
|
+
// src/core/browserTranslation.ts
|
|
1590
|
+
var BASELINE_MARKER = "__ABSOLUTE_SSR_TEXT_BASELINES__", BROWSER_TRANSLATION_BASELINE_SCRIPT, browserTranslationBaselineTag = () => `<script>${BROWSER_TRANSLATION_BASELINE_SCRIPT}</script>`, injectBrowserTranslationBaseline = (html) => {
|
|
1591
|
+
if (html.includes(BASELINE_MARKER))
|
|
1592
|
+
return html;
|
|
1593
|
+
const script = browserTranslationBaselineTag();
|
|
1594
|
+
const closingBodyIndex = html.lastIndexOf("</body>");
|
|
1595
|
+
if (closingBodyIndex < 0)
|
|
1596
|
+
return `${html}${script}`;
|
|
1597
|
+
return `${html.slice(0, closingBodyIndex)}${script}${html.slice(closingBodyIndex)}`;
|
|
1598
|
+
};
|
|
1599
|
+
var init_browserTranslation = __esm(() => {
|
|
1600
|
+
BROWSER_TRANSLATION_BASELINE_SCRIPT = "window.__ABSOLUTE_SSR_TEXT_BASELINES__=new WeakMap();" + "{const r=document.body,b=window.__ABSOLUTE_SSR_TEXT_BASELINES__;" + 'if(r)for(const e of [r,...r.querySelectorAll("*")]){' + "const t=new Map();for(const [i,n]of[...e.childNodes].entries())" + 'if(n.nodeType===3)t.set(i,n.nodeValue??"");if(t.size)b.set(e,t);}}';
|
|
1601
|
+
});
|
|
1602
|
+
|
|
1589
1603
|
// src/cli/scripts/telemetry.ts
|
|
1590
1604
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
1591
1605
|
import { homedir } from "os";
|
|
@@ -2165,7 +2179,7 @@ var routeContextCache, cacheRouteData = (pagePath, data) => {
|
|
|
2165
2179
|
}
|
|
2166
2180
|
return html + snippet;
|
|
2167
2181
|
}, injectSsrScripts = (html, requestId, indexPath, requestContext) => {
|
|
2168
|
-
let result = html;
|
|
2182
|
+
let result = injectBeforeClose(html, browserTranslationBaselineTag());
|
|
2169
2183
|
const registeredScripts = getAndClearClientScripts(requestId);
|
|
2170
2184
|
if (registeredScripts.length > 0) {
|
|
2171
2185
|
result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
|
|
@@ -2201,6 +2215,7 @@ var routeContextCache, cacheRouteData = (pagePath, data) => {
|
|
|
2201
2215
|
};
|
|
2202
2216
|
var init_ssrRender = __esm(() => {
|
|
2203
2217
|
init_registerClientScript();
|
|
2218
|
+
init_browserTranslation();
|
|
2204
2219
|
routeContextCache = new Map;
|
|
2205
2220
|
selectorCache = new Map;
|
|
2206
2221
|
});
|
|
@@ -4194,6 +4209,82 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
4194
4209
|
resolvedServerBuildComponentCache = new Map;
|
|
4195
4210
|
});
|
|
4196
4211
|
|
|
4212
|
+
// src/client/browserTranslation.ts
|
|
4213
|
+
var translationRestorer = (restore, hasTranslation) => Object.assign(restore, { hasTranslation }), emptyTranslationRestorer = () => translationRestorer(() => {
|
|
4214
|
+
return;
|
|
4215
|
+
}, false), textNodeAt = (parent, index) => {
|
|
4216
|
+
const node = parent.childNodes[index];
|
|
4217
|
+
return node instanceof Text ? node : undefined;
|
|
4218
|
+
}, visitElements = (root, visit) => {
|
|
4219
|
+
visit(root);
|
|
4220
|
+
for (const element of root.querySelectorAll("*"))
|
|
4221
|
+
visit(element);
|
|
4222
|
+
}, elementPath = (root, element) => {
|
|
4223
|
+
const path = [];
|
|
4224
|
+
let current = element;
|
|
4225
|
+
while (current !== root) {
|
|
4226
|
+
const parent = current.parentElement;
|
|
4227
|
+
if (parent === null)
|
|
4228
|
+
return null;
|
|
4229
|
+
path.unshift([...parent.children].indexOf(current));
|
|
4230
|
+
current = parent;
|
|
4231
|
+
}
|
|
4232
|
+
return path;
|
|
4233
|
+
}, elementAtPath = (root, path) => {
|
|
4234
|
+
let current = root;
|
|
4235
|
+
for (const index of path) {
|
|
4236
|
+
const child = current.children[index];
|
|
4237
|
+
if (!(child instanceof Element))
|
|
4238
|
+
return null;
|
|
4239
|
+
current = child;
|
|
4240
|
+
}
|
|
4241
|
+
return current;
|
|
4242
|
+
}, captureSsrTextBaselines = (root) => {
|
|
4243
|
+
if (root === null || typeof window === "undefined")
|
|
4244
|
+
return;
|
|
4245
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap;
|
|
4246
|
+
visitElements(root, (element) => {
|
|
4247
|
+
const text = new Map;
|
|
4248
|
+
for (const [index, node] of [...element.childNodes].entries()) {
|
|
4249
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
4250
|
+
text.set(index, node.nodeValue ?? "");
|
|
4251
|
+
}
|
|
4252
|
+
if (text.size > 0)
|
|
4253
|
+
baselines.set(element, text);
|
|
4254
|
+
});
|
|
4255
|
+
window.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;
|
|
4256
|
+
}, prepareBrowserTranslationHydration = (root) => {
|
|
4257
|
+
if (root === null || typeof window === "undefined")
|
|
4258
|
+
return emptyTranslationRestorer();
|
|
4259
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;
|
|
4260
|
+
if (baselines === undefined)
|
|
4261
|
+
return emptyTranslationRestorer();
|
|
4262
|
+
const translated = [];
|
|
4263
|
+
visitElements(root, (element) => {
|
|
4264
|
+
const text = baselines.get(element);
|
|
4265
|
+
const path = elementPath(root, element);
|
|
4266
|
+
if (text === undefined || path === null)
|
|
4267
|
+
return;
|
|
4268
|
+
for (const [index, baseline] of text) {
|
|
4269
|
+
const node = textNodeAt(element, index);
|
|
4270
|
+
if (node === undefined || node.data === baseline)
|
|
4271
|
+
continue;
|
|
4272
|
+
translated.push({ baseline, index, path, translated: node.data });
|
|
4273
|
+
node.data = baseline;
|
|
4274
|
+
}
|
|
4275
|
+
});
|
|
4276
|
+
return translationRestorer(() => {
|
|
4277
|
+
for (const snapshot of translated) {
|
|
4278
|
+
const parent = elementAtPath(root, snapshot.path);
|
|
4279
|
+
if (parent === null)
|
|
4280
|
+
continue;
|
|
4281
|
+
const node = textNodeAt(parent, snapshot.index);
|
|
4282
|
+
if (node !== undefined && node.data === snapshot.baseline)
|
|
4283
|
+
node.data = snapshot.translated;
|
|
4284
|
+
}
|
|
4285
|
+
}, translated.length > 0);
|
|
4286
|
+
};
|
|
4287
|
+
|
|
4197
4288
|
// src/core/streamingSlotRegistrar.ts
|
|
4198
4289
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
4199
4290
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
@@ -5406,6 +5497,7 @@ var ABSOLUTE_TELEPORT_TARGET_ID = "absolute-teleports";
|
|
|
5406
5497
|
var ABSOLUTE_TELEPORT_TARGET = `#${ABSOLUTE_TELEPORT_TARGET_ID}`;
|
|
5407
5498
|
|
|
5408
5499
|
// src/vue/pageHandler.ts
|
|
5500
|
+
init_browserTranslation();
|
|
5409
5501
|
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
5410
5502
|
var isGenericVueComponent = (value) => typeof value === "function" || isRecord3(value);
|
|
5411
5503
|
var readHasIslands = (value) => {
|
|
@@ -5557,7 +5649,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
5557
5649
|
const buildTail = () => {
|
|
5558
5650
|
const teleports = ssrContext.teleports?.[ABSOLUTE_TELEPORT_TARGET] ?? "";
|
|
5559
5651
|
const teleportHost = `<div id="${ABSOLUTE_TELEPORT_TARGET_ID}">${teleports}</div>`;
|
|
5560
|
-
return clientMode === "none" ? `</div>${teleportHost}${ssrOnlyHmrShim}</body></html>` : `</div>${teleportHost}<script
|
|
5652
|
+
return clientMode === "none" ? `</div>${teleportHost}${ssrOnlyHmrShim}</body></html>` : `</div>${teleportHost}<script>${BROWSER_TRANSLATION_BASELINE_SCRIPT}window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
|
|
5561
5653
|
};
|
|
5562
5654
|
if (resolvedPage.hasSpaRoutes && clientMode === "auto") {
|
|
5563
5655
|
return new Response(`${head}${buildTail()}`, {
|
|
@@ -5995,6 +6087,22 @@ var useIslandStore = (store, selector) => {
|
|
|
5995
6087
|
});
|
|
5996
6088
|
return state;
|
|
5997
6089
|
};
|
|
6090
|
+
// src/vue/browserTranslation.ts
|
|
6091
|
+
var preserveBrowserTranslation = (strategy) => {
|
|
6092
|
+
const translatedStrategy = (hydrate, forEachElement) => strategy(() => {
|
|
6093
|
+
const restore = [];
|
|
6094
|
+
forEachElement((element) => {
|
|
6095
|
+
restore.push(prepareBrowserTranslationHydration(element));
|
|
6096
|
+
});
|
|
6097
|
+
try {
|
|
6098
|
+
hydrate();
|
|
6099
|
+
} finally {
|
|
6100
|
+
for (const apply of restore)
|
|
6101
|
+
apply();
|
|
6102
|
+
}
|
|
6103
|
+
}, forEachElement);
|
|
6104
|
+
return translatedStrategy;
|
|
6105
|
+
};
|
|
5998
6106
|
// src/vue/useResource.ts
|
|
5999
6107
|
import {
|
|
6000
6108
|
getCurrentScope,
|
|
@@ -6071,13 +6179,16 @@ export {
|
|
|
6071
6179
|
StreamSlot,
|
|
6072
6180
|
SuspenseSlot,
|
|
6073
6181
|
applyVueRouterRedirect,
|
|
6182
|
+
captureSsrTextBaselines,
|
|
6074
6183
|
createTypedIsland,
|
|
6075
6184
|
defineRoutes,
|
|
6076
6185
|
defineVueSetupApp,
|
|
6077
6186
|
handleVuePageRequest,
|
|
6187
|
+
prepareBrowserTranslationHydration,
|
|
6188
|
+
preserveBrowserTranslation,
|
|
6078
6189
|
useIslandStore,
|
|
6079
6190
|
useResource
|
|
6080
6191
|
};
|
|
6081
6192
|
|
|
6082
|
-
//# debugId=
|
|
6193
|
+
//# debugId=9CDBEB929AFF9F1764756E2164756E21
|
|
6083
6194
|
//# sourceMappingURL=index.js.map
|