@symbiote-native/angular 0.8.0 → 2.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 (256) hide show
  1. package/README.md +13 -10
  2. package/babel-register-composed.cjs +58 -18
  3. package/bin/symbiote-angular-dev.cjs +16 -4
  4. package/build/angular/anchor-host-registry.js +1 -15
  5. package/build/angular/anchor-host-registry.js.map +1 -1
  6. package/build/angular/change-detection-flush.d.ts +31 -0
  7. package/build/angular/change-detection-flush.js +110 -0
  8. package/build/angular/change-detection-flush.js.map +1 -0
  9. package/build/angular/components/activity-indicator-props.d.ts +2 -0
  10. package/build/angular/components/activity-indicator-props.js +2 -0
  11. package/build/angular/components/activity-indicator-props.js.map +1 -0
  12. package/build/angular/components/button-props.d.ts +2 -0
  13. package/build/angular/components/button-props.js +2 -0
  14. package/build/angular/components/button-props.js.map +1 -0
  15. package/build/angular/components/flat-list/index.d.ts +2 -1
  16. package/build/angular/components/flat-list/index.js +22 -10
  17. package/build/angular/components/flat-list/index.js.map +1 -1
  18. package/build/angular/components/image-background-props.d.ts +6 -0
  19. package/build/angular/components/image-background-props.js +2 -0
  20. package/build/angular/components/image-background-props.js.map +1 -0
  21. package/build/angular/components/{image/shared.d.ts → image-shared.d.ts} +4 -4
  22. package/build/angular/components/{image/shared.js → image-shared.js} +39 -28
  23. package/build/angular/components/image-shared.js.map +1 -0
  24. package/build/angular/components/input-accessory-view-props.d.ts +7 -0
  25. package/build/angular/components/input-accessory-view-props.js +9 -0
  26. package/build/angular/components/input-accessory-view-props.js.map +1 -0
  27. package/build/angular/components/keyboard-avoiding-view/index.d.ts +2 -1
  28. package/build/angular/components/keyboard-avoiding-view/index.js +28 -27
  29. package/build/angular/components/keyboard-avoiding-view/index.js.map +1 -1
  30. package/build/angular/components/modal/index.d.ts +2 -0
  31. package/build/angular/components/modal/index.js +33 -20
  32. package/build/angular/components/modal/index.js.map +1 -1
  33. package/build/angular/components/pressable-props.d.ts +32 -0
  34. package/build/angular/components/pressable-props.js +11 -0
  35. package/build/angular/components/pressable-props.js.map +1 -0
  36. package/build/angular/components/refresh-control-props.d.ts +16 -0
  37. package/build/angular/components/refresh-control-props.js +14 -0
  38. package/build/angular/components/refresh-control-props.js.map +1 -0
  39. package/build/angular/components/safe-area-view-props.d.ts +7 -0
  40. package/build/angular/components/safe-area-view-props.js +11 -0
  41. package/build/angular/components/safe-area-view-props.js.map +1 -0
  42. package/build/angular/components/scroll-view-props.d.ts +76 -0
  43. package/build/angular/components/scroll-view-props.js +18 -0
  44. package/build/angular/components/scroll-view-props.js.map +1 -0
  45. package/build/angular/components/section-list/index.d.ts +3 -0
  46. package/build/angular/components/section-list/index.js +10 -1
  47. package/build/angular/components/section-list/index.js.map +1 -1
  48. package/build/angular/components/text-input-props.d.ts +45 -0
  49. package/build/angular/components/text-input-props.js +18 -0
  50. package/build/angular/components/text-input-props.js.map +1 -0
  51. package/build/angular/components/touchable-native-feedback/touchable-native-feedback-props.d.ts +6 -0
  52. package/build/angular/components/touchable-native-feedback/touchable-native-feedback-props.js +2 -0
  53. package/build/angular/components/touchable-native-feedback/touchable-native-feedback-props.js.map +1 -0
  54. package/build/angular/components/touchable-props.d.ts +14 -0
  55. package/build/angular/components/touchable-props.js +13 -0
  56. package/build/angular/components/touchable-props.js.map +1 -0
  57. package/build/angular/components/touchable-without-feedback/touchable-without-feedback-props.d.ts +3 -0
  58. package/build/angular/components/touchable-without-feedback/touchable-without-feedback-props.js +2 -0
  59. package/build/angular/components/touchable-without-feedback/touchable-without-feedback-props.js.map +1 -0
  60. package/build/angular/components/virtualized-list/index.d.ts +8 -1
  61. package/build/angular/components/virtualized-list/index.js +373 -278
  62. package/build/angular/components/virtualized-list/index.js.map +1 -1
  63. package/build/angular/components/virtualized-section-list/index.d.ts +3 -0
  64. package/build/angular/components/virtualized-section-list/index.js +10 -1
  65. package/build/angular/components/virtualized-section-list/index.js.map +1 -1
  66. package/build/angular/components.d.ts +21 -27
  67. package/build/angular/components.js +13 -15
  68. package/build/angular/components.js.map +1 -1
  69. package/build/angular/create-portal/index.d.ts +11 -2
  70. package/build/angular/create-portal/index.js +37 -11
  71. package/build/angular/create-portal/index.js.map +1 -1
  72. package/build/angular/create-tunnel/index.js +1 -1
  73. package/build/angular/element-props.d.ts +53 -0
  74. package/build/angular/element-props.js +2 -0
  75. package/build/angular/element-props.js.map +1 -0
  76. package/build/angular/elements.d.ts +528 -0
  77. package/build/angular/elements.js +1444 -0
  78. package/build/angular/elements.js.map +1 -0
  79. package/build/angular/gate-demand.d.ts +37 -0
  80. package/build/angular/gate-demand.js +84 -0
  81. package/build/angular/gate-demand.js.map +1 -0
  82. package/build/angular/host-instance/index.js +1 -1
  83. package/build/angular/index.d.ts +5 -2
  84. package/build/angular/index.js +16 -1
  85. package/build/angular/index.js.map +1 -1
  86. package/build/angular/modules/animated/create-animated-component.d.ts +6 -6
  87. package/build/angular/modules/animated/create-animated-component.js +73 -81
  88. package/build/angular/modules/animated/create-animated-component.js.map +1 -1
  89. package/build/angular/modules/animated/index.js +1 -1
  90. package/build/angular/modules/animated/index.js.map +1 -1
  91. package/build/angular/modules/image/index.d.ts +3 -0
  92. package/build/angular/modules/image/index.js +16 -0
  93. package/build/angular/modules/image/index.js.map +1 -0
  94. package/build/angular/primitives/index.d.ts +28 -16
  95. package/build/angular/primitives/index.js +77 -31
  96. package/build/angular/primitives/index.js.map +1 -1
  97. package/build/angular/primitives/shared.d.ts +2 -3
  98. package/build/angular/primitives/shared.js +8 -53
  99. package/build/angular/primitives/shared.js.map +1 -1
  100. package/build/angular/register.d.ts +1 -0
  101. package/build/angular/register.js +16 -0
  102. package/build/angular/register.js.map +1 -0
  103. package/build/angular/render/index.js +4 -2
  104. package/build/angular/render/index.js.map +1 -1
  105. package/build/angular/renderer/index.js +207 -60
  106. package/build/angular/renderer/index.js.map +1 -1
  107. package/build/angular/renderer/value-change.d.ts +2 -0
  108. package/build/angular/renderer/value-change.js +9 -0
  109. package/build/angular/renderer/value-change.js.map +1 -0
  110. package/metro-config.cjs +23 -5
  111. package/metro-css-parser.cjs +2 -1
  112. package/package.json +17 -7
  113. package/src/anchor-host-registry.ts +1 -15
  114. package/src/change-detection-flush.ts +120 -0
  115. package/src/components/activity-indicator-props.ts +21 -0
  116. package/src/components/button-props.ts +26 -0
  117. package/src/components/flat-list/index.ts +12 -4
  118. package/src/components/image-background-props.ts +24 -0
  119. package/src/components/{image/shared.ts → image-shared.ts} +57 -26
  120. package/src/components/input-accessory-view-props.ts +21 -0
  121. package/src/components/keyboard-avoiding-view/index.ts +27 -16
  122. package/src/components/modal/index.ts +32 -11
  123. package/src/components/pressable-props.ts +73 -0
  124. package/src/components/refresh-control-props.ts +43 -0
  125. package/src/components/safe-area-view-props.ts +28 -0
  126. package/src/components/scroll-view-props.ts +109 -0
  127. package/src/components/section-list/index.ts +18 -0
  128. package/src/components/text-input-props.ts +72 -0
  129. package/src/components/touchable-native-feedback/touchable-native-feedback-props.ts +23 -0
  130. package/src/components/touchable-props.ts +30 -0
  131. package/src/components/touchable-without-feedback/touchable-without-feedback-props.ts +21 -0
  132. package/src/components/virtualized-list/index.ts +254 -153
  133. package/src/components/virtualized-section-list/index.ts +18 -0
  134. package/src/components.ts +86 -35
  135. package/src/create-portal/index.ts +39 -9
  136. package/src/create-tunnel/index.ts +1 -1
  137. package/src/diagnostics.ts +1 -1
  138. package/src/element-props.ts +90 -0
  139. package/src/elements.ts +919 -0
  140. package/src/gate-demand.ts +109 -0
  141. package/src/host-instance/index.ts +1 -1
  142. package/src/index.ts +54 -15
  143. package/src/modules/animated/create-animated-component.ts +73 -59
  144. package/src/modules/animated/index.ts +1 -1
  145. package/src/modules/image/index.ts +18 -0
  146. package/src/primitives/index.ts +47 -16
  147. package/src/primitives/shared.ts +11 -44
  148. package/src/register.ts +15 -0
  149. package/src/render/index.ts +4 -2
  150. package/src/renderer/index.ts +239 -80
  151. package/src/renderer/value-change.ts +8 -0
  152. package/build/angular/components/activity-indicator/index.android.d.ts +0 -13
  153. package/build/angular/components/activity-indicator/index.android.js +0 -29
  154. package/build/angular/components/activity-indicator/index.android.js.map +0 -1
  155. package/build/angular/components/activity-indicator/index.d.ts +0 -1
  156. package/build/angular/components/activity-indicator/index.ios.d.ts +0 -9
  157. package/build/angular/components/activity-indicator/index.ios.js +0 -26
  158. package/build/angular/components/activity-indicator/index.ios.js.map +0 -1
  159. package/build/angular/components/activity-indicator/index.js +0 -4
  160. package/build/angular/components/activity-indicator/index.js.map +0 -1
  161. package/build/angular/components/activity-indicator/shared.d.ts +0 -67
  162. package/build/angular/components/activity-indicator/shared.js +0 -260
  163. package/build/angular/components/activity-indicator/shared.js.map +0 -1
  164. package/build/angular/components/button.d.ts +0 -65
  165. package/build/angular/components/button.js +0 -351
  166. package/build/angular/components/button.js.map +0 -1
  167. package/build/angular/components/image/index.android.d.ts +0 -15
  168. package/build/angular/components/image/index.android.js +0 -91
  169. package/build/angular/components/image/index.android.js.map +0 -1
  170. package/build/angular/components/image/index.d.ts +0 -1
  171. package/build/angular/components/image/index.ios.d.ts +0 -15
  172. package/build/angular/components/image/index.ios.js +0 -91
  173. package/build/angular/components/image/index.ios.js.map +0 -1
  174. package/build/angular/components/image/index.js +0 -3
  175. package/build/angular/components/image/index.js.map +0 -1
  176. package/build/angular/components/image/shared.js.map +0 -1
  177. package/build/angular/components/image-background.d.ts +0 -82
  178. package/build/angular/components/image-background.js +0 -434
  179. package/build/angular/components/image-background.js.map +0 -1
  180. package/build/angular/components/input-accessory-view/index.d.ts +0 -65
  181. package/build/angular/components/input-accessory-view/index.js +0 -290
  182. package/build/angular/components/input-accessory-view/index.js.map +0 -1
  183. package/build/angular/components/pressable/index.d.ts +0 -129
  184. package/build/angular/components/pressable/index.js +0 -473
  185. package/build/angular/components/pressable/index.js.map +0 -1
  186. package/build/angular/components/refresh-control/index.d.ts +0 -90
  187. package/build/angular/components/refresh-control/index.js +0 -380
  188. package/build/angular/components/refresh-control/index.js.map +0 -1
  189. package/build/angular/components/safe-area-view/index.d.ts +0 -62
  190. package/build/angular/components/safe-area-view/index.js +0 -287
  191. package/build/angular/components/safe-area-view/index.js.map +0 -1
  192. package/build/angular/components/scroll-view/index.android.d.ts +0 -20
  193. package/build/angular/components/scroll-view/index.android.js +0 -262
  194. package/build/angular/components/scroll-view/index.android.js.map +0 -1
  195. package/build/angular/components/scroll-view/index.d.ts +0 -3
  196. package/build/angular/components/scroll-view/index.ios.d.ts +0 -8
  197. package/build/angular/components/scroll-view/index.ios.js +0 -92
  198. package/build/angular/components/scroll-view/index.ios.js.map +0 -1
  199. package/build/angular/components/scroll-view/index.js +0 -6
  200. package/build/angular/components/scroll-view/index.js.map +0 -1
  201. package/build/angular/components/scroll-view/projection.d.ts +0 -67
  202. package/build/angular/components/scroll-view/projection.js +0 -560
  203. package/build/angular/components/scroll-view/projection.js.map +0 -1
  204. package/build/angular/components/scroll-view/shared.d.ts +0 -239
  205. package/build/angular/components/scroll-view/shared.js +0 -832
  206. package/build/angular/components/scroll-view/shared.js.map +0 -1
  207. package/build/angular/components/scroll-view/sticky-header.d.ts +0 -40
  208. package/build/angular/components/scroll-view/sticky-header.js +0 -224
  209. package/build/angular/components/scroll-view/sticky-header.js.map +0 -1
  210. package/build/angular/components/switch/index.android.d.ts +0 -24
  211. package/build/angular/components/switch/index.android.js +0 -112
  212. package/build/angular/components/switch/index.android.js.map +0 -1
  213. package/build/angular/components/switch/index.d.ts +0 -1
  214. package/build/angular/components/switch/index.ios.d.ts +0 -23
  215. package/build/angular/components/switch/index.ios.js +0 -111
  216. package/build/angular/components/switch/index.ios.js.map +0 -1
  217. package/build/angular/components/switch/index.js +0 -4
  218. package/build/angular/components/switch/index.js.map +0 -1
  219. package/build/angular/components/switch/shared.d.ts +0 -49
  220. package/build/angular/components/switch/shared.js +0 -191
  221. package/build/angular/components/switch/shared.js.map +0 -1
  222. package/build/angular/components/text-input.d.ts +0 -161
  223. package/build/angular/components/text-input.js +0 -659
  224. package/build/angular/components/text-input.js.map +0 -1
  225. package/build/angular/components/touchable/index.d.ts +0 -276
  226. package/build/angular/components/touchable/index.js +0 -1422
  227. package/build/angular/components/touchable/index.js.map +0 -1
  228. package/build/angular/components/touchable-native-feedback/index.d.ts +0 -86
  229. package/build/angular/components/touchable-native-feedback/index.js +0 -407
  230. package/build/angular/components/touchable-native-feedback/index.js.map +0 -1
  231. package/src/components/activity-indicator/index.android.ts +0 -23
  232. package/src/components/activity-indicator/index.ios.ts +0 -21
  233. package/src/components/activity-indicator/index.ts +0 -4
  234. package/src/components/activity-indicator/shared.ts +0 -225
  235. package/src/components/button.ts +0 -220
  236. package/src/components/image/index.android.ts +0 -99
  237. package/src/components/image/index.ios.ts +0 -99
  238. package/src/components/image/index.ts +0 -3
  239. package/src/components/image-background.ts +0 -290
  240. package/src/components/input-accessory-view/index.ts +0 -240
  241. package/src/components/pressable/index.ts +0 -462
  242. package/src/components/refresh-control/index.ts +0 -340
  243. package/src/components/safe-area-view/index.ts +0 -231
  244. package/src/components/scroll-view/index.android.ts +0 -205
  245. package/src/components/scroll-view/index.ios.ts +0 -81
  246. package/src/components/scroll-view/index.ts +0 -7
  247. package/src/components/scroll-view/projection.ts +0 -713
  248. package/src/components/scroll-view/shared.ts +0 -1066
  249. package/src/components/scroll-view/sticky-header.ts +0 -267
  250. package/src/components/switch/index.android.ts +0 -113
  251. package/src/components/switch/index.ios.ts +0 -112
  252. package/src/components/switch/index.ts +0 -4
  253. package/src/components/switch/shared.ts +0 -284
  254. package/src/components/text-input.ts +0 -613
  255. package/src/components/touchable/index.ts +0 -913
  256. package/src/components/touchable-native-feedback/index.ts +0 -317
@@ -1,832 +0,0 @@
1
- // ScrollView, the Angular lifecycle half. The Fabric tree is nested: a scroll view wraps a
2
- // content view holding the children (RN's ScrollView.js shape). The platform-invariant math
3
- // (decelerationRate, per-axis intrinsics, content-size dedupe, imperative handle, native sticky
4
- // scroll-attach, aria/role fold) lives in @symbiote-native/components, shared with React/Vue.
5
- // Angular supplies only the lifecycle: the host node held by IDENTITY through a directive's
6
- // ElementRef, a forwarded-prop bag set via Renderer2 (-> routeProp), and the native sticky attach
7
- // wired through whenCommitted.
8
- //
9
- // RefreshControl integration diverges per platform (.ios/.android, Metro filename-selected): iOS
10
- // renders it as a SIBLING before the content container; Android WRAPS the scroll view in an
11
- // AndroidSwipeRefreshLayout.
12
- //
13
- // Angular cannot transform <ng-content> children the way React children.map / Vue slots() can, so
14
- // ScrollView owns a projection bridge: the content host registers a ScrollViewProjectionController
15
- // with the Angular renderer, which wraps projected children whose indices match
16
- // stickyHeaderIndices. Android RefreshControl projection re-renders the projected component as the
17
- // wrapper around the scroll view (RN's Android shape), excluding it from the content slot.
18
- import { Directive, computed, signal, ElementRef, EventEmitter, Output, ViewChild, ContentChild, inject, } from '@angular/core';
19
- import { attachStickyScroll, buildScrollViewHandle, didContentSizeChange, forwardScrollEvent, readLayoutDimension, resolveAccessibilityProps, resolveDecelerationRate, resolveScrollForwarding, selectScrollIntrinsics, splitLayoutProps, } from '@symbiote-native/components';
20
- import { AnimatedValue, dlog, event as animatedEvent, isNativeAnimatedAvailable, isSymbioteNode, resolveClassName, whenCommitted, } from '@symbiote-native/engine';
21
- import { anchorHostStyle, SymbioteHostPropsDirective } from '../../primitives';
22
- import { RefreshControl } from '../refresh-control';
23
- import { ScrollViewProjectionController } from './projection';
24
- import * as i0 from "@angular/core";
25
- // The inputs every platform ScrollView accepts, listed on each concrete @Component (the adapter
26
- // convention, mirroring Switch/Animated) so the base fields bind consistently. The aria-* /
27
- // role aliases ride here too and are folded by resolveAccessibilityProps before reaching native.
28
- export const SCROLL_VIEW_INPUTS = [
29
- 'style',
30
- 'contentContainerStyle',
31
- 'horizontal',
32
- 'scrollEnabled',
33
- 'showsVerticalScrollIndicator',
34
- 'showsHorizontalScrollIndicator',
35
- 'pagingEnabled',
36
- 'bounces',
37
- 'decelerationRate',
38
- 'scrollEventThrottle',
39
- 'contentInset',
40
- 'contentOffset',
41
- 'removeClippedSubviews',
42
- 'snapToInterval',
43
- 'snapToOffsets',
44
- 'snapToAlignment',
45
- 'snapToStart',
46
- 'snapToEnd',
47
- 'disableIntervalMomentum',
48
- 'stickyHeaderIndices',
49
- 'invertStickyHeaders',
50
- 'StickyHeaderComponent',
51
- 'keyboardDismissMode',
52
- 'keyboardShouldPersistTaps',
53
- 'maintainVisibleContentPosition',
54
- 'alwaysBounceHorizontal',
55
- 'alwaysBounceVertical',
56
- 'centerContent',
57
- 'scrollIndicatorInsets',
58
- 'indicatorStyle',
59
- 'directionalLockEnabled',
60
- 'automaticallyAdjustKeyboardInsets',
61
- 'contentInsetAdjustmentBehavior',
62
- 'minimumZoomScale',
63
- 'maximumZoomScale',
64
- 'zoomScale',
65
- 'bouncesZoom',
66
- 'pinchGestureEnabled',
67
- 'nestedScrollEnabled',
68
- 'overScrollMode',
69
- 'fadingEdgeLength',
70
- 'persistentScrollbar',
71
- 'endFillColor',
72
- 'onScroll',
73
- 'onScrollBeginDrag',
74
- 'onScrollEndDrag',
75
- 'onMomentumScrollBegin',
76
- 'onMomentumScrollEnd',
77
- 'testID',
78
- 'nativeID',
79
- 'accessible',
80
- 'accessibilityLabel',
81
- 'accessibilityHint',
82
- 'accessibilityRole',
83
- 'accessibilityState',
84
- 'accessibilityValue',
85
- 'accessibilityActions',
86
- 'accessibilityLabelledBy',
87
- 'importantForAccessibility',
88
- 'accessibilityLiveRegion',
89
- 'screenReaderFocusable',
90
- 'accessibilityViewIsModal',
91
- 'accessibilityElementsHidden',
92
- 'accessibilityIgnoresInvertColors',
93
- 'accessibilityLanguage',
94
- 'accessibilityRespondsToUserInteraction',
95
- 'accessibilityShowsLargeContentViewer',
96
- 'accessibilityLargeContentTitle',
97
- 'role',
98
- 'aria-label',
99
- 'aria-labelledby',
100
- 'aria-live',
101
- 'aria-hidden',
102
- 'aria-busy',
103
- 'aria-checked',
104
- 'aria-disabled',
105
- 'aria-expanded',
106
- 'aria-selected',
107
- 'aria-modal',
108
- 'aria-valuemax',
109
- 'aria-valuemin',
110
- 'aria-valuenow',
111
- 'aria-valuetext',
112
- ];
113
- // Strip undefined entries so a prop the user never set is not forwarded to the host (an undefined
114
- // reaching Fabric is at best a no-op, at worst clears a default). The Angular twin of React/Vue
115
- // destructuring `...rest` past the defined props.
116
- function compact(bag) {
117
- const result = {};
118
- for (const key of Object.keys(bag)) {
119
- if (bag[key] !== undefined)
120
- result[key] = bag[key];
121
- }
122
- return result;
123
- }
124
- // ScrollView's forwarded surface (scroll events + the snap/keyboard/zoom families) is exactly the
125
- // flat-bag shape SymbioteHostPropsDirective spreads onto a host element via Renderer2 (-> routeProp).
126
- // The scroll-event callbacks ride this bag (not the (event) channel) because routeProp must be free
127
- // to wire onScroll as an Animated.event when sticky headers drive the value natively, which the
128
- // listen()/setEventListener channel cannot carry. This mirrors React/Vue putting onScroll on
129
- // outerProps.
130
- export class ScrollViewProjectionDirective {
131
- elementRef = inject(ElementRef);
132
- set symbioteScrollViewProjection(controller) {
133
- const node = this.elementRef.nativeElement;
134
- if (isSymbioteNode(node))
135
- controller.bindContentNode(node);
136
- }
137
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ScrollViewProjectionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
138
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: ScrollViewProjectionDirective, isStandalone: true, selector: "[symbioteScrollViewProjection]", inputs: { symbioteScrollViewProjection: "symbioteScrollViewProjection" }, ngImport: i0 });
139
- }
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ScrollViewProjectionDirective, decorators: [{
141
- type: Directive,
142
- args: [{
143
- selector: '[symbioteScrollViewProjection]',
144
- standalone: true,
145
- inputs: ['symbioteScrollViewProjection'],
146
- }]
147
- }] });
148
- // @Directive() (no selector) is the Angular-sanctioned decorator for an abstract base that
149
- // declares lifecycle hooks and @ViewChild queries (mirrors AnimatedComponentBase) — without it
150
- // ngtsc rejects the inherited hooks/queries (NG2007). The concrete platform @Components add ONLY a
151
- // decorator + their platform template; all behavior lives here.
152
- export class ScrollViewBase {
153
- style;
154
- contentContainerStyle;
155
- horizontal;
156
- scrollEnabled;
157
- showsVerticalScrollIndicator;
158
- showsHorizontalScrollIndicator;
159
- pagingEnabled;
160
- bounces;
161
- decelerationRate;
162
- scrollEventThrottle;
163
- contentInset;
164
- contentOffset;
165
- removeClippedSubviews;
166
- snapToInterval;
167
- snapToOffsets;
168
- snapToAlignment;
169
- snapToStart;
170
- snapToEnd;
171
- disableIntervalMomentum;
172
- stickyHeaderIndices;
173
- invertStickyHeaders;
174
- StickyHeaderComponent;
175
- keyboardDismissMode;
176
- keyboardShouldPersistTaps;
177
- maintainVisibleContentPosition;
178
- alwaysBounceHorizontal;
179
- alwaysBounceVertical;
180
- centerContent;
181
- scrollIndicatorInsets;
182
- indicatorStyle;
183
- directionalLockEnabled;
184
- automaticallyAdjustKeyboardInsets;
185
- contentInsetAdjustmentBehavior;
186
- minimumZoomScale;
187
- maximumZoomScale;
188
- zoomScale;
189
- bouncesZoom;
190
- pinchGestureEnabled;
191
- nestedScrollEnabled;
192
- overScrollMode;
193
- fadingEdgeLength;
194
- persistentScrollbar;
195
- endFillColor;
196
- onScroll;
197
- onScrollBeginDrag;
198
- onScrollEndDrag;
199
- onMomentumScrollBegin;
200
- onMomentumScrollEnd;
201
- // The layout/content-size/accessibility events as real Angular events: `(layout)="…"`, not
202
- // `[onLayout]="…"`. onScroll and the drag/momentum family stay plain @Input() callbacks above —
203
- // they must also accept an Animated.event(...) native-driver marker (see the file header note),
204
- // which no @Output() binding can carry.
205
- layout = new EventEmitter();
206
- scrollToTop = new EventEmitter();
207
- contentSizeChange = new EventEmitter();
208
- accessibilityAction = new EventEmitter();
209
- accessibilityTap = new EventEmitter();
210
- magicTap = new EventEmitter();
211
- accessibilityEscape = new EventEmitter();
212
- testID;
213
- nativeID;
214
- accessible;
215
- accessibilityLabel;
216
- accessibilityHint;
217
- accessibilityRole;
218
- accessibilityState;
219
- accessibilityValue;
220
- accessibilityActions;
221
- accessibilityLabelledBy;
222
- importantForAccessibility;
223
- accessibilityLiveRegion;
224
- screenReaderFocusable;
225
- accessibilityViewIsModal;
226
- accessibilityElementsHidden;
227
- accessibilityIgnoresInvertColors;
228
- accessibilityLanguage;
229
- accessibilityRespondsToUserInteraction;
230
- accessibilityShowsLargeContentViewer;
231
- accessibilityLargeContentTitle;
232
- role;
233
- 'aria-label';
234
- 'aria-labelledby';
235
- 'aria-live';
236
- 'aria-hidden';
237
- 'aria-busy';
238
- 'aria-checked';
239
- 'aria-disabled';
240
- 'aria-expanded';
241
- 'aria-selected';
242
- 'aria-modal';
243
- 'aria-valuemax';
244
- 'aria-valuemin';
245
- 'aria-valuenow';
246
- 'aria-valuetext';
247
- // The host directive on the scroll-view intrinsic; `.node` is the committed SymbioteNode held by
248
- // IDENTITY (Renderer2.createElement returned the engine node, ElementRef hands it back unwrapped).
249
- // Inherited by the decorated subclass — Angular collects base-class @ViewChild queries.
250
- hostDirective;
251
- projectedRefreshControl;
252
- // This component's OWN anchor host — where a `class="..."` at the use site resolves (see
253
- // anchorHostStyle's doc comment) — NOT `#host` in the platform templates, which targets the real
254
- // inner scroll-view primitive one level down. Injected in the BASE because both platform
255
- // subclasses merged the identical anchor style into their `scrollProps` override.
256
- elementRef = inject(ElementRef);
257
- // The anchor's class-derived style is written by the RENDERER (addClass/removeClass ->
258
- // commitClassStyle), never through an @Input, so `inputsRevision` cannot cover it and a bag
259
- // memoized on plain reads of it would keep a stale class forever. It gets its own signal, polled
260
- // in ngDoCheck below: that hook runs on exactly the checks that could have changed it (Angular
261
- // applies the parent's class bindings before flushing this directive's pre-order hooks), which is
262
- // the same cadence the old `scrollProps` getter was re-read at.
263
- anchorStyle = signal(undefined, /* @ts-ignore */
264
- ...(ngDevMode ? [{ debugName: "anchorStyle" }] : /* istanbul ignore next */ []));
265
- // A single AnimatedValue tracks the scroll offset and drives every sticky header's translateY
266
- // (RN's _scrollAnimatedValue). A stable field (allocated once, held by identity — Angular does
267
- // not proxy class fields, so no markRaw needed); the native attach below feeds it on the UI
268
- // thread. Allocated unconditionally; inert until a sticky header consumes it.
269
- scrollAnimatedValue = new AnimatedValue(0);
270
- // The last-seen content size, used to dedupe onContentSizeChange: RN fires the content onLayout
271
- // on every layout pass; only real size changes emit (didContentSizeChange).
272
- lastContentSize = null;
273
- // Inverted sticky headers stick to the BOTTOM, so they need the viewport height (RN _handleLayout).
274
- viewportHeight = undefined;
275
- // What the projection controller was last told about the projected RefreshControl, so
276
- // ngAfterContentChecked can tell a real content change from an ordinary check.
277
- lastHasProjectedRefreshControl = false;
278
- projectionController = new ScrollViewProjectionController({
279
- stickyHeaderIndices: undefined,
280
- invertStickyHeaders: undefined,
281
- scrollViewHeight: undefined,
282
- scrollAnimatedValue: this.scrollAnimatedValue,
283
- customStickyHeaderComponent: undefined,
284
- excludeRefreshControl: false,
285
- });
286
- // Native sticky-scroll attach (RN attachNativeEvent): when the native module is available the
287
- // scroll value is driven on the UI thread so the interpolations ride scroll natively (no JS
288
- // jitter). Through whenCommitted because under Angular's zoneless batched CD the host's Fabric
289
- // tag does not exist yet at ngAfterViewInit time (the async-commit gotcha Vue documents); the
290
- // bind runs now if committed, else after the commit that assigns the tag. Detached on destroy.
291
- detachStickyScroll;
292
- cancelStickyBind;
293
- // What the current attach was made for, so a re-run that changes nothing stays a no-op.
294
- stickyAttachedEnabled = false;
295
- stickyAttachedNode = null;
296
- lastLoggedIsHorizontal = undefined;
297
- // Stable reference (bound once): inverted sticky headers need the viewport height captured off
298
- // the scroll-view's own onLayout before forwarding to the user (RN _handleLayout). A getter that
299
- // built this arrow function fresh on every `scrollProps` access would hand `[symbioteHostProps]`
300
- // a new function reference every change-detection pass touching this component — jsonEqual
301
- // (commit.ts) falls back to Object.is on a function leaf, so even a structurally-identical bag
302
- // reads as "props changed" and forces a real Fabric re-clone that cascades up every ancestor
303
- // (see AnimatedComponentBase.reconcile()'s identical warning).
304
- handleInvertedStickyLayout = (event) => {
305
- const height = readLayoutDimension(event, 'height');
306
- // The projection controller is pushed from here rather than picked up on the next prop-bag
307
- // read: viewportHeight is internal mutable state, so once `scrollProps` became a memoized
308
- // computed nothing would re-read it. Guarded on a real change - an onLayout that reports the
309
- // same height must not cost a sticky reconcile walk.
310
- if (height !== undefined && height !== this.viewportHeight) {
311
- this.viewportHeight = height;
312
- this.updateProjectionController();
313
- }
314
- this.layout.emit(event);
315
- };
316
- // Same reasoning as handleInvertedStickyLayout: the content view's onLayout synthesizes
317
- // onContentSizeChange (deduped) and must stay a stable reference across `contentProps` re-reads.
318
- handleContentLayout = (event) => {
319
- const width = readLayoutDimension(event, 'width');
320
- const height = readLayoutDimension(event, 'height');
321
- if (width === undefined || height === undefined)
322
- return;
323
- if (!didContentSizeChange(this.lastContentSize, { width, height }))
324
- return;
325
- this.lastContentSize = { width, height };
326
- dlog(`Angular ScrollView contentSizeChange ${width}x${height}`);
327
- this.contentSizeChange.emit({ width, height });
328
- };
329
- // Memoizes the wrapper each `emitterCallback` builds, keyed by the emitter it closes over.
330
- // Without this, `scrollProps`/`refreshControlProps` would hand a fresh closure to the forwarded
331
- // prop bag on every evaluation — the same jsonEqual/Object.is function-leaf problem as the arrow
332
- // fields above. `.observed` is checked BEFORE the cache so an unbound event still resolves to
333
- // `undefined` rather than a stale wrapper from before the last unsubscribe.
334
- emitterCallbackCache = new WeakMap();
335
- // The sticky JS-path Animated.event handler depends on a REAL input (onScroll), so it can't be a
336
- // plain stable field the way handleInvertedStickyLayout/handleContentLayout are — it must track
337
- // `this.onScroll` genuinely changing, mirroring sticky-header.ts's own rebuildInterpolation cache
338
- // (rebuild only when the tracked dependency's reference actually differs, not on every getter
339
- // read). A fresh `animatedEvent(...)` call every `scrollProps` access would otherwise construct a
340
- // new listener wrapper (and a new AnimatedEvent walking `collectMappedValues`) on every unrelated
341
- // change-detection pass while sticky headers are active.
342
- cachedStickyOnScrollSource;
343
- cachedStickyOnScrollHandler;
344
- get isHorizontal() {
345
- const value = this.horizontal === true;
346
- if (value !== this.lastLoggedIsHorizontal) {
347
- this.lastLoggedIsHorizontal = value;
348
- dlog(`Angular ScrollView isHorizontal changed to ${value} (horizontal input=${this.horizontal})`);
349
- }
350
- return value;
351
- }
352
- get hasStickyHeaders() {
353
- return (this.stickyHeaderIndices !== undefined &&
354
- this.stickyHeaderIndices.length > 0);
355
- }
356
- // A class-name string resolves through the shared registry before it reaches
357
- // selectScrollIntrinsics, which only understands style objects/arrays.
358
- get resolvedContentContainerStyle() {
359
- return typeof this.contentContainerStyle === 'string'
360
- ? resolveClassName(this.contentContainerStyle)
361
- : this.contentContainerStyle;
362
- }
363
- get scrollViewBaseStyle() {
364
- return selectScrollIntrinsics(this.isHorizontal, this.resolvedContentContainerStyle).scrollViewBaseStyle;
365
- }
366
- // Bridges non-reactive @Input fields into the reactive graph, so a computed() can memoize a
367
- // bag derived from them. Signal inputs would make this unnecessary, but `input()` is visible
368
- // only to the AOT compiler and this package's unit suite runs on JIT - see the
369
- // `angular-adapter-change-detection` skill, §6. `signal()`/`computed()` themselves are plain
370
- // runtime APIs and need no compiler support, which is what makes this bridge possible at all.
371
- //
372
- // ONLY safe for a bag whose every dependency is an @Input. A bag that also reads internal
373
- // mutable state (viewportHeight, lastContentSize, the anchor's class-derived style) would go
374
- // stale, because nothing bumps this for those - make that state its own signal (see
375
- // `anchorStyle`) instead of widening this one.
376
- inputsRevision = signal(0, /* @ts-ignore */
377
- ...(ngDevMode ? [{ debugName: "inputsRevision" }] : /* istanbul ignore next */ []));
378
- // The forwarded host-prop bag for the scroll-view node: aria/role folded, the native pass-through
379
- // families, the scroll-event callbacks, then the lifecycle-managed overrides (nestedScrollEnabled
380
- // default ON, horizontal when defined, decelerationRate resolved per-platform, the sticky onScroll
381
- // path). Base style UNDER user style so an explicit user value still wins. Mirrors Vue's outerProps
382
- // + scrollProps assembly.
383
- //
384
- // MEASURED 2026-08-16: as a getter this rebuilt the whole bag on every refresh of this view, so
385
- // the `symbioteHostProps` reference check failed every time and every key was re-pushed through
386
- // the renderer - once per scroll frame per host binding (2 before `contentProps` was memoized,
387
- // 1 after, 0 now; the pin lives in prop-bag-stability.test.ts).
388
- //
389
- // It is a `computed` on the BASE and no longer overridable: a subclass getter cannot override a
390
- // field. The platform subclasses used to override it with byte-identical bodies (merge the
391
- // anchor's class-derived style ahead of the resolved style), so that merge moved down here
392
- // rather than into a `decorateScrollProps` hook both of them would implement the same way.
393
- scrollProps = computed(() => {
394
- this.inputsRevision();
395
- const bag = compact({
396
- ...resolveAccessibilityProps(this.accessibilityInputs()),
397
- scrollEnabled: this.scrollEnabled,
398
- showsVerticalScrollIndicator: this.showsVerticalScrollIndicator,
399
- showsHorizontalScrollIndicator: this.showsHorizontalScrollIndicator,
400
- pagingEnabled: this.pagingEnabled,
401
- bounces: this.bounces,
402
- contentInset: this.contentInset,
403
- contentOffset: this.contentOffset,
404
- removeClippedSubviews: this.removeClippedSubviews,
405
- snapToInterval: this.snapToInterval,
406
- snapToOffsets: this.snapToOffsets,
407
- snapToAlignment: this.snapToAlignment,
408
- snapToStart: this.snapToStart,
409
- snapToEnd: this.snapToEnd,
410
- disableIntervalMomentum: this.disableIntervalMomentum,
411
- keyboardDismissMode: this.keyboardDismissMode,
412
- keyboardShouldPersistTaps: this.keyboardShouldPersistTaps,
413
- maintainVisibleContentPosition: this.maintainVisibleContentPosition,
414
- alwaysBounceHorizontal: this.alwaysBounceHorizontal,
415
- alwaysBounceVertical: this.alwaysBounceVertical,
416
- centerContent: this.centerContent,
417
- scrollIndicatorInsets: this.scrollIndicatorInsets,
418
- indicatorStyle: this.indicatorStyle,
419
- directionalLockEnabled: this.directionalLockEnabled,
420
- automaticallyAdjustKeyboardInsets: this.automaticallyAdjustKeyboardInsets,
421
- contentInsetAdjustmentBehavior: this.contentInsetAdjustmentBehavior,
422
- minimumZoomScale: this.minimumZoomScale,
423
- maximumZoomScale: this.maximumZoomScale,
424
- zoomScale: this.zoomScale,
425
- bouncesZoom: this.bouncesZoom,
426
- pinchGestureEnabled: this.pinchGestureEnabled,
427
- overScrollMode: this.overScrollMode,
428
- fadingEdgeLength: this.fadingEdgeLength,
429
- persistentScrollbar: this.persistentScrollbar,
430
- endFillColor: this.endFillColor,
431
- onScrollBeginDrag: this.onScrollBeginDrag,
432
- onScrollEndDrag: this.onScrollEndDrag,
433
- onMomentumScrollBegin: this.onMomentumScrollBegin,
434
- onMomentumScrollEnd: this.onMomentumScrollEnd,
435
- onScrollToTop: this.emitterCallback(this.scrollToTop),
436
- onAccessibilityAction: this.emitterCallback(this.accessibilityAction),
437
- onAccessibilityTap: this.emitterCallback(this.accessibilityTap),
438
- onMagicTap: this.emitterCallback(this.magicTap),
439
- onAccessibilityEscape: this.emitterCallback(this.accessibilityEscape),
440
- });
441
- // RN defaults nested scrolling ON (ScrollView.js `nestedScrollEnabled ?? true`); Android needs
442
- // it to scroll a nested scrollable independently, iOS handles nesting natively (a no-op there).
443
- bag.nestedScrollEnabled = this.nestedScrollEnabled ?? true;
444
- // iOS needs `horizontal` to flip RCTScrollView's axis; Android's dedicated manager ignores it.
445
- if (this.horizontal !== undefined)
446
- bag.horizontal = this.horizontal;
447
- if (this.decelerationRate !== undefined) {
448
- bag.decelerationRate = resolveDecelerationRate(this.decelerationRate);
449
- }
450
- // onScroll: when sticky headers are active, the offset must reach the AnimatedValue (RN
451
- // _scrollAnimatedValueAttachment). With the native module, the post-commit attach below drives
452
- // it on the UI thread (throttle 1, ScrollView.js:1798); without it, Animated.event drives the
453
- // value each frame (JS jitter). The DECISIONS (which path, throttle defaults, whether to
454
- // capture viewport height) are folded out to the shared resolveScrollForwarding; Angular only
455
- // EXECUTES them, keeping stable-reference handlers so a fresh closure never forces a re-clone.
456
- const nativeStickyAvailable = this.hasStickyHeaders && isNativeAnimatedAvailable();
457
- const forwarding = resolveScrollForwarding({
458
- hasStickyHeaders: this.hasStickyHeaders,
459
- nativeStickyAvailable,
460
- invertStickyHeaders: this.invertStickyHeaders,
461
- scrollEventThrottle: this.scrollEventThrottle,
462
- maintainVisibleContentPosition: this.maintainVisibleContentPosition,
463
- snapToAlignment: this.snapToAlignment,
464
- });
465
- // onScroll: the JS-fallback path uses the cached Animated.event handler; the native + plain paths
466
- // forward the user handler as-is (the native driver attaches the value on the UI thread).
467
- if (forwarding.mode === 'sticky-js') {
468
- bag.onScroll = this.stickyOnScrollHandler(this.onScroll);
469
- }
470
- else if (this.onScroll !== undefined) {
471
- bag.onScroll = this.onScroll;
472
- }
473
- if (forwarding.scrollEventThrottle !== undefined) {
474
- bag.scrollEventThrottle = forwarding.scrollEventThrottle;
475
- }
476
- // Inverted sticky headers need the viewport height (RN _handleLayout): capture it on the
477
- // scroll-view onLayout, then call the user's handler. Otherwise forward the layout emitter.
478
- if (forwarding.capturesViewportHeight) {
479
- bag.onLayout = this.handleInvertedStickyLayout;
480
- }
481
- else {
482
- const layoutCallback = this.emitterCallback(this.layout);
483
- if (layoutCallback !== undefined)
484
- bag.onLayout = layoutCallback;
485
- }
486
- // Thunks, not strings: an eagerly built message would be paid with logging off (see dlog's own
487
- // comment). Less often than it used to fire now that this bag is memoized, but the recompute
488
- // still rides every real input change.
489
- dlog(() => `Angular ScrollView -> ${this.isHorizontal ? 'horizontal' : 'vertical'} (sticky=${this.hasStickyHeaders})`);
490
- dlog(() => `STICKY[sv] forwarding mode=${forwarding.mode} throttle=${forwarding.scrollEventThrottle} ` +
491
- `nativeStickyAvailable=${nativeStickyAvailable} onScrollBound=${bag.onScroll !== undefined}`);
492
- // The anchor's class-derived style goes FIRST: flattenStyle's later-wins collapse keeps an
493
- // explicit [style] winning over the ambient class. Flat rather than the nested
494
- // `[anchor, [base, style]]` the platform overrides used to build - flattenStyle folds nested
495
- // arrays in the same order, so the resolved value is unchanged.
496
- bag.style = [this.anchorStyle(), this.scrollViewBaseStyle, this.style];
497
- return bag;
498
- }, /* @ts-ignore */
499
- ...(ngDevMode ? [{ debugName: "scrollProps" }] : /* istanbul ignore next */ []));
500
- // Overridable hook, NOT `this.style` directly: `splitLayoutProps` below decides which layout
501
- // properties (flex/height/gap/…) go on the Android outer refresh-control wrapper vs. the inner
502
- // scroll view. `this.style` alone only carries the explicit `[style]` @Input — a composed
503
- // component's own anchor host can hold ADDITIONAL class-derived layout style invisible to this
504
- // split, so the wrapper collapses to zero size on real Android devices. Angular's Android
505
- // ScrollView (index.android.ts) overrides this to merge in `anchorHostStyle` (mirrors Vue's
506
- // identical `layoutSplitStyle` field and the device bug it fixes).
507
- get layoutSplitStyle() {
508
- return this.style;
509
- }
510
- // Memoizable for the same reasons `scrollProps` is: `layoutSplitStyle` resolves to @Input `style`
511
- // plus (on Android) the `anchorStyle` signal, both covered. The anchor style is deliberately NOT
512
- // re-merged into `props.style` here - `splitLayoutProps` already routed its layout half to the
513
- // outer refresh-control wrapper and left the rest in `inner`.
514
- androidWrappedScrollProps = computed(() => {
515
- this.inputsRevision();
516
- const props = { ...this.scrollProps() };
517
- const { inner, outer } = splitLayoutProps(this.layoutSplitStyle);
518
- dlog(() => `Angular ScrollView splitProbe layoutSplitStyle=${JSON.stringify(this.layoutSplitStyle)} ` +
519
- `outer=${JSON.stringify(outer)} inner=${JSON.stringify(inner)}`);
520
- props.style = [this.scrollViewBaseStyle, inner];
521
- props.nestedScrollEnabled = true;
522
- return props;
523
- }, /* @ts-ignore */
524
- ...(ngDevMode ? [{ debugName: "androidWrappedScrollProps" }] : /* istanbul ignore next */ []));
525
- // Deliberately still GETTERS, unlike every other bag on this class. Their whole content comes
526
- // from the PROJECTED RefreshControl's own @Input()s (refreshing, tintColor, colors, …), which
527
- // Angular routes through THAT component's ngOnChanges - `inputsRevision` here never moves for
528
- // them. Memoizing on it would freeze `refreshing` at its first value and strand the native
529
- // spinner forever, which is exactly the silent-staleness class this file avoids elsewhere.
530
- // Making them memoizable means giving RefreshControl its own revision signal to read here.
531
- get iosRefreshControlProps() {
532
- return this.refreshControlProps();
533
- }
534
- get androidRefreshControlProps() {
535
- const { outer } = splitLayoutProps(this.layoutSplitStyle);
536
- dlog(() => `Angular ScrollView refreshControlProbe outer=${JSON.stringify(outer)} ` +
537
- `hasRefresh=${this.projectedRefreshControl !== undefined}`);
538
- return this.refreshControlProps(outer);
539
- }
540
- handleProjectedRefresh(nativeNode) {
541
- this.projectedRefreshControl?.handleRefresh(nativeNode);
542
- }
543
- refreshControlProps(style) {
544
- const refresh = this.projectedRefreshControl;
545
- if (refresh === undefined)
546
- return {};
547
- return compact({
548
- ...refresh.folded,
549
- refreshing: refresh.refreshing,
550
- tintColor: refresh.tintColor,
551
- title: refresh.title,
552
- titleColor: refresh.titleColor,
553
- progressViewOffset: refresh.progressViewOffset,
554
- colors: refresh.colors,
555
- progressBackgroundColor: refresh.progressBackgroundColor,
556
- size: refresh.size,
557
- enabled: refresh.enabled,
558
- style,
559
- testID: refresh.testID,
560
- nativeID: refresh.nativeID,
561
- accessible: refresh.accessible,
562
- onAccessibilityAction: this.emitterCallback(refresh.accessibilityAction),
563
- onAccessibilityTap: this.emitterCallback(refresh.accessibilityTap),
564
- onMagicTap: this.emitterCallback(refresh.magicTap),
565
- onAccessibilityEscape: this.emitterCallback(refresh.accessibilityEscape),
566
- });
567
- }
568
- get hasProjectedRefreshControl() {
569
- return this.projectedRefreshControl !== undefined;
570
- }
571
- // The content (inner) view's prop bag. `collapsable: false` keeps the layout-only content view a
572
- // real native view (Android Fabric view-flattens it away otherwise, hoisting cells as direct
573
- // children of a scroll view that hosts exactly one — an addViewAt crash). collapsableChildren
574
- // false preserves the cell views maintainVisibleContentPosition/snapToAlignment anchor against.
575
- // onLayout synthesizes onContentSizeChange (deduped). iOS never flattens; both are no-ops there.
576
- contentProps = computed(() => {
577
- this.inputsRevision();
578
- const { contentStyle } = selectScrollIntrinsics(this.isHorizontal, this.resolvedContentContainerStyle);
579
- const bag = {
580
- style: contentStyle,
581
- collapsable: false,
582
- };
583
- if (this.maintainVisibleContentPosition !== undefined ||
584
- this.snapToAlignment !== undefined) {
585
- bag.collapsableChildren = false;
586
- }
587
- bag.onLayout = this.handleContentLayout;
588
- return bag;
589
- }, /* @ts-ignore */
590
- ...(ngDevMode ? [{ debugName: "contentProps" }] : /* istanbul ignore next */ []));
591
- // Wraps an @Output() as a plain callback only while it has a subscriber, so an unbound event
592
- // still leaves the forwarded prop bag key absent — the same "undefined means nobody cares"
593
- // contract the old @Input() callbacks had. Mirrors Pressable's emitterHandler. The wrapper itself
594
- // is memoized per emitter (emitterCallbackCache) rather than rebuilt on every call: see that
595
- // field's comment for why an unstable closure here breaks the forwarded prop bag.
596
- //
597
- // `.observed` is NOT reactive, and `scrollProps` memoizes over it. That is sound because Angular
598
- // subscribes a template's (event) listeners in its CREATION pass, before any input is written and
599
- // before this component's own view is first refreshed - so `observed` is already settled at the
600
- // first evaluation and cannot flip afterwards without destroying the whole component.
601
- emitterCallback(emitter) {
602
- if (!emitter.observed)
603
- return undefined;
604
- let cached = this.emitterCallbackCache.get(emitter);
605
- if (cached === undefined) {
606
- cached = (event) => emitter.emit(event);
607
- this.emitterCallbackCache.set(emitter, cached);
608
- }
609
- return cached;
610
- }
611
- // Rebuilds the JS-path Animated.event handler only when the tracked `onScroll` input actually
612
- // changes reference (see cachedStickyOnScrollHandler's comment).
613
- stickyOnScrollHandler(userOnScroll) {
614
- if (this.cachedStickyOnScrollHandler === undefined ||
615
- this.cachedStickyOnScrollSource !== userOnScroll) {
616
- this.cachedStickyOnScrollSource = userOnScroll;
617
- this.cachedStickyOnScrollHandler = animatedEvent([{ nativeEvent: { contentOffset: { y: this.scrollAnimatedValue } } }], userOnScroll === undefined
618
- ? undefined
619
- : {
620
- listener: (...args) => forwardScrollEvent(userOnScroll, args),
621
- });
622
- }
623
- return this.cachedStickyOnScrollHandler;
624
- }
625
- // The committed scroll-view node held by IDENTITY (the directive's ElementRef). null until the
626
- // element commits; the imperative handle and the sticky attach both read it through this getter.
627
- get hostNode() {
628
- const native = this.hostDirective?.node;
629
- return isSymbioteNode(native) ? native : null;
630
- }
631
- // The imperative API a parent reaches via @ViewChild(ScrollView). buildScrollViewHandle is the
632
- // shared, proven handle (React/Vue use it verbatim); it reads the node through the LAZY getter on
633
- // every call, so a command before commit no-ops rather than freezing a null node.
634
- handle = buildScrollViewHandle(() => this.hostNode);
635
- scrollTo(options) {
636
- this.handle.scrollTo(options);
637
- }
638
- scrollToEnd(options) {
639
- this.handle.scrollToEnd(options);
640
- }
641
- flashScrollIndicators() {
642
- this.handle.flashScrollIndicators();
643
- }
644
- getScrollNode() {
645
- return this.handle.getScrollNode();
646
- }
647
- ngAfterViewInit() {
648
- dlog('STICKY[sv] ngAfterViewInit');
649
- // Runs once the template has bound the content node, so this is the reconcile that actually
650
- // wraps the sticky children (the ngOnChanges one above fires before the content node exists).
651
- this.updateProjectionController();
652
- this.attachSticky();
653
- }
654
- // Re-read the anchor's class-derived style. It is written by the renderer's addClass/removeClass,
655
- // never through an @Input, so this poll is the only thing that can invalidate a bag holding it -
656
- // ngOnChanges alone would strand a class toggled after mount (covered by
657
- // scroll-view-class-style.test.ts's toggle case, which goes red the moment this hook stops
658
- // polling). ngDoCheck is the right hook, not a near-enough one: render3's `callHooks` flushes a
659
- // node's pre-order hooks at the next `ɵɵadvance` PAST it, which is after the parent wrote this
660
- // element's `ɵɵclassProp` and before this component's own view refreshes. It also runs under
661
- // `setActiveConsumer(null)`, so the write registers no dependency on the caller's view and cannot
662
- // throw NG0600. And `commitClassStyle` allocates a fresh style array only when a class token
663
- // actually moved, so `signal.set`'s own Object.is check makes an unchanged poll dirty nothing.
664
- ngDoCheck() {
665
- this.anchorStyle.set(anchorHostStyle(this.elementRef));
666
- // The attach can want a node that does not exist yet, and nothing else would ask again.
667
- // ngOnChanges covers "indices arrived late"; it does NOT cover "indices arrived late AND the host
668
- // node had not committed yet", which is exactly what a VirtualizedList does - it derives
669
- // stickyHeaderIndices from the measured window, so they land after this component's
670
- // ngAfterViewInit and before its host node resolves. Device-diagnosed 2026-08-18 on
671
- // examples/angular BenchmarkScreen STICKY PATH B, whose log ends on `attachSticky NOT attaching
672
- // (wantsAttach=true hasNode=false)` - sticky never turned on, while PATH A (literal indices in
673
- // the template) worked because ngAfterViewInit already saw a node. Retried ONLY from that stuck
674
- // state, so a settled ScrollView pays nothing per check. Device-verified the same day.
675
- // Not covered headless: sticky-native-attach.test.ts's late-indices case has its node resolved by
676
- // the time the indices land, and the deferred-creation ordering under `@if` never rendered the
677
- // ScrollView at all.
678
- if (this.stickyAttachedEnabled && this.stickyAttachedNode === null)
679
- this.attachSticky();
680
- }
681
- // The projected RefreshControl is a @ContentChild, not an @Input, so ngOnChanges never fires when
682
- // one is added or removed at the use site - and `excludeRefreshControl` decides whether the
683
- // projection walk pulls it out of the scroll content. Angular resolves the query before this
684
- // hook. Guarded on the flag itself so a check that changed nothing skips the reconcile walk,
685
- // which the old getter-driven update could not do.
686
- ngAfterContentChecked() {
687
- if (this.hasProjectedRefreshControl === this.lastHasProjectedRefreshControl)
688
- return;
689
- this.lastHasProjectedRefreshControl = this.hasProjectedRefreshControl;
690
- this.updateProjectionController();
691
- }
692
- // `stickyHeaderIndices` is an ordinary @Input, so it can arrive AFTER the first change-detection
693
- // pass - any app deriving it from data rather than writing a literal in the template does exactly
694
- // that. ngAfterViewInit runs once, so without this the native attach below would be skipped on
695
- // that first pass and never retried: the wrapper still projects (that half self-heals), the
696
- // header sits at the right place with the right z-index, and simply never moves. Device-reported
697
- // 2026-08-16, regression-covered in sticky-native-attach.test.ts. The other three adapters never
698
- // had this hole because they re-run the attach from a reactive effect keyed on the same
699
- // condition (Svelte's `$effect` in index.svelte, React's useEffect deps, Vue's watcher).
700
- ngOnChanges() {
701
- dlog('STICKY[sv] ngOnChanges');
702
- // Every computed() prop bag below reads plain @Input fields, which are NOT reactive on their
703
- // own - this bump is what tells them an input changed. It must stay in ngOnChanges: that is
704
- // the single moment Angular has finished writing every changed input for this pass.
705
- this.inputsRevision.update(revision => revision + 1);
706
- // stickyHeaderIndices / invertStickyHeaders / StickyHeaderComponent are @Inputs, so this is
707
- // where the projection controller learns about them. It used to be a side effect of reading
708
- // the `scrollProps` getter - which a memoized computed no longer performs per pass.
709
- this.updateProjectionController();
710
- this.attachSticky();
711
- }
712
- // Wire the native sticky-scroll attach once the view exists AND sticky is actually on. Re-runs
713
- // on every input change, so it must be idempotent: see the guard below.
714
- attachSticky() {
715
- const wantsAttach = this.hasStickyHeaders && isNativeAnimatedAvailable();
716
- const node = wantsAttach ? this.hostNode : null;
717
- dlog(() => `STICKY[sv] attachSticky indices=${JSON.stringify(this.stickyHeaderIndices)} ` +
718
- `hasSticky=${this.hasStickyHeaders} nativeAvailable=${isNativeAnimatedAvailable()} ` +
719
- `wantsAttach=${wantsAttach} hasNode=${node !== null} ` +
720
- `wasEnabled=${this.stickyAttachedEnabled} nodeChanged=${node !== this.stickyAttachedNode}`);
721
- // Nothing that decides the attach has changed - return rather than detach and rebind the
722
- // native scroll event, which every unrelated @Input change would otherwise churn now that
723
- // ngOnChanges drives this too.
724
- if (wantsAttach === this.stickyAttachedEnabled &&
725
- node === this.stickyAttachedNode) {
726
- dlog('STICKY[sv] attachSticky skipped (nothing about the attach changed)');
727
- return;
728
- }
729
- this.cancelStickyBind?.();
730
- this.cancelStickyBind = undefined;
731
- if (this.detachStickyScroll !== undefined) {
732
- this.detachStickyScroll();
733
- this.detachStickyScroll = undefined;
734
- }
735
- // Recorded even when the node is not resolved yet, so the NEXT call (which will see a real
736
- // node) reads as a change and attaches.
737
- this.stickyAttachedEnabled = wantsAttach;
738
- this.stickyAttachedNode = node;
739
- if (!wantsAttach || node === null) {
740
- dlog(`STICKY[sv] attachSticky NOT attaching (wantsAttach=${wantsAttach} hasNode=${node !== null})`);
741
- return;
742
- }
743
- dlog('STICKY[sv] attachSticky waiting for commit to bind the native scroll event');
744
- this.cancelStickyBind = whenCommitted(node, () => {
745
- dlog('STICKY[sv] attachSticky node committed -> attachStickyScroll');
746
- this.detachStickyScroll = attachStickyScroll(node, this.scrollAnimatedValue);
747
- });
748
- }
749
- ngOnDestroy() {
750
- this.cancelStickyBind?.();
751
- this.cancelStickyBind = undefined;
752
- if (this.detachStickyScroll !== undefined)
753
- this.detachStickyScroll();
754
- }
755
- updateProjectionController() {
756
- this.projectionController.update({
757
- stickyHeaderIndices: this.stickyHeaderIndices,
758
- invertStickyHeaders: this.invertStickyHeaders,
759
- scrollViewHeight: this.viewportHeight,
760
- scrollAnimatedValue: this.scrollAnimatedValue,
761
- customStickyHeaderComponent: this.StickyHeaderComponent,
762
- excludeRefreshControl: this.hasProjectedRefreshControl,
763
- });
764
- }
765
- // Typed as the a11y intersection WITH the string index so resolveAccessibilityProps's result
766
- // stays assignable into the forwarded bag (a genuine narrowing, built at that type — no cast).
767
- accessibilityInputs() {
768
- return {
769
- testID: this.testID,
770
- nativeID: this.nativeID,
771
- accessible: this.accessible,
772
- accessibilityLabel: this.accessibilityLabel,
773
- accessibilityHint: this.accessibilityHint,
774
- accessibilityRole: this.accessibilityRole,
775
- accessibilityState: this.accessibilityState,
776
- accessibilityValue: this.accessibilityValue,
777
- accessibilityActions: this.accessibilityActions,
778
- accessibilityLabelledBy: this.accessibilityLabelledBy,
779
- importantForAccessibility: this.importantForAccessibility,
780
- accessibilityLiveRegion: this.accessibilityLiveRegion,
781
- screenReaderFocusable: this.screenReaderFocusable,
782
- accessibilityViewIsModal: this.accessibilityViewIsModal,
783
- accessibilityElementsHidden: this.accessibilityElementsHidden,
784
- accessibilityIgnoresInvertColors: this.accessibilityIgnoresInvertColors,
785
- accessibilityLanguage: this.accessibilityLanguage,
786
- accessibilityRespondsToUserInteraction: this.accessibilityRespondsToUserInteraction,
787
- accessibilityShowsLargeContentViewer: this.accessibilityShowsLargeContentViewer,
788
- accessibilityLargeContentTitle: this.accessibilityLargeContentTitle,
789
- role: this.role,
790
- 'aria-label': this['aria-label'],
791
- 'aria-labelledby': this['aria-labelledby'],
792
- 'aria-live': this['aria-live'],
793
- 'aria-hidden': this['aria-hidden'],
794
- 'aria-busy': this['aria-busy'],
795
- 'aria-checked': this['aria-checked'],
796
- 'aria-disabled': this['aria-disabled'],
797
- 'aria-expanded': this['aria-expanded'],
798
- 'aria-selected': this['aria-selected'],
799
- 'aria-modal': this['aria-modal'],
800
- 'aria-valuemax': this['aria-valuemax'],
801
- 'aria-valuemin': this['aria-valuemin'],
802
- 'aria-valuenow': this['aria-valuenow'],
803
- 'aria-valuetext': this['aria-valuetext'],
804
- };
805
- }
806
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ScrollViewBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
807
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: ScrollViewBase, isStandalone: true, outputs: { layout: "layout", scrollToTop: "scrollToTop", contentSizeChange: "contentSizeChange", accessibilityAction: "accessibilityAction", accessibilityTap: "accessibilityTap", magicTap: "magicTap", accessibilityEscape: "accessibilityEscape" }, queries: [{ propertyName: "projectedRefreshControl", first: true, predicate: RefreshControl, descendants: true }], viewQueries: [{ propertyName: "hostDirective", first: true, predicate: ["host"], descendants: true, read: SymbioteHostPropsDirective }], usesOnChanges: true, ngImport: i0 });
808
- }
809
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ScrollViewBase, decorators: [{
810
- type: Directive
811
- }], propDecorators: { layout: [{
812
- type: Output
813
- }], scrollToTop: [{
814
- type: Output
815
- }], contentSizeChange: [{
816
- type: Output
817
- }], accessibilityAction: [{
818
- type: Output
819
- }], accessibilityTap: [{
820
- type: Output
821
- }], magicTap: [{
822
- type: Output
823
- }], accessibilityEscape: [{
824
- type: Output
825
- }], hostDirective: [{
826
- type: ViewChild,
827
- args: ['host', { read: SymbioteHostPropsDirective }]
828
- }], projectedRefreshControl: [{
829
- type: ContentChild,
830
- args: [RefreshControl]
831
- }] } });
832
- //# sourceMappingURL=shared.js.map