@absolutejs/absolute 0.20.0-beta.55 → 0.20.0-beta.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/angular/browser.js +1 -45
  2. package/dist/angular/browser.js.map +2 -2
  3. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  4. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  5. package/dist/angular/index.js +1 -17
  6. package/dist/angular/index.js.map +2 -2
  7. package/dist/build.js +18 -3
  8. package/dist/build.js.map +4 -4
  9. package/dist/cli/index.js +53 -3
  10. package/dist/client/chunks/angularPatch-arh4sr68.js +157 -0
  11. package/dist/client/chunks/angularPatch-arh4sr68.js.map +10 -0
  12. package/dist/client/chunks/index-5py90ctf.js +87 -0
  13. package/dist/client/chunks/index-5py90ctf.js.map +10 -0
  14. package/dist/client/chunks/index-m35nbkdp.js +374 -0
  15. package/dist/client/chunks/index-m35nbkdp.js.map +12 -0
  16. package/dist/client/chunks/index-qxjc7kc5.js +12 -0
  17. package/dist/client/chunks/index-qxjc7kc5.js.map +9 -0
  18. package/dist/client/chunks/islands-xj2n8nwf.js +281 -0
  19. package/dist/client/chunks/islands-xj2n8nwf.js.map +14 -0
  20. package/dist/client/chunks/react-pdg4325x.js +65 -0
  21. package/dist/client/chunks/react-pdg4325x.js.map +10 -0
  22. package/dist/client/chunks/svelte-s0c964kb.js +19 -0
  23. package/dist/client/chunks/svelte-s0c964kb.js.map +10 -0
  24. package/dist/client/chunks/vue-rdskrnyg.js +24 -0
  25. package/dist/client/chunks/vue-rdskrnyg.js.map +10 -0
  26. package/dist/client/index.js +56 -947
  27. package/dist/client/index.js.map +7 -22
  28. package/dist/index.js +18 -3
  29. package/dist/index.js.map +4 -4
  30. package/dist/islands/browser.js +1 -17
  31. package/dist/islands/browser.js.map +2 -2
  32. package/dist/islands/index.js +1 -17
  33. package/dist/islands/index.js.map +2 -2
  34. package/dist/mobile/index.js +1332 -64
  35. package/dist/mobile/index.js.map +8 -6
  36. package/dist/mobile/remoteMacAgentEntry.js +101 -92
  37. package/dist/mobile/shellBootstrap.js +258 -4
  38. package/dist/react/browser.js +1 -45
  39. package/dist/react/browser.js.map +2 -2
  40. package/dist/react/hooks/index.js +1 -17
  41. package/dist/react/hooks/index.js.map +2 -2
  42. package/dist/react/index.js +1 -17
  43. package/dist/react/index.js.map +2 -2
  44. package/dist/src/mobile/adaptiveShell.d.ts +27 -0
  45. package/dist/src/mobile/deviceCapabilities.d.ts +1 -0
  46. package/dist/src/mobile/index.d.ts +1 -0
  47. package/dist/svelte/browser.js +1 -17
  48. package/dist/svelte/browser.js.map +2 -2
  49. package/dist/svelte/index.js +1 -17
  50. package/dist/svelte/index.js.map +2 -2
  51. package/dist/vue/browser.js +84 -121
  52. package/dist/vue/browser.js.map +4 -4
  53. package/dist/vue/index.js +84 -121
  54. package/dist/vue/index.js.map +4 -4
  55. package/package.json +9 -7
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 bridgeBootstrap = (path: string) => {
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",
@@ -0,0 +1,157 @@
1
+ import {
2
+ isProductionRuntime,
3
+ resolveAngularRuntimePath
4
+ } from "./index-m35nbkdp.js";
5
+ import"./index-qxjc7kc5.js";
6
+
7
+ // src/angular/angularPatch.ts
8
+ var ensureHead = (doc) => {
9
+ if (!doc || doc.head || !doc.documentElement) {
10
+ return;
11
+ }
12
+ const head = doc.createElement("head");
13
+ doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
14
+ };
15
+ var SSR_LAYOUT_RECT = Object.freeze({
16
+ bottom: 0,
17
+ height: 0,
18
+ left: 0,
19
+ right: 0,
20
+ top: 0,
21
+ width: 0,
22
+ x: 0,
23
+ y: 0,
24
+ toJSON() {
25
+ return this;
26
+ }
27
+ });
28
+ var layoutPatchApplied = false;
29
+ var collectPrototypeChain = (instance) => {
30
+ const protos = [];
31
+ let current = instance ? Object.getPrototypeOf(instance) : null;
32
+ while (current && current !== Object.prototype) {
33
+ protos.push(current);
34
+ current = Object.getPrototypeOf(current);
35
+ }
36
+ return protos;
37
+ };
38
+ var patchElementLayout = (doc) => {
39
+ if (layoutPatchApplied || !doc) {
40
+ return;
41
+ }
42
+ let element;
43
+ try {
44
+ element = doc.createElement("div");
45
+ } catch {
46
+ return;
47
+ }
48
+ const protos = collectPrototypeChain(element);
49
+ if (protos.length === 0)
50
+ return;
51
+ const copyLayoutRect = (rect) => ({ ...rect });
52
+ const createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);
53
+ const getClientRects = () => [];
54
+ const noop = () => {
55
+ return;
56
+ };
57
+ const numericProps = [
58
+ "clientWidth",
59
+ "clientHeight",
60
+ "clientLeft",
61
+ "clientTop",
62
+ "offsetWidth",
63
+ "offsetHeight",
64
+ "offsetLeft",
65
+ "offsetTop",
66
+ "scrollWidth",
67
+ "scrollHeight",
68
+ "scrollLeft",
69
+ "scrollTop"
70
+ ];
71
+ for (const proto of protos) {
72
+ const define = (name, value) => {
73
+ const descriptor = Object.getOwnPropertyDescriptor(proto, name);
74
+ if (typeof descriptor?.value === "function")
75
+ return;
76
+ Object.defineProperty(proto, name, {
77
+ configurable: true,
78
+ value,
79
+ writable: true
80
+ });
81
+ };
82
+ define("getBoundingClientRect", createLayoutRect);
83
+ define("getClientRects", getClientRects);
84
+ define("scrollTo", noop);
85
+ define("scrollBy", noop);
86
+ define("scrollIntoView", noop);
87
+ define("focus", noop);
88
+ define("blur", noop);
89
+ for (const prop of numericProps) {
90
+ const desc = Object.getOwnPropertyDescriptor(proto, prop);
91
+ if (desc)
92
+ continue;
93
+ Object.defineProperty(proto, prop, {
94
+ configurable: true,
95
+ get: () => 0
96
+ });
97
+ }
98
+ }
99
+ layoutPatchApplied = true;
100
+ };
101
+ var applyPatches = async () => {
102
+ const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
103
+ const { ɵDominoAdapter } = await import(spec);
104
+ if (!ɵDominoAdapter?.prototype) {
105
+ console.warn("[Angular Patch] ɵDominoAdapter not found, skipping patches");
106
+ return false;
107
+ }
108
+ try {
109
+ const adapter = new ɵDominoAdapter;
110
+ const resolveSeedDoc = () => {
111
+ if (typeof adapter.createHtmlDocument === "function")
112
+ return adapter.createHtmlDocument();
113
+ if (typeof adapter.getDefaultDocument === "function")
114
+ return adapter.getDefaultDocument();
115
+ return null;
116
+ };
117
+ const seedDoc = resolveSeedDoc();
118
+ if (seedDoc) {
119
+ patchElementLayout(seedDoc);
120
+ const probe = seedDoc.createElement("div");
121
+ if (typeof probe.getBoundingClientRect !== "function") {
122
+ console.warn("[Angular Patch] Layout shim did not stick on probe element prototype chain");
123
+ }
124
+ }
125
+ } catch (error) {
126
+ console.warn("[Angular Patch] Could not eagerly patch Element prototypes:", error);
127
+ }
128
+ const proto = ɵDominoAdapter.prototype;
129
+ const origGetBaseHref = proto.getBaseHref;
130
+ proto.getBaseHref = function(doc) {
131
+ if (!doc || !doc.head || typeof doc.head.children === "undefined") {
132
+ return "";
133
+ }
134
+ return origGetBaseHref.call(this, doc);
135
+ };
136
+ const origCreateHtmlDocument = proto.createHtmlDocument;
137
+ proto.createHtmlDocument = function() {
138
+ const doc = origCreateHtmlDocument.call(this);
139
+ ensureHead(doc);
140
+ patchElementLayout(doc);
141
+ return doc;
142
+ };
143
+ const origGetDefaultDocument = proto.getDefaultDocument;
144
+ proto.getDefaultDocument = function() {
145
+ const doc = origGetDefaultDocument.call(this);
146
+ ensureHead(doc);
147
+ patchElementLayout(doc);
148
+ return doc;
149
+ };
150
+ return true;
151
+ };
152
+ export {
153
+ applyPatches
154
+ };
155
+
156
+ //# debugId=CE12054E3565B4C864756E2164756E21
157
+ //# sourceMappingURL=angularPatch-arh4sr68.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/angular/angularPatch.ts"],
4
+ "sourcesContent": [
5
+ "import { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport { isProductionRuntime } from '../utils/runtimeMode';\n\n// Patches Angular SSR's DominoAdapter to guard against null doc.head\n\nconst ensureHead = (doc: Document) => {\n\tif (!doc || doc.head || !doc.documentElement) {\n\t\treturn;\n\t}\n\n\tconst head = doc.createElement('head');\n\tdoc.documentElement.insertBefore(head, doc.documentElement.firstChild);\n};\n\n// Domino's Element does not implement layout APIs that browser components\n// (e.g. ngx-datatable, swiper, drag-drop) call eagerly during change detection.\n// Returning a zeroed DOMRect lets those components render in SSR without\n// crashing — the real values get computed once the page hydrates client-side.\nconst SSR_LAYOUT_RECT = Object.freeze({\n\tbottom: 0,\n\theight: 0,\n\tleft: 0,\n\tright: 0,\n\ttop: 0,\n\twidth: 0,\n\tx: 0,\n\ty: 0,\n\ttoJSON() {\n\t\treturn this;\n\t}\n});\nlet layoutPatchApplied = false;\nconst collectPrototypeChain = (instance: object | null) => {\n\tconst protos: object[] = [];\n\tlet current: object | null = instance\n\t\t? Object.getPrototypeOf(instance)\n\t\t: null;\n\twhile (current && current !== Object.prototype) {\n\t\tprotos.push(current);\n\t\tcurrent = Object.getPrototypeOf(current);\n\t}\n\n\treturn protos;\n};\n\nconst patchElementLayout = (doc: Document) => {\n\tif (layoutPatchApplied || !doc) {\n\t\treturn;\n\t}\n\tlet element: Element;\n\ttry {\n\t\telement = doc.createElement('div');\n\t} catch {\n\t\treturn;\n\t}\n\t// Walk the entire prototype chain so HTMLElement → Element → Node all get\n\t// the layout shims. Domino's base Element.prototype is several hops above\n\t// HTMLDivElement.prototype, and 3rd-party libs call methods anywhere along\n\t// the chain.\n\tconst protos = collectPrototypeChain(element);\n\tif (protos.length === 0) return;\n\n\tconst copyLayoutRect = (rect: typeof SSR_LAYOUT_RECT) => ({ ...rect });\n\tconst createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);\n\tconst getClientRects = () => [];\n\tconst noop = () => undefined;\n\tconst numericProps = [\n\t\t'clientWidth',\n\t\t'clientHeight',\n\t\t'clientLeft',\n\t\t'clientTop',\n\t\t'offsetWidth',\n\t\t'offsetHeight',\n\t\t'offsetLeft',\n\t\t'offsetTop',\n\t\t'scrollWidth',\n\t\t'scrollHeight',\n\t\t'scrollLeft',\n\t\t'scrollTop'\n\t];\n\n\tfor (const proto of protos) {\n\t\tconst define = (name: string, value: unknown) => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\t\t\tif (typeof descriptor?.value === 'function') return;\n\n\t\t\tObject.defineProperty(proto, name, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t};\n\n\t\tdefine('getBoundingClientRect', createLayoutRect);\n\t\tdefine('getClientRects', getClientRects);\n\t\tdefine('scrollTo', noop);\n\t\tdefine('scrollBy', noop);\n\t\tdefine('scrollIntoView', noop);\n\t\tdefine('focus', noop);\n\t\tdefine('blur', noop);\n\n\t\tfor (const prop of numericProps) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop);\n\t\t\tif (desc) continue;\n\t\t\tObject.defineProperty(proto, prop, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget: () => 0\n\t\t\t});\n\t\t}\n\t}\n\n\tlayoutPatchApplied = true;\n};\n\nexport const applyPatches = async () => {\n\t// §1.1 — bare specifier in dev shares Bun's module cache with bundled\n\t// server pages. Production stays on the resolved vendor path. Use\n\t// `isProductionRuntime()` instead of a direct `process.env.NODE_ENV`\n\t// read so Bun's bundler doesn't constant-fold this branch out of\n\t// dist/ at absolutejs build time.\n\tconst spec = isProductionRuntime()\n\t\t? resolveAngularRuntimePath('@angular/platform-server')\n\t\t: '@angular/platform-server';\n\tconst { ɵDominoAdapter } = await import(spec);\n\tif (!ɵDominoAdapter?.prototype) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] ɵDominoAdapter not found, skipping patches'\n\t\t);\n\n\t\treturn false;\n\t}\n\n\t// Patch the layout shims onto Domino's Element prototypes immediately\n\t// (don't wait for the first createHtmlDocument call). Components that\n\t// hold an ElementRef from the very first change-detection pass call\n\t// these methods before the lazy patch path would have run.\n\ttry {\n\t\tconst adapter = new ɵDominoAdapter();\n\t\tconst resolveSeedDoc = () => {\n\t\t\tif (typeof adapter.createHtmlDocument === 'function')\n\t\t\t\treturn adapter.createHtmlDocument();\n\t\t\tif (typeof adapter.getDefaultDocument === 'function')\n\t\t\t\treturn adapter.getDefaultDocument();\n\n\t\t\treturn null;\n\t\t};\n\t\tconst seedDoc = resolveSeedDoc();\n\t\tif (seedDoc) {\n\t\t\tpatchElementLayout(seedDoc);\n\t\t\tconst probe = seedDoc.createElement('div');\n\t\t\tif (typeof probe.getBoundingClientRect !== 'function') {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[Angular Patch] Layout shim did not stick on probe element prototype chain'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] Could not eagerly patch Element prototypes:',\n\t\t\terror\n\t\t);\n\t}\n\n\tconst proto = ɵDominoAdapter.prototype;\n\n\tconst origGetBaseHref = proto.getBaseHref;\n\tproto.getBaseHref = function (doc: Document) {\n\t\tif (!doc || !doc.head || typeof doc.head.children === 'undefined') {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn origGetBaseHref.call(this, doc);\n\t};\n\n\tconst origCreateHtmlDocument = proto.createHtmlDocument;\n\tproto.createHtmlDocument = function () {\n\t\tconst doc = origCreateHtmlDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\tconst origGetDefaultDocument = proto.getDefaultDocument;\n\tproto.getDefaultDocument = function () {\n\t\tconst doc = origGetDefaultDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\treturn true;\n};\n"
6
+ ],
7
+ "mappings": ";;;;;;;AAKA,IAAM,aAAa,CAAC,QAAkB;AAAA,EACrC,IAAI,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,iBAAiB;AAAA,IAC7C;AAAA,EACD;AAAA,EAEA,MAAM,OAAO,IAAI,cAAc,MAAM;AAAA,EACrC,IAAI,gBAAgB,aAAa,MAAM,IAAI,gBAAgB,UAAU;AAAA;AAOtE,IAAM,kBAAkB,OAAO,OAAO;AAAA,EACrC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AAAA,EACL,OAAO;AAAA,EACP,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,GAAG;AAAA,IACR,OAAO;AAAA;AAET,CAAC;AACD,IAAI,qBAAqB;AACzB,IAAM,wBAAwB,CAAC,aAA4B;AAAA,EAC1D,MAAM,SAAmB,CAAC;AAAA,EAC1B,IAAI,UAAyB,WAC1B,OAAO,eAAe,QAAQ,IAC9B;AAAA,EACH,OAAO,WAAW,YAAY,OAAO,WAAW;AAAA,IAC/C,OAAO,KAAK,OAAO;AAAA,IACnB,UAAU,OAAO,eAAe,OAAO;AAAA,EACxC;AAAA,EAEA,OAAO;AAAA;AAGR,IAAM,qBAAqB,CAAC,QAAkB;AAAA,EAC7C,IAAI,sBAAsB,CAAC,KAAK;AAAA,IAC/B;AAAA,EACD;AAAA,EACA,IAAI;AAAA,EACJ,IAAI;AAAA,IACH,UAAU,IA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AA,EAGR,MAAM,yBAAyB,MAAM;AAAA,EACrC,MAAM,qBAAqB,QAAS,GAAG;AAAA,IACtC,MAAM,MAAM,uBAAuB,KAAK,IAAI;AAAA,IAC5C,WAAW,GAAG;AAAA,IACd,mBAAmB,GAAG;AAAA,IAEtB,OAAO;AAAA;AAAA,EAGR,OAAO;AAAA;",
8
+ "debugId": "CE12054E3565B4C864756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,87 @@
1
+ // src/client/browserTranslation.ts
2
+ var translationRestorer = (restore, hasTranslation) => Object.assign(restore, { hasTranslation });
3
+ var emptyTranslationRestorer = () => translationRestorer(() => {
4
+ return;
5
+ }, false);
6
+ var textNodeAt = (parent, index) => {
7
+ const node = parent.childNodes[index];
8
+ return node instanceof Text ? node : undefined;
9
+ };
10
+ var visitElements = (root, visit) => {
11
+ visit(root);
12
+ for (const element of root.querySelectorAll("*"))
13
+ visit(element);
14
+ };
15
+ var elementPath = (root, element) => {
16
+ const path = [];
17
+ let current = element;
18
+ while (current !== root) {
19
+ const parent = current.parentElement;
20
+ if (parent === null)
21
+ return null;
22
+ path.unshift([...parent.children].indexOf(current));
23
+ current = parent;
24
+ }
25
+ return path;
26
+ };
27
+ var elementAtPath = (root, path) => {
28
+ let current = root;
29
+ for (const index of path) {
30
+ const child = current.children[index];
31
+ if (!(child instanceof Element))
32
+ return null;
33
+ current = child;
34
+ }
35
+ return current;
36
+ };
37
+ var captureSsrTextBaselines = (root) => {
38
+ if (root === null || typeof window === "undefined")
39
+ return;
40
+ const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap;
41
+ visitElements(root, (element) => {
42
+ const text = new Map;
43
+ for (const [index, node] of [...element.childNodes].entries()) {
44
+ if (node.nodeType === Node.TEXT_NODE)
45
+ text.set(index, node.nodeValue ?? "");
46
+ }
47
+ if (text.size > 0)
48
+ baselines.set(element, text);
49
+ });
50
+ window.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;
51
+ };
52
+ var prepareBrowserTranslationHydration = (root) => {
53
+ if (root === null || typeof window === "undefined")
54
+ return emptyTranslationRestorer();
55
+ const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;
56
+ if (baselines === undefined)
57
+ return emptyTranslationRestorer();
58
+ const translated = [];
59
+ visitElements(root, (element) => {
60
+ const text = baselines.get(element);
61
+ const path = elementPath(root, element);
62
+ if (text === undefined || path === null)
63
+ return;
64
+ for (const [index, baseline] of text) {
65
+ const node = textNodeAt(element, index);
66
+ if (node === undefined || node.data === baseline)
67
+ continue;
68
+ translated.push({ baseline, index, path, translated: node.data });
69
+ node.data = baseline;
70
+ }
71
+ });
72
+ return translationRestorer(() => {
73
+ for (const snapshot of translated) {
74
+ const parent = elementAtPath(root, snapshot.path);
75
+ if (parent === null)
76
+ continue;
77
+ const node = textNodeAt(parent, snapshot.index);
78
+ if (node !== undefined && node.data === snapshot.baseline)
79
+ node.data = snapshot.translated;
80
+ }
81
+ }, translated.length > 0);
82
+ };
83
+
84
+ export { captureSsrTextBaselines, prepareBrowserTranslationHydration };
85
+
86
+ //# debugId=7A942374163F685B64756E2164756E21
87
+ //# sourceMappingURL=index-5py90ctf.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/client/browserTranslation.ts"],
4
+ "sourcesContent": [
5
+ "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"
6
+ ],
7
+ "mappings": ";AAkBA,IAAM,sBAAsB,CAAC,SAAqB,mBACjD,OAAO,OAAO,SAAS,EAAE,eAAe,CAAC;AAE1C,IAAM,2BAA2B,MAChC,oBAAoB,MAAG;AAAA,EAAG;AAAA,GAAW,KAAK;AAE3C,IAAM,aAAa,CAAC,QAAiB,UAAkB;AAAA,EACtD,MAAM,OAAO,OAAO,WAAW;AAAA,EAE/B,OAAO,gBAAgB,OAAO,OAAO;AAAA;AAGtC,IAAM,gBAAgB,CAAC,MAAe,UAAsC;AAAA,EAC3E,MAAM,IAAI;AAAA,EACV,WAAW,WAAW,KAAK,iBAAiB,GAAG;AAAA,IAAG,MAAM,OAAO;AAAA;AAGhE,IAAM,cAAc,CAAC,MAAe,YAAqB;AAAA,EACxD,MAAM,OAAiB,CAAC;AAAA,EACxB,IAAI,UAAU;AAAA,EACd,OAAO,YAAY,MAAM;AAAA,IACxB,MAAM,SAAS,QAAQ;AAAA,IACvB,IAAI,WAAW;AAAA,MAAM,OAAO;AAAA,IAC5B,KAAK,QAAQ,CAAC,GAAG,OAAO,QAAQ,EAAE,QAAQ,OAAO,CAAC;AAAA,IAClD,UAAU;AAAA,EACX;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