@symbiote-native/angular 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +5 -4
  2. package/babel-register-composed.cjs +0 -8
  3. package/build/angular/callback-host.d.ts +25 -0
  4. package/build/angular/callback-host.js +211 -0
  5. package/build/angular/callback-host.js.map +1 -0
  6. package/build/angular/change-detection-flush.d.ts +14 -2
  7. package/build/angular/change-detection-flush.js +54 -6
  8. package/build/angular/change-detection-flush.js.map +1 -1
  9. package/build/angular/components/flat-list/index.js +39 -86
  10. package/build/angular/components/flat-list/index.js.map +1 -1
  11. package/build/angular/components/image-shared.js +49 -110
  12. package/build/angular/components/image-shared.js.map +1 -1
  13. package/build/angular/components/keyboard-avoiding-view/index.js +33 -72
  14. package/build/angular/components/keyboard-avoiding-view/index.js.map +1 -1
  15. package/build/angular/components/modal/index.js +58 -103
  16. package/build/angular/components/modal/index.js.map +1 -1
  17. package/build/angular/components/pressable-props.d.ts +2 -0
  18. package/build/angular/components/section-list/index.js +20 -103
  19. package/build/angular/components/section-list/index.js.map +1 -1
  20. package/build/angular/components/touchable-props.d.ts +1 -0
  21. package/build/angular/components/virtualized-list/directives.js +32 -22
  22. package/build/angular/components/virtualized-list/directives.js.map +1 -1
  23. package/build/angular/components/virtualized-list/index.d.ts +7 -1
  24. package/build/angular/components/virtualized-list/index.js +350 -359
  25. package/build/angular/components/virtualized-list/index.js.map +1 -1
  26. package/build/angular/components/virtualized-section-list/directives.js +20 -12
  27. package/build/angular/components/virtualized-section-list/directives.js.map +1 -1
  28. package/build/angular/components/virtualized-section-list/index.js +36 -142
  29. package/build/angular/components/virtualized-section-list/index.js.map +1 -1
  30. package/build/angular/components.d.ts +1 -1
  31. package/build/angular/components.js +1 -1
  32. package/build/angular/components.js.map +1 -1
  33. package/build/angular/create-portal/index.js +9 -8
  34. package/build/angular/create-portal/index.js.map +1 -1
  35. package/build/angular/create-tunnel/index.js +13 -12
  36. package/build/angular/create-tunnel/index.js.map +1 -1
  37. package/build/angular/descriptor-to-angular/index.js +6 -6
  38. package/build/angular/descriptor-to-angular/index.js.map +1 -1
  39. package/build/angular/diagnostics.d.ts +13 -0
  40. package/build/angular/diagnostics.js +18 -0
  41. package/build/angular/diagnostics.js.map +1 -1
  42. package/build/angular/element-props.d.ts +1 -3
  43. package/build/angular/elements.d.ts +46 -32
  44. package/build/angular/elements.js +217 -434
  45. package/build/angular/elements.js.map +1 -1
  46. package/build/angular/index.d.ts +3 -1
  47. package/build/angular/index.js +44 -13
  48. package/build/angular/index.js.map +1 -1
  49. package/build/angular/modules/animated/animated-leaf-binder.js +0 -2
  50. package/build/angular/modules/animated/animated-leaf-binder.js.map +1 -1
  51. package/build/angular/modules/animated/create-animated-component.js +69 -74
  52. package/build/angular/modules/animated/create-animated-component.js.map +1 -1
  53. package/build/angular/modules/animated/index.d.ts +30 -19
  54. package/build/angular/modules/status-bar/index.js +2 -8
  55. package/build/angular/modules/status-bar/index.js.map +1 -1
  56. package/build/angular/primitives/index.d.ts +14 -28
  57. package/build/angular/primitives/index.js +44 -107
  58. package/build/angular/primitives/index.js.map +1 -1
  59. package/build/angular/primitives/shared.d.ts +1 -0
  60. package/build/angular/primitives/shared.js +47 -32
  61. package/build/angular/primitives/shared.js.map +1 -1
  62. package/build/angular/render/index.js +34 -1
  63. package/build/angular/render/index.js.map +1 -1
  64. package/build/angular/renderer/index.d.ts +56 -0
  65. package/build/angular/renderer/index.js +295 -114
  66. package/build/angular/renderer/index.js.map +1 -1
  67. package/build/angular/runtime-matching.d.ts +9 -0
  68. package/build/angular/runtime-matching.js +82 -0
  69. package/build/angular/runtime-matching.js.map +1 -0
  70. package/build/angular/services/color-scheme.service.js +4 -4
  71. package/build/angular/services/color-scheme.service.js.map +1 -1
  72. package/build/angular/services/window-dimensions.service.js +4 -4
  73. package/build/angular/services/window-dimensions.service.js.map +1 -1
  74. package/build/angular/style-host.d.ts +11 -0
  75. package/build/angular/style-host.js +86 -0
  76. package/build/angular/style-host.js.map +1 -0
  77. package/metro-config.cjs +32 -16
  78. package/package.json +5 -5
  79. package/src/callback-host.ts +229 -0
  80. package/src/change-detection-flush.ts +62 -9
  81. package/src/components/flat-list/index.ts +2 -1
  82. package/src/components/keyboard-avoiding-view/index.ts +8 -0
  83. package/src/components/pressable-props.ts +8 -0
  84. package/src/components/touchable-props.ts +4 -0
  85. package/src/components/virtualized-list/index.ts +98 -45
  86. package/src/components.ts +0 -2
  87. package/src/diagnostics.ts +18 -0
  88. package/src/element-props.ts +1 -5
  89. package/src/elements.ts +159 -38
  90. package/src/index.ts +47 -14
  91. package/src/primitives/index.ts +14 -70
  92. package/src/primitives/shared.ts +21 -6
  93. package/src/render/index.ts +44 -0
  94. package/src/renderer/index.ts +347 -104
  95. package/src/runtime-matching.ts +80 -0
  96. package/src/style-host.ts +94 -0
  97. package/tsconfig.angular.base.json +11 -0
@@ -10,10 +10,15 @@ import {
10
10
  type SimpleChanges,
11
11
  } from '@angular/core';
12
12
  import { countAngular } from '../diagnostics';
13
- import { createCallbackWrapper } from '../change-detection-flush';
13
+ import {
14
+ createCallbackWrapper,
15
+ registerViewMarker,
16
+ type ICallbackWrapper,
17
+ } from '../change-detection-flush';
14
18
  import {
15
19
  flattenStyle,
16
20
  isSymbioteNode,
21
+ propOf,
17
22
  type IHostInstance,
18
23
  type IStyleProp,
19
24
  } from '@symbiote-native/engine';
@@ -43,7 +48,7 @@ import {
43
48
  */
44
49
  export function anchorHostStyle(elementRef: ElementRef<unknown>): unknown {
45
50
  const node = elementRef.nativeElement;
46
- return isSymbioteNode(node) ? node.props.style : undefined;
51
+ return isSymbioteNode(node) ? propOf(node, 'style') : undefined;
47
52
  }
48
53
 
49
54
  // anchorHostStyle returns `unknown` (it reads whatever already resolved onto the anchor node's
@@ -259,10 +264,20 @@ export class SymbioteHostPropsDirective {
259
264
  // binds its result: the "pan does nothing" bug. Shared with the TAG path's `SymbioteElement`,
260
265
  // which has the identical deficit; the mechanism, the `onScroll` exemption and why the wrapper
261
266
  // is cached per original handler live in `createCallbackWrapper`.
262
- private readonly wrapCallback = createCallbackWrapper(
263
- this.cdr,
264
- this.elementRef.nativeElement,
265
- );
267
+ //
268
+ // THE REF REACHES THE WRAPPER BY THE NODE NOW, not as an argument. `SymbioteElement` stopped
269
+ // injecting one per element — it was ~1-2.4 us on every tag of a screen to serve the few that carry
270
+ // a callback — so `createCallbackWrapper` looks its marker up in `markViewFor`. This directive
271
+ // keeps its own injection because it is matched by an ATTRIBUTE a composed component writes
272
+ // deliberately, not by every element, and registers it here for the same node the wrapper holds.
273
+ private readonly wrapCallback = this.registerMarkerAndWrap();
274
+
275
+ private registerMarkerAndWrap(): ICallbackWrapper {
276
+ const node: unknown = this.elementRef.nativeElement;
277
+ if (typeof node === 'object' && node !== null)
278
+ registerViewMarker(node, this.cdr);
279
+ return createCallbackWrapper(node);
280
+ }
266
281
 
267
282
  // Values pushed by the previous bag, so a push writes only what actually moved. Copied rather
268
283
  // than aliased: a component is free to hand back the same object with mutated fields.
@@ -22,6 +22,7 @@ import {
22
22
  createComponent,
23
23
  createEnvironmentInjector,
24
24
  DOCUMENT,
25
+ enableProdMode,
25
26
  ErrorHandler,
26
27
  RendererFactory2,
27
28
  ɵINJECTOR_SCOPE as INJECTOR_SCOPE,
@@ -137,11 +138,54 @@ function teardown(rootTag: IRootTag): void {
137
138
  disposeRoot(rootTag);
138
139
  }
139
140
 
141
+ // Metro's build switch, and esbuild's in this repo's headless runner. Declared HERE rather than in
142
+ // an ambient `globals.d.ts`, because the AOT tests (`elements.test.ts`, `style-input-aot.test.ts`)
143
+ // build their own ngtsc programs from an explicit file list that an ambient declaration never
144
+ // reaches — seven of them went red with `Cannot find name '__DEV__'`, reported as an empty
145
+ // diagnostic set, which reads as "the template checker found nothing" and is not that.
146
+ //
147
+ // `declare const` emits no JavaScript, so it shadows nothing at runtime and both bundlers still
148
+ // substitute the identifier.
149
+ declare const __DEV__: boolean;
150
+
151
+ /**
152
+ * Turn Angular's assertions off when — and only when — the bundler has said this is a release.
153
+ *
154
+ * `ngDevMode` is a THIRD dev switch, and neither of the two this project already handles reaches
155
+ * it: `initNgDevMode()` turns itself ON whenever the global is undefined (`ng_dev_mode.ts:85`), and
156
+ * `@react-native/babel-preset` inlines `__DEV__` while knowing nothing about Angular. So every
157
+ * release build made with this adapter shipped dev-mode Angular — `inject()` of a special token
158
+ * builds a `new NodeInjector` and emits two profiler events PER ELEMENT
159
+ * (`di.ts:525`, `runInInjectorProfilerContext`). Measured on `angular-elements-suite.itest.ts`,
160
+ * `build-release`, with the census byte-identical on both sides: a 1 000-row create went from
161
+ * ~300 ms to ~223 ms, all of it in pass 1.
162
+ *
163
+ * AN EXPLICIT `false` IS THE ONLY RELEASE SIGNAL. A host that never defines `__DEV__` reads
164
+ * `undefined`, and a `!__DEV__` test would silence every NG-code diagnostic there in exchange for a
165
+ * speed-up nobody asked for. Metro writes a literal `true` or `false`, so the signal exists exactly
166
+ * where it can be trusted.
167
+ *
168
+ * Per mount rather than once per process: `enableProdMode()` only ever writes `false`, so repeating
169
+ * it costs a property write and a guard that has already been taken on every surface but the first.
170
+ *
171
+ * READ AS AN IDENTIFIER, NEVER AS `globalThis.__DEV__`, and that distinction is the whole
172
+ * mechanism. Both Metro and esbuild deliver `__DEV__` by SUBSTITUTING the identifier for a literal,
173
+ * so a property lookup finds nothing whatever the build says. The first spelling of this function
174
+ * used `Reflect.get(globalThis, '__DEV__')`, never fired once in the bench bundle, and measured a
175
+ * clean zero — which reads exactly like "this optimization does not work" and is not that. The
176
+ * `typeof` guard is what makes the bare identifier safe where nothing declares it at all.
177
+ */
178
+ function settleAngularDevMode(): void {
179
+ if (typeof __DEV__ === 'undefined' || __DEV__ !== false) return;
180
+ enableProdMode();
181
+ }
182
+
140
183
  export function mount(
141
184
  rootTag: IRootTag,
142
185
  rootComponent: Type<unknown>,
143
186
  options?: IMountOptions,
144
187
  ): SymbioteSurface {
188
+ settleAngularDevMode();
145
189
  // A re-mount on a live rootTag starts clean; otherwise the stale app double-drives the surface.
146
190
  teardown(rootTag);
147
191