@symbiote-native/angular 0.6.2 → 0.7.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 (162) hide show
  1. package/bin/symbiote-angular-dev.cjs +20 -19
  2. package/build/angular/anchor-host-registry.js +2 -2
  3. package/build/angular/anchor-host-registry.js.map +1 -1
  4. package/build/angular/components/activity-indicator/index.android.d.ts +2 -1
  5. package/build/angular/components/activity-indicator/index.android.js +6 -3
  6. package/build/angular/components/activity-indicator/index.android.js.map +1 -1
  7. package/build/angular/components/activity-indicator/index.ios.d.ts +2 -1
  8. package/build/angular/components/activity-indicator/index.ios.js +6 -3
  9. package/build/angular/components/activity-indicator/index.ios.js.map +1 -1
  10. package/build/angular/components/activity-indicator/shared.js +3 -3
  11. package/build/angular/components/button.d.ts +4 -2
  12. package/build/angular/components/button.js +28 -17
  13. package/build/angular/components/button.js.map +1 -1
  14. package/build/angular/components/flat-list/index.d.ts +5 -3
  15. package/build/angular/components/flat-list/index.js +35 -38
  16. package/build/angular/components/flat-list/index.js.map +1 -1
  17. package/build/angular/components/image/index.android.d.ts +8 -3
  18. package/build/angular/components/image/index.android.js +39 -9
  19. package/build/angular/components/image/index.android.js.map +1 -1
  20. package/build/angular/components/image/index.ios.d.ts +8 -3
  21. package/build/angular/components/image/index.ios.js +39 -9
  22. package/build/angular/components/image/index.ios.js.map +1 -1
  23. package/build/angular/components/image/shared.d.ts +4 -1
  24. package/build/angular/components/image/shared.js +33 -2
  25. package/build/angular/components/image/shared.js.map +1 -1
  26. package/build/angular/components/image-background.d.ts +2 -1
  27. package/build/angular/components/image-background.js +6 -4
  28. package/build/angular/components/image-background.js.map +1 -1
  29. package/build/angular/components/input-accessory-view/index.d.ts +9 -4
  30. package/build/angular/components/input-accessory-view/index.js +43 -9
  31. package/build/angular/components/input-accessory-view/index.js.map +1 -1
  32. package/build/angular/components/keyboard-avoiding-view/index.d.ts +2 -1
  33. package/build/angular/components/keyboard-avoiding-view/index.js +6 -4
  34. package/build/angular/components/keyboard-avoiding-view/index.js.map +1 -1
  35. package/build/angular/components/modal/index.d.ts +11 -8
  36. package/build/angular/components/modal/index.js +45 -28
  37. package/build/angular/components/modal/index.js.map +1 -1
  38. package/build/angular/components/pressable/index.d.ts +11 -5
  39. package/build/angular/components/pressable/index.js +61 -12
  40. package/build/angular/components/pressable/index.js.map +1 -1
  41. package/build/angular/components/refresh-control/index.d.ts +8 -4
  42. package/build/angular/components/refresh-control/index.js +52 -16
  43. package/build/angular/components/refresh-control/index.js.map +1 -1
  44. package/build/angular/components/safe-area-view/index.d.ts +9 -4
  45. package/build/angular/components/safe-area-view/index.js +46 -9
  46. package/build/angular/components/safe-area-view/index.js.map +1 -1
  47. package/build/angular/components/scroll-view/index.android.d.ts +2 -3
  48. package/build/angular/components/scroll-view/index.android.js +49 -52
  49. package/build/angular/components/scroll-view/index.android.js.map +1 -1
  50. package/build/angular/components/scroll-view/index.ios.d.ts +2 -3
  51. package/build/angular/components/scroll-view/index.ios.js +15 -17
  52. package/build/angular/components/scroll-view/index.ios.js.map +1 -1
  53. package/build/angular/components/scroll-view/projection.d.ts +3 -0
  54. package/build/angular/components/scroll-view/projection.js +68 -7
  55. package/build/angular/components/scroll-view/projection.js.map +1 -1
  56. package/build/angular/components/scroll-view/shared.d.ts +14 -5
  57. package/build/angular/components/scroll-view/shared.js +198 -69
  58. package/build/angular/components/scroll-view/shared.js.map +1 -1
  59. package/build/angular/components/scroll-view/sticky-header.js +14 -19
  60. package/build/angular/components/scroll-view/sticky-header.js.map +1 -1
  61. package/build/angular/components/section-list/index.d.ts +2 -1
  62. package/build/angular/components/section-list/index.js +31 -39
  63. package/build/angular/components/section-list/index.js.map +1 -1
  64. package/build/angular/components/switch/index.android.d.ts +7 -3
  65. package/build/angular/components/switch/index.android.js +38 -10
  66. package/build/angular/components/switch/index.android.js.map +1 -1
  67. package/build/angular/components/switch/index.ios.d.ts +7 -3
  68. package/build/angular/components/switch/index.ios.js +38 -10
  69. package/build/angular/components/switch/index.ios.js.map +1 -1
  70. package/build/angular/components/switch/shared.d.ts +12 -3
  71. package/build/angular/components/switch/shared.js +66 -5
  72. package/build/angular/components/switch/shared.js.map +1 -1
  73. package/build/angular/components/text-input.d.ts +10 -2
  74. package/build/angular/components/text-input.js +46 -6
  75. package/build/angular/components/text-input.js.map +1 -1
  76. package/build/angular/components/touchable/index.d.ts +17 -8
  77. package/build/angular/components/touchable/index.js +78 -19
  78. package/build/angular/components/touchable/index.js.map +1 -1
  79. package/build/angular/components/touchable-native-feedback/index.d.ts +6 -3
  80. package/build/angular/components/touchable-native-feedback/index.js +61 -25
  81. package/build/angular/components/touchable-native-feedback/index.js.map +1 -1
  82. package/build/angular/components/virtualized-list/directives.js +18 -18
  83. package/build/angular/components/virtualized-list/index.d.ts +12 -4
  84. package/build/angular/components/virtualized-list/index.js +163 -68
  85. package/build/angular/components/virtualized-list/index.js.map +1 -1
  86. package/build/angular/components/virtualized-section-list/directives.js +12 -12
  87. package/build/angular/components/virtualized-section-list/index.d.ts +2 -1
  88. package/build/angular/components/virtualized-section-list/index.js +6 -4
  89. package/build/angular/components/virtualized-section-list/index.js.map +1 -1
  90. package/build/angular/components.d.ts +1 -1
  91. package/build/angular/components.js +5 -0
  92. package/build/angular/components.js.map +1 -1
  93. package/build/angular/create-portal/index.js +29 -35
  94. package/build/angular/create-portal/index.js.map +1 -1
  95. package/build/angular/create-tunnel/index.js +19 -22
  96. package/build/angular/create-tunnel/index.js.map +1 -1
  97. package/build/angular/descriptor-to-angular/index.js +3 -3
  98. package/build/angular/index.d.ts +4 -2
  99. package/build/angular/index.js +2 -2
  100. package/build/angular/index.js.map +1 -1
  101. package/build/angular/modules/animated/animated-leaf-binder.d.ts +1 -7
  102. package/build/angular/modules/animated/animated-leaf-binder.js +22 -72
  103. package/build/angular/modules/animated/animated-leaf-binder.js.map +1 -1
  104. package/build/angular/modules/animated/create-animated-component.d.ts +11 -6
  105. package/build/angular/modules/animated/create-animated-component.js +83 -50
  106. package/build/angular/modules/animated/create-animated-component.js.map +1 -1
  107. package/build/angular/modules/app-registry/index.js.map +1 -1
  108. package/build/angular/modules/status-bar/index.js +3 -3
  109. package/build/angular/primitives/index.d.ts +1 -1
  110. package/build/angular/primitives/index.js +46 -46
  111. package/build/angular/primitives/index.js.map +1 -1
  112. package/build/angular/primitives/shared.d.ts +39 -1
  113. package/build/angular/primitives/shared.js +110 -9
  114. package/build/angular/primitives/shared.js.map +1 -1
  115. package/build/angular/render/index.js +23 -35
  116. package/build/angular/render/index.js.map +1 -1
  117. package/build/angular/services/color-scheme.service.js +3 -3
  118. package/build/angular/services/window-dimensions.service.js +3 -3
  119. package/package.json +9 -7
  120. package/src/anchor-host-registry.ts +2 -2
  121. package/src/components/activity-indicator/index.android.ts +2 -0
  122. package/src/components/activity-indicator/index.ios.ts +2 -0
  123. package/src/components/button.ts +28 -14
  124. package/src/components/flat-list/index.ts +34 -36
  125. package/src/components/image/index.android.ts +50 -6
  126. package/src/components/image/index.ios.ts +50 -6
  127. package/src/components/image/shared.ts +34 -2
  128. package/src/components/image-background.ts +2 -1
  129. package/src/components/input-accessory-view/index.ts +42 -4
  130. package/src/components/keyboard-avoiding-view/index.ts +7 -1
  131. package/src/components/modal/index.ts +51 -26
  132. package/src/components/pressable/index.ts +67 -8
  133. package/src/components/refresh-control/index.ts +54 -12
  134. package/src/components/safe-area-view/index.ts +50 -5
  135. package/src/components/scroll-view/index.android.ts +34 -41
  136. package/src/components/scroll-view/index.ios.ts +10 -21
  137. package/src/components/scroll-view/projection.ts +79 -7
  138. package/src/components/scroll-view/shared.ts +223 -68
  139. package/src/components/scroll-view/sticky-header.ts +11 -16
  140. package/src/components/section-list/index.ts +27 -36
  141. package/src/components/switch/index.android.ts +48 -7
  142. package/src/components/switch/index.ios.ts +48 -7
  143. package/src/components/switch/shared.ts +79 -3
  144. package/src/components/text-input.ts +52 -2
  145. package/src/components/touchable/index.ts +76 -16
  146. package/src/components/touchable-native-feedback/index.ts +62 -21
  147. package/src/components/virtualized-list/index.ts +137 -44
  148. package/src/components/virtualized-section-list/index.ts +2 -1
  149. package/src/components.ts +5 -0
  150. package/src/create-portal/index.ts +23 -29
  151. package/src/create-tunnel/index.ts +13 -16
  152. package/src/index.ts +30 -1
  153. package/src/modules/animated/animated-leaf-binder.ts +28 -77
  154. package/src/modules/animated/create-animated-component.ts +75 -36
  155. package/src/modules/app-registry/index.ts +6 -8
  156. package/src/primitives/index.ts +1 -0
  157. package/src/primitives/shared.ts +102 -3
  158. package/src/render/index.ts +23 -35
  159. package/build/angular/modules/animated/animated-leaf-binder/index.d.ts +0 -14
  160. package/build/angular/modules/animated/animated-leaf-binder/index.js +0 -91
  161. package/build/angular/modules/animated/animated-leaf-binder/index.js.map +0 -1
  162. package/src/modules/animated/animated-leaf-binder/index.ts +0 -101
@@ -1,91 +0,0 @@
1
- // Pure Fabrication (GRASP): the leaf-lifecycle orchestration shared by every Animated*
2
- // wrapper, extracted out of AnimatedComponentBase so AnimatedImage — which cannot extend
3
- // AnimatedComponentBase, since it must extend ImageBase for TS's-native image handling —
4
- // gets the SAME logic via composition instead of copy-pasting it. Framework-thin on
5
- // purpose: it knows nothing about Angular (@ViewChild, DI, change detection), only the
6
- // engine's Animated leaf + commit primitives, so it stays testable without any Angular
7
- // bootstrap. NOTE: react/vue drive this same dance through their own runtime HOC
8
- // (createAnimatedComponent) rather than a class, so there is no cross-adapter dedup
9
- // opportunity here yet — this Pure Fabrication is local to the angular adapter.
10
- import { AnimatedProps, attachNativeEventHandler, dlog, whenCommitted, } from '@symbiote-native/engine';
11
- export class AnimatedLeafBinder {
12
- resolveNode;
13
- label;
14
- // The leaf currently wired into the value graph. Null until the first reconcile.
15
- attached = null;
16
- // The whenCommitted waiter for the current leaf's node binding, cancelled before the next.
17
- cancelBind;
18
- // Detachers for any Animated.event prop bound natively to the committed node (JS path: none).
19
- eventDetachers = [];
20
- // `resolveNode` stays a caller-supplied resolver (not a constructor-captured node) so this
21
- // class never needs to know HOW the host node is found — AnimatedComponentBase and
22
- // AnimatedImage both resolve it the same way (resolveHostNode + isSymbioteNode over their
23
- // own @ViewChild), but that's Angular DI state this binder has no business touching.
24
- // `label` is purely diagnostic (dlog), mirroring the constructor.name the pre-extraction
25
- // dlog call used.
26
- constructor(resolveNode, label) {
27
- this.resolveNode = resolveNode;
28
- this.label = label;
29
- }
30
- // Build a fresh AnimatedProps leaf from the current props (the React/Vue per-render
31
- // useMemo(rest)), wire it into the graph, and swap the previous one out. Attach the NEW leaf
32
- // BEFORE detaching the OLD one: a shared Value self-detaches (dropping its native node) the
33
- // instant its child count hits zero, so detaching first would kill a running native animation
34
- // on any unrelated re-render (mirrors RN's AnimatedComponent._attachProps). Then bind the
35
- // committed node, go native if wanted, and rebind native events.
36
- reconcile(props, wantsNative) {
37
- dlog(`${this.label} reconcile`);
38
- const newLeaf = new AnimatedProps(props);
39
- newLeaf.__attach();
40
- if (this.attached !== null && this.attached !== newLeaf)
41
- this.attached.__detach();
42
- this.attached = newLeaf;
43
- this.bindNode(newLeaf, props, wantsNative);
44
- }
45
- // Bind the leaf to the host's Fabric node THROUGH whenCommitted: under Angular's zoneless
46
- // batched change detection the inner host's tag does not exist yet at ngAfterViewInit time
47
- // (the same async-commit gotcha Vue documents), so binding eagerly would no-op. whenCommitted
48
- // runs the action now if already committed, else after the commit that assigns the tag.
49
- bindNode(leaf, props, wantsNative) {
50
- this.cancelBind?.();
51
- this.cancelBind = undefined;
52
- const node = this.resolveNode();
53
- if (node === null)
54
- return;
55
- this.cancelBind = whenCommitted(node, () => {
56
- leaf.setNativeView(node);
57
- if (wantsNative)
58
- leaf.__makeNative();
59
- this.attachEvents(node, props);
60
- });
61
- }
62
- // Native-attach any Animated.event prop (e.g. onScroll={Animated.event(…,{useNativeDriver:true})})
63
- // to the committed node. attachNativeEventHandler no-ops (returns undefined) unless the prop is a
64
- // native event handler with a committed tag, so the JS path stays the fallback. Rebound each
65
- // reconcile so a new inline event re-attaches; detached first to avoid leaking the prior binding.
66
- attachEvents(node, props) {
67
- this.detachEvents();
68
- for (const key of Object.keys(props)) {
69
- const attachment = attachNativeEventHandler(node, key, props[key]);
70
- if (attachment !== undefined)
71
- this.eventDetachers.push(attachment.detach);
72
- }
73
- }
74
- detachEvents() {
75
- for (const detach of this.eventDetachers)
76
- detach();
77
- this.eventDetachers = [];
78
- }
79
- // Tear down everything: cancel a still-pending bind, drop native event listeners, detach the
80
- // current leaf from the value graph. Safe to call even if reconcile() was never called.
81
- destroy() {
82
- this.cancelBind?.();
83
- this.cancelBind = undefined;
84
- this.detachEvents();
85
- if (this.attached !== null) {
86
- this.attached.__detach();
87
- this.attached = null;
88
- }
89
- }
90
- }
91
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/animated/animated-leaf-binder/index.ts"],"names":[],"mappings":"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"}
@@ -1,101 +0,0 @@
1
- // Pure Fabrication (GRASP): the leaf-lifecycle orchestration shared by every Animated*
2
- // wrapper, extracted out of AnimatedComponentBase so AnimatedImage — which cannot extend
3
- // AnimatedComponentBase, since it must extend ImageBase for TS's-native image handling —
4
- // gets the SAME logic via composition instead of copy-pasting it. Framework-thin on
5
- // purpose: it knows nothing about Angular (@ViewChild, DI, change detection), only the
6
- // engine's Animated leaf + commit primitives, so it stays testable without any Angular
7
- // bootstrap. NOTE: react/vue drive this same dance through their own runtime HOC
8
- // (createAnimatedComponent) rather than a class, so there is no cross-adapter dedup
9
- // opportunity here yet — this Pure Fabrication is local to the angular adapter.
10
- import {
11
- AnimatedProps,
12
- attachNativeEventHandler,
13
- dlog,
14
- whenCommitted,
15
- type ISymbioteNode,
16
- } from '@symbiote-native/engine';
17
-
18
- export class AnimatedLeafBinder {
19
- // The leaf currently wired into the value graph. Null until the first reconcile.
20
- private attached: AnimatedProps | null = null;
21
- // The whenCommitted waiter for the current leaf's node binding, cancelled before the next.
22
- private cancelBind: (() => void) | undefined;
23
- // Detachers for any Animated.event prop bound natively to the committed node (JS path: none).
24
- private eventDetachers: Array<() => void> = [];
25
-
26
- // `resolveNode` stays a caller-supplied resolver (not a constructor-captured node) so this
27
- // class never needs to know HOW the host node is found — AnimatedComponentBase and
28
- // AnimatedImage both resolve it the same way (resolveHostNode + isSymbioteNode over their
29
- // own @ViewChild), but that's Angular DI state this binder has no business touching.
30
- // `label` is purely diagnostic (dlog), mirroring the constructor.name the pre-extraction
31
- // dlog call used.
32
- constructor(
33
- private readonly resolveNode: () => ISymbioteNode | null,
34
- private readonly label: string,
35
- ) {}
36
-
37
- // Build a fresh AnimatedProps leaf from the current props (the React/Vue per-render
38
- // useMemo(rest)), wire it into the graph, and swap the previous one out. Attach the NEW leaf
39
- // BEFORE detaching the OLD one: a shared Value self-detaches (dropping its native node) the
40
- // instant its child count hits zero, so detaching first would kill a running native animation
41
- // on any unrelated re-render (mirrors RN's AnimatedComponent._attachProps). Then bind the
42
- // committed node, go native if wanted, and rebind native events.
43
- reconcile(props: Record<string, unknown>, wantsNative: boolean): void {
44
- dlog(`${this.label} reconcile`);
45
- const newLeaf = new AnimatedProps(props);
46
- newLeaf.__attach();
47
- if (this.attached !== null && this.attached !== newLeaf) this.attached.__detach();
48
- this.attached = newLeaf;
49
-
50
- this.bindNode(newLeaf, props, wantsNative);
51
- }
52
-
53
- // Bind the leaf to the host's Fabric node THROUGH whenCommitted: under Angular's zoneless
54
- // batched change detection the inner host's tag does not exist yet at ngAfterViewInit time
55
- // (the same async-commit gotcha Vue documents), so binding eagerly would no-op. whenCommitted
56
- // runs the action now if already committed, else after the commit that assigns the tag.
57
- private bindNode(
58
- leaf: AnimatedProps,
59
- props: Record<string, unknown>,
60
- wantsNative: boolean,
61
- ): void {
62
- this.cancelBind?.();
63
- this.cancelBind = undefined;
64
- const node = this.resolveNode();
65
- if (node === null) return;
66
- this.cancelBind = whenCommitted(node, () => {
67
- leaf.setNativeView(node);
68
- if (wantsNative) leaf.__makeNative();
69
- this.attachEvents(node, props);
70
- });
71
- }
72
-
73
- // Native-attach any Animated.event prop (e.g. onScroll={Animated.event(…,{useNativeDriver:true})})
74
- // to the committed node. attachNativeEventHandler no-ops (returns undefined) unless the prop is a
75
- // native event handler with a committed tag, so the JS path stays the fallback. Rebound each
76
- // reconcile so a new inline event re-attaches; detached first to avoid leaking the prior binding.
77
- private attachEvents(node: ISymbioteNode, props: Record<string, unknown>): void {
78
- this.detachEvents();
79
- for (const key of Object.keys(props)) {
80
- const attachment = attachNativeEventHandler(node, key, props[key]);
81
- if (attachment !== undefined) this.eventDetachers.push(attachment.detach);
82
- }
83
- }
84
-
85
- private detachEvents(): void {
86
- for (const detach of this.eventDetachers) detach();
87
- this.eventDetachers = [];
88
- }
89
-
90
- // Tear down everything: cancel a still-pending bind, drop native event listeners, detach the
91
- // current leaf from the value graph. Safe to call even if reconcile() was never called.
92
- destroy(): void {
93
- this.cancelBind?.();
94
- this.cancelBind = undefined;
95
- this.detachEvents();
96
- if (this.attached !== null) {
97
- this.attached.__detach();
98
- this.attached = null;
99
- }
100
- }
101
- }