@absolutejs/absolute 0.20.0-beta.54 → 0.20.0-beta.56
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 +66 -10
- package/dist/build.js.map +11 -10
- package/dist/cli/config/server.js +4 -1
- package/dist/cli/index.js +53 -3
- package/dist/client/index.js +126 -7
- package/dist/client/index.js.map +8 -6
- package/dist/index.js +289 -233
- package/dist/index.js.map +13 -12
- package/dist/islands/index.js +17 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/mobile/index.js +1332 -64
- package/dist/mobile/index.js.map +8 -6
- package/dist/mobile/remoteMacAgentEntry.js +101 -92
- package/dist/mobile/shellBootstrap.js +258 -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/mobile/adaptiveShell.d.ts +27 -0
- package/dist/src/mobile/deviceCapabilities.d.ts +1 -0
- package/dist/src/mobile/index.d.ts +1 -0
- 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
|
@@ -39067,6 +39067,9 @@ var renderSpaNotFound = async (framework, pageName, request) => {
|
|
|
39067
39067
|
});
|
|
39068
39068
|
};
|
|
39069
39069
|
|
|
39070
|
+
// src/core/browserTranslation.ts
|
|
39071
|
+
var 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);}}';
|
|
39072
|
+
|
|
39070
39073
|
// src/react/pageHandler.ts
|
|
39071
39074
|
var withRequestUrl = (props, url) => Object.assign(Object.create(null), props, { url });
|
|
39072
39075
|
var resolveRequestPathname = (request) => {
|
|
@@ -39121,7 +39124,7 @@ var handleReactPageRequest = async (input) => {
|
|
|
39121
39124
|
const refreshSetup = buildRefreshSetup();
|
|
39122
39125
|
const stream = await renderToReadableStream(element, {
|
|
39123
39126
|
bootstrapModules: [resolvedIndex],
|
|
39124
|
-
bootstrapScriptContent: propsScript + refreshSetup
|
|
39127
|
+
bootstrapScriptContent: BROWSER_TRANSLATION_BASELINE_SCRIPT + propsScript + refreshSetup,
|
|
39125
39128
|
onError(error) {
|
|
39126
39129
|
console.error("[SSR] React streaming error:", error);
|
|
39127
39130
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -1358,7 +1358,7 @@ import { existsSync as existsSync3, readFileSync as readFileSync7 } from "fs";
|
|
|
1358
1358
|
import { extname, join as join7, relative, resolve as resolve4 } from "path";
|
|
1359
1359
|
import { fileURLToPath } from "url";
|
|
1360
1360
|
import ts from "typescript";
|
|
1361
|
-
var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
|
|
1361
|
+
var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES, ADAPTERS, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
|
|
1362
1362
|
const value = JSON.parse(readFileSync7(path, "utf8"));
|
|
1363
1363
|
if (!object2(value))
|
|
1364
1364
|
throw new TypeError(`${path} must contain an object.`);
|
|
@@ -1578,6 +1578,11 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRE
|
|
|
1578
1578
|
}), resolveAbsoluteDeviceCapabilityPlan = (projectRoot, provider = "capacitor") => {
|
|
1579
1579
|
const allProviders = loadAbsoluteDeviceCapabilityProviders(projectRoot, provider);
|
|
1580
1580
|
const capabilities = discoverAbsoluteDeviceCapabilities(projectRoot, allProviders);
|
|
1581
|
+
for (const capability of ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES) {
|
|
1582
|
+
if (allProviders[capability] && !capabilities.includes(capability))
|
|
1583
|
+
capabilities.push(capability);
|
|
1584
|
+
}
|
|
1585
|
+
capabilities.sort();
|
|
1581
1586
|
const providers = {};
|
|
1582
1587
|
for (const name of capabilities) {
|
|
1583
1588
|
const capabilityProvider = allProviders[name];
|
|
@@ -1593,6 +1598,10 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRE
|
|
|
1593
1598
|
};
|
|
1594
1599
|
};
|
|
1595
1600
|
var init_deviceCapabilities = __esm(() => {
|
|
1601
|
+
ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES = [
|
|
1602
|
+
"keyboard",
|
|
1603
|
+
"systemBars"
|
|
1604
|
+
];
|
|
1596
1605
|
ADAPTERS = {
|
|
1597
1606
|
capacitor: "@absolutejs/devices-capacitor",
|
|
1598
1607
|
expo: "@absolutejs/devices-expo"
|
|
@@ -2093,6 +2102,7 @@ export const createAbsoluteExpoSyncBridge = async (
|
|
|
2093
2102
|
import { router, usePathname } from 'expo-router';
|
|
2094
2103
|
import { useEffect, useRef, useState } from 'react';
|
|
2095
2104
|
import { ActivityIndicator, BackHandler, Platform, StyleSheet, View } from 'react-native';
|
|
2105
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
2096
2106
|
import { WebView, type WebViewMessageEvent } from 'react-native-webview';
|
|
2097
2107
|
import { materializeAbsoluteWebBundle } from './webAssets';
|
|
2098
2108
|
import { createExpoDevicesBridgeHost } from '@absolutejs/devices-expo/bridge';
|
|
@@ -2125,7 +2135,10 @@ const isNativeRoute = (pathname: string) => {
|
|
|
2125
2135
|
});
|
|
2126
2136
|
};
|
|
2127
2137
|
|
|
2128
|
-
const
|
|
2138
|
+
const hostMetricsScript = (safeAreaInsets: { bottom: number; left: number; right: number; top: number }) =>
|
|
2139
|
+
\`globalThis.__absoluteNativeHostMetrics = \${JSON.stringify({ safeAreaInsets })}; dispatchEvent(new CustomEvent('absolute:native-host-metrics', { detail: globalThis.__absoluteNativeHostMetrics })); true;\`;
|
|
2140
|
+
|
|
2141
|
+
const bridgeBootstrap = (path: string, safeAreaInsets: { bottom: number; left: number; right: number; top: number }) => {
|
|
2129
2142
|
const initialPath = DEV_ORIGIN
|
|
2130
2143
|
? 'location.pathname + location.search + location.hash'
|
|
2131
2144
|
: JSON.stringify(path);
|
|
@@ -2134,6 +2147,7 @@ const bridgeBootstrap = (path: string) => {
|
|
|
2134
2147
|
const listeners = new Map();
|
|
2135
2148
|
let sequence = 0;
|
|
2136
2149
|
let currentPath = \${initialPath};
|
|
2150
|
+
globalThis.__absoluteNativeHostMetrics = \${JSON.stringify({ safeAreaInsets })};
|
|
2137
2151
|
const send = value => {
|
|
2138
2152
|
const source = JSON.stringify(value);
|
|
2139
2153
|
if (new TextEncoder().encode(source).byteLength > 65536) throw new Error('Expo bridge message exceeds 64 KiB.');
|
|
@@ -2238,6 +2252,7 @@ const authStatus = async () => {
|
|
|
2238
2252
|
|
|
2239
2253
|
export function AbsoluteWebHost() {
|
|
2240
2254
|
const pathname = usePathname() || '/';
|
|
2255
|
+
const safeAreaInsets = useSafeAreaInsets();
|
|
2241
2256
|
const webView = useRef<WebView>(null);
|
|
2242
2257
|
const devicesBridge = useRef<{ close(): void | Promise<void>; request(method: string, params: Record<string, unknown>): Promise<unknown> } | undefined>(undefined);
|
|
2243
2258
|
const syncBridge = useRef<{ close(): void | Promise<void>; request(method: string, params: Record<string, unknown>): Promise<unknown> } | undefined>(undefined);
|
|
@@ -2280,6 +2295,9 @@ export function AbsoluteWebHost() {
|
|
|
2280
2295
|
}
|
|
2281
2296
|
void materializeAbsoluteWebBundle().then(uri => setIndexUri(uri + '?absolutePath=' + encodeURIComponent(pathname)));
|
|
2282
2297
|
}, [pathname]);
|
|
2298
|
+
useEffect(() => {
|
|
2299
|
+
webView.current?.injectJavaScript(hostMetricsScript(safeAreaInsets));
|
|
2300
|
+
}, [safeAreaInsets.bottom, safeAreaInsets.left, safeAreaInsets.right, safeAreaInsets.top]);
|
|
2283
2301
|
useEffect(() => {
|
|
2284
2302
|
const subscription = BackHandler.addEventListener('hardwareBackPress', () => {
|
|
2285
2303
|
if (!canGoBack) return false;
|
|
@@ -2363,7 +2381,7 @@ export function AbsoluteWebHost() {
|
|
|
2363
2381
|
allowFileAccessFromFileURLs
|
|
2364
2382
|
allowUniversalAccessFromFileURLs={false}
|
|
2365
2383
|
allowingReadAccessToURL={indexUri.slice(0, indexUri.lastIndexOf('/') + 1)}
|
|
2366
|
-
injectedJavaScriptBeforeContentLoaded={bridgeBootstrap(pathname)}
|
|
2384
|
+
injectedJavaScriptBeforeContentLoaded={bridgeBootstrap(pathname, safeAreaInsets)}
|
|
2367
2385
|
onMessage={onMessage}
|
|
2368
2386
|
onNavigationStateChange={state => setCanGoBack(state.canGoBack)}
|
|
2369
2387
|
onShouldStartLoadWithRequest={request => {
|
|
@@ -21350,6 +21368,22 @@ var init_iosTestReport = __esm(() => {
|
|
|
21350
21368
|
["SETUP-05", "Confirm generated iOS project signing and Xcode warnings."],
|
|
21351
21369
|
["DEV-01", "Record cold and warm bun dev startup timings."],
|
|
21352
21370
|
["DEV-02", "Complete route traversal, HMR, relaunch, and recovery checks."],
|
|
21371
|
+
[
|
|
21372
|
+
"ADAPT-01",
|
|
21373
|
+
"Confirm safe-area variables and platform attributes on React, Angular, Vue, Svelte, HTML, and HTMX pages."
|
|
21374
|
+
],
|
|
21375
|
+
[
|
|
21376
|
+
"ADAPT-02",
|
|
21377
|
+
"Rotate with the keyboard open and confirm viewport and available-height variables update without double padding."
|
|
21378
|
+
],
|
|
21379
|
+
[
|
|
21380
|
+
"ADAPT-03",
|
|
21381
|
+
"Go offline and reconnect; confirm the root state and accessibility announcement update."
|
|
21382
|
+
],
|
|
21383
|
+
[
|
|
21384
|
+
"ADAPT-04",
|
|
21385
|
+
"Confirm automatic system-bar appearance and unchanged author layout."
|
|
21386
|
+
],
|
|
21353
21387
|
...Array.from({ length: 10 }, (_, index) => [
|
|
21354
21388
|
`DEVICEDEV-${String(index + 1).padStart(2, "0")}`,
|
|
21355
21389
|
`Complete physical-device development runbook check DEVICEDEV-${String(index + 1).padStart(2, "0")}.`
|
|
@@ -21435,6 +21469,22 @@ var init_androidTestReport = __esm(() => {
|
|
|
21435
21469
|
],
|
|
21436
21470
|
["DEV-01", "Record cold and warm native startup timings."],
|
|
21437
21471
|
["DEV-02", "Complete route traversal, HMR, relaunch, and recovery checks."],
|
|
21472
|
+
[
|
|
21473
|
+
"ADAPT-01",
|
|
21474
|
+
"Confirm safe-area variables and platform attributes on every embedded framework."
|
|
21475
|
+
],
|
|
21476
|
+
[
|
|
21477
|
+
"ADAPT-02",
|
|
21478
|
+
"Rotate with the keyboard open and confirm viewport and available-height variables update without double padding."
|
|
21479
|
+
],
|
|
21480
|
+
[
|
|
21481
|
+
"ADAPT-03",
|
|
21482
|
+
"Go offline and reconnect; confirm the root state and accessibility announcement update."
|
|
21483
|
+
],
|
|
21484
|
+
[
|
|
21485
|
+
"ADAPT-04",
|
|
21486
|
+
"Confirm automatic system-bar appearance and unchanged author layout."
|
|
21487
|
+
],
|
|
21438
21488
|
["CAP-01", "Complete automatic device-capability provisioning checks."],
|
|
21439
21489
|
[
|
|
21440
21490
|
"SYSUI-01",
|
package/dist/client/index.js
CHANGED
|
@@ -235,6 +235,82 @@ var init_islandMarkupAttributes = __esm(() => {
|
|
|
235
235
|
init_islands();
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
+
// src/client/browserTranslation.ts
|
|
239
|
+
var translationRestorer = (restore, hasTranslation) => Object.assign(restore, { hasTranslation }), emptyTranslationRestorer = () => translationRestorer(() => {
|
|
240
|
+
return;
|
|
241
|
+
}, false), textNodeAt = (parent, index) => {
|
|
242
|
+
const node = parent.childNodes[index];
|
|
243
|
+
return node instanceof Text ? node : undefined;
|
|
244
|
+
}, visitElements = (root, visit) => {
|
|
245
|
+
visit(root);
|
|
246
|
+
for (const element of root.querySelectorAll("*"))
|
|
247
|
+
visit(element);
|
|
248
|
+
}, elementPath = (root, element) => {
|
|
249
|
+
const path = [];
|
|
250
|
+
let current = element;
|
|
251
|
+
while (current !== root) {
|
|
252
|
+
const parent = current.parentElement;
|
|
253
|
+
if (parent === null)
|
|
254
|
+
return null;
|
|
255
|
+
path.unshift([...parent.children].indexOf(current));
|
|
256
|
+
current = parent;
|
|
257
|
+
}
|
|
258
|
+
return path;
|
|
259
|
+
}, elementAtPath = (root, path) => {
|
|
260
|
+
let current = root;
|
|
261
|
+
for (const index of path) {
|
|
262
|
+
const child = current.children[index];
|
|
263
|
+
if (!(child instanceof Element))
|
|
264
|
+
return null;
|
|
265
|
+
current = child;
|
|
266
|
+
}
|
|
267
|
+
return current;
|
|
268
|
+
}, captureSsrTextBaselines = (root) => {
|
|
269
|
+
if (root === null || typeof window === "undefined")
|
|
270
|
+
return;
|
|
271
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap;
|
|
272
|
+
visitElements(root, (element) => {
|
|
273
|
+
const text = new Map;
|
|
274
|
+
for (const [index, node] of [...element.childNodes].entries()) {
|
|
275
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
276
|
+
text.set(index, node.nodeValue ?? "");
|
|
277
|
+
}
|
|
278
|
+
if (text.size > 0)
|
|
279
|
+
baselines.set(element, text);
|
|
280
|
+
});
|
|
281
|
+
window.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;
|
|
282
|
+
}, prepareBrowserTranslationHydration = (root) => {
|
|
283
|
+
if (root === null || typeof window === "undefined")
|
|
284
|
+
return emptyTranslationRestorer();
|
|
285
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;
|
|
286
|
+
if (baselines === undefined)
|
|
287
|
+
return emptyTranslationRestorer();
|
|
288
|
+
const translated = [];
|
|
289
|
+
visitElements(root, (element) => {
|
|
290
|
+
const text = baselines.get(element);
|
|
291
|
+
const path = elementPath(root, element);
|
|
292
|
+
if (text === undefined || path === null)
|
|
293
|
+
return;
|
|
294
|
+
for (const [index, baseline] of text) {
|
|
295
|
+
const node = textNodeAt(element, index);
|
|
296
|
+
if (node === undefined || node.data === baseline)
|
|
297
|
+
continue;
|
|
298
|
+
translated.push({ baseline, index, path, translated: node.data });
|
|
299
|
+
node.data = baseline;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
return translationRestorer(() => {
|
|
303
|
+
for (const snapshot of translated) {
|
|
304
|
+
const parent = elementAtPath(root, snapshot.path);
|
|
305
|
+
if (parent === null)
|
|
306
|
+
continue;
|
|
307
|
+
const node = textNodeAt(parent, snapshot.index);
|
|
308
|
+
if (node !== undefined && node.data === snapshot.baseline)
|
|
309
|
+
node.data = snapshot.translated;
|
|
310
|
+
}
|
|
311
|
+
}, translated.length > 0);
|
|
312
|
+
};
|
|
313
|
+
|
|
238
314
|
// src/client/hydrators/react.ts
|
|
239
315
|
var exports_react = {};
|
|
240
316
|
__export(exports_react, {
|
|
@@ -243,6 +319,7 @@ __export(exports_react, {
|
|
|
243
319
|
});
|
|
244
320
|
import { createElement } from "react";
|
|
245
321
|
import { hydrateRoot } from "react-dom/client";
|
|
322
|
+
import { flushSync } from "react-dom";
|
|
246
323
|
var reactIslandRoots, isPropsRecord = (value) => typeof value === "object" && value !== null, HOST_REACT_EXPANDO_PREFIXES, detachFromHostReactRoot = (element) => {
|
|
247
324
|
for (const key of Object.keys(element)) {
|
|
248
325
|
const isHostExpando = HOST_REACT_EXPANDO_PREFIXES.some((prefix) => key.startsWith(prefix));
|
|
@@ -257,11 +334,28 @@ var reactIslandRoots, isPropsRecord = (value) => typeof value === "object" && va
|
|
|
257
334
|
return;
|
|
258
335
|
}
|
|
259
336
|
detachFromHostReactRoot(element);
|
|
337
|
+
const restoreTranslation = prepareBrowserTranslationHydration(element);
|
|
338
|
+
const hydrate = (elementToHydrate) => {
|
|
339
|
+
let root;
|
|
340
|
+
const startHydration = () => {
|
|
341
|
+
root = hydrateRoot(element, elementToHydrate);
|
|
342
|
+
};
|
|
343
|
+
try {
|
|
344
|
+
if (restoreTranslation.hasTranslation)
|
|
345
|
+
flushSync(startHydration);
|
|
346
|
+
else
|
|
347
|
+
startHydration();
|
|
348
|
+
} finally {
|
|
349
|
+
restoreTranslation();
|
|
350
|
+
}
|
|
351
|
+
if (root !== undefined)
|
|
352
|
+
reactIslandRoots.set(element, root);
|
|
353
|
+
};
|
|
260
354
|
if (!isPropsRecord(props)) {
|
|
261
|
-
|
|
355
|
+
hydrate(createElement(component));
|
|
262
356
|
return;
|
|
263
357
|
}
|
|
264
|
-
|
|
358
|
+
hydrate(createElement(component, props));
|
|
265
359
|
}, isReactComponent = (value) => typeof value === "function";
|
|
266
360
|
var init_react = __esm(() => {
|
|
267
361
|
reactIslandRoots = new WeakMap;
|
|
@@ -638,6 +732,20 @@ var init_registerClientScript = __esm(() => {
|
|
|
638
732
|
}
|
|
639
733
|
});
|
|
640
734
|
|
|
735
|
+
// src/core/browserTranslation.ts
|
|
736
|
+
var BASELINE_MARKER = "__ABSOLUTE_SSR_TEXT_BASELINES__", BROWSER_TRANSLATION_BASELINE_SCRIPT, browserTranslationBaselineTag = () => `<script>${BROWSER_TRANSLATION_BASELINE_SCRIPT}</script>`, injectBrowserTranslationBaseline = (html) => {
|
|
737
|
+
if (html.includes(BASELINE_MARKER))
|
|
738
|
+
return html;
|
|
739
|
+
const script = browserTranslationBaselineTag();
|
|
740
|
+
const closingBodyIndex = html.lastIndexOf("</body>");
|
|
741
|
+
if (closingBodyIndex < 0)
|
|
742
|
+
return `${html}${script}`;
|
|
743
|
+
return `${html.slice(0, closingBodyIndex)}${script}${html.slice(closingBodyIndex)}`;
|
|
744
|
+
};
|
|
745
|
+
var init_browserTranslation = __esm(() => {
|
|
746
|
+
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);}}';
|
|
747
|
+
});
|
|
748
|
+
|
|
641
749
|
// src/angular/httpTransferCache.ts
|
|
642
750
|
var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
|
|
643
751
|
const {
|
|
@@ -690,7 +798,7 @@ var routeContextCache, cacheRouteData = (pagePath, data) => {
|
|
|
690
798
|
}
|
|
691
799
|
return html + snippet;
|
|
692
800
|
}, injectSsrScripts = (html, requestId, indexPath, requestContext) => {
|
|
693
|
-
let result = html;
|
|
801
|
+
let result = injectBeforeClose(html, browserTranslationBaselineTag());
|
|
694
802
|
const registeredScripts = getAndClearClientScripts(requestId);
|
|
695
803
|
if (registeredScripts.length > 0) {
|
|
696
804
|
result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
|
|
@@ -726,6 +834,7 @@ var routeContextCache, cacheRouteData = (pagePath, data) => {
|
|
|
726
834
|
};
|
|
727
835
|
var init_ssrRender = __esm(() => {
|
|
728
836
|
init_registerClientScript();
|
|
837
|
+
init_browserTranslation();
|
|
729
838
|
routeContextCache = new Map;
|
|
730
839
|
selectorCache = new Map;
|
|
731
840
|
});
|
|
@@ -1113,6 +1222,14 @@ var isPropsRecord4 = (value) => typeof value === "object" && value !== null;
|
|
|
1113
1222
|
var isIslandElement = (value) => value instanceof HTMLElement && value.dataset.island === "true";
|
|
1114
1223
|
var observedRoots = new WeakSet;
|
|
1115
1224
|
var hydratingIslands = new WeakSet;
|
|
1225
|
+
var hydratePreservingBrowserTranslation = async (element, hydrate) => {
|
|
1226
|
+
const restoreTranslation = prepareBrowserTranslationHydration(element);
|
|
1227
|
+
try {
|
|
1228
|
+
await hydrate();
|
|
1229
|
+
} finally {
|
|
1230
|
+
restoreTranslation();
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1116
1233
|
var hydrateByFramework = async (registry, framework, componentName, element, props, resolveComponent) => {
|
|
1117
1234
|
const propsRecord = isPropsRecord4(props) ? props : undefined;
|
|
1118
1235
|
if (framework === "react") {
|
|
@@ -1129,7 +1246,7 @@ var hydrateByFramework = async (registry, framework, componentName, element, pro
|
|
|
1129
1246
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.svelte?.[componentName]);
|
|
1130
1247
|
if (!isSvelteComponent2(resolvedComponent))
|
|
1131
1248
|
return;
|
|
1132
|
-
hydrateSvelteIsland2(resolvedComponent, element, propsRecord);
|
|
1249
|
+
await hydratePreservingBrowserTranslation(element, () => hydrateSvelteIsland2(resolvedComponent, element, propsRecord));
|
|
1133
1250
|
element.dataset.hydrated = "true";
|
|
1134
1251
|
return;
|
|
1135
1252
|
}
|
|
@@ -1138,7 +1255,7 @@ var hydrateByFramework = async (registry, framework, componentName, element, pro
|
|
|
1138
1255
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.vue?.[componentName]);
|
|
1139
1256
|
if (!isVueComponent2(resolvedComponent))
|
|
1140
1257
|
return;
|
|
1141
|
-
hydrateVueIsland2(resolvedComponent, element, propsRecord);
|
|
1258
|
+
await hydratePreservingBrowserTranslation(element, () => hydrateVueIsland2(resolvedComponent, element, propsRecord));
|
|
1142
1259
|
element.dataset.hydrated = "true";
|
|
1143
1260
|
return;
|
|
1144
1261
|
}
|
|
@@ -1148,7 +1265,7 @@ var hydrateByFramework = async (registry, framework, componentName, element, pro
|
|
|
1148
1265
|
const { islandId } = element.dataset;
|
|
1149
1266
|
if (!isAngularComponent2(resolvedComponent) || !islandId)
|
|
1150
1267
|
return;
|
|
1151
|
-
await mountAngularIsland2(resolvedComponent, element, propsRecord ?? {}, islandId);
|
|
1268
|
+
await hydratePreservingBrowserTranslation(element, () => mountAngularIsland2(resolvedComponent, element, propsRecord ?? {}, islandId));
|
|
1152
1269
|
element.dataset.hydrated = "true";
|
|
1153
1270
|
}
|
|
1154
1271
|
};
|
|
@@ -1239,15 +1356,17 @@ var startIslands = ({
|
|
|
1239
1356
|
});
|
|
1240
1357
|
};
|
|
1241
1358
|
export {
|
|
1359
|
+
captureSsrTextBaselines,
|
|
1242
1360
|
createIslandManifestResolver,
|
|
1243
1361
|
createIslandStore,
|
|
1244
1362
|
getIslandStoreServerSnapshot,
|
|
1245
1363
|
getStreamSwapRuntimeScript,
|
|
1246
1364
|
initializeIslandStores,
|
|
1365
|
+
prepareBrowserTranslationHydration,
|
|
1247
1366
|
readIslandStore,
|
|
1248
1367
|
startIslands,
|
|
1249
1368
|
subscribeIslandStore
|
|
1250
1369
|
};
|
|
1251
1370
|
|
|
1252
|
-
//# debugId=
|
|
1371
|
+
//# debugId=77AFDE1DACC53DED64756E2164756E21
|
|
1253
1372
|
//# sourceMappingURL=index.js.map
|