@ng-native/platform 0.17.1 → 0.18.1

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/adapter.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * `bootstrap.test.ts` asserts each one still exists, so an upgrade fails there rather than on a
7
7
  * device.
8
8
  */
9
- import { ApplicationRef, Renderer2, RendererFactory2, type Binding, type ComponentRef, type EnvironmentProviders, type Provider, type Type } from '@angular/core';
9
+ import { ApplicationRef, Renderer2, RendererFactory2, type Binding, type ComponentRef, type EnvironmentProviders, type ListenerOptions, type Provider, type Type } from '@angular/core';
10
10
  import { Engine, type EngineNode, type EngineOptions, type FabricUIManager } from '@ng-native/fabric';
11
11
  /** What a package outside core changes about how a template is rendered. */
12
12
  export interface RendererExtension {
@@ -23,8 +23,10 @@ export interface RendererExtension {
23
23
  /**
24
24
  * Take a listener over: answer what removes it, or nothing to leave it to the renderer. The
25
25
  * target is a node, or the name Angular gives a global one: `'window'`, `'document'`, `'body'`.
26
+ * The options are what a script gave `Renderer2.listen`: whether the listener hears the event
27
+ * as it goes down, once only, and passively.
26
28
  */
27
- listen?(target: EngineNode | string, eventName: string, callback: (event: unknown) => boolean | void, engine: Engine): (() => void) | undefined;
29
+ listen?(target: EngineNode | string, eventName: string, callback: (event: unknown) => boolean | void, engine: Engine, options?: ListenerOptions): (() => void) | undefined;
28
30
  /**
29
31
  * Told of each element a template creates, before it has attributes or children: where an
30
32
  * element gets what it has for its name alone, as a `button` has its role.
package/dist/adapter.js CHANGED
@@ -10,9 +10,10 @@ import { APP_BOOTSTRAP_LISTENER, ApplicationInitStatus, ApplicationRef, DOCUMENT
10
10
  import { installDateParse } from "./date-parse.js";
11
11
  import { inertImplementation } from "./inert-document.js";
12
12
  import { PLATFORM_NATIVE_ID } from "./platform-id.js";
13
- import { Engine, firstFamily, HostEngine, installDeferTriggers, installNodeGlobal, markComponentHost, nativePlatform, onFontsRegistered, onFontsSettled, reportUnboundFormsInput, styleSheetOf, } from '@ng-native/fabric';
13
+ import { Engine, firstFamily, HostEngine, installDeferTriggers, installNodeGlobal, markComponentHost, nativePlatform, onFontsRegistered, onFontsSettled, platformColourOf, reportUnboundFormsInput, styleSheetOf, } from '@ng-native/fabric';
14
14
  import { calmLoadingBanner } from "./dev-loading-view.js";
15
15
  import { installHotEpoch } from "./hot-epoch.js";
16
+ import { onSurfaceStop } from "./surface-stop.js";
16
17
  /**
17
18
  * Angular `(touchEnd)` -> Fabric `topTouchEnd`.
18
19
  *
@@ -54,7 +55,13 @@ const styleValue = (value) => typeof value !== 'string'
54
55
  */
55
56
  const declaredValue = (key, value) => key === 'fontFamily' && typeof value === 'string'
56
57
  ? (firstFamily(value) ?? value)
57
- : styleValue(value);
58
+ : (platformColour(key, value) ?? styleValue(value));
59
+ const COLOUR_KEY = /color$/i;
60
+ /**
61
+ * `platform-color(link)` in a colour property, as the stylesheet holds it: the names, which the
62
+ * engine gives the platform's shape. Written as text, native reads no colour from it.
63
+ */
64
+ const platformColour = (key, value) => typeof value === 'string' && COLOUR_KEY.test(key) ? platformColourOf(value) : undefined;
58
65
  /**
59
66
  * A bound custom property's name, as it was written. Angular 22 compiles `[style.--tint]` to
60
67
  * `--%NS%tint`, for a DOM renderer to fill with a namespace; there is none here.
@@ -428,16 +435,25 @@ class NativeRenderer {
428
435
  setValue(node, value) {
429
436
  this.engine.setText(node, value);
430
437
  }
431
- listen(target, eventName, callback) {
438
+ listen(target, eventName, callback, options) {
432
439
  for (const extension of extensions) {
433
- const unlisten = extension.listen?.(target, eventName, callback, this.engine);
440
+ const unlisten = extension.listen?.(target, eventName, callback, this.engine, options);
434
441
  if (unlisten)
435
442
  return unlisten;
436
443
  }
437
444
  // Angular's names for a global target, 'window', 'document' and 'body': there is none here.
438
445
  if (typeof target === 'string')
439
446
  return () => { };
440
- return this.engine.setEventListener(target, topLevelType(eventName), callback);
447
+ // `once` taken off before the first call: the engine keeps a listener until it is told.
448
+ let unlisten = () => { };
449
+ const listener = options?.once
450
+ ? (event) => {
451
+ unlisten();
452
+ return callback(event);
453
+ }
454
+ : callback;
455
+ unlisten = this.engine.setEventListener(target, topLevelType(eventName), listener);
456
+ return unlisten;
441
457
  }
442
458
  }
443
459
  /**
@@ -1067,6 +1083,18 @@ export function mount(rootTag, component, fabric, options = {}) {
1067
1083
  for (const [name, value] of Object.entries(inputs))
1068
1084
  componentRef.setInput(name, value);
1069
1085
  const applicationRef = injector.get(ApplicationRef);
1086
+ // The app goes with the surface it is on, which Fabric stops when, among others, Android
1087
+ // recreates the activity: see `surface-stop.ts`. What its destroy throws goes to its own
1088
+ // `ErrorHandler`, looked up while the app can still answer, rather than into Fabric's call.
1089
+ applicationRef.onDestroy(onSurfaceStop(rootTag, () => {
1090
+ const errors = injector.get(ErrorHandler);
1091
+ try {
1092
+ applicationRef.destroy();
1093
+ }
1094
+ catch (error) {
1095
+ errors.handleError(error);
1096
+ }
1097
+ }));
1070
1098
  // `ApplicationRef.bootstrap()` does all of this; `createComponent` does not, and we
1071
1099
  // deliberately do not use `bootstrap()` because it wants a DOM selector. Order and
1072
1100
  // bookkeeping both matter, so this mirrors `_loadComponent` step for step.
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,WAAW,EAQX,8BAA8B,IAAI,6BAA6B,EAC/D,eAAe,IAAI,cAAc,EACjC,uCAAuC,IAAI,sCAAsC,EACjF,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAq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CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACjD,0FAA0F;IAC1F,mFAAmF;IACnF,cAAc,CAAC,IAAI,EAAE,CAAC;IACtB,0FAA0F;IAC1F,yFAAyF;IACzF,gFAAgF;IAChF,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,8FAA8F;IAC9F,iDAAiD;IACjD,MAAM,SAAS,GAAG,iBAAiB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpF,MAAM,WAAW,GAAG,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChF,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;QAC1B,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;QACd,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACjD,MAAM,EAAE,GAAG,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC3D,IAAI,EAAE,KAAK,CAAC,CAAC;YAAE,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC;QAChE,QAAQ,CAAC,YAAY,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Where the engine meets Angular, which the engine itself never imports: Renderer2 over the\n * engine, plus bootstrap.\n *\n * Bootstrap leans on private `ɵ` exports of `@angular/core`, which can change in any major.\n * `bootstrap.test.ts` asserts each one still exists, so an upgrade fails there rather than on a\n * device.\n */\nimport {\n APP_BOOTSTRAP_LISTENER,\n ApplicationInitStatus,\n ApplicationRef,\n DOCUMENT,\n ErrorHandler,\n LOCALE_ID,\n Renderer2,\n RendererFactory2,\n createComponent,\n createEnvironmentInjector,\n PLATFORM_ID,\n type Binding,\n type ComponentRef,\n type EnvironmentInjector,\n type EnvironmentProviders,\n type Provider,\n type RendererStyleFlags2,\n type Type,\n ɵcreateOrReusePlatformInjector as createOrReusePlatformInjector,\n ɵINJECTOR_SCOPE as INJECTOR_SCOPE,\n ɵprovideZonelessChangeDetectionInternal as provideZonelessChangeDetectionInternal,\n ɵsetDocument as setDocument,\n ɵsetLocaleId as setLocaleId,\n} from '@angular/core';\nimport { installDateParse } from './date-parse.ts';\nimport { inertImplementation } from './inert-document.ts';\nimport { PLATFORM_NATIVE_ID } from './platform-id.ts';\nimport {\n Engine,\n firstFamily,\n HostEngine,\n installDeferTriggers,\n installNodeGlobal,\n markComponentHost,\n nativePlatform,\n onFontsRegistered,\n onFontsSettled,\n reportUnboundFormsInput,\n styleSheetOf,\n type EngineNode,\n type EngineOptions,\n type FabricUIManager,\n type NativeAnimated,\n type StyleSheet,\n} from '@ng-native/fabric';\nimport { calmLoadingBanner, type LoadingBanner } from './dev-loading-view.ts';\nimport { installHotEpoch } from './hot-epoch.ts';\n\n/**\n * Angular `(touchEnd)` -> Fabric `topTouchEnd`.\n *\n * There is no alias for `press`: `onPress` is not a native event, RN synthesises it in JS from\n * the touch responder system. `Pressable` in `components.ts` does the same, and because Angular\n * resolves a directive output before an element event, `(press)` on a `<pressable>` binds to\n * that output rather than reaching the renderer at all.\n */\nfunction topLevelType(eventName: string): string {\n return 'top' + eventName.charAt(0).toUpperCase() + eventName.slice(1);\n}\n\n/**\n * What Angular's compiler emits for a style binding is aimed at the DOM: `[style.font-size]`\n * arrives dash-cased, and `[style.width.px]` arrives as the string `'10px'`. Fabric reads\n * camelCase keys and plain numbers, and drops both forms without a word.\n */\nconst PX = /^-?\\d*\\.?\\d+px$/;\nconst NUMBER = /^-?\\d*\\.?\\d+$/;\nconst REM = /^-?\\d*\\.?\\d+rem$/;\nconst styleKey = (name: string): string =>\n name.includes('-') ? name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase()) : name;\n/**\n * A bare number arrives as a string too, and Yoga wants a number. A `rem` is 16 points, as in a\n * stylesheet, so it needs no font size in scope.\n *\n * Angular parses `[style]=\"'flex: 1'\"` itself and calls `setStyle('flex', '1')`, so the same\n * declaration written as an object gave `1` and written as a string gave `'1'` - the two spellings\n * of one design disagreeing at the only layer that can tell.\n */\nconst styleValue = (value: unknown): unknown =>\n typeof value !== 'string'\n ? value\n : PX.test(value) || NUMBER.test(value)\n ? parseFloat(value)\n : REM.test(value)\n ? parseFloat(value) * 16\n : value;\n/**\n * A `font-family` is a stack, quoted or not, where native takes one family by name: the first,\n * unquoted, as a stylesheet rule commits it. Left as written, `'Inter-Bold'` names no font.\n */\nconst declaredValue = (key: string, value: unknown): unknown =>\n key === 'fontFamily' && typeof value === 'string'\n ? (firstFamily(value) ?? value)\n : styleValue(value);\n\n/**\n * A bound custom property's name, as it was written. Angular 22 compiles `[style.--tint]` to\n * `--%NS%tint`, for a DOM renderer to fill with a namespace; there is none here.\n */\nconst customPropertyName = (style: string): string => style.replace(/%NS%/g, '');\n\nconst IMPORTANT = /!\\s*important\\s*$/i;\n\n/**\n * `flex: 1; margin-top: 4px` -> `{ flex: 1, marginTop: 4 }`.\n *\n * Only the static-attribute path needs this. Angular compiles `[style]` and `[style.x]` into\n * styling instructions that parse the string themselves and arrive one declaration at a time; a\n * *static* `style=\"...\"` is not a binding at all, so it comes through `setAttribute` whole.\n *\n * Splitting on `;` and `:` rather than parsing properly, because the values that reach here are\n * lengths, numbers, keywords, colours and font families. A `url()` or a family name containing\n * either character would be cut in the wrong place.\n */\nfunction parseStyleAttribute(css: string): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const declaration of css.split(';')) {\n const at = declaration.indexOf(':');\n if (at === -1) continue;\n const name = declaration.slice(0, at).trim();\n // `!important` comes off as Angular takes it off a bound value, which `setStyle` reads alike.\n // ponytail: neither is ranked above a rule's own `!important`, as a browser ranks it.\n const value = declaration\n .slice(at + 1)\n .replace(IMPORTANT, '')\n .trim();\n // A custom property keeps its name, which is case-sensitive, and its text for the engine.\n // Any other is left as written, for `setStyle` to read as it reads a bound one.\n if (name) out[name.startsWith('--') ? name : styleKey(name)] = value;\n }\n return out;\n}\n\nconst SIDES = ['Top', 'Right', 'Bottom', 'Left'] as const;\nconst SHORTHANDS = new Set(['padding', 'margin', 'inset', 'gap']);\n\n/** CSS whitespace, which a no-break space is not. */\nconst CSS_SPACE = /[ \\t\\n\\r\\f]/;\n\n/** The values in `text`, split on CSS whitespace outside parentheses: `4px calc(2px + 2px)` is two. */\nfunction cssValues(text: string): string[] {\n const parts: string[] = [];\n let part = '';\n let depth = 0;\n for (const char of text) {\n if (depth === 0 && CSS_SPACE.test(char)) {\n if (part) parts.push(part);\n part = '';\n continue;\n }\n if (char === '(') depth++;\n else if (char === ')') depth = Math.max(0, depth - 1);\n part += char;\n }\n if (part) parts.push(part);\n return parts;\n}\n\n/** A shorthand with more values than it takes, which a browser drops whole. */\nconst REFUSED = 'refused';\n\n/**\n * A shorthand written with a value for each side, `padding: 4px 8px`, as the longhands native\n * reads: it takes one number for `padding`, and drops the text. Null for one value, which native\n * takes as it is, and for a value holding a `var()`, whose count is only known once it is settled.\n * `REFUSED` for more values than the shorthand takes.\n *\n * ponytail: `padding`, `margin`, `inset` and `gap`, the ones written this way in a style. A\n * stylesheet has every shorthand; add one here when a style needs it.\n */\nfunction longhands(key: string, value: unknown): [string, string][] | typeof REFUSED | null {\n if (!SHORTHANDS.has(key) || typeof value !== 'string' || /var\\(/i.test(value)) return null;\n const parts = cssValues(value);\n if (parts.length < 2) return null;\n if (parts.length > (key === 'gap' ? 2 : 4)) return REFUSED;\n const [first, second = first, third = first, fourth = second] = parts as [string, ...string[]];\n if (key === 'gap')\n return [\n ['rowGap', first],\n ['columnGap', second],\n ];\n return [first, second, third, fourth].map((part, side) => [\n key === 'inset' ? SIDES[side]!.toLowerCase() : `${key}${SIDES[side]!}`,\n part,\n ]);\n}\n\n/** The longhands each element's shorthand was last written as, to take out when it changes. */\nconst writtenAs = new WeakMap<EngineNode, Map<string, string[]>>();\n\n/** The declarations each element's `style` attribute made, to take out when it changes or goes. */\nconst attributeStyles = new WeakMap<EngineNode, readonly string[]>();\n\nclass NativeRenderer implements Renderer2 {\n readonly data: { [key: string]: unknown } = Object.create(null);\n destroyNode: (node: EngineNode) => void;\n\n private readonly engine: Engine;\n /** The creating component's compiled CSS. Elements this renderer makes are matched against it. */\n private readonly sheet: StyleSheet | null;\n\n constructor(engine: Engine, sheet: StyleSheet | null = null) {\n this.engine = engine;\n this.sheet = sheet;\n this.destroyNode = (node) => this.engine.destroyNode(node);\n }\n\n destroy(): void {}\n\n createElement(name: string, namespace?: string | null): EngineNode {\n const claimed = namespace && namers ? nameIn(name, namespace, this.engine) : undefined;\n const named = claimed ?? name;\n const node = this.engine.createElement(named, this.sheet);\n if (namespace && claimed !== undefined) {\n // Drawn as a library's drawing: see `EngineNode.namespace`.\n node.namespace = namespace;\n // Still the element it was written as to a stylesheet: a drawing's `text` is kept as another.\n if (named !== name) node.typeName = name;\n }\n if (extensions.length) {\n for (const extension of extensions) extension.created?.(node, this.engine);\n }\n return node;\n }\n\n createComment(): EngineNode {\n return this.engine.createAnchor();\n }\n\n createText(value: string): EngineNode {\n return this.engine.createText(value);\n }\n\n appendChild(parent: EngineNode, newChild: EngineNode): void {\n this.engine.appendChild(parent, newChild);\n if (extensions.length) this.inserted(parent, newChild);\n }\n\n insertBefore(parent: EngineNode, newChild: EngineNode, refChild: EngineNode | null): void {\n if (!parent) return;\n this.engine.insertBefore(parent, newChild, refChild);\n if (extensions.length) this.inserted(parent, newChild);\n }\n\n /** Tell the extensions a node was put under a parent. */\n private inserted(parent: EngineNode, child: EngineNode): void {\n for (const extension of extensions) extension.inserted?.(child, parent, this.engine);\n }\n\n removeChild(_parent: EngineNode | null, oldChild: EngineNode): void {\n // From the parent it has, as Angular's DOM renderer takes a node out: the parent it is\n // handed is whatever the caller had, and a library's may be no parent of it at all. One in\n // no parent is out already.\n if (!oldChild.parent) return;\n this.engine.removeChild(oldChild.parent, oldChild);\n if (extensions.length) {\n for (const extension of extensions) extension.removed?.(oldChild, this.engine);\n }\n }\n\n selectRootElement(selectorOrNode: string | EngineNode): EngineNode {\n if (typeof selectorOrNode !== 'string') return selectorOrNode;\n return this.engine.root;\n }\n\n parentNode(node: EngineNode): EngineNode | null {\n return this.engine.parentNode(node);\n }\n\n nextSibling(node: EngineNode): EngineNode | null {\n return this.engine.nextSibling(node);\n }\n\n setAttribute(el: EngineNode, name: string, value: string): void {\n // `class` drives selector matching, not a native prop: nothing on the native side reads it.\n if (name === 'class') {\n this.engine.setClasses(el, value);\n return;\n }\n /*\n * A *static* `style=\"flex: 1\"` is not a binding, so it never becomes a styling instruction -\n * it arrives here as one attribute holding the whole declaration list. Handing that string on\n * as the `style` prop meant Fabric received a string where it merges objects, which it drops\n * without a word: every static style in the codebase, and in this project's own doc comments,\n * was doing nothing at all.\n */\n if (name === 'style') {\n const declared = parseStyleAttribute(value);\n this.dropAttributeStyles(el, declared);\n for (const [key, next] of Object.entries(declared)) this.setStyle(el, key, next);\n attributeStyles.set(el, Object.keys(declared));\n return;\n }\n this.set(el, name, value);\n }\n\n removeAttribute(el: EngineNode, name: string): void {\n // What `setAttribute` made of each is what goes: neither was ever a prop.\n if (name === 'class') return this.engine.setClasses(el, '');\n if (name === 'style') {\n this.dropAttributeStyles(el, {});\n attributeStyles.delete(el);\n return;\n }\n this.set(el, name, null);\n }\n\n /** Set a prop, unless an extension takes the attribute or property it was written as. */\n private set(el: EngineNode, name: string, value: unknown): void {\n if (!extensions.length) return this.engine.setProp(el, name, value);\n for (const extension of extensions) {\n if (extension.set?.(el, name, value, this.engine)) return;\n }\n this.engine.setProp(el, name, value);\n }\n\n /** Takes out what an element's `style` attribute declared and `kept` does not. */\n private dropAttributeStyles(el: EngineNode, kept: Record<string, unknown>): void {\n for (const key of attributeStyles.get(el) ?? []) {\n if (!(key in kept)) this.removeStyle(el, key);\n }\n }\n\n addClass(el: EngineNode, name: string): void {\n this.engine.addClass(el, name);\n }\n\n removeClass(el: EngineNode, name: string): void {\n this.engine.removeClass(el, name);\n }\n\n setStyle(el: EngineNode, style: string, value: unknown, _flags?: RendererStyleFlags2): void {\n if (style.startsWith('--')) {\n this.engine.setCustomProperty(el, customPropertyName(style), value);\n return;\n }\n if (extensions.length && this.restyled(el, style, value)) return;\n // A number bound to the CSS name is a CSS number, a multiple of the font size, as a browser's\n // `style.setProperty` reads it. A style object's `lineHeight: 24` stays React Native's points.\n if (style === 'line-height' && typeof value === 'number') value = String(value);\n const key = styleKey(style);\n if (this.setShorthand(el, key, value)) return;\n // `setDeclaration`, written out: Angular calls this for every declaration of every bound\n // style, where the call more measured slower in `pnpm bench`. The two change together.\n if (this.engine.setBoundStyle(el, key, value)) return this.dropStyle(el, key);\n const next = declaredValue(key, value);\n const current = el.props['style'] as Record<string, unknown> | undefined;\n if (current && current === el.ownStyle) {\n if (current[key] === next) return;\n current[key] = next;\n this.engine.styleChanged(el, key);\n return;\n }\n const owned = { ...(current ?? {}), [key]: next };\n el.ownStyle = owned;\n this.engine.setProp(el, 'style', owned);\n }\n\n /**\n * Set one declaration of an element's inline style, by the key the view reads, as an extension\n * restyles it. `setStyle` does the same for the declaration Angular sets.\n */\n private setDeclaration(el: EngineNode, key: string, value: unknown): void {\n // A `var()` is for the cascade to settle, with the tokens in scope, not a value of the style.\n if (this.engine.setBoundStyle(el, key, value)) return this.dropStyle(el, key);\n const next = declaredValue(key, value);\n const current = el.props['style'] as Record<string, unknown> | undefined;\n if (current && current === el.ownStyle) {\n if (current[key] === next) return;\n current[key] = next;\n this.engine.styleChanged(el, key);\n return;\n }\n const owned = { ...(current ?? {}), [key]: next };\n el.ownStyle = owned;\n this.engine.setProp(el, 'style', owned);\n }\n\n /**\n * A shorthand with a value for each side, set as its sides, or dropped for more values than it\n * takes. False for any other declaration, which is set as it is.\n */\n private setShorthand(el: EngineNode, key: string, value: unknown): boolean {\n if (!SHORTHANDS.has(key)) return false;\n const sides = longhands(key, value);\n this.dropLonghands(el, key, sides === REFUSED ? null : sides);\n if (!sides) return false;\n this.removeStyle(el, key);\n if (sides === REFUSED) {\n const most = key === 'gap' ? 'two' : 'four';\n const why = `${key} takes ${most} values at most`;\n this.engine.reportDroppedDeclaration(key, String(value), el.tag, why);\n return true;\n }\n (writtenAs.get(el) ?? writtenAs.set(el, new Map()).get(el)!).set(\n key,\n sides.map(([side]) => side),\n );\n for (const [side, part] of sides) this.setStyle(el, side, part);\n return true;\n }\n\n removeStyle(el: EngineNode, style: string, _flags?: RendererStyleFlags2): void {\n if (style.startsWith('--')) {\n this.engine.setCustomProperty(el, customPropertyName(style), null);\n return;\n }\n if (extensions.length && this.restyled(el, style, null)) return;\n const key = styleKey(style);\n if (SHORTHANDS.has(key)) this.dropLonghands(el, key, null);\n this.dropDeclaration(el, key);\n }\n\n private dropDeclaration(el: EngineNode, key: string): void {\n this.engine.setBoundStyle(el, key, null);\n this.dropStyle(el, key);\n }\n\n /**\n * Ask the extensions what a declaration is set as: the first to answer has each of its\n * declarations set, or removed for a `null`, in place of the one written.\n */\n private restyled(el: EngineNode, style: string, value: unknown): boolean {\n for (const extension of extensions) {\n const declarations = extension.style?.(el, style, value, this.engine);\n if (!declarations) continue;\n for (const [key, next] of Object.entries(declarations)) {\n if (next == null) this.dropDeclaration(el, key);\n else this.setDeclaration(el, key, next);\n }\n return true;\n }\n return false;\n }\n\n /** Takes out the longhands `key` was written as, but for the ones it is about to be again. */\n private dropLonghands(el: EngineNode, key: string, next: [string, string][] | null): void {\n const written = writtenAs.get(el);\n const sides = written?.get(key);\n if (!sides) return;\n written!.delete(key);\n for (const side of sides) {\n if (!next?.some(([kept]) => kept === side)) this.removeStyle(el, side);\n }\n }\n\n /** Takes `key` out of an element's inline style, if it is there. */\n private dropStyle(el: EngineNode, key: string): void {\n const current = el.props['style'] as Record<string, unknown> | undefined;\n if (!current || !(key in current)) return;\n if (current === el.ownStyle) {\n delete current[key];\n this.engine.styleChanged(el);\n return;\n }\n const { [key]: _removed, ...rest } = current;\n el.ownStyle = rest;\n this.engine.setProp(el, 'style', rest);\n }\n\n setProperty(el: EngineNode, name: string, value: unknown): void {\n if (this.engine.dev) reportUnboundFormsInput(this.engine, el, name);\n this.set(el, name, value);\n }\n\n setValue(node: EngineNode, value: string): void {\n this.engine.setText(node, value);\n }\n\n listen(\n target: EngineNode | string,\n eventName: string,\n callback: (event: unknown) => boolean | void,\n ): () => void {\n for (const extension of extensions) {\n const unlisten = extension.listen?.(target, eventName, callback, this.engine);\n if (unlisten) return unlisten;\n }\n // Angular's names for a global target, 'window', 'document' and 'body': there is none here.\n if (typeof target === 'string') return () => {};\n return this.engine.setEventListener(target, topLevelType(eventName), callback);\n }\n}\n\n/** What a package outside core changes about how a template is rendered. */\nexport interface RendererExtension {\n /**\n * Answer the element a name stands for in a namespace, where it is another than the name\n * alone is: Angular creates an element written inside an `<svg>` in the `svg` namespace, and\n * a `<text>` there is the drawing's text, not the app's. An element an extension answers for,\n * with another name or its own, is a library's drawing to the engine, painted and given its\n * font as a browser does: see `EngineNode.namespace`. Undefined leaves it the app's own element.\n * Asked with the engine the element is created in, as every other member is, so an extension\n * answers for the apps that asked for it and leaves another app in the process alone.\n */\n named?(name: string, namespace: string, engine: Engine): string | undefined;\n /**\n * Take a listener over: answer what removes it, or nothing to leave it to the renderer. The\n * target is a node, or the name Angular gives a global one: `'window'`, `'document'`, `'body'`.\n */\n listen?(\n target: EngineNode | string,\n eventName: string,\n callback: (event: unknown) => boolean | void,\n engine: Engine,\n ): (() => void) | undefined;\n /**\n * Told of each element a template creates, before it has attributes or children: where an\n * element gets what it has for its name alone, as a `button` has its role.\n */\n created?(node: EngineNode, engine: Engine): void;\n /**\n * Told of each node put under a parent, the first time and each time it is moved: where an\n * element gets what depends on what holds it.\n */\n inserted?(node: EngineNode, parent: EngineNode, engine: Engine): void;\n /** Told of each node taken out of its parent by the renderer, once it is out. */\n removed?(node: EngineNode, engine: Engine): void;\n /**\n * Take an attribute or a property over, `null` for one being removed: answer true once it is\n * set as the props the element's view reads, as an `<input>`'s `value` is a text field's text.\n */\n set?(node: EngineNode, name: string, value: unknown, engine: Engine): boolean;\n /**\n * Take a bound style over, `null` for one being removed: answer the declarations it is set as,\n * by the keys the view reads, each `null` to remove it. As CSS's `inset-inline: 4px 8px` is a\n * `start` and an `end`.\n */\n style?(\n node: EngineNode,\n name: string,\n value: unknown,\n engine: Engine,\n ): Record<string, unknown> | undefined;\n}\n\n/**\n * Asked for their length before each is called: an app with none pays nothing an element. A new\n * array on each change, so an extension that takes itself away during a hook skips no other.\n */\nlet extensions: readonly RendererExtension[] = [];\n\n/** How many of the extensions name elements in a namespace: see `RendererExtension.named`. */\nlet namers = 0;\n\n/**\n * The element a name in a namespace stands for: the first extension's answer, or undefined where\n * none answers, which leaves it the app's own element.\n */\nfunction nameIn(name: string, namespace: string, engine: Engine): string | undefined {\n for (const extension of extensions) {\n const named = extension.named?.(name, namespace, engine);\n if (named) return named;\n }\n return undefined;\n}\n\n/**\n * Add to what the renderer does, for every app in the process. Returns what takes it away again.\n *\n * For a package that renders templates written for another host, as a web-compatibility layer\n * delivers a `click` from a press and gives `(document:keydown)` something to listen on. The\n * extensions are asked in the order they were added, and the first to answer takes the listener.\n */\nexport function extendRenderer(extension: RendererExtension): () => void {\n // An entry of this call's own: the same extension added twice is removed once by each.\n const entry: RendererExtension = {\n named: extension.named && ((...args) => extension.named?.(...args)),\n listen: (...args) => extension.listen?.(...args),\n created: (...args) => extension.created?.(...args),\n inserted: (...args) => extension.inserted?.(...args),\n removed: (...args) => extension.removed?.(...args),\n set: (...args) => extension.set?.(...args) ?? false,\n style: (...args) => extension.style?.(...args),\n };\n extensions = [...extensions, entry];\n if (entry.named) namers++;\n return () => {\n if (!extensions.includes(entry)) return;\n if (entry.named) namers--;\n extensions = extensions.filter((each) => each !== entry);\n };\n}\n\n/**\n * The slice of Angular's component definition `createRenderer` receives that says which element\n * names a template can legitimately contain. Private shape, read only to keep the engine's typo\n * check quiet, so a missing piece means \"nothing to declare\" rather than an error.\n */\ninterface ComponentDefLike {\n id?: string;\n type?: unknown;\n encapsulation?: number;\n /** The component's inputs, keyed by the name a template writes. */\n inputs?: object;\n tView?: {\n directiveRegistry?:\n readonly { selectors?: readonly (readonly unknown[])[]; inputs?: object }[] | null;\n } | null;\n ngContentSelectors?: readonly string[];\n}\n\n/** `ViewEncapsulation.None`'s value in a component definition. */\nconst NONE = 2;\n\n/** The attribute names in a projection selector such as `[listHeader]` or `text[slot=a]`. */\nconst PROJECTED_ATTRIBUTE = /\\[([^\\]=~|^$*\\s]+)/g;\n\nexport class NativeRendererFactory implements RendererFactory2 {\n private readonly renderer: NativeRenderer;\n /** One renderer per component type, because each carries its own stylesheet. */\n private readonly byComponent = new Map<string, NativeRenderer>();\n /** The global sheet each `ViewEncapsulation.None` component registered, which a hot swap replaces. */\n private readonly globalById = new Map<string, StyleSheet>();\n /** The scoped sheet each emulated or Shadow DOM component has, which a hot swap replaces. */\n private readonly scopedById = new Map<string, StyleSheet>();\n readonly engine: Engine;\n\n constructor(engine: Engine) {\n this.engine = engine;\n this.renderer = new NativeRenderer(engine);\n }\n\n /**\n * Angular hands us the component definition here, which is how emulated encapsulation gets\n * scoped: the renderer a component uses is bound to that component's compiled stylesheet, so\n * its elements match its rules and nobody else's.\n */\n createRenderer(host: unknown, type: ComponentDefLike | null): Renderer2 {\n const sheet = this.scopedSheetOf(type);\n\n // `host` is the element this component is mounted on, and Angular created it with the\n // *parent's* renderer, so it carries the parent's sheet. Tagging it here is the only moment\n // the two are both in hand, and it is what makes `:host` reachable at all.\n //\n // It is also the one sure sign that an element hosts a component, whatever the selector\n // that put it there, which is what tells an `<x-card>` from a typo.\n if (host && typeof host === 'object') {\n this.engine.setHostSheet(host as EngineNode, sheet);\n markComponentHost(host as EngineNode);\n this.keepInputAttributes(host as EngineNode, type);\n }\n if (type) this.declareElements(type);\n\n if (!sheet) return this.renderer;\n\n const key = type?.id ?? '';\n let renderer = this.byComponent.get(key);\n if (!renderer) {\n renderer = new NativeRenderer(this.engine, sheet);\n this.byComponent.set(key, renderer);\n }\n return renderer;\n }\n\n /**\n * Keep a static attribute that is one of the component's inputs off its host view.\n *\n * Angular gives `<app-field accessibilityLabel=\"Email\">` to the input and writes it to the host\n * element as well, which on a web page is an attribute only a selector reads and here is a prop:\n * a second element with the label, on a view that is only a container. It stays on the node for\n * `:host([variant])` to match. The component's host bindings have not run yet, so a prop by an\n * input's name is the static attribute, and a host binding that writes it later is committed.\n */\n private keepInputAttributes(host: EngineNode, def: ComponentDefLike | null): void {\n for (const input of Object.keys(def?.inputs ?? {})) this.engine.keepAsAttribute(host, input);\n }\n\n /**\n * The sheet a component's elements are matched against, or null.\n *\n * `ViewEncapsulation.None`: a browser adds the component's CSS to the document as written, so\n * its rules reach any element, its host by class among them, and `:host` matches nothing. Its\n * sheet is a global one, registered when the component first renders, and it has none of its\n * own. Shadow DOM stays scoped, as a shadow root scopes it.\n */\n private scopedSheetOf(type: ComponentDefLike | null): StyleSheet | null {\n const sheet = styleSheetOf(type?.type);\n const id = type?.id ?? '';\n this.swapScoped(id, type?.encapsulation === NONE ? null : sheet);\n const registered = this.globalById.get(id);\n if (!sheet || type?.encapsulation !== NONE) {\n // A hot swap that left the component no rules, or made it scoped: its old sheet goes, and a\n // scoped one takes its `@keyframes` over now, before anything plays them.\n if (registered) {\n this.engine.removeGlobalSheet(registered);\n if (sheet) this.engine.sheetReplaced(registered, sheet);\n }\n this.globalById.delete(id);\n return sheet;\n }\n this.engine.addGlobalSheet(sheet, registered);\n this.globalById.set(id, sheet);\n return null;\n }\n\n /**\n * Tell the engine when a hot swap gave a component another scoped sheet, or none, so the\n * `@keyframes` the old one defined go with it. Nothing changes without a hot swap.\n */\n private swapScoped(id: string, sheet: StyleSheet | null): void {\n const previous = this.scopedById.get(id);\n if (previous && previous !== sheet) this.engine.sheetReplaced(previous, sheet);\n if (sheet) this.scopedById.set(id, sheet);\n else this.scopedById.delete(id);\n }\n\n /**\n * Angular's HMR calls this before it recreates a hot-swapped component's views. The renderer\n * cached for that component is bound to the sheet it had, so an edited stylesheet would never\n * reach the recreated views without letting it go.\n */\n componentReplaced(id: string): void {\n this.byComponent.delete(id);\n }\n\n /** Component definitions whose templates have been looked through already. */\n private readonly declared = new WeakSet<object>();\n\n /**\n * Tell the engine every element name this component's template may select by tag.\n *\n * Angular builds a component's template view, with its directive registry resolved from the\n * component's `imports`, before it asks for the renderer, so the registry is in hand here and\n * before the template that uses those names runs. This is what keeps a directive that owns an\n * element without hosting a component, such as Angular's `router-outlet`, from reading as a\n * typo; a component host is marked directly instead, above.\n */\n private declareElements(def: ComponentDefLike): void {\n // Only once the template view exists. The root component asks for a renderer twice, first\n // without a host and before its template view is built, and marking it seen then would\n // skip the call that has the registry.\n const registry = def.tView?.directiveRegistry;\n if (!registry || this.declared.has(def)) return;\n this.declared.add(def);\n for (const directive of registry) {\n for (const selector of directive.selectors ?? []) {\n const tag = selector[0];\n if (typeof tag === 'string' && tag) this.engine.declareElement(tag);\n }\n }\n this.declareAttributes(def, registry);\n }\n\n /**\n * Tell the engine the attribute names that are Angular's rather than a native view's: what a\n * directive selects on or takes as an input, which Angular also writes to the node as a static\n * attribute, and what the component's `<ng-content select>` projects by.\n */\n private declareAttributes(\n def: ComponentDefLike,\n registry: NonNullable<NonNullable<ComponentDefLike['tView']>['directiveRegistry']>,\n ): void {\n for (const directive of registry) {\n for (const selector of directive.selectors ?? []) {\n for (const name of selector.filter((part, at) => at % 2 === 1)) {\n if (typeof name === 'string') this.engine.declareAttribute(name);\n }\n }\n for (const input of Object.keys(directive.inputs ?? {})) this.engine.declareAttribute(input);\n }\n for (const selector of def.ngContentSelectors ?? []) {\n for (const [, name] of selector.matchAll(PROJECTED_ATTRIBUTE)) {\n this.engine.declareAttribute(name!);\n }\n }\n }\n\n private renderStarted = 0;\n private frame = 0;\n\n /**\n * Drive CSS transitions.\n *\n * A transition is not a binding: nothing in Angular changes while one runs, so change detection\n * would never fire again and the animation would stop on its first frame. This pumps the engine\n * directly for as long as one has frames left, and commits each one.\n */\n private readonly pump = (): void => {\n this.frame = 0;\n // A frame has been drawn since, so every view committed before it has been seen.\n this.unseenSince = null;\n this.engine.advanceAnimations();\n // Also the commit for anything changed outside change detection. Angular's `animate.enter`\n // and `animate.leave` add their classes from an animation queue that runs after the render\n // pass, so without a frame behind it the class would sit on the node and never reach native.\n this.commit();\n // `pending` as well as `transitioning`: a transition's end listener runs after the commit\n // that finished it, and removing a leaving element is exactly what it tends to do.\n if (this.engine.animating || this.engine.pending) this.schedule();\n };\n\n private schedule(): void {\n if (this.frame) return;\n // `requestAnimationFrame` is a global in React Native. The fallback is for Node, where the\n // suite drives `advanceTransitions` itself and this never runs.\n const request =\n globalThis.requestAnimationFrame ??\n ((callback: FrameRequestCallback) => setTimeout(() => callback(Date.now()), 16));\n this.frame = request(this.pump) as unknown as number;\n }\n\n /**\n * A change that lands outside a render pass has no commit coming. The engine reports the moment\n * the tree goes dirty, and this arranges a frame for it, which is how the classes Angular's\n * animation queue adds after a pass reach native at all.\n */\n readonly commitSoon = (): void => {\n if (!this.rendering) this.schedule();\n };\n\n private rendering = false;\n /** How many commits there had been before the first that created a view no frame has drawn. */\n private unseenSince: number | null = null;\n private settling = false;\n\n /**\n * Commit, with the views created since the last frame was drawn taken as unseen: what this gives\n * them is where they start, and no transition runs toward it. A browser computes no style for an\n * element before the frame after it was inserted, so a class added before then, in the same\n * task or in another, starts nothing either. A view this commit creates is unseen until the next\n * frame, which is asked for here.\n */\n private commit(): boolean {\n const before = this.engine.stats.commits;\n const created = this.engine.stats.createdNodes;\n const since = this.unseenSince;\n const committed = since === null ? this.engine.commit() : this.engine.commitUnseen(since);\n if (since === null && this.engine.stats.createdNodes !== created) {\n this.unseenSince = before;\n this.schedule();\n }\n return committed;\n }\n\n /**\n * Commit what the rest of this turn changes before a frame is drawn, rather than a frame later.\n *\n * Angular's `animate.enter` adds its class from a queue that runs after the render pass, so the\n * element has been committed once without it. Committed again in the same turn, the class is on\n * the view's first frame, and the engine starts the view there instead of easing to it.\n */\n private settleTurn(): void {\n if (this.settling) return;\n this.settling = true;\n queueMicrotask(() => {\n this.settling = false;\n if (!this.engine.pending) return;\n this.commit();\n if (this.engine.animating) this.schedule();\n });\n }\n\n /** How many change-detection passes are under way, one inside another. */\n private passes = 0;\n\n begin(): void {\n if (this.passes++ > 0) return;\n this.rendering = true;\n this.renderStarted = globalThis.performance?.now?.() ?? Date.now();\n }\n\n /**\n * The single commit point: at most one commit per change-detection pass. A pass begun inside\n * another, a `detectChanges()` called from a lifecycle hook, is part of the one around it and\n * commits with it: a library that calls it from every `ngAfterViewInit` would otherwise commit\n * the screen once for each of its components as the screen is first built.\n */\n end(): void {\n if (this.passes > 0 && --this.passes > 0) return;\n this.rendering = false;\n if (this.commit()) this.settleTurn();\n\n // A commit is what starts a transition, because it is where the cascade is recomputed.\n if (this.engine.animating) this.schedule();\n\n // Excludes the mount, which is not representative of a steady-state frame.\n const elapsed = (globalThis.performance?.now?.() ?? Date.now()) - this.renderStarted;\n const stats = this.engine.stats;\n if (stats.commits > 1 && elapsed > stats.worstRenderMs) stats.worstRenderMs = elapsed;\n }\n}\n\nexport interface MountResult {\n componentRef: ComponentRef<unknown>;\n applicationRef: ApplicationRef;\n factory: NativeRendererFactory;\n engine: Engine;\n}\n\n/**\n * Angular decides whether `animate.enter` and `animate.leave` do anything when `@angular/core` is\n * first evaluated, by reading a global that a Metro polyfill has to have set by then. Nothing\n * later can change the answer, so the most that can be done is to notice and say so. Checked here\n * because booting is the one moment every app passes through.\n */\nfunction warnIfAnimationsAreOff(): void {\n const document = (globalThis as { document?: { documentElement?: { getAnimations?: unknown } } })\n .document;\n if (typeof document?.documentElement?.getAnimations === 'function') return;\n console.error(\n '[angular-native] `animate.enter` and `animate.leave` will do nothing: Angular reads ' +\n 'whether to support them when it is first imported, before anything here runs. Build ' +\n 'metro.config.js with `withAngularNative` from `@ng-native/metro/config.cjs`, which ' +\n 'adds the polyfill that sets it. Animated styles and CSS transitions work either way.',\n );\n}\n\ndeclare const __DEV__: boolean | undefined;\n\n/**\n * The reload the HMR block falls back to when a change is more than a template.\n *\n * Each compiled component module can patch its own live class when only the template moved. For\n * anything else - a new method, a changed selector, different imports - there is no metadata to\n * replace, so it calls `globalThis.__angularNativeReload` instead. React Native's own Fast Refresh\n * cannot cover for it: that is React-specific, and it accepts the update and reports success, so\n * Metro never falls back on its own.\n *\n * This is installed here because `mount` is the one call every app makes. It used to be a line in\n * an example app's entry file, which meant every other app logged \"hmr reload\", called an empty\n * function, and carried on running the code from before the edit - with a second copy of every\n * class in the changed file now loaded, which Angular reports as `NG0912`. An edit that ships and\n * does nothing is a bad enough failure; one that also makes the next few screenshots lie about\n * what the app is running is worse.\n *\n * An app that sets its own is left alone: it will have a better reason string than this one.\n */\nfunction installReloadHook(): void {\n reloadMetroThroughExpo();\n const scope = globalThis as { __angularNativeReload?: () => void };\n if (scope.__angularNativeReload) return;\n scope.__angularNativeReload = () => afterParking(reloadApp);\n}\n\n/**\n * Reload once the router has left its history with the dev server, for the app that comes back\n * to open on the page this one was showing. The router sets the hook, in development; with no\n * router there is nothing to wait for. A history that could not be left is no reason not to reload.\n */\nfunction afterParking(reload: () => void): void {\n const park = (globalThis as { __angularNativePark?: () => Promise<void> }).__angularNativePark;\n if (!park) return reload();\n void park().then(reload, reload);\n}\n\n/** Longer than any history takes to go back through; an app is never left out of sight. */\nconst RESTORE_PATIENCE = 5000;\n\n/**\n * Keep the app out of sight while the router goes back through the history a reload left, so it\n * comes back on the page it was showing rather than on its first page with the others arriving\n * over it one by one. The router says when it is done, in development; with no router, or on a\n * start no reload led to, that is at once or never asked.\n */\nfunction hideWhileRestoring(hide: (hidden: boolean) => void): void {\n // The bare identifier, so a release build folds the rest away: see `mount`.\n if (typeof __DEV__ === 'undefined' || !__DEV__) return;\n const restoring = (globalThis as { __angularNativeRestoring?: Promise<void> })\n .__angularNativeRestoring;\n if (!restoring) return;\n hide(true);\n const show = () => hide(false);\n const patience = new Promise<void>((resolve) => setTimeout(resolve, RESTORE_PATIENCE));\n void Promise.race([restoring, patience]).then(show, show);\n}\n\n/**\n * How long after Expo says it reloaded the app that an app still running was not reloaded.\n * A reload takes the JavaScript runtime with it, so nothing here runs once one has begun.\n */\nconst STILL_HERE = 2000;\n\n/**\n * Reload through Expo, and through React Native when that does nothing.\n *\n * Expo's first. `DevSettings.reload()` under Expo Go on iOS re-runs the bundle the app downloaded\n * when it launched rather than fetching the current one, so the app comes back holding the code\n * from before the edit, and without Expo's native modules until Expo Go is relaunched.\n *\n * React Native's when Expo's rejects, and when it resolves and the app is still running. Under\n * Expo Go on Android `reloadAppAsync` resolves and reloads nothing, and the edit that asked for\n * the reload never arrived: the app went on running the code from before it.\n */\nfunction reloadThroughExpo(\n expo: (reason?: string) => Promise<void>,\n reason: string,\n reactNative: () => void,\n): void {\n let fellBack = false;\n const fallBack = (why: string, error?: unknown) => {\n if (fellBack) return;\n fellBack = true;\n console.error(`[angular-native] Expo's reload ${why}; reloading through React Native.`, error);\n reactNative();\n };\n expo(reason).then(\n () => setTimeout(() => fallBack('did nothing'), STILL_HERE),\n (error: unknown) => fallBack('failed', error),\n );\n}\n\n/**\n * Required rather than imported, both of them: React Native ships Flow, which Node cannot parse,\n * and this file has to stay importable by the test suite. Expo is genuinely optional.\n */\nfunction reloadApp(): void {\n const reason = 'angular-native: more than a template changed';\n const reactNative = () => {\n try {\n const { DevSettings } = require('react-native') as {\n DevSettings?: { reload(reason?: string): void };\n };\n DevSettings?.reload(reason);\n } catch {\n // No React Native under us: nothing to reload.\n }\n };\n let expo: ((reason?: string) => Promise<void>) | undefined;\n try {\n expo = (require('expo') as { reloadAppAsync?: typeof expo }).reloadAppAsync;\n } catch {\n // Not an Expo app. React Native's own reload does re-fetch outside Expo Go.\n }\n if (expo) reloadThroughExpo(expo, reason, reactNative);\n else reactNative();\n}\n\n/**\n * Metro's own reload, for an edit nothing accepted: a route file, a service, or a component the\n * hook above has already asked to reload. Metro calls React Native's Fast Refresh runtime, which\n * calls `DevSettings.reload()`, and in Expo Go that brings the app back without Expo's native\n * modules (`Cannot find native module 'ExpoFontLoader'`) until Expo Go is relaunched. Expo's\n * reload works in Expo Go and a development build alike, so in an Expo app Metro's goes through\n * it too. With or without Expo, it waits for the router to park its history: see `afterParking`.\n */\nconst THROUGH_EXPO = Symbol.for('ng-native.reloadThroughExpo');\n\nfunction reloadMetroThroughExpo(): void {\n const scope = globalThis as { __METRO_GLOBAL_PREFIX__?: string } & Record<string, unknown>;\n const refresh = scope[`${scope.__METRO_GLOBAL_PREFIX__ ?? ''}__ReactRefresh`] as\n { performFullRefresh?: ((reason: string) => void) & { [THROUGH_EXPO]?: true } } | undefined;\n const reactNative = refresh?.performFullRefresh;\n if (!refresh || !reactNative || reactNative[THROUGH_EXPO]) return;\n let reloadAppAsync: ((reason?: string) => Promise<void>) | undefined;\n try {\n ({ reloadAppAsync } = require('expo') as { reloadAppAsync?: typeof reloadAppAsync });\n } catch {\n // Not an Expo app: React Native's own reload re-fetches the bundle there.\n }\n const expo = reloadAppAsync;\n // Either way once the router has parked its history: see `afterParking`.\n const reload = (reason: string) =>\n afterParking(() => {\n const native = () => reactNative.call(refresh, reason);\n if (expo) reloadThroughExpo(expo, reason, native);\n else native();\n });\n reload[THROUGH_EXPO] = true as const;\n refresh.performFullRefresh = reload;\n}\n\n/** Dev only, and required rather than imported: React Native ships Flow, which Node cannot parse. */\nfunction calmDevBanner(): void {\n try {\n const { default: banner } = require('react-native/Libraries/Utilities/DevLoadingView') as {\n default?: LoadingBanner;\n };\n if (banner) calmLoadingBanner(banner);\n } catch {\n // No React Native under us: a test, or the web.\n }\n}\n\n/**\n * React Native's `NativeAnimatedHelper`, for the engine to move sticky headers by a scroll on the\n * native side. Required rather than imported for the same reason as the banner, and null where\n * there is no native animated module to talk to: a test, or the web.\n */\nfunction nativeAnimated(): NativeAnimated | null {\n try {\n const { default: helper } =\n require('react-native/src/private/animated/NativeAnimatedHelper') as {\n default?: NativeAnimated & { assertNativeAnimatedModule(): void };\n };\n if (!helper) return null;\n helper.assertNativeAnimatedModule();\n return helper;\n } catch {\n return null;\n }\n}\n\n/** The root component's host until its `:host` says otherwise. See `Engine.setDefaultStyle`. */\nconst ROOT_HOST_STYLE = { height: '100%' } as const;\n\n/**\n * Run the app's initializers, `provideAppInitializer` and `APP_INITIALIZER`, before the root\n * component exists, as `bootstrapApplication` does. `createEnvironmentInjector` runs only\n * environment initializers, so without this an app initializer silently never ran.\n *\n * Through Angular's own `ApplicationInitStatus`, so its `done` and `donePromise` stay true to what\n * happened for anything that waits on them. `runInitializers` is what Angular's bootstrap calls;\n * it is missing from the public types, which is why it is reached through a cast.\n *\n * An initializer that returns a promise is started, not awaited: `mount` is synchronous and the\n * first frame does not wait. One that fails reaches the `ErrorHandler` rather than vanishing.\n */\nfunction runInitializers(injector: EnvironmentInjector): void {\n const status = injector.get(ApplicationInitStatus);\n (status as unknown as { runInitializers(): void }).runInitializers();\n status.donePromise.catch((error: unknown) => injector.get(ErrorHandler).handleError(error));\n}\n\nexport function mount(\n rootTag: number,\n component: Type<unknown>,\n fabric: FabricUIManager,\n options: EngineOptions & {\n providers?: (Provider | EnvironmentProviders)[];\n /**\n * Root component inputs, set before its first change detection. That is the only moment a\n * `required` input can be given, and `mount` runs that first pass itself, so a caller cannot\n * set one afterwards. What `render()` in `@ng-native/testing` passes a component's inputs as.\n */\n inputs?: Record<string, unknown>;\n /**\n * Bindings for the root component, as `createComponent` takes them: `outputBinding()` for a\n * listener a template would bind. What `render()` passes its `on` as.\n */\n bindings?: Binding[];\n } = {},\n): MountResult {\n // The bare identifier, behind `typeof` so Node does not throw: Metro inlines `__DEV__` and folds\n // this branch away in a release build, and a property read through `globalThis` it cannot, which\n // left the reload hook and its `require('expo')` in every release bundle.\n if (typeof __DEV__ !== 'undefined' && __DEV__) {\n warnIfAnimationsAreOff();\n installReloadHook();\n installHotEpoch();\n calmDevBanner();\n }\n installDeferTriggers();\n installNodeGlobal();\n const { providers: extraProviders = [], inputs = {}, bindings, ...engineOptions } = options;\n // The factory needs the engine and the engine needs the factory's dirty hook, so the hook is\n // handed over once both exist rather than through the constructor.\n const engine = new Engine(fabric, rootTag, {\n ...engineOptions,\n nativeAnimated:\n engineOptions.nativeAnimated === undefined ? nativeAnimated() : engineOptions.nativeAnimated,\n });\n installDateParse(engine.dev);\n const factory = new NativeRendererFactory(engine);\n engine.setOnDirty(factory.commitSoon);\n // `getElementById` is what `TransferState` calls, and `TransferState` is what `resource()`\n // reaches for the moment one is created. Without it every resource in an app throws\n // `doc.getElementById is not a function` before its loader has run - which is a long way from\n // anything a stylesheet does, and is why the stub is not as thin as it looks.\n //\n // `implementation` is what the i18n runtime parses the cases of a plural or select with. It asks\n // Angular's own `getDocument()` rather than the injector, which answers the global `document`\n // the Metro polyfills define for animations until it is told of this one.\n const documentStub = {\n head: undefined,\n body: undefined,\n getElementById: () => null,\n implementation: inertImplementation,\n };\n setDocument(documentStub as unknown as Document);\n\n // Parent the app injector to the platform injector, exactly as `internalCreateApplication`\n // does. Some Angular services are `providedIn: 'platform'` - `Console` among them - and with a\n // null parent they simply do not exist: the router fails with NG0201 the moment it logs.\n const platformInjector = createOrReusePlatformInjector();\n\n const injector = createEnvironmentInjector(\n [\n // `INJECTOR_SCOPE` and `DOCUMENT` are both load-bearing: without the first Angular cannot\n // resolve `ChangeDetectionSchedulerImpl` (NG0201), without the second `getStyleHost` throws\n // NG0210.\n { provide: INJECTOR_SCOPE, useValue: 'root' },\n provideZonelessChangeDetectionInternal(),\n { provide: RendererFactory2, useValue: factory },\n // Exposed so a component can read commit stats, or reach a node for a native command.\n { provide: Engine, useValue: engine },\n // The contract the shared packages inject. `Engine` is still provided under its own token\n // for the three worklet components that need Fabric's own handles. See `fabric/host.ts`.\n { provide: HostEngine, useExisting: Engine },\n { provide: DOCUMENT, useValue: documentStub },\n // 'native', not Angular's default 'unknown': see `platform-id.ts`.\n { provide: PLATFORM_ID, useValue: PLATFORM_NATIVE_ID },\n { provide: ErrorHandler, useClass: ErrorHandler },\n ...extraProviders,\n ],\n // The platform injector is an EnvironmentInjector in practice; the factory's return type is\n // just declared more loosely.\n platformInjector as EnvironmentInjector,\n );\n\n // Errors the engine catches in its native event dispatch, which is outside every Angular\n // listener wrapper: responder handlers, engine-level listeners, a commit a focus change starts.\n // Looked up when one happens rather than now, as Angular's own handler is, so an app's\n // `ErrorHandler` that injects something not yet constructible is not forced at boot. A caller\n // that passed its own `onError` keeps it.\n if (!engineOptions.onError) {\n engine.setOnError((error) => injector.get(ErrorHandler).handleError(error));\n }\n\n runInitializers(injector);\n // The locale a template's plural picks its case by. Angular's own bootstrap tells the i18n\n // runtime the `LOCALE_ID`, and without it every language is counted by the rules of `en-US`.\n setLocaleId(injector.get(LOCALE_ID) || 'en-US');\n\n // What `@ng-native/tailwind`'s `ios:` and `android:` variants match beneath. On the root so\n // they work with nothing to set up; an app that had to add it itself, and did not, got platform\n // variants that silently matched nothing.\n engine.addClass(engine.root, `platform-${nativePlatform()}`);\n\n // No `hostElement`, so Angular creates the host from the selector as it does any other\n // component's, and it goes under the engine root as a view of its own. The engine root is the\n // surface and is never committed: as the host it took the component's `:host` rules and sent\n // them nowhere, so a root component's background and padding were dropped without a word.\n const componentRef = createComponent(component, {\n environmentInjector: injector,\n ...(bindings && { bindings }),\n });\n const host = componentRef.location.nativeElement as EngineNode;\n // The full height of the surface, as the web's mount point is given, so a template's `flex: 1`\n // still fills the screen. A height rather than `flex: 1`, which a `:host` height would lose to.\n // The app's own `:host` overrides it. Given under the root, which it is a share of.\n engine.appendChild(engine.root, host);\n engine.setDefaultStyle(host, ROOT_HOST_STYLE);\n hideWhileRestoring((hidden) => {\n engine.setDefaultStyle(host, hidden ? { ...ROOT_HOST_STYLE, opacity: 0 } : ROOT_HOST_STYLE);\n factory.commitSoon();\n });\n\n for (const [name, value] of Object.entries(inputs)) componentRef.setInput(name, value);\n\n const applicationRef = injector.get(ApplicationRef);\n\n // `ApplicationRef.bootstrap()` does all of this; `createComponent` does not, and we\n // deliberately do not use `bootstrap()` because it wants a DOM selector. Order and\n // bookkeeping both matter, so this mirrors `_loadComponent` step for step.\n applicationRef.componentTypes.push(component);\n applicationRef.attachView(componentRef.hostView);\n // Before the listeners, so the root component's template has run and any outlet in it has\n // registered itself by the time the router's initial navigation activates a route.\n applicationRef.tick();\n // Load-bearing, not bookkeeping: the router's bootstrap listener returns early unless the\n // ref it is handed is `ApplicationRef.components[0]`, so with an empty array the initial\n // navigation never runs and a routed app renders nothing but its outlet's host.\n applicationRef.components.push(componentRef);\n // Text laid out before its face registered is laid out again when it does: `loadFonts` is not\n // awaited before `mount` behind a splash screen.\n const stopFonts = onFontsRegistered((families) => engine.fontsRegistered(families));\n const stopSettled = onFontsSettled((families) => engine.fontsSettled(families));\n componentRef.onDestroy(() => {\n stopFonts();\n stopSettled();\n applicationRef.detachView(componentRef.hostView);\n const at = applicationRef.components.indexOf(componentRef);\n if (at !== -1) applicationRef.components.splice(at, 1);\n });\n\n for (const listener of injector.get(APP_BOOTSTRAP_LISTENER, [])) {\n listener(componentRef);\n }\n\n return { componentRef, applicationRef, factory, engine };\n}\n"]}
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,WAAW,EASX,8BAA8B,IAAI,6BAA6B,EAC/D,eAAe,IAAI,cAAc,EACjC,uCAAuC,IAAI,sCAAsC,EACjF,YAAY,IAAI,WAAW,E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QAAQ,CAAC,CAAC;IACjD,0FAA0F;IAC1F,mFAAmF;IACnF,cAAc,CAAC,IAAI,EAAE,CAAC;IACtB,0FAA0F;IAC1F,yFAAyF;IACzF,gFAAgF;IAChF,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,8FAA8F;IAC9F,iDAAiD;IACjD,MAAM,SAAS,GAAG,iBAAiB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpF,MAAM,WAAW,GAAG,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChF,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE;QAC1B,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;QACd,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACjD,MAAM,EAAE,GAAG,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC3D,IAAI,EAAE,KAAK,CAAC,CAAC;YAAE,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC;QAChE,QAAQ,CAAC,YAAY,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Where the engine meets Angular, which the engine itself never imports: Renderer2 over the\n * engine, plus bootstrap.\n *\n * Bootstrap leans on private `ɵ` exports of `@angular/core`, which can change in any major.\n * `bootstrap.test.ts` asserts each one still exists, so an upgrade fails there rather than on a\n * device.\n */\nimport {\n APP_BOOTSTRAP_LISTENER,\n ApplicationInitStatus,\n ApplicationRef,\n DOCUMENT,\n ErrorHandler,\n LOCALE_ID,\n Renderer2,\n RendererFactory2,\n createComponent,\n createEnvironmentInjector,\n PLATFORM_ID,\n type Binding,\n type ComponentRef,\n type EnvironmentInjector,\n type EnvironmentProviders,\n type ListenerOptions,\n type Provider,\n type RendererStyleFlags2,\n type Type,\n ɵcreateOrReusePlatformInjector as createOrReusePlatformInjector,\n ɵINJECTOR_SCOPE as INJECTOR_SCOPE,\n ɵprovideZonelessChangeDetectionInternal as provideZonelessChangeDetectionInternal,\n ɵsetDocument as setDocument,\n ɵsetLocaleId as setLocaleId,\n} from '@angular/core';\nimport { installDateParse } from './date-parse.ts';\nimport { inertImplementation } from './inert-document.ts';\nimport { PLATFORM_NATIVE_ID } from './platform-id.ts';\nimport {\n Engine,\n firstFamily,\n HostEngine,\n installDeferTriggers,\n installNodeGlobal,\n markComponentHost,\n nativePlatform,\n onFontsRegistered,\n onFontsSettled,\n platformColourOf,\n reportUnboundFormsInput,\n styleSheetOf,\n type EngineNode,\n type EngineOptions,\n type FabricUIManager,\n type NativeAnimated,\n type StyleSheet,\n} from '@ng-native/fabric';\nimport { calmLoadingBanner, type LoadingBanner } from './dev-loading-view.ts';\nimport { installHotEpoch } from './hot-epoch.ts';\nimport { onSurfaceStop } from './surface-stop.ts';\n\n/**\n * Angular `(touchEnd)` -> Fabric `topTouchEnd`.\n *\n * There is no alias for `press`: `onPress` is not a native event, RN synthesises it in JS from\n * the touch responder system. `Pressable` in `components.ts` does the same, and because Angular\n * resolves a directive output before an element event, `(press)` on a `<pressable>` binds to\n * that output rather than reaching the renderer at all.\n */\nfunction topLevelType(eventName: string): string {\n return 'top' + eventName.charAt(0).toUpperCase() + eventName.slice(1);\n}\n\n/**\n * What Angular's compiler emits for a style binding is aimed at the DOM: `[style.font-size]`\n * arrives dash-cased, and `[style.width.px]` arrives as the string `'10px'`. Fabric reads\n * camelCase keys and plain numbers, and drops both forms without a word.\n */\nconst PX = /^-?\\d*\\.?\\d+px$/;\nconst NUMBER = /^-?\\d*\\.?\\d+$/;\nconst REM = /^-?\\d*\\.?\\d+rem$/;\nconst styleKey = (name: string): string =>\n name.includes('-') ? name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase()) : name;\n/**\n * A bare number arrives as a string too, and Yoga wants a number. A `rem` is 16 points, as in a\n * stylesheet, so it needs no font size in scope.\n *\n * Angular parses `[style]=\"'flex: 1'\"` itself and calls `setStyle('flex', '1')`, so the same\n * declaration written as an object gave `1` and written as a string gave `'1'` - the two spellings\n * of one design disagreeing at the only layer that can tell.\n */\nconst styleValue = (value: unknown): unknown =>\n typeof value !== 'string'\n ? value\n : PX.test(value) || NUMBER.test(value)\n ? parseFloat(value)\n : REM.test(value)\n ? parseFloat(value) * 16\n : value;\n/**\n * A `font-family` is a stack, quoted or not, where native takes one family by name: the first,\n * unquoted, as a stylesheet rule commits it. Left as written, `'Inter-Bold'` names no font.\n */\nconst declaredValue = (key: string, value: unknown): unknown =>\n key === 'fontFamily' && typeof value === 'string'\n ? (firstFamily(value) ?? value)\n : (platformColour(key, value) ?? styleValue(value));\n\nconst COLOUR_KEY = /color$/i;\n\n/**\n * `platform-color(link)` in a colour property, as the stylesheet holds it: the names, which the\n * engine gives the platform's shape. Written as text, native reads no colour from it.\n */\nconst platformColour = (key: string, value: unknown): unknown =>\n typeof value === 'string' && COLOUR_KEY.test(key) ? platformColourOf(value) : undefined;\n\n/**\n * A bound custom property's name, as it was written. Angular 22 compiles `[style.--tint]` to\n * `--%NS%tint`, for a DOM renderer to fill with a namespace; there is none here.\n */\nconst customPropertyName = (style: string): string => style.replace(/%NS%/g, '');\n\nconst IMPORTANT = /!\\s*important\\s*$/i;\n\n/**\n * `flex: 1; margin-top: 4px` -> `{ flex: 1, marginTop: 4 }`.\n *\n * Only the static-attribute path needs this. Angular compiles `[style]` and `[style.x]` into\n * styling instructions that parse the string themselves and arrive one declaration at a time; a\n * *static* `style=\"...\"` is not a binding at all, so it comes through `setAttribute` whole.\n *\n * Splitting on `;` and `:` rather than parsing properly, because the values that reach here are\n * lengths, numbers, keywords, colours and font families. A `url()` or a family name containing\n * either character would be cut in the wrong place.\n */\nfunction parseStyleAttribute(css: string): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const declaration of css.split(';')) {\n const at = declaration.indexOf(':');\n if (at === -1) continue;\n const name = declaration.slice(0, at).trim();\n // `!important` comes off as Angular takes it off a bound value, which `setStyle` reads alike.\n // ponytail: neither is ranked above a rule's own `!important`, as a browser ranks it.\n const value = declaration\n .slice(at + 1)\n .replace(IMPORTANT, '')\n .trim();\n // A custom property keeps its name, which is case-sensitive, and its text for the engine.\n // Any other is left as written, for `setStyle` to read as it reads a bound one.\n if (name) out[name.startsWith('--') ? name : styleKey(name)] = value;\n }\n return out;\n}\n\nconst SIDES = ['Top', 'Right', 'Bottom', 'Left'] as const;\nconst SHORTHANDS = new Set(['padding', 'margin', 'inset', 'gap']);\n\n/** CSS whitespace, which a no-break space is not. */\nconst CSS_SPACE = /[ \\t\\n\\r\\f]/;\n\n/** The values in `text`, split on CSS whitespace outside parentheses: `4px calc(2px + 2px)` is two. */\nfunction cssValues(text: string): string[] {\n const parts: string[] = [];\n let part = '';\n let depth = 0;\n for (const char of text) {\n if (depth === 0 && CSS_SPACE.test(char)) {\n if (part) parts.push(part);\n part = '';\n continue;\n }\n if (char === '(') depth++;\n else if (char === ')') depth = Math.max(0, depth - 1);\n part += char;\n }\n if (part) parts.push(part);\n return parts;\n}\n\n/** A shorthand with more values than it takes, which a browser drops whole. */\nconst REFUSED = 'refused';\n\n/**\n * A shorthand written with a value for each side, `padding: 4px 8px`, as the longhands native\n * reads: it takes one number for `padding`, and drops the text. Null for one value, which native\n * takes as it is, and for a value holding a `var()`, whose count is only known once it is settled.\n * `REFUSED` for more values than the shorthand takes.\n *\n * ponytail: `padding`, `margin`, `inset` and `gap`, the ones written this way in a style. A\n * stylesheet has every shorthand; add one here when a style needs it.\n */\nfunction longhands(key: string, value: unknown): [string, string][] | typeof REFUSED | null {\n if (!SHORTHANDS.has(key) || typeof value !== 'string' || /var\\(/i.test(value)) return null;\n const parts = cssValues(value);\n if (parts.length < 2) return null;\n if (parts.length > (key === 'gap' ? 2 : 4)) return REFUSED;\n const [first, second = first, third = first, fourth = second] = parts as [string, ...string[]];\n if (key === 'gap')\n return [\n ['rowGap', first],\n ['columnGap', second],\n ];\n return [first, second, third, fourth].map((part, side) => [\n key === 'inset' ? SIDES[side]!.toLowerCase() : `${key}${SIDES[side]!}`,\n part,\n ]);\n}\n\n/** The longhands each element's shorthand was last written as, to take out when it changes. */\nconst writtenAs = new WeakMap<EngineNode, Map<string, string[]>>();\n\n/** The declarations each element's `style` attribute made, to take out when it changes or goes. */\nconst attributeStyles = new WeakMap<EngineNode, readonly string[]>();\n\nclass NativeRenderer implements Renderer2 {\n readonly data: { [key: string]: unknown } = Object.create(null);\n destroyNode: (node: EngineNode) => void;\n\n private readonly engine: Engine;\n /** The creating component's compiled CSS. Elements this renderer makes are matched against it. */\n private readonly sheet: StyleSheet | null;\n\n constructor(engine: Engine, sheet: StyleSheet | null = null) {\n this.engine = engine;\n this.sheet = sheet;\n this.destroyNode = (node) => this.engine.destroyNode(node);\n }\n\n destroy(): void {}\n\n createElement(name: string, namespace?: string | null): EngineNode {\n const claimed = namespace && namers ? nameIn(name, namespace, this.engine) : undefined;\n const named = claimed ?? name;\n const node = this.engine.createElement(named, this.sheet);\n if (namespace && claimed !== undefined) {\n // Drawn as a library's drawing: see `EngineNode.namespace`.\n node.namespace = namespace;\n // Still the element it was written as to a stylesheet: a drawing's `text` is kept as another.\n if (named !== name) node.typeName = name;\n }\n if (extensions.length) {\n for (const extension of extensions) extension.created?.(node, this.engine);\n }\n return node;\n }\n\n createComment(): EngineNode {\n return this.engine.createAnchor();\n }\n\n createText(value: string): EngineNode {\n return this.engine.createText(value);\n }\n\n appendChild(parent: EngineNode, newChild: EngineNode): void {\n this.engine.appendChild(parent, newChild);\n if (extensions.length) this.inserted(parent, newChild);\n }\n\n insertBefore(parent: EngineNode, newChild: EngineNode, refChild: EngineNode | null): void {\n if (!parent) return;\n this.engine.insertBefore(parent, newChild, refChild);\n if (extensions.length) this.inserted(parent, newChild);\n }\n\n /** Tell the extensions a node was put under a parent. */\n private inserted(parent: EngineNode, child: EngineNode): void {\n for (const extension of extensions) extension.inserted?.(child, parent, this.engine);\n }\n\n removeChild(_parent: EngineNode | null, oldChild: EngineNode): void {\n // From the parent it has, as Angular's DOM renderer takes a node out: the parent it is\n // handed is whatever the caller had, and a library's may be no parent of it at all. One in\n // no parent is out already.\n if (!oldChild.parent) return;\n this.engine.removeChild(oldChild.parent, oldChild);\n if (extensions.length) {\n for (const extension of extensions) extension.removed?.(oldChild, this.engine);\n }\n }\n\n selectRootElement(selectorOrNode: string | EngineNode): EngineNode {\n if (typeof selectorOrNode !== 'string') return selectorOrNode;\n return this.engine.root;\n }\n\n parentNode(node: EngineNode): EngineNode | null {\n return this.engine.parentNode(node);\n }\n\n nextSibling(node: EngineNode): EngineNode | null {\n return this.engine.nextSibling(node);\n }\n\n setAttribute(el: EngineNode, name: string, value: string): void {\n // `class` drives selector matching, not a native prop: nothing on the native side reads it.\n if (name === 'class') {\n this.engine.setClasses(el, value);\n return;\n }\n /*\n * A *static* `style=\"flex: 1\"` is not a binding, so it never becomes a styling instruction -\n * it arrives here as one attribute holding the whole declaration list. Handing that string on\n * as the `style` prop meant Fabric received a string where it merges objects, which it drops\n * without a word: every static style in the codebase, and in this project's own doc comments,\n * was doing nothing at all.\n */\n if (name === 'style') {\n const declared = parseStyleAttribute(value);\n this.dropAttributeStyles(el, declared);\n for (const [key, next] of Object.entries(declared)) this.setStyle(el, key, next);\n attributeStyles.set(el, Object.keys(declared));\n return;\n }\n this.set(el, name, value);\n }\n\n removeAttribute(el: EngineNode, name: string): void {\n // What `setAttribute` made of each is what goes: neither was ever a prop.\n if (name === 'class') return this.engine.setClasses(el, '');\n if (name === 'style') {\n this.dropAttributeStyles(el, {});\n attributeStyles.delete(el);\n return;\n }\n this.set(el, name, null);\n }\n\n /** Set a prop, unless an extension takes the attribute or property it was written as. */\n private set(el: EngineNode, name: string, value: unknown): void {\n if (!extensions.length) return this.engine.setProp(el, name, value);\n for (const extension of extensions) {\n if (extension.set?.(el, name, value, this.engine)) return;\n }\n this.engine.setProp(el, name, value);\n }\n\n /** Takes out what an element's `style` attribute declared and `kept` does not. */\n private dropAttributeStyles(el: EngineNode, kept: Record<string, unknown>): void {\n for (const key of attributeStyles.get(el) ?? []) {\n if (!(key in kept)) this.removeStyle(el, key);\n }\n }\n\n addClass(el: EngineNode, name: string): void {\n this.engine.addClass(el, name);\n }\n\n removeClass(el: EngineNode, name: string): void {\n this.engine.removeClass(el, name);\n }\n\n setStyle(el: EngineNode, style: string, value: unknown, _flags?: RendererStyleFlags2): void {\n if (style.startsWith('--')) {\n this.engine.setCustomProperty(el, customPropertyName(style), value);\n return;\n }\n if (extensions.length && this.restyled(el, style, value)) return;\n // A number bound to the CSS name is a CSS number, a multiple of the font size, as a browser's\n // `style.setProperty` reads it. A style object's `lineHeight: 24` stays React Native's points.\n if (style === 'line-height' && typeof value === 'number') value = String(value);\n const key = styleKey(style);\n if (this.setShorthand(el, key, value)) return;\n // `setDeclaration`, written out: Angular calls this for every declaration of every bound\n // style, where the call more measured slower in `pnpm bench`. The two change together.\n if (this.engine.setBoundStyle(el, key, value)) return this.dropStyle(el, key);\n const next = declaredValue(key, value);\n const current = el.props['style'] as Record<string, unknown> | undefined;\n if (current && current === el.ownStyle) {\n if (current[key] === next) return;\n current[key] = next;\n this.engine.styleChanged(el, key);\n return;\n }\n const owned = { ...(current ?? {}), [key]: next };\n el.ownStyle = owned;\n this.engine.setProp(el, 'style', owned);\n }\n\n /**\n * Set one declaration of an element's inline style, by the key the view reads, as an extension\n * restyles it. `setStyle` does the same for the declaration Angular sets.\n */\n private setDeclaration(el: EngineNode, key: string, value: unknown): void {\n // A `var()` is for the cascade to settle, with the tokens in scope, not a value of the style.\n if (this.engine.setBoundStyle(el, key, value)) return this.dropStyle(el, key);\n const next = declaredValue(key, value);\n const current = el.props['style'] as Record<string, unknown> | undefined;\n if (current && current === el.ownStyle) {\n if (current[key] === next) return;\n current[key] = next;\n this.engine.styleChanged(el, key);\n return;\n }\n const owned = { ...(current ?? {}), [key]: next };\n el.ownStyle = owned;\n this.engine.setProp(el, 'style', owned);\n }\n\n /**\n * A shorthand with a value for each side, set as its sides, or dropped for more values than it\n * takes. False for any other declaration, which is set as it is.\n */\n private setShorthand(el: EngineNode, key: string, value: unknown): boolean {\n if (!SHORTHANDS.has(key)) return false;\n const sides = longhands(key, value);\n this.dropLonghands(el, key, sides === REFUSED ? null : sides);\n if (!sides) return false;\n this.removeStyle(el, key);\n if (sides === REFUSED) {\n const most = key === 'gap' ? 'two' : 'four';\n const why = `${key} takes ${most} values at most`;\n this.engine.reportDroppedDeclaration(key, String(value), el.tag, why);\n return true;\n }\n (writtenAs.get(el) ?? writtenAs.set(el, new Map()).get(el)!).set(\n key,\n sides.map(([side]) => side),\n );\n for (const [side, part] of sides) this.setStyle(el, side, part);\n return true;\n }\n\n removeStyle(el: EngineNode, style: string, _flags?: RendererStyleFlags2): void {\n if (style.startsWith('--')) {\n this.engine.setCustomProperty(el, customPropertyName(style), null);\n return;\n }\n if (extensions.length && this.restyled(el, style, null)) return;\n const key = styleKey(style);\n if (SHORTHANDS.has(key)) this.dropLonghands(el, key, null);\n this.dropDeclaration(el, key);\n }\n\n private dropDeclaration(el: EngineNode, key: string): void {\n this.engine.setBoundStyle(el, key, null);\n this.dropStyle(el, key);\n }\n\n /**\n * Ask the extensions what a declaration is set as: the first to answer has each of its\n * declarations set, or removed for a `null`, in place of the one written.\n */\n private restyled(el: EngineNode, style: string, value: unknown): boolean {\n for (const extension of extensions) {\n const declarations = extension.style?.(el, style, value, this.engine);\n if (!declarations) continue;\n for (const [key, next] of Object.entries(declarations)) {\n if (next == null) this.dropDeclaration(el, key);\n else this.setDeclaration(el, key, next);\n }\n return true;\n }\n return false;\n }\n\n /** Takes out the longhands `key` was written as, but for the ones it is about to be again. */\n private dropLonghands(el: EngineNode, key: string, next: [string, string][] | null): void {\n const written = writtenAs.get(el);\n const sides = written?.get(key);\n if (!sides) return;\n written!.delete(key);\n for (const side of sides) {\n if (!next?.some(([kept]) => kept === side)) this.removeStyle(el, side);\n }\n }\n\n /** Takes `key` out of an element's inline style, if it is there. */\n private dropStyle(el: EngineNode, key: string): void {\n const current = el.props['style'] as Record<string, unknown> | undefined;\n if (!current || !(key in current)) return;\n if (current === el.ownStyle) {\n delete current[key];\n this.engine.styleChanged(el);\n return;\n }\n const { [key]: _removed, ...rest } = current;\n el.ownStyle = rest;\n this.engine.setProp(el, 'style', rest);\n }\n\n setProperty(el: EngineNode, name: string, value: unknown): void {\n if (this.engine.dev) reportUnboundFormsInput(this.engine, el, name);\n this.set(el, name, value);\n }\n\n setValue(node: EngineNode, value: string): void {\n this.engine.setText(node, value);\n }\n\n listen(\n target: EngineNode | string,\n eventName: string,\n callback: (event: unknown) => boolean | void,\n options?: ListenerOptions,\n ): () => void {\n for (const extension of extensions) {\n const unlisten = extension.listen?.(target, eventName, callback, this.engine, options);\n if (unlisten) return unlisten;\n }\n // Angular's names for a global target, 'window', 'document' and 'body': there is none here.\n if (typeof target === 'string') return () => {};\n // `once` taken off before the first call: the engine keeps a listener until it is told.\n let unlisten = () => {};\n const listener = options?.once\n ? (event: unknown) => {\n unlisten();\n return callback(event);\n }\n : callback;\n unlisten = this.engine.setEventListener(target, topLevelType(eventName), listener);\n return unlisten;\n }\n}\n\n/** What a package outside core changes about how a template is rendered. */\nexport interface RendererExtension {\n /**\n * Answer the element a name stands for in a namespace, where it is another than the name\n * alone is: Angular creates an element written inside an `<svg>` in the `svg` namespace, and\n * a `<text>` there is the drawing's text, not the app's. An element an extension answers for,\n * with another name or its own, is a library's drawing to the engine, painted and given its\n * font as a browser does: see `EngineNode.namespace`. Undefined leaves it the app's own element.\n * Asked with the engine the element is created in, as every other member is, so an extension\n * answers for the apps that asked for it and leaves another app in the process alone.\n */\n named?(name: string, namespace: string, engine: Engine): string | undefined;\n /**\n * Take a listener over: answer what removes it, or nothing to leave it to the renderer. The\n * target is a node, or the name Angular gives a global one: `'window'`, `'document'`, `'body'`.\n * The options are what a script gave `Renderer2.listen`: whether the listener hears the event\n * as it goes down, once only, and passively.\n */\n listen?(\n target: EngineNode | string,\n eventName: string,\n callback: (event: unknown) => boolean | void,\n engine: Engine,\n options?: ListenerOptions,\n ): (() => void) | undefined;\n /**\n * Told of each element a template creates, before it has attributes or children: where an\n * element gets what it has for its name alone, as a `button` has its role.\n */\n created?(node: EngineNode, engine: Engine): void;\n /**\n * Told of each node put under a parent, the first time and each time it is moved: where an\n * element gets what depends on what holds it.\n */\n inserted?(node: EngineNode, parent: EngineNode, engine: Engine): void;\n /** Told of each node taken out of its parent by the renderer, once it is out. */\n removed?(node: EngineNode, engine: Engine): void;\n /**\n * Take an attribute or a property over, `null` for one being removed: answer true once it is\n * set as the props the element's view reads, as an `<input>`'s `value` is a text field's text.\n */\n set?(node: EngineNode, name: string, value: unknown, engine: Engine): boolean;\n /**\n * Take a bound style over, `null` for one being removed: answer the declarations it is set as,\n * by the keys the view reads, each `null` to remove it. As CSS's `inset-inline: 4px 8px` is a\n * `start` and an `end`.\n */\n style?(\n node: EngineNode,\n name: string,\n value: unknown,\n engine: Engine,\n ): Record<string, unknown> | undefined;\n}\n\n/**\n * Asked for their length before each is called: an app with none pays nothing an element. A new\n * array on each change, so an extension that takes itself away during a hook skips no other.\n */\nlet extensions: readonly RendererExtension[] = [];\n\n/** How many of the extensions name elements in a namespace: see `RendererExtension.named`. */\nlet namers = 0;\n\n/**\n * The element a name in a namespace stands for: the first extension's answer, or undefined where\n * none answers, which leaves it the app's own element.\n */\nfunction nameIn(name: string, namespace: string, engine: Engine): string | undefined {\n for (const extension of extensions) {\n const named = extension.named?.(name, namespace, engine);\n if (named) return named;\n }\n return undefined;\n}\n\n/**\n * Add to what the renderer does, for every app in the process. Returns what takes it away again.\n *\n * For a package that renders templates written for another host, as a web-compatibility layer\n * delivers a `click` from a press and gives `(document:keydown)` something to listen on. The\n * extensions are asked in the order they were added, and the first to answer takes the listener.\n */\nexport function extendRenderer(extension: RendererExtension): () => void {\n // An entry of this call's own: the same extension added twice is removed once by each.\n const entry: RendererExtension = {\n named: extension.named && ((...args) => extension.named?.(...args)),\n listen: (...args) => extension.listen?.(...args),\n created: (...args) => extension.created?.(...args),\n inserted: (...args) => extension.inserted?.(...args),\n removed: (...args) => extension.removed?.(...args),\n set: (...args) => extension.set?.(...args) ?? false,\n style: (...args) => extension.style?.(...args),\n };\n extensions = [...extensions, entry];\n if (entry.named) namers++;\n return () => {\n if (!extensions.includes(entry)) return;\n if (entry.named) namers--;\n extensions = extensions.filter((each) => each !== entry);\n };\n}\n\n/**\n * The slice of Angular's component definition `createRenderer` receives that says which element\n * names a template can legitimately contain. Private shape, read only to keep the engine's typo\n * check quiet, so a missing piece means \"nothing to declare\" rather than an error.\n */\ninterface ComponentDefLike {\n id?: string;\n type?: unknown;\n encapsulation?: number;\n /** The component's inputs, keyed by the name a template writes. */\n inputs?: object;\n tView?: {\n directiveRegistry?:\n readonly { selectors?: readonly (readonly unknown[])[]; inputs?: object }[] | null;\n } | null;\n ngContentSelectors?: readonly string[];\n}\n\n/** `ViewEncapsulation.None`'s value in a component definition. */\nconst NONE = 2;\n\n/** The attribute names in a projection selector such as `[listHeader]` or `text[slot=a]`. */\nconst PROJECTED_ATTRIBUTE = /\\[([^\\]=~|^$*\\s]+)/g;\n\nexport class NativeRendererFactory implements RendererFactory2 {\n private readonly renderer: NativeRenderer;\n /** One renderer per component type, because each carries its own stylesheet. */\n private readonly byComponent = new Map<string, NativeRenderer>();\n /** The global sheet each `ViewEncapsulation.None` component registered, which a hot swap replaces. */\n private readonly globalById = new Map<string, StyleSheet>();\n /** The scoped sheet each emulated or Shadow DOM component has, which a hot swap replaces. */\n private readonly scopedById = new Map<string, StyleSheet>();\n readonly engine: Engine;\n\n constructor(engine: Engine) {\n this.engine = engine;\n this.renderer = new NativeRenderer(engine);\n }\n\n /**\n * Angular hands us the component definition here, which is how emulated encapsulation gets\n * scoped: the renderer a component uses is bound to that component's compiled stylesheet, so\n * its elements match its rules and nobody else's.\n */\n createRenderer(host: unknown, type: ComponentDefLike | null): Renderer2 {\n const sheet = this.scopedSheetOf(type);\n\n // `host` is the element this component is mounted on, and Angular created it with the\n // *parent's* renderer, so it carries the parent's sheet. Tagging it here is the only moment\n // the two are both in hand, and it is what makes `:host` reachable at all.\n //\n // It is also the one sure sign that an element hosts a component, whatever the selector\n // that put it there, which is what tells an `<x-card>` from a typo.\n if (host && typeof host === 'object') {\n this.engine.setHostSheet(host as EngineNode, sheet);\n markComponentHost(host as EngineNode);\n this.keepInputAttributes(host as EngineNode, type);\n }\n if (type) this.declareElements(type);\n\n if (!sheet) return this.renderer;\n\n const key = type?.id ?? '';\n let renderer = this.byComponent.get(key);\n if (!renderer) {\n renderer = new NativeRenderer(this.engine, sheet);\n this.byComponent.set(key, renderer);\n }\n return renderer;\n }\n\n /**\n * Keep a static attribute that is one of the component's inputs off its host view.\n *\n * Angular gives `<app-field accessibilityLabel=\"Email\">` to the input and writes it to the host\n * element as well, which on a web page is an attribute only a selector reads and here is a prop:\n * a second element with the label, on a view that is only a container. It stays on the node for\n * `:host([variant])` to match. The component's host bindings have not run yet, so a prop by an\n * input's name is the static attribute, and a host binding that writes it later is committed.\n */\n private keepInputAttributes(host: EngineNode, def: ComponentDefLike | null): void {\n for (const input of Object.keys(def?.inputs ?? {})) this.engine.keepAsAttribute(host, input);\n }\n\n /**\n * The sheet a component's elements are matched against, or null.\n *\n * `ViewEncapsulation.None`: a browser adds the component's CSS to the document as written, so\n * its rules reach any element, its host by class among them, and `:host` matches nothing. Its\n * sheet is a global one, registered when the component first renders, and it has none of its\n * own. Shadow DOM stays scoped, as a shadow root scopes it.\n */\n private scopedSheetOf(type: ComponentDefLike | null): StyleSheet | null {\n const sheet = styleSheetOf(type?.type);\n const id = type?.id ?? '';\n this.swapScoped(id, type?.encapsulation === NONE ? null : sheet);\n const registered = this.globalById.get(id);\n if (!sheet || type?.encapsulation !== NONE) {\n // A hot swap that left the component no rules, or made it scoped: its old sheet goes, and a\n // scoped one takes its `@keyframes` over now, before anything plays them.\n if (registered) {\n this.engine.removeGlobalSheet(registered);\n if (sheet) this.engine.sheetReplaced(registered, sheet);\n }\n this.globalById.delete(id);\n return sheet;\n }\n this.engine.addGlobalSheet(sheet, registered);\n this.globalById.set(id, sheet);\n return null;\n }\n\n /**\n * Tell the engine when a hot swap gave a component another scoped sheet, or none, so the\n * `@keyframes` the old one defined go with it. Nothing changes without a hot swap.\n */\n private swapScoped(id: string, sheet: StyleSheet | null): void {\n const previous = this.scopedById.get(id);\n if (previous && previous !== sheet) this.engine.sheetReplaced(previous, sheet);\n if (sheet) this.scopedById.set(id, sheet);\n else this.scopedById.delete(id);\n }\n\n /**\n * Angular's HMR calls this before it recreates a hot-swapped component's views. The renderer\n * cached for that component is bound to the sheet it had, so an edited stylesheet would never\n * reach the recreated views without letting it go.\n */\n componentReplaced(id: string): void {\n this.byComponent.delete(id);\n }\n\n /** Component definitions whose templates have been looked through already. */\n private readonly declared = new WeakSet<object>();\n\n /**\n * Tell the engine every element name this component's template may select by tag.\n *\n * Angular builds a component's template view, with its directive registry resolved from the\n * component's `imports`, before it asks for the renderer, so the registry is in hand here and\n * before the template that uses those names runs. This is what keeps a directive that owns an\n * element without hosting a component, such as Angular's `router-outlet`, from reading as a\n * typo; a component host is marked directly instead, above.\n */\n private declareElements(def: ComponentDefLike): void {\n // Only once the template view exists. The root component asks for a renderer twice, first\n // without a host and before its template view is built, and marking it seen then would\n // skip the call that has the registry.\n const registry = def.tView?.directiveRegistry;\n if (!registry || this.declared.has(def)) return;\n this.declared.add(def);\n for (const directive of registry) {\n for (const selector of directive.selectors ?? []) {\n const tag = selector[0];\n if (typeof tag === 'string' && tag) this.engine.declareElement(tag);\n }\n }\n this.declareAttributes(def, registry);\n }\n\n /**\n * Tell the engine the attribute names that are Angular's rather than a native view's: what a\n * directive selects on or takes as an input, which Angular also writes to the node as a static\n * attribute, and what the component's `<ng-content select>` projects by.\n */\n private declareAttributes(\n def: ComponentDefLike,\n registry: NonNullable<NonNullable<ComponentDefLike['tView']>['directiveRegistry']>,\n ): void {\n for (const directive of registry) {\n for (const selector of directive.selectors ?? []) {\n for (const name of selector.filter((part, at) => at % 2 === 1)) {\n if (typeof name === 'string') this.engine.declareAttribute(name);\n }\n }\n for (const input of Object.keys(directive.inputs ?? {})) this.engine.declareAttribute(input);\n }\n for (const selector of def.ngContentSelectors ?? []) {\n for (const [, name] of selector.matchAll(PROJECTED_ATTRIBUTE)) {\n this.engine.declareAttribute(name!);\n }\n }\n }\n\n private renderStarted = 0;\n private frame = 0;\n\n /**\n * Drive CSS transitions.\n *\n * A transition is not a binding: nothing in Angular changes while one runs, so change detection\n * would never fire again and the animation would stop on its first frame. This pumps the engine\n * directly for as long as one has frames left, and commits each one.\n */\n private readonly pump = (): void => {\n this.frame = 0;\n // A frame has been drawn since, so every view committed before it has been seen.\n this.unseenSince = null;\n this.engine.advanceAnimations();\n // Also the commit for anything changed outside change detection. Angular's `animate.enter`\n // and `animate.leave` add their classes from an animation queue that runs after the render\n // pass, so without a frame behind it the class would sit on the node and never reach native.\n this.commit();\n // `pending` as well as `transitioning`: a transition's end listener runs after the commit\n // that finished it, and removing a leaving element is exactly what it tends to do.\n if (this.engine.animating || this.engine.pending) this.schedule();\n };\n\n private schedule(): void {\n if (this.frame) return;\n // `requestAnimationFrame` is a global in React Native. The fallback is for Node, where the\n // suite drives `advanceTransitions` itself and this never runs.\n const request =\n globalThis.requestAnimationFrame ??\n ((callback: FrameRequestCallback) => setTimeout(() => callback(Date.now()), 16));\n this.frame = request(this.pump) as unknown as number;\n }\n\n /**\n * A change that lands outside a render pass has no commit coming. The engine reports the moment\n * the tree goes dirty, and this arranges a frame for it, which is how the classes Angular's\n * animation queue adds after a pass reach native at all.\n */\n readonly commitSoon = (): void => {\n if (!this.rendering) this.schedule();\n };\n\n private rendering = false;\n /** How many commits there had been before the first that created a view no frame has drawn. */\n private unseenSince: number | null = null;\n private settling = false;\n\n /**\n * Commit, with the views created since the last frame was drawn taken as unseen: what this gives\n * them is where they start, and no transition runs toward it. A browser computes no style for an\n * element before the frame after it was inserted, so a class added before then, in the same\n * task or in another, starts nothing either. A view this commit creates is unseen until the next\n * frame, which is asked for here.\n */\n private commit(): boolean {\n const before = this.engine.stats.commits;\n const created = this.engine.stats.createdNodes;\n const since = this.unseenSince;\n const committed = since === null ? this.engine.commit() : this.engine.commitUnseen(since);\n if (since === null && this.engine.stats.createdNodes !== created) {\n this.unseenSince = before;\n this.schedule();\n }\n return committed;\n }\n\n /**\n * Commit what the rest of this turn changes before a frame is drawn, rather than a frame later.\n *\n * Angular's `animate.enter` adds its class from a queue that runs after the render pass, so the\n * element has been committed once without it. Committed again in the same turn, the class is on\n * the view's first frame, and the engine starts the view there instead of easing to it.\n */\n private settleTurn(): void {\n if (this.settling) return;\n this.settling = true;\n queueMicrotask(() => {\n this.settling = false;\n if (!this.engine.pending) return;\n this.commit();\n if (this.engine.animating) this.schedule();\n });\n }\n\n /** How many change-detection passes are under way, one inside another. */\n private passes = 0;\n\n begin(): void {\n if (this.passes++ > 0) return;\n this.rendering = true;\n this.renderStarted = globalThis.performance?.now?.() ?? Date.now();\n }\n\n /**\n * The single commit point: at most one commit per change-detection pass. A pass begun inside\n * another, a `detectChanges()` called from a lifecycle hook, is part of the one around it and\n * commits with it: a library that calls it from every `ngAfterViewInit` would otherwise commit\n * the screen once for each of its components as the screen is first built.\n */\n end(): void {\n if (this.passes > 0 && --this.passes > 0) return;\n this.rendering = false;\n if (this.commit()) this.settleTurn();\n\n // A commit is what starts a transition, because it is where the cascade is recomputed.\n if (this.engine.animating) this.schedule();\n\n // Excludes the mount, which is not representative of a steady-state frame.\n const elapsed = (globalThis.performance?.now?.() ?? Date.now()) - this.renderStarted;\n const stats = this.engine.stats;\n if (stats.commits > 1 && elapsed > stats.worstRenderMs) stats.worstRenderMs = elapsed;\n }\n}\n\nexport interface MountResult {\n componentRef: ComponentRef<unknown>;\n applicationRef: ApplicationRef;\n factory: NativeRendererFactory;\n engine: Engine;\n}\n\n/**\n * Angular decides whether `animate.enter` and `animate.leave` do anything when `@angular/core` is\n * first evaluated, by reading a global that a Metro polyfill has to have set by then. Nothing\n * later can change the answer, so the most that can be done is to notice and say so. Checked here\n * because booting is the one moment every app passes through.\n */\nfunction warnIfAnimationsAreOff(): void {\n const document = (globalThis as { document?: { documentElement?: { getAnimations?: unknown } } })\n .document;\n if (typeof document?.documentElement?.getAnimations === 'function') return;\n console.error(\n '[angular-native] `animate.enter` and `animate.leave` will do nothing: Angular reads ' +\n 'whether to support them when it is first imported, before anything here runs. Build ' +\n 'metro.config.js with `withAngularNative` from `@ng-native/metro/config.cjs`, which ' +\n 'adds the polyfill that sets it. Animated styles and CSS transitions work either way.',\n );\n}\n\ndeclare const __DEV__: boolean | undefined;\n\n/**\n * The reload the HMR block falls back to when a change is more than a template.\n *\n * Each compiled component module can patch its own live class when only the template moved. For\n * anything else - a new method, a changed selector, different imports - there is no metadata to\n * replace, so it calls `globalThis.__angularNativeReload` instead. React Native's own Fast Refresh\n * cannot cover for it: that is React-specific, and it accepts the update and reports success, so\n * Metro never falls back on its own.\n *\n * This is installed here because `mount` is the one call every app makes. It used to be a line in\n * an example app's entry file, which meant every other app logged \"hmr reload\", called an empty\n * function, and carried on running the code from before the edit - with a second copy of every\n * class in the changed file now loaded, which Angular reports as `NG0912`. An edit that ships and\n * does nothing is a bad enough failure; one that also makes the next few screenshots lie about\n * what the app is running is worse.\n *\n * An app that sets its own is left alone: it will have a better reason string than this one.\n */\nfunction installReloadHook(): void {\n reloadMetroThroughExpo();\n const scope = globalThis as { __angularNativeReload?: () => void };\n if (scope.__angularNativeReload) return;\n scope.__angularNativeReload = () => afterParking(reloadApp);\n}\n\n/**\n * Reload once the router has left its history with the dev server, for the app that comes back\n * to open on the page this one was showing. The router sets the hook, in development; with no\n * router there is nothing to wait for. A history that could not be left is no reason not to reload.\n */\nfunction afterParking(reload: () => void): void {\n const park = (globalThis as { __angularNativePark?: () => Promise<void> }).__angularNativePark;\n if (!park) return reload();\n void park().then(reload, reload);\n}\n\n/** Longer than any history takes to go back through; an app is never left out of sight. */\nconst RESTORE_PATIENCE = 5000;\n\n/**\n * Keep the app out of sight while the router goes back through the history a reload left, so it\n * comes back on the page it was showing rather than on its first page with the others arriving\n * over it one by one. The router says when it is done, in development; with no router, or on a\n * start no reload led to, that is at once or never asked.\n */\nfunction hideWhileRestoring(hide: (hidden: boolean) => void): void {\n // The bare identifier, so a release build folds the rest away: see `mount`.\n if (typeof __DEV__ === 'undefined' || !__DEV__) return;\n const restoring = (globalThis as { __angularNativeRestoring?: Promise<void> })\n .__angularNativeRestoring;\n if (!restoring) return;\n hide(true);\n const show = () => hide(false);\n const patience = new Promise<void>((resolve) => setTimeout(resolve, RESTORE_PATIENCE));\n void Promise.race([restoring, patience]).then(show, show);\n}\n\n/**\n * How long after Expo says it reloaded the app that an app still running was not reloaded.\n * A reload takes the JavaScript runtime with it, so nothing here runs once one has begun.\n */\nconst STILL_HERE = 2000;\n\n/**\n * Reload through Expo, and through React Native when that does nothing.\n *\n * Expo's first. `DevSettings.reload()` under Expo Go on iOS re-runs the bundle the app downloaded\n * when it launched rather than fetching the current one, so the app comes back holding the code\n * from before the edit, and without Expo's native modules until Expo Go is relaunched.\n *\n * React Native's when Expo's rejects, and when it resolves and the app is still running. Under\n * Expo Go on Android `reloadAppAsync` resolves and reloads nothing, and the edit that asked for\n * the reload never arrived: the app went on running the code from before it.\n */\nfunction reloadThroughExpo(\n expo: (reason?: string) => Promise<void>,\n reason: string,\n reactNative: () => void,\n): void {\n let fellBack = false;\n const fallBack = (why: string, error?: unknown) => {\n if (fellBack) return;\n fellBack = true;\n console.error(`[angular-native] Expo's reload ${why}; reloading through React Native.`, error);\n reactNative();\n };\n expo(reason).then(\n () => setTimeout(() => fallBack('did nothing'), STILL_HERE),\n (error: unknown) => fallBack('failed', error),\n );\n}\n\n/**\n * Required rather than imported, both of them: React Native ships Flow, which Node cannot parse,\n * and this file has to stay importable by the test suite. Expo is genuinely optional.\n */\nfunction reloadApp(): void {\n const reason = 'angular-native: more than a template changed';\n const reactNative = () => {\n try {\n const { DevSettings } = require('react-native') as {\n DevSettings?: { reload(reason?: string): void };\n };\n DevSettings?.reload(reason);\n } catch {\n // No React Native under us: nothing to reload.\n }\n };\n let expo: ((reason?: string) => Promise<void>) | undefined;\n try {\n expo = (require('expo') as { reloadAppAsync?: typeof expo }).reloadAppAsync;\n } catch {\n // Not an Expo app. React Native's own reload does re-fetch outside Expo Go.\n }\n if (expo) reloadThroughExpo(expo, reason, reactNative);\n else reactNative();\n}\n\n/**\n * Metro's own reload, for an edit nothing accepted: a route file, a service, or a component the\n * hook above has already asked to reload. Metro calls React Native's Fast Refresh runtime, which\n * calls `DevSettings.reload()`, and in Expo Go that brings the app back without Expo's native\n * modules (`Cannot find native module 'ExpoFontLoader'`) until Expo Go is relaunched. Expo's\n * reload works in Expo Go and a development build alike, so in an Expo app Metro's goes through\n * it too. With or without Expo, it waits for the router to park its history: see `afterParking`.\n */\nconst THROUGH_EXPO = Symbol.for('ng-native.reloadThroughExpo');\n\nfunction reloadMetroThroughExpo(): void {\n const scope = globalThis as { __METRO_GLOBAL_PREFIX__?: string } & Record<string, unknown>;\n const refresh = scope[`${scope.__METRO_GLOBAL_PREFIX__ ?? ''}__ReactRefresh`] as\n { performFullRefresh?: ((reason: string) => void) & { [THROUGH_EXPO]?: true } } | undefined;\n const reactNative = refresh?.performFullRefresh;\n if (!refresh || !reactNative || reactNative[THROUGH_EXPO]) return;\n let reloadAppAsync: ((reason?: string) => Promise<void>) | undefined;\n try {\n ({ reloadAppAsync } = require('expo') as { reloadAppAsync?: typeof reloadAppAsync });\n } catch {\n // Not an Expo app: React Native's own reload re-fetches the bundle there.\n }\n const expo = reloadAppAsync;\n // Either way once the router has parked its history: see `afterParking`.\n const reload = (reason: string) =>\n afterParking(() => {\n const native = () => reactNative.call(refresh, reason);\n if (expo) reloadThroughExpo(expo, reason, native);\n else native();\n });\n reload[THROUGH_EXPO] = true as const;\n refresh.performFullRefresh = reload;\n}\n\n/** Dev only, and required rather than imported: React Native ships Flow, which Node cannot parse. */\nfunction calmDevBanner(): void {\n try {\n const { default: banner } = require('react-native/Libraries/Utilities/DevLoadingView') as {\n default?: LoadingBanner;\n };\n if (banner) calmLoadingBanner(banner);\n } catch {\n // No React Native under us: a test, or the web.\n }\n}\n\n/**\n * React Native's `NativeAnimatedHelper`, for the engine to move sticky headers by a scroll on the\n * native side. Required rather than imported for the same reason as the banner, and null where\n * there is no native animated module to talk to: a test, or the web.\n */\nfunction nativeAnimated(): NativeAnimated | null {\n try {\n const { default: helper } =\n require('react-native/src/private/animated/NativeAnimatedHelper') as {\n default?: NativeAnimated & { assertNativeAnimatedModule(): void };\n };\n if (!helper) return null;\n helper.assertNativeAnimatedModule();\n return helper;\n } catch {\n return null;\n }\n}\n\n/** The root component's host until its `:host` says otherwise. See `Engine.setDefaultStyle`. */\nconst ROOT_HOST_STYLE = { height: '100%' } as const;\n\n/**\n * Run the app's initializers, `provideAppInitializer` and `APP_INITIALIZER`, before the root\n * component exists, as `bootstrapApplication` does. `createEnvironmentInjector` runs only\n * environment initializers, so without this an app initializer silently never ran.\n *\n * Through Angular's own `ApplicationInitStatus`, so its `done` and `donePromise` stay true to what\n * happened for anything that waits on them. `runInitializers` is what Angular's bootstrap calls;\n * it is missing from the public types, which is why it is reached through a cast.\n *\n * An initializer that returns a promise is started, not awaited: `mount` is synchronous and the\n * first frame does not wait. One that fails reaches the `ErrorHandler` rather than vanishing.\n */\nfunction runInitializers(injector: EnvironmentInjector): void {\n const status = injector.get(ApplicationInitStatus);\n (status as unknown as { runInitializers(): void }).runInitializers();\n status.donePromise.catch((error: unknown) => injector.get(ErrorHandler).handleError(error));\n}\n\nexport function mount(\n rootTag: number,\n component: Type<unknown>,\n fabric: FabricUIManager,\n options: EngineOptions & {\n providers?: (Provider | EnvironmentProviders)[];\n /**\n * Root component inputs, set before its first change detection. That is the only moment a\n * `required` input can be given, and `mount` runs that first pass itself, so a caller cannot\n * set one afterwards. What `render()` in `@ng-native/testing` passes a component's inputs as.\n */\n inputs?: Record<string, unknown>;\n /**\n * Bindings for the root component, as `createComponent` takes them: `outputBinding()` for a\n * listener a template would bind. What `render()` passes its `on` as.\n */\n bindings?: Binding[];\n } = {},\n): MountResult {\n // The bare identifier, behind `typeof` so Node does not throw: Metro inlines `__DEV__` and folds\n // this branch away in a release build, and a property read through `globalThis` it cannot, which\n // left the reload hook and its `require('expo')` in every release bundle.\n if (typeof __DEV__ !== 'undefined' && __DEV__) {\n warnIfAnimationsAreOff();\n installReloadHook();\n installHotEpoch();\n calmDevBanner();\n }\n installDeferTriggers();\n installNodeGlobal();\n const { providers: extraProviders = [], inputs = {}, bindings, ...engineOptions } = options;\n // The factory needs the engine and the engine needs the factory's dirty hook, so the hook is\n // handed over once both exist rather than through the constructor.\n const engine = new Engine(fabric, rootTag, {\n ...engineOptions,\n nativeAnimated:\n engineOptions.nativeAnimated === undefined ? nativeAnimated() : engineOptions.nativeAnimated,\n });\n installDateParse(engine.dev);\n const factory = new NativeRendererFactory(engine);\n engine.setOnDirty(factory.commitSoon);\n // `getElementById` is what `TransferState` calls, and `TransferState` is what `resource()`\n // reaches for the moment one is created. Without it every resource in an app throws\n // `doc.getElementById is not a function` before its loader has run - which is a long way from\n // anything a stylesheet does, and is why the stub is not as thin as it looks.\n //\n // `implementation` is what the i18n runtime parses the cases of a plural or select with. It asks\n // Angular's own `getDocument()` rather than the injector, which answers the global `document`\n // the Metro polyfills define for animations until it is told of this one.\n const documentStub = {\n head: undefined,\n body: undefined,\n getElementById: () => null,\n implementation: inertImplementation,\n };\n setDocument(documentStub as unknown as Document);\n\n // Parent the app injector to the platform injector, exactly as `internalCreateApplication`\n // does. Some Angular services are `providedIn: 'platform'` - `Console` among them - and with a\n // null parent they simply do not exist: the router fails with NG0201 the moment it logs.\n const platformInjector = createOrReusePlatformInjector();\n\n const injector = createEnvironmentInjector(\n [\n // `INJECTOR_SCOPE` and `DOCUMENT` are both load-bearing: without the first Angular cannot\n // resolve `ChangeDetectionSchedulerImpl` (NG0201), without the second `getStyleHost` throws\n // NG0210.\n { provide: INJECTOR_SCOPE, useValue: 'root' },\n provideZonelessChangeDetectionInternal(),\n { provide: RendererFactory2, useValue: factory },\n // Exposed so a component can read commit stats, or reach a node for a native command.\n { provide: Engine, useValue: engine },\n // The contract the shared packages inject. `Engine` is still provided under its own token\n // for the three worklet components that need Fabric's own handles. See `fabric/host.ts`.\n { provide: HostEngine, useExisting: Engine },\n { provide: DOCUMENT, useValue: documentStub },\n // 'native', not Angular's default 'unknown': see `platform-id.ts`.\n { provide: PLATFORM_ID, useValue: PLATFORM_NATIVE_ID },\n { provide: ErrorHandler, useClass: ErrorHandler },\n ...extraProviders,\n ],\n // The platform injector is an EnvironmentInjector in practice; the factory's return type is\n // just declared more loosely.\n platformInjector as EnvironmentInjector,\n );\n\n // Errors the engine catches in its native event dispatch, which is outside every Angular\n // listener wrapper: responder handlers, engine-level listeners, a commit a focus change starts.\n // Looked up when one happens rather than now, as Angular's own handler is, so an app's\n // `ErrorHandler` that injects something not yet constructible is not forced at boot. A caller\n // that passed its own `onError` keeps it.\n if (!engineOptions.onError) {\n engine.setOnError((error) => injector.get(ErrorHandler).handleError(error));\n }\n\n runInitializers(injector);\n // The locale a template's plural picks its case by. Angular's own bootstrap tells the i18n\n // runtime the `LOCALE_ID`, and without it every language is counted by the rules of `en-US`.\n setLocaleId(injector.get(LOCALE_ID) || 'en-US');\n\n // What `@ng-native/tailwind`'s `ios:` and `android:` variants match beneath. On the root so\n // they work with nothing to set up; an app that had to add it itself, and did not, got platform\n // variants that silently matched nothing.\n engine.addClass(engine.root, `platform-${nativePlatform()}`);\n\n // No `hostElement`, so Angular creates the host from the selector as it does any other\n // component's, and it goes under the engine root as a view of its own. The engine root is the\n // surface and is never committed: as the host it took the component's `:host` rules and sent\n // them nowhere, so a root component's background and padding were dropped without a word.\n const componentRef = createComponent(component, {\n environmentInjector: injector,\n ...(bindings && { bindings }),\n });\n const host = componentRef.location.nativeElement as EngineNode;\n // The full height of the surface, as the web's mount point is given, so a template's `flex: 1`\n // still fills the screen. A height rather than `flex: 1`, which a `:host` height would lose to.\n // The app's own `:host` overrides it. Given under the root, which it is a share of.\n engine.appendChild(engine.root, host);\n engine.setDefaultStyle(host, ROOT_HOST_STYLE);\n hideWhileRestoring((hidden) => {\n engine.setDefaultStyle(host, hidden ? { ...ROOT_HOST_STYLE, opacity: 0 } : ROOT_HOST_STYLE);\n factory.commitSoon();\n });\n\n for (const [name, value] of Object.entries(inputs)) componentRef.setInput(name, value);\n\n const applicationRef = injector.get(ApplicationRef);\n // The app goes with the surface it is on, which Fabric stops when, among others, Android\n // recreates the activity: see `surface-stop.ts`. What its destroy throws goes to its own\n // `ErrorHandler`, looked up while the app can still answer, rather than into Fabric's call.\n applicationRef.onDestroy(\n onSurfaceStop(rootTag, () => {\n const errors = injector.get(ErrorHandler);\n try {\n applicationRef.destroy();\n } catch (error) {\n errors.handleError(error);\n }\n }),\n );\n\n // `ApplicationRef.bootstrap()` does all of this; `createComponent` does not, and we\n // deliberately do not use `bootstrap()` because it wants a DOM selector. Order and\n // bookkeeping both matter, so this mirrors `_loadComponent` step for step.\n applicationRef.componentTypes.push(component);\n applicationRef.attachView(componentRef.hostView);\n // Before the listeners, so the root component's template has run and any outlet in it has\n // registered itself by the time the router's initial navigation activates a route.\n applicationRef.tick();\n // Load-bearing, not bookkeeping: the router's bootstrap listener returns early unless the\n // ref it is handed is `ApplicationRef.components[0]`, so with an empty array the initial\n // navigation never runs and a routed app renders nothing but its outlet's host.\n applicationRef.components.push(componentRef);\n // Text laid out before its face registered is laid out again when it does: `loadFonts` is not\n // awaited before `mount` behind a splash screen.\n const stopFonts = onFontsRegistered((families) => engine.fontsRegistered(families));\n const stopSettled = onFontsSettled((families) => engine.fontsSettled(families));\n componentRef.onDestroy(() => {\n stopFonts();\n stopSettled();\n applicationRef.detachView(componentRef.hostView);\n const at = applicationRef.components.indexOf(componentRef);\n if (at !== -1) applicationRef.components.splice(at, 1);\n });\n\n for (const listener of injector.get(APP_BOOTSTRAP_LISTENER, [])) {\n listener(componentRef);\n }\n\n return { componentRef, applicationRef, factory, engine };\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * An app goes with the surface it is mounted on.
3
+ *
4
+ * Fabric stops a surface by calling `RN$stopSurface` with the surface's id, which is the root tag
5
+ * `mount` was given. React's renderer installs that function, when React Native first loads it,
6
+ * and tears down its own root there; nothing told an app mounted here. An Android activity
7
+ * Android recreates, after the font size or the display size changes for one, starts a new
8
+ * surface, runs the app's runnable on it and then stops the old surface, so the old app ran on
9
+ * beside the new one: its timers, its subscriptions, its back button handlers and its effects.
10
+ *
11
+ * The function is wrapped as anything else wraps a global, around what is there when an app
12
+ * mounts, and wrapped again by a later mount when something replaced it since.
13
+ */
14
+ /** Call `stop` when the surface `rootTag` stops. Answers the function that stops waiting. */
15
+ export declare function onSurfaceStop(rootTag: number, stop: () => void): () => void;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * An app goes with the surface it is mounted on.
3
+ *
4
+ * Fabric stops a surface by calling `RN$stopSurface` with the surface's id, which is the root tag
5
+ * `mount` was given. React's renderer installs that function, when React Native first loads it,
6
+ * and tears down its own root there; nothing told an app mounted here. An Android activity
7
+ * Android recreates, after the font size or the display size changes for one, starts a new
8
+ * surface, runs the app's runnable on it and then stops the old surface, so the old app ran on
9
+ * beside the new one: its timers, its subscriptions, its back button handlers and its effects.
10
+ *
11
+ * The function is wrapped as anything else wraps a global, around what is there when an app
12
+ * mounts, and wrapped again by a later mount when something replaced it since.
13
+ */
14
+ const scope = globalThis;
15
+ /** What each surface's apps do when it stops. */
16
+ const stops = new Map();
17
+ let installed;
18
+ /** Call `stop` when the surface `rootTag` stops. Answers the function that stops waiting. */
19
+ export function onSurfaceStop(rootTag, stop) {
20
+ installSurfaceStop();
21
+ let callbacks = stops.get(rootTag);
22
+ if (!callbacks)
23
+ stops.set(rootTag, (callbacks = new Set()));
24
+ callbacks.add(stop);
25
+ return () => void callbacks.delete(stop);
26
+ }
27
+ function installSurfaceStop() {
28
+ if (installed && scope.RN$stopSurface === installed)
29
+ return;
30
+ const next = scope.RN$stopSurface;
31
+ installed = (surfaceId) => {
32
+ const callbacks = stops.get(surfaceId);
33
+ // A stopped surface is not started again: its id is not reused.
34
+ stops.delete(surfaceId);
35
+ // Every app on the surface goes, and the wrapped function runs, whatever one of them throws;
36
+ // the first thing thrown is thrown after, as it would have been from the function alone.
37
+ const failures = [];
38
+ for (const stop of callbacks ?? []) {
39
+ try {
40
+ stop();
41
+ }
42
+ catch (error) {
43
+ failures.push(error);
44
+ }
45
+ }
46
+ try {
47
+ next?.(surfaceId);
48
+ }
49
+ finally {
50
+ if (failures.length > 0)
51
+ throw failures[0];
52
+ }
53
+ };
54
+ scope.RN$stopSurface = installed;
55
+ }
56
+ //# sourceMappingURL=surface-stop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-stop.js","sourceRoot":"","sources":["../src/surface-stop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,KAAK,GAAG,UAA8C,CAAC;AAE7D,iDAAiD;AACjD,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;AAEjD,IAAI,SAAkC,CAAC;AAEvC,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,IAAgB;IAC7D,kBAAkB,EAAE,CAAC;IACrB,IAAI,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,SAAS;QAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;IAC5D,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,kBAAkB;IACzB,IAAI,SAAS,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS;QAAE,OAAO;IAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC;IAClC,SAAS,GAAG,CAAC,SAAS,EAAE,EAAE;QACxB,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvC,gEAAgE;QAChE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxB,6FAA6F;QAC7F,yFAAyF;QACzF,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,SAAS,IAAI,EAAE,EAAE,CAAC;YACnC,IAAI,CAAC;gBACH,IAAI,EAAE,CAAC;YACT,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QACD,IAAI,CAAC;YACH,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC;QACpB,CAAC;gBAAS,CAAC;YACT,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,cAAc,GAAG,SAAS,CAAC;AACnC,CAAC","sourcesContent":["/**\n * An app goes with the surface it is mounted on.\n *\n * Fabric stops a surface by calling `RN$stopSurface` with the surface's id, which is the root tag\n * `mount` was given. React's renderer installs that function, when React Native first loads it,\n * and tears down its own root there; nothing told an app mounted here. An Android activity\n * Android recreates, after the font size or the display size changes for one, starts a new\n * surface, runs the app's runnable on it and then stops the old surface, so the old app ran on\n * beside the new one: its timers, its subscriptions, its back button handlers and its effects.\n *\n * The function is wrapped as anything else wraps a global, around what is there when an app\n * mounts, and wrapped again by a later mount when something replaced it since.\n */\n\ntype StopSurface = (surfaceId: number) => void;\n\nconst scope = globalThis as { RN$stopSurface?: StopSurface };\n\n/** What each surface's apps do when it stops. */\nconst stops = new Map<number, Set<() => void>>();\n\nlet installed: StopSurface | undefined;\n\n/** Call `stop` when the surface `rootTag` stops. Answers the function that stops waiting. */\nexport function onSurfaceStop(rootTag: number, stop: () => void): () => void {\n installSurfaceStop();\n let callbacks = stops.get(rootTag);\n if (!callbacks) stops.set(rootTag, (callbacks = new Set()));\n callbacks.add(stop);\n return () => void callbacks.delete(stop);\n}\n\nfunction installSurfaceStop(): void {\n if (installed && scope.RN$stopSurface === installed) return;\n const next = scope.RN$stopSurface;\n installed = (surfaceId) => {\n const callbacks = stops.get(surfaceId);\n // A stopped surface is not started again: its id is not reused.\n stops.delete(surfaceId);\n // Every app on the surface goes, and the wrapped function runs, whatever one of them throws;\n // the first thing thrown is thrown after, as it would have been from the function alone.\n const failures: unknown[] = [];\n for (const stop of callbacks ?? []) {\n try {\n stop();\n } catch (error) {\n failures.push(error);\n }\n }\n try {\n next?.(surfaceId);\n } finally {\n if (failures.length > 0) throw failures[0];\n }\n };\n scope.RN$stopSurface = installed;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/platform",
3
- "version": "0.17.1",
3
+ "version": "0.18.1",
4
4
  "description": "Angular Native's Renderer2 and bootstrap: mounts an Angular application onto React Native's Fabric.",
5
5
  "keywords": [
6
6
  "angular",
@@ -30,7 +30,7 @@
30
30
  "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@ng-native/fabric": "0.17.1"
33
+ "@ng-native/fabric": "0.18.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@angular/core": "^22.0.0",