@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,913 +0,0 @@
1
- // The Touchable* family for Angular, all built on Pressable (the Angular twin of the React/Vue
2
- // adapter). The press-timing constants and the deactivation-floor math are shared with every
3
- // adapter (@symbiote-native/components/state/touchable); here Angular owns only the Animated wiring + the
4
- // press scheduling state:
5
- // TouchableOpacity: animate an Animated.Value opacity toward activeOpacity on press-in and back
6
- // to 1 on press-out, driven from Pressable's onPressIn/onPressOut. The opacity Value is held by
7
- // IDENTITY as a plain field (an engine object, never an @Input / reactive wrap) and the
8
- // <symbiote-animated-view> leaf commits it every frame.
9
- // TouchableHighlight: paint underlayColor + lower child opacity while the underlay is SHOWN.
10
- // RN drives that from onPressIn/onPress/onPressOut and holds it past the tap for delayPressOut,
11
- // NOT from Pressable's pressed flag — a tap too fast to see is already un-pressed by then.
12
- // TouchableWithoutFeedback: no visual change, but RN still runs the full press-timing machine.
13
- //
14
- // Every Touchable's own press/hover/accessibility events are now real @Output() EventEmitters too,
15
- // matching Pressable (which they wrap) — `(press)="handler($event)"`, never `[onPress]="handler"`.
16
- // Non-event config (delayLongPress, hitSlop, ...) still rides down as plain @Input() bindings.
17
- // Accessibility EVENTS forward straight through to Pressable's own outputs
18
- // (`(accessibilityAction)="accessibilityAction.emit($event)"`); accessibility STATE folds the web
19
- // aria-*/role aliases and merges `disabled` into the a11y state on Pressable's own host — no re-fold
20
- // here (the a11y host is Pressable's view, mirroring React's `...rest` -> Pressable). No JS-side
21
- // platform branch, so this stays a flat single file, mirroring React/Vue. Each Touchable
22
- // forwards the Angular Pressable surface verbatim; parity is against that surface, exactly as
23
- // React's Touchable parity is against
24
- // the React Pressable surface.
25
-
26
- import {
27
- CUSTOM_ELEMENTS_SCHEMA,
28
- ChangeDetectionStrategy,
29
- Component,
30
- computed,
31
- type DoCheck,
32
- ElementRef,
33
- EventEmitter,
34
- inject,
35
- Input,
36
- type OnChanges,
37
- type OnDestroy,
38
- Output,
39
- signal,
40
- } from '@angular/core';
41
- import {
42
- createHighlightUnderlayHandlers,
43
- createHighlightUnderlayRuntime,
44
- createTouchableFeedbackHandlers,
45
- createTouchableFeedbackRuntime,
46
- hasTouchablePressHandler,
47
- resolveHighlightExtraStyles,
48
- restingOpacityFromStyle,
49
- DEFAULT_ACTIVE_OPACITY,
50
- OPACITY_ACTIVE_GRANT_DURATION_MS,
51
- OPACITY_INACTIVE_DURATION_MS,
52
- RESTING_OPACITY,
53
- TOUCHABLE_MIN_PRESS_DURATION_MS,
54
- type IAccessibilityProps,
55
- type IAccessibilityStateValue,
56
- type IAriaProps,
57
- type IHighlightUnderlayHandlers,
58
- type IPressableAndroidRippleConfig,
59
- type IPressTimingProps,
60
- type IRectOffset,
61
- type ITouchableFeedbackHandlers,
62
- } from '@symbiote-native/components';
63
- import {
64
- type ISymbioteEvent,
65
- type IStyleProp,
66
- type IViewStyle,
67
- } from '@symbiote-native/engine';
68
- import {
69
- anchorHostStyle,
70
- anchorStyleProp,
71
- SymbioteStyleInputDirective,
72
- } from '../../primitives';
73
- import { Pressable, type IAngularPressableInputs } from '../pressable';
74
- import { Animated, AnimatedView } from '../../modules/animated';
75
-
76
- // The shared field base for all three: the Pressable INPUT surface (minus style, which each
77
- // Touchable routes differently, and minus the press/hover events, which each Touchable declares as
78
- // its OWN @Output()s below) + RN's press-timing config + the public style. Mirrors React/Vue's
79
- // ITouchableBaseProps. Declared per-adapter over the Angular Pressable surface, since children
80
- // ride <ng-content> here rather than a field, unlike React/Vue's element-returning props.
81
- type IAngularTouchableBaseProps = Omit<IAngularPressableInputs, 'style'> &
82
- IPressTimingProps & {
83
- style?: IStyleProp<IViewStyle>;
84
- };
85
-
86
- export type IAngularTouchableOpacityProps = IAngularTouchableBaseProps & {
87
- activeOpacity?: number;
88
- };
89
-
90
- export type IAngularTouchableHighlightProps = IAngularTouchableBaseProps & {
91
- activeOpacity?: number;
92
- underlayColor?: string;
93
- };
94
-
95
- export type IAngularTouchableWithoutFeedbackProps = IAngularTouchableBaseProps;
96
-
97
- // The real timers both shared machines schedule on — core/components carries no timer globals, so
98
- // scheduling is the adapter's half. Every canceller is retained so ngOnDestroy cancels what is
99
- // still in flight: a deferred press-out or a held underlay firing after teardown would emit from a
100
- // destroyed component and write a signal on a destroyed view.
101
- interface ITimerScheduler {
102
- schedule: (callback: () => void, ms: number) => () => void;
103
- cancelAll: () => void;
104
- }
105
-
106
- function createTimerScheduler(): ITimerScheduler {
107
- const pending = new Set<() => void>();
108
- return {
109
- schedule(callback: () => void, ms: number): () => void {
110
- const id = setTimeout(() => {
111
- pending.delete(cancel);
112
- callback();
113
- }, ms);
114
- const cancel = (): void => {
115
- clearTimeout(id);
116
- pending.delete(cancel);
117
- };
118
- pending.add(cancel);
119
- return cancel;
120
- },
121
- cancelAll(): void {
122
- for (const cancel of [...pending]) cancel();
123
- pending.clear();
124
- },
125
- };
126
- }
127
-
128
- @Component({
129
- selector: 'TouchableOpacity',
130
- standalone: true,
131
- hostDirectives: [
132
- { directive: SymbioteStyleInputDirective, inputs: ['style'] },
133
- ],
134
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
135
- imports: [Pressable, AnimatedView],
136
- changeDetection: ChangeDetectionStrategy.OnPush,
137
- template: `
138
- <Pressable
139
- (press)="press.emit($event)"
140
- (pressIn)="handlePressIn($event)"
141
- (pressOut)="handlePressOut($event)"
142
- (pressMove)="pressMove.emit($event)"
143
- (longPress)="longPress.emit($event)"
144
- (hoverIn)="hoverIn.emit($event)"
145
- (hoverOut)="hoverOut.emit($event)"
146
- [delayLongPress]="delayLongPress"
147
- [delayHoverIn]="delayHoverIn"
148
- [delayHoverOut]="delayHoverOut"
149
- [disabled]="disabled"
150
- [cancelable]="cancelable"
151
- [hitSlop]="hitSlop"
152
- [pressRetentionOffset]="pressRetentionOffset"
153
- [unstable_pressDelay]="unstable_pressDelay"
154
- [android_ripple]="android_ripple"
155
- [android_disableSound]="android_disableSound"
156
- [testID]="testID"
157
- [nativeID]="nativeID"
158
- [hasTVPreferredFocus]="hasTVPreferredFocus"
159
- [nextFocusDown]="nextFocusDown"
160
- [nextFocusForward]="nextFocusForward"
161
- [nextFocusLeft]="nextFocusLeft"
162
- [nextFocusRight]="nextFocusRight"
163
- [nextFocusUp]="nextFocusUp"
164
- [accessible]="accessible"
165
- [accessibilityLabel]="accessibilityLabel"
166
- [accessibilityHint]="accessibilityHint"
167
- [accessibilityRole]="accessibilityRole"
168
- [accessibilityState]="accessibilityState"
169
- [accessibilityValue]="accessibilityValue"
170
- [accessibilityActions]="accessibilityActions"
171
- [accessibilityLabelledBy]="accessibilityLabelledBy"
172
- [importantForAccessibility]="importantForAccessibility"
173
- [accessibilityLiveRegion]="accessibilityLiveRegion"
174
- [screenReaderFocusable]="screenReaderFocusable"
175
- [accessibilityViewIsModal]="accessibilityViewIsModal"
176
- [accessibilityElementsHidden]="accessibilityElementsHidden"
177
- [accessibilityIgnoresInvertColors]="accessibilityIgnoresInvertColors"
178
- [accessibilityLanguage]="accessibilityLanguage"
179
- [accessibilityRespondsToUserInteraction]="
180
- accessibilityRespondsToUserInteraction
181
- "
182
- [accessibilityShowsLargeContentViewer]="
183
- accessibilityShowsLargeContentViewer
184
- "
185
- [accessibilityLargeContentTitle]="accessibilityLargeContentTitle"
186
- (accessibilityAction)="accessibilityAction.emit($event)"
187
- (accessibilityTap)="accessibilityTap.emit($event)"
188
- (magicTap)="magicTap.emit($event)"
189
- (accessibilityEscape)="accessibilityEscape.emit($event)"
190
- [ariaLabel]="ariaLabel"
191
- [ariaBusy]="ariaBusy"
192
- [ariaChecked]="ariaChecked"
193
- [ariaDisabled]="ariaDisabled"
194
- [ariaExpanded]="ariaExpanded"
195
- [ariaHidden]="ariaHidden"
196
- [ariaLabelledBy]="ariaLabelledBy"
197
- [ariaLive]="ariaLive"
198
- [ariaSelected]="ariaSelected"
199
- [ariaModal]="ariaModal"
200
- [ariaValueMax]="ariaValueMax"
201
- [ariaValueMin]="ariaValueMin"
202
- [ariaValueNow]="ariaValueNow"
203
- [ariaValueText]="ariaValueText"
204
- [id]="id"
205
- [role]="role"
206
- >
207
- <symbiote-animated-view [style]="animatedStyle">
208
- <ng-content></ng-content>
209
- </symbiote-animated-view>
210
- </Pressable>
211
- `,
212
- })
213
- export class TouchableOpacity
214
- implements IAngularTouchableOpacityProps, OnChanges, OnDestroy, DoCheck
215
- {
216
- @Output() readonly press = new EventEmitter<ISymbioteEvent>();
217
- @Output() readonly pressIn = new EventEmitter<ISymbioteEvent>();
218
- @Output() readonly pressOut = new EventEmitter<ISymbioteEvent>();
219
- @Output() readonly pressMove = new EventEmitter<ISymbioteEvent>();
220
- @Output() readonly longPress = new EventEmitter<ISymbioteEvent>();
221
- @Output() readonly hoverIn = new EventEmitter<ISymbioteEvent>();
222
- @Output() readonly hoverOut = new EventEmitter<ISymbioteEvent>();
223
- @Output() readonly accessibilityAction = new EventEmitter<ISymbioteEvent>();
224
- @Output() readonly accessibilityTap = new EventEmitter<ISymbioteEvent>();
225
- @Output() readonly magicTap = new EventEmitter<ISymbioteEvent>();
226
- @Output() readonly accessibilityEscape = new EventEmitter<ISymbioteEvent>();
227
- @Input() activeOpacity?: number;
228
- @Input() delayPressIn?: number;
229
- @Input() delayPressOut?: number;
230
- @Input() minPressDuration?: number;
231
- @Input() style?: IStyleProp<IViewStyle>;
232
- @Input() delayLongPress?: number;
233
- @Input() delayHoverIn?: number;
234
- @Input() delayHoverOut?: number;
235
- @Input() disabled?: boolean;
236
- @Input() cancelable?: boolean;
237
- @Input() hitSlop?: IRectOffset;
238
- @Input() pressRetentionOffset?: IRectOffset;
239
- @Input() unstable_pressDelay?: number;
240
- @Input() android_ripple?: IPressableAndroidRippleConfig;
241
- @Input() android_disableSound?: boolean;
242
- @Input() testID?: string;
243
- @Input() nativeID?: string;
244
- @Input() hasTVPreferredFocus?: boolean;
245
- @Input() nextFocusDown?: number;
246
- @Input() nextFocusForward?: number;
247
- @Input() nextFocusLeft?: number;
248
- @Input() nextFocusRight?: number;
249
- @Input() nextFocusUp?: number;
250
- @Input() accessible?: boolean;
251
- @Input() accessibilityLabel?: string;
252
- @Input() accessibilityHint?: string;
253
- @Input() accessibilityRole?: IAccessibilityProps['accessibilityRole'];
254
- @Input() accessibilityState?: IAccessibilityStateValue;
255
- @Input() accessibilityValue?: IAccessibilityProps['accessibilityValue'];
256
- @Input() accessibilityActions?: IAccessibilityProps['accessibilityActions'];
257
- @Input() accessibilityLabelledBy?: string | string[];
258
- @Input()
259
- importantForAccessibility?: IAccessibilityProps['importantForAccessibility'];
260
- @Input()
261
- accessibilityLiveRegion?: IAccessibilityProps['accessibilityLiveRegion'];
262
- @Input() screenReaderFocusable?: boolean;
263
- @Input() accessibilityViewIsModal?: boolean;
264
- @Input() accessibilityElementsHidden?: boolean;
265
- @Input() accessibilityIgnoresInvertColors?: boolean;
266
- @Input() accessibilityLanguage?: string;
267
- @Input() accessibilityRespondsToUserInteraction?: boolean;
268
- @Input() accessibilityShowsLargeContentViewer?: boolean;
269
- @Input() accessibilityLargeContentTitle?: string;
270
- @Input() ariaLabel?: string;
271
- @Input() ariaBusy?: boolean;
272
- @Input() ariaChecked?: boolean | 'mixed';
273
- @Input() ariaDisabled?: boolean;
274
- @Input() ariaExpanded?: boolean;
275
- @Input() ariaHidden?: boolean;
276
- @Input() ariaLabelledBy?: string;
277
- @Input() ariaLive?: IAriaProps['aria-live'];
278
- @Input() ariaSelected?: boolean;
279
- @Input() ariaModal?: boolean;
280
- @Input() ariaValueMax?: number;
281
- @Input() ariaValueMin?: number;
282
- @Input() ariaValueNow?: number;
283
- @Input() ariaValueText?: string;
284
- @Input() id?: string;
285
- @Input() role?: IAriaProps['role'];
286
-
287
- // One Animated.Value per mount. Held by IDENTITY as a plain field (an engine object, never an
288
- // @Input / reactive wrap); the <symbiote-animated-view> leaf rasterizes it for the first paint
289
- // and drives it through setNativeProps every frame.
290
- //
291
- // RN seeds it from _getChildStyleOpacityWithDefault(props.style). Angular writes @Input()s AFTER
292
- // the field initializers run, so `style` is still undefined here — the real resting value is
293
- // seeded by the first ngOnChanges below, which still precedes the first template pass.
294
- private readonly opacity = new Animated.Value(RESTING_OPACITY);
295
- // The shared press-scheduling cell (delayPressIn timer + activation clock), persisted on the
296
- // instance; the machine's handlers are rebuilt per event over live @Input()s.
297
- private readonly runtime = createTouchableFeedbackRuntime();
298
- private readonly timers = createTimerScheduler();
299
- // What the last settle ran for. Undefined until the first ngOnChanges, which is the MOUNT.
300
- private settled:
301
- { disabled: boolean | undefined; resting: number } | undefined;
302
- // This component's OWN host — the non-painting anchor `class="..."` at the use site resolves
303
- // onto (see anchorHostStyle's doc comment) — NOT the <symbiote-animated-view> leaf one level down.
304
- private readonly elementRef = inject(ElementRef);
305
-
306
- // The (possibly animated) style the leaf reduces: the anchor's class-derived style first, then
307
- // the user's explicit style, then the live opacity layered on top (last wins via the style array
308
- // the commit layer flattens). `unknown` because the array mixes a plain style with an
309
- // AnimatedNode, exactly the bag AnimatedView's `style` input accepts.
310
- get animatedStyle(): unknown {
311
- return [this.anchorStyle(), this.style, { opacity: this.opacity }];
312
- }
313
-
314
- // The anchor's class-derived style is written by the renderer's addClass/removeClass at the USE
315
- // SITE - it never appears in SimpleChanges, and nothing about it dirties THIS component's view.
316
- // A `class=` present at creation therefore worked, while one toggled later did not: the parent
317
- // refreshed, the class landed on the anchor, and this component's own view was never refreshed,
318
- // so whatever merged the anchor style in was never re-evaluated. Polling it into a signal from
319
- // ngDoCheck fixes both halves: ngDoCheck runs during the PARENT's refresh even when this view is
320
- // skipped, and the signal write is what then marks this view for refresh. `signal.set`'s own
321
- // Object.is makes an unchanged poll a no-op, so there is no loop.
322
- private readonly anchorStyle = signal<unknown>(undefined);
323
-
324
- ngDoCheck(): void {
325
- this.anchorStyle.set(anchorHostStyle(this.elementRef));
326
- }
327
-
328
- // RN's componentDidUpdate: a changed `disabled` or a changed style opacity re-settles the view,
329
- // so a Touchable disabled mid-press does not stay stuck at its active opacity. The FIRST call is
330
- // the mount (ngOnChanges runs before ngOnInit and before the first template pass), so it seeds
331
- // the Value instead of animating — RN does this on update only, and a fade at mount would animate
332
- // away from the value the leaf is about to paint. A use site with no bindings gets no ngOnChanges
333
- // at all, and there the RESTING_OPACITY seed is already the right answer.
334
- ngOnChanges(): void {
335
- const settled = { disabled: this.disabled, resting: this.restingOpacity() };
336
- if (this.settled === undefined) {
337
- this.opacity.setValue(settled.resting);
338
- } else if (
339
- this.settled.disabled !== settled.disabled ||
340
- this.settled.resting !== settled.resting
341
- ) {
342
- this.setOpacityTo(settled.resting, OPACITY_INACTIVE_DURATION_MS);
343
- }
344
- this.settled = settled;
345
- }
346
-
347
- // RN's componentWillUnmount: stop the animation so a teardown mid-fade leaves no driver running
348
- // against a node that is gone, and drop any press-out still deferred behind a timer.
349
- ngOnDestroy(): void {
350
- this.timers.cancelAll();
351
- this.opacity.resetAnimation();
352
- }
353
-
354
- // RN's _getChildStyleOpacityWithDefault: the fade settles at the opacity the CALLER's style asks
355
- // for, not at a hard 1 — a Touchable styled `opacity: 0.6` must come back to 0.6.
356
- private restingOpacity(): number {
357
- return restingOpacityFromStyle(this.style);
358
- }
359
-
360
- private setOpacityTo(toValue: number, duration: number): void {
361
- Animated.timing(this.opacity, {
362
- toValue,
363
- duration,
364
- easing: Animated.Easing.inOut(Animated.Easing.quad),
365
- // RN's own (TouchableOpacity.js:242). opacity is natively drivable, so the fade survives a
366
- // busy JS thread — which is the entire point of press feedback.
367
- useNativeDriver: true,
368
- }).start();
369
- }
370
-
371
- // Built per event so the machine reads live @Input()s (delay/opacity); the runtime persists across
372
- // calls. The shared machine owns the scheduling — the adapter supplies only the native seam: the
373
- // Animated opacity fade + the @Output() emit, as activate/deactivate.
374
- private feedbackHandlers(): ITouchableFeedbackHandlers {
375
- return createTouchableFeedbackHandlers(
376
- {
377
- delayPressIn: this.delayPressIn ?? 0,
378
- delayPressOut: this.delayPressOut ?? 0,
379
- // RN's Touchables override Pressability's own 130ms floor with 0; what holds the active
380
- // visual there is the fade's own duration, not a press-duration floor.
381
- minPressDuration:
382
- this.minPressDuration ?? TOUCHABLE_MIN_PRESS_DURATION_MS,
383
- schedule: this.timers.schedule,
384
- now: Date.now,
385
- },
386
- this.runtime,
387
- {
388
- activate: (event: ISymbioteEvent): void => {
389
- this.setOpacityTo(
390
- this.activeOpacity ?? DEFAULT_ACTIVE_OPACITY,
391
- OPACITY_ACTIVE_GRANT_DURATION_MS,
392
- );
393
- this.pressIn.emit(event);
394
- },
395
- deactivate: (event: ISymbioteEvent): void => {
396
- this.setOpacityTo(
397
- this.restingOpacity(),
398
- OPACITY_INACTIVE_DURATION_MS,
399
- );
400
- this.pressOut.emit(event);
401
- },
402
- },
403
- );
404
- }
405
-
406
- // Arrow fields (stable identity for OnPush, `this` intact when Pressable's `(pressIn)` invokes
407
- // them). The delayPressIn defer + minPressDuration/delayPressOut hold live in the shared machine.
408
- handlePressIn = (event: ISymbioteEvent): void => {
409
- this.feedbackHandlers().handlePressIn(event);
410
- };
411
-
412
- handlePressOut = (event: ISymbioteEvent): void => {
413
- this.feedbackHandlers().handlePressOut(event);
414
- };
415
- }
416
-
417
- @Component({
418
- selector: 'TouchableHighlight',
419
- standalone: true,
420
- hostDirectives: [
421
- { directive: SymbioteStyleInputDirective, inputs: ['style'] },
422
- ],
423
- imports: [Pressable],
424
- changeDetection: ChangeDetectionStrategy.OnPush,
425
- template: `
426
- <Pressable
427
- [style]="containerStyle()"
428
- (press)="handlePress($event)"
429
- (pressIn)="handlePressIn($event)"
430
- (pressOut)="handlePressOut($event)"
431
- (pressMove)="pressMove.emit($event)"
432
- (longPress)="longPress.emit($event)"
433
- (hoverIn)="hoverIn.emit($event)"
434
- (hoverOut)="hoverOut.emit($event)"
435
- [delayLongPress]="delayLongPress"
436
- [delayHoverIn]="delayHoverIn"
437
- [delayHoverOut]="delayHoverOut"
438
- [disabled]="disabled"
439
- [cancelable]="cancelable"
440
- [hitSlop]="hitSlop"
441
- [pressRetentionOffset]="pressRetentionOffset"
442
- [unstable_pressDelay]="unstable_pressDelay"
443
- [android_ripple]="android_ripple"
444
- [android_disableSound]="android_disableSound"
445
- [testID]="testID"
446
- [nativeID]="nativeID"
447
- [hasTVPreferredFocus]="hasTVPreferredFocus"
448
- [nextFocusDown]="nextFocusDown"
449
- [nextFocusForward]="nextFocusForward"
450
- [nextFocusLeft]="nextFocusLeft"
451
- [nextFocusRight]="nextFocusRight"
452
- [nextFocusUp]="nextFocusUp"
453
- [accessible]="accessible"
454
- [accessibilityLabel]="accessibilityLabel"
455
- [accessibilityHint]="accessibilityHint"
456
- [accessibilityRole]="accessibilityRole"
457
- [accessibilityState]="accessibilityState"
458
- [accessibilityValue]="accessibilityValue"
459
- [accessibilityActions]="accessibilityActions"
460
- [accessibilityLabelledBy]="accessibilityLabelledBy"
461
- [importantForAccessibility]="importantForAccessibility"
462
- [accessibilityLiveRegion]="accessibilityLiveRegion"
463
- [screenReaderFocusable]="screenReaderFocusable"
464
- [accessibilityViewIsModal]="accessibilityViewIsModal"
465
- [accessibilityElementsHidden]="accessibilityElementsHidden"
466
- [accessibilityIgnoresInvertColors]="accessibilityIgnoresInvertColors"
467
- [accessibilityLanguage]="accessibilityLanguage"
468
- [accessibilityRespondsToUserInteraction]="
469
- accessibilityRespondsToUserInteraction
470
- "
471
- [accessibilityShowsLargeContentViewer]="
472
- accessibilityShowsLargeContentViewer
473
- "
474
- [accessibilityLargeContentTitle]="accessibilityLargeContentTitle"
475
- (accessibilityAction)="accessibilityAction.emit($event)"
476
- (accessibilityTap)="accessibilityTap.emit($event)"
477
- (magicTap)="magicTap.emit($event)"
478
- (accessibilityEscape)="accessibilityEscape.emit($event)"
479
- [ariaLabel]="ariaLabel"
480
- [ariaBusy]="ariaBusy"
481
- [ariaChecked]="ariaChecked"
482
- [ariaDisabled]="ariaDisabled"
483
- [ariaExpanded]="ariaExpanded"
484
- [ariaHidden]="ariaHidden"
485
- [ariaLabelledBy]="ariaLabelledBy"
486
- [ariaLive]="ariaLive"
487
- [ariaSelected]="ariaSelected"
488
- [ariaModal]="ariaModal"
489
- [ariaValueMax]="ariaValueMax"
490
- [ariaValueMin]="ariaValueMin"
491
- [ariaValueNow]="ariaValueNow"
492
- [ariaValueText]="ariaValueText"
493
- [id]="id"
494
- [role]="role"
495
- >
496
- <ng-content></ng-content>
497
- </Pressable>
498
- `,
499
- })
500
- export class TouchableHighlight
501
- implements IAngularTouchableHighlightProps, OnChanges, OnDestroy, DoCheck
502
- {
503
- @Output() readonly press = new EventEmitter<ISymbioteEvent>();
504
- @Output() readonly pressIn = new EventEmitter<ISymbioteEvent>();
505
- @Output() readonly pressOut = new EventEmitter<ISymbioteEvent>();
506
- @Output() readonly pressMove = new EventEmitter<ISymbioteEvent>();
507
- @Output() readonly longPress = new EventEmitter<ISymbioteEvent>();
508
- @Output() readonly hoverIn = new EventEmitter<ISymbioteEvent>();
509
- @Output() readonly hoverOut = new EventEmitter<ISymbioteEvent>();
510
- @Output() readonly accessibilityAction = new EventEmitter<ISymbioteEvent>();
511
- @Output() readonly accessibilityTap = new EventEmitter<ISymbioteEvent>();
512
- @Output() readonly magicTap = new EventEmitter<ISymbioteEvent>();
513
- @Output() readonly accessibilityEscape = new EventEmitter<ISymbioteEvent>();
514
- // RN's onShowUnderlay / onHideUnderlay — fired on a real transition only, never on a repeat.
515
- @Output() readonly showUnderlay = new EventEmitter<void>();
516
- @Output() readonly hideUnderlay = new EventEmitter<void>();
517
- @Input() activeOpacity?: number;
518
- @Input() underlayColor?: string;
519
- @Input() delayPressIn?: number;
520
- @Input() delayPressOut?: number;
521
- @Input() minPressDuration?: number;
522
- @Input() style?: IStyleProp<IViewStyle>;
523
- @Input() delayLongPress?: number;
524
- @Input() delayHoverIn?: number;
525
- @Input() delayHoverOut?: number;
526
- @Input() disabled?: boolean;
527
- @Input() cancelable?: boolean;
528
- @Input() hitSlop?: IRectOffset;
529
- @Input() pressRetentionOffset?: IRectOffset;
530
- @Input() unstable_pressDelay?: number;
531
- @Input() android_ripple?: IPressableAndroidRippleConfig;
532
- @Input() android_disableSound?: boolean;
533
- @Input() testID?: string;
534
- @Input() nativeID?: string;
535
- @Input() hasTVPreferredFocus?: boolean;
536
- @Input() nextFocusDown?: number;
537
- @Input() nextFocusForward?: number;
538
- @Input() nextFocusLeft?: number;
539
- @Input() nextFocusRight?: number;
540
- @Input() nextFocusUp?: number;
541
- @Input() accessible?: boolean;
542
- @Input() accessibilityLabel?: string;
543
- @Input() accessibilityHint?: string;
544
- @Input() accessibilityRole?: IAccessibilityProps['accessibilityRole'];
545
- @Input() accessibilityState?: IAccessibilityStateValue;
546
- @Input() accessibilityValue?: IAccessibilityProps['accessibilityValue'];
547
- @Input() accessibilityActions?: IAccessibilityProps['accessibilityActions'];
548
- @Input() accessibilityLabelledBy?: string | string[];
549
- @Input()
550
- importantForAccessibility?: IAccessibilityProps['importantForAccessibility'];
551
- @Input()
552
- accessibilityLiveRegion?: IAccessibilityProps['accessibilityLiveRegion'];
553
- @Input() screenReaderFocusable?: boolean;
554
- @Input() accessibilityViewIsModal?: boolean;
555
- @Input() accessibilityElementsHidden?: boolean;
556
- @Input() accessibilityIgnoresInvertColors?: boolean;
557
- @Input() accessibilityLanguage?: string;
558
- @Input() accessibilityRespondsToUserInteraction?: boolean;
559
- @Input() accessibilityShowsLargeContentViewer?: boolean;
560
- @Input() accessibilityLargeContentTitle?: string;
561
- @Input() ariaLabel?: string;
562
- @Input() ariaBusy?: boolean;
563
- @Input() ariaChecked?: boolean | 'mixed';
564
- @Input() ariaDisabled?: boolean;
565
- @Input() ariaExpanded?: boolean;
566
- @Input() ariaHidden?: boolean;
567
- @Input() ariaLabelledBy?: string;
568
- @Input() ariaLive?: IAriaProps['aria-live'];
569
- @Input() ariaSelected?: boolean;
570
- @Input() ariaModal?: boolean;
571
- @Input() ariaValueMax?: number;
572
- @Input() ariaValueMin?: number;
573
- @Input() ariaValueNow?: number;
574
- @Input() ariaValueText?: string;
575
- @Input() id?: string;
576
- @Input() role?: IAriaProps['role'];
577
-
578
- // This component's OWN host — the non-painting anchor `class="..."` at the use site resolves
579
- // onto (see anchorHostStyle's doc comment) — NOT the Pressable one level down.
580
- private readonly elementRef = inject(ElementRef);
581
-
582
- // `shown` is NOT Pressable's `pressed`. RN holds the underlay for delayPressOut past the tap so a
583
- // press too fast to see still flashes, and the pressed flag is already false by then. A SIGNAL,
584
- // because the hide fires from a timer — outside any Angular listener, so under zoneless CD
585
- // nothing else would mark this view. A signal write both notifies the change-detection scheduler
586
- // (markAncestorsForTraversal) and dirties this template's own reactive consumer, which is the one
587
- // thing honored in Targeted mode; markForCheck from a plain field would not be reachable here.
588
- private readonly shown = signal(false);
589
- private readonly underlayRuntime = createHighlightUnderlayRuntime();
590
- private readonly timers = createTimerScheduler();
591
-
592
- // The container style Pressable paints.
593
- //
594
- // POINT-7 DECISION — both halves stay on the CONTAINER, deliberately. RN's _createExtraStyles
595
- // keeps them apart: `underlay` (the backgroundColor) on the container, `child` (the lowered
596
- // opacity) cloned onto the single child. Angular has no cloneElement and no way to reach a
597
- // projected <ng-content> node, so the only path to the child is a permanent wrapper View — which
598
- // inserts a node into the flex chain and silently re-parents any `flex` a child declares. The
599
- // fake Fabric runs no Yoga, so no headless test can measure that damage, only assert the extra
600
- // node exists; shipping an unmeasurable layout change is worse than the visual approximation.
601
- // Same call, same reason, as the Solid adapter. resolveHighlightExtraStyles keeps the two styles
602
- // SEPARATE regardless, so a layout-safe fix (which needs a device check, not a test) stays open.
603
- //
604
- // Returns a NEW ARRAY whenever a dependency moves: Pressable's `style` @Input then reports an
605
- // ordinary change. A stable reference was the earlier bug — Pressable's view never refreshed, so
606
- // a class or [style] toggled after mount never reached the committed view.
607
- readonly containerStyle = computed<IStyleProp<IViewStyle>>(() => {
608
- this.inputsRevision();
609
- const base: IStyleProp<IViewStyle> = [this.anchorStyle(), this.style];
610
- const extra = resolveHighlightExtraStyles({
611
- shown: this.shown(),
612
- hasPressHandler: this.hasPressHandler(),
613
- underlayColor: this.underlayColor,
614
- activeOpacity: this.activeOpacity,
615
- });
616
- return extra === undefined ? base : [base, extra.underlay, extra.child];
617
- });
618
-
619
- // RN's _hasPressHandler: a Touchable that handles no press paints no underlay. Angular exposes
620
- // the press lifecycle as @Output()s, so "a handler is present" is "something is subscribed" — the
621
- // same `.observed` test Pressable uses to decide whether to arm its long-press timer at all.
622
- private hasPressHandler(): boolean {
623
- return hasTouchablePressHandler({
624
- onPress: this.press.observed ? this.press : undefined,
625
- onPressIn: this.pressIn.observed ? this.pressIn : undefined,
626
- onPressOut: this.pressOut.observed ? this.pressOut : undefined,
627
- onLongPress: this.longPress.observed ? this.longPress : undefined,
628
- });
629
- }
630
-
631
- // Built per event so the machine reads live @Input()s (delayPressOut, the has-handler gate); the
632
- // runtime persists across calls, which is what lets handlePressOut see the timer handlePress set.
633
- private underlayHandlers(): IHighlightUnderlayHandlers {
634
- return createHighlightUnderlayHandlers(
635
- {
636
- delayPressOut: this.delayPressOut ?? 0,
637
- hasPressHandler: this.hasPressHandler(),
638
- schedule: this.timers.schedule,
639
- },
640
- this.underlayRuntime,
641
- {
642
- setShown: (shown: boolean): void => this.shown.set(shown),
643
- onShowUnderlay: (): void => this.showUnderlay.emit(),
644
- onHideUnderlay: (): void => this.hideUnderlay.emit(),
645
- },
646
- );
647
- }
648
-
649
- // Visual first, then the caller's own event — RN's order in _createPressabilityConfig.
650
- // onLongPress is deliberately NOT intercepted (Pressable emits it straight through); it is only
651
- // READ, by the has-press-handler gate above.
652
- handlePressIn(event: ISymbioteEvent): void {
653
- this.underlayHandlers().handlePressIn(event);
654
- this.pressIn.emit(event);
655
- }
656
-
657
- handlePress(event: ISymbioteEvent): void {
658
- this.underlayHandlers().handlePress(event);
659
- this.press.emit(event);
660
- }
661
-
662
- handlePressOut(event: ISymbioteEvent): void {
663
- this.underlayHandlers().handlePressOut(event);
664
- this.pressOut.emit(event);
665
- }
666
-
667
- ngOnDestroy(): void {
668
- this.timers.cancelAll();
669
- }
670
-
671
- // `style`, `underlayColor` and `activeOpacity` are read untracked inside containerStyle, so the
672
- // bump is what tells it they moved. See the ngDoCheck note below for the anchor half, which
673
- // ngOnChanges cannot cover.
674
- private readonly inputsRevision = signal(0);
675
- private readonly anchorStyle = signal<IStyleProp<IViewStyle> | undefined>(
676
- undefined,
677
- );
678
-
679
- ngOnChanges(): void {
680
- this.inputsRevision.update(revision => revision + 1);
681
- }
682
-
683
- // The anchor's class-derived style is written by the renderer's addClass/removeClass at the USE
684
- // SITE - it never appears in SimpleChanges, and nothing about it dirties THIS component's view.
685
- // ngDoCheck runs during the PARENT's refresh even when this view is skipped, and the signal
686
- // write is what then marks this view for refresh. `signal.set`'s own Object.is makes an
687
- // unchanged poll a no-op, so there is no loop.
688
- ngDoCheck(): void {
689
- this.anchorStyle.set(anchorStyleProp<IViewStyle>(this.elementRef));
690
- }
691
- }
692
-
693
- @Component({
694
- selector: 'TouchableWithoutFeedback',
695
- standalone: true,
696
- hostDirectives: [
697
- { directive: SymbioteStyleInputDirective, inputs: ['style'] },
698
- ],
699
- imports: [Pressable],
700
- changeDetection: ChangeDetectionStrategy.OnPush,
701
- template: `
702
- <Pressable
703
- [style]="mergedStyle"
704
- (press)="press.emit($event)"
705
- (pressIn)="handlePressIn($event)"
706
- (pressOut)="handlePressOut($event)"
707
- (pressMove)="pressMove.emit($event)"
708
- (longPress)="longPress.emit($event)"
709
- (hoverIn)="hoverIn.emit($event)"
710
- (hoverOut)="hoverOut.emit($event)"
711
- [delayLongPress]="delayLongPress"
712
- [delayHoverIn]="delayHoverIn"
713
- [delayHoverOut]="delayHoverOut"
714
- [disabled]="disabled"
715
- [cancelable]="cancelable"
716
- [hitSlop]="hitSlop"
717
- [pressRetentionOffset]="pressRetentionOffset"
718
- [unstable_pressDelay]="unstable_pressDelay"
719
- [android_ripple]="android_ripple"
720
- [android_disableSound]="android_disableSound"
721
- [testID]="testID"
722
- [nativeID]="nativeID"
723
- [hasTVPreferredFocus]="hasTVPreferredFocus"
724
- [nextFocusDown]="nextFocusDown"
725
- [nextFocusForward]="nextFocusForward"
726
- [nextFocusLeft]="nextFocusLeft"
727
- [nextFocusRight]="nextFocusRight"
728
- [nextFocusUp]="nextFocusUp"
729
- [accessible]="accessible"
730
- [accessibilityLabel]="accessibilityLabel"
731
- [accessibilityHint]="accessibilityHint"
732
- [accessibilityRole]="accessibilityRole"
733
- [accessibilityState]="accessibilityState"
734
- [accessibilityValue]="accessibilityValue"
735
- [accessibilityActions]="accessibilityActions"
736
- [accessibilityLabelledBy]="accessibilityLabelledBy"
737
- [importantForAccessibility]="importantForAccessibility"
738
- [accessibilityLiveRegion]="accessibilityLiveRegion"
739
- [screenReaderFocusable]="screenReaderFocusable"
740
- [accessibilityViewIsModal]="accessibilityViewIsModal"
741
- [accessibilityElementsHidden]="accessibilityElementsHidden"
742
- [accessibilityIgnoresInvertColors]="accessibilityIgnoresInvertColors"
743
- [accessibilityLanguage]="accessibilityLanguage"
744
- [accessibilityRespondsToUserInteraction]="
745
- accessibilityRespondsToUserInteraction
746
- "
747
- [accessibilityShowsLargeContentViewer]="
748
- accessibilityShowsLargeContentViewer
749
- "
750
- [accessibilityLargeContentTitle]="accessibilityLargeContentTitle"
751
- (accessibilityAction)="accessibilityAction.emit($event)"
752
- (accessibilityTap)="accessibilityTap.emit($event)"
753
- (magicTap)="magicTap.emit($event)"
754
- (accessibilityEscape)="accessibilityEscape.emit($event)"
755
- [ariaLabel]="ariaLabel"
756
- [ariaBusy]="ariaBusy"
757
- [ariaChecked]="ariaChecked"
758
- [ariaDisabled]="ariaDisabled"
759
- [ariaExpanded]="ariaExpanded"
760
- [ariaHidden]="ariaHidden"
761
- [ariaLabelledBy]="ariaLabelledBy"
762
- [ariaLive]="ariaLive"
763
- [ariaSelected]="ariaSelected"
764
- [ariaModal]="ariaModal"
765
- [ariaValueMax]="ariaValueMax"
766
- [ariaValueMin]="ariaValueMin"
767
- [ariaValueNow]="ariaValueNow"
768
- [ariaValueText]="ariaValueText"
769
- [id]="id"
770
- [role]="role"
771
- >
772
- <ng-content></ng-content>
773
- </Pressable>
774
- `,
775
- })
776
- export class TouchableWithoutFeedback
777
- implements DoCheck, OnDestroy, IAngularTouchableWithoutFeedbackProps
778
- {
779
- // RN's TouchableWithoutFeedback builds a FULL Pressability config with delayPressIn /
780
- // delayPressOut / minPressDuration: 0 — "without feedback" means no VISUAL, not no timing. So the
781
- // same shared machine TouchableOpacity uses runs here, with the visual half left empty: the
782
- // pressIn/pressOut EMIT is what gets deferred and floored.
783
- @Output() readonly press = new EventEmitter<ISymbioteEvent>();
784
- @Output() readonly pressIn = new EventEmitter<ISymbioteEvent>();
785
- @Output() readonly pressOut = new EventEmitter<ISymbioteEvent>();
786
- @Output() readonly pressMove = new EventEmitter<ISymbioteEvent>();
787
- @Output() readonly longPress = new EventEmitter<ISymbioteEvent>();
788
- @Output() readonly hoverIn = new EventEmitter<ISymbioteEvent>();
789
- @Output() readonly hoverOut = new EventEmitter<ISymbioteEvent>();
790
- @Output() readonly accessibilityAction = new EventEmitter<ISymbioteEvent>();
791
- @Output() readonly accessibilityTap = new EventEmitter<ISymbioteEvent>();
792
- @Output() readonly magicTap = new EventEmitter<ISymbioteEvent>();
793
- @Output() readonly accessibilityEscape = new EventEmitter<ISymbioteEvent>();
794
- @Input() delayPressIn?: number;
795
- @Input() delayPressOut?: number;
796
- @Input() minPressDuration?: number;
797
- @Input() style?: IStyleProp<IViewStyle>;
798
- @Input() delayLongPress?: number;
799
- @Input() delayHoverIn?: number;
800
- @Input() delayHoverOut?: number;
801
- @Input() disabled?: boolean;
802
- @Input() cancelable?: boolean;
803
- @Input() hitSlop?: IRectOffset;
804
- @Input() pressRetentionOffset?: IRectOffset;
805
- @Input() unstable_pressDelay?: number;
806
- @Input() android_ripple?: IPressableAndroidRippleConfig;
807
- @Input() android_disableSound?: boolean;
808
- @Input() testID?: string;
809
- @Input() nativeID?: string;
810
- @Input() hasTVPreferredFocus?: boolean;
811
- @Input() nextFocusDown?: number;
812
- @Input() nextFocusForward?: number;
813
- @Input() nextFocusLeft?: number;
814
- @Input() nextFocusRight?: number;
815
- @Input() nextFocusUp?: number;
816
- @Input() accessible?: boolean;
817
- @Input() accessibilityLabel?: string;
818
- @Input() accessibilityHint?: string;
819
- @Input() accessibilityRole?: IAccessibilityProps['accessibilityRole'];
820
- @Input() accessibilityState?: IAccessibilityStateValue;
821
- @Input() accessibilityValue?: IAccessibilityProps['accessibilityValue'];
822
- @Input() accessibilityActions?: IAccessibilityProps['accessibilityActions'];
823
- @Input() accessibilityLabelledBy?: string | string[];
824
- @Input()
825
- importantForAccessibility?: IAccessibilityProps['importantForAccessibility'];
826
- @Input()
827
- accessibilityLiveRegion?: IAccessibilityProps['accessibilityLiveRegion'];
828
- @Input() screenReaderFocusable?: boolean;
829
- @Input() accessibilityViewIsModal?: boolean;
830
- @Input() accessibilityElementsHidden?: boolean;
831
- @Input() accessibilityIgnoresInvertColors?: boolean;
832
- @Input() accessibilityLanguage?: string;
833
- @Input() accessibilityRespondsToUserInteraction?: boolean;
834
- @Input() accessibilityShowsLargeContentViewer?: boolean;
835
- @Input() accessibilityLargeContentTitle?: string;
836
- @Input() ariaLabel?: string;
837
- @Input() ariaBusy?: boolean;
838
- @Input() ariaChecked?: boolean | 'mixed';
839
- @Input() ariaDisabled?: boolean;
840
- @Input() ariaExpanded?: boolean;
841
- @Input() ariaHidden?: boolean;
842
- @Input() ariaLabelledBy?: string;
843
- @Input() ariaLive?: IAriaProps['aria-live'];
844
- @Input() ariaSelected?: boolean;
845
- @Input() ariaModal?: boolean;
846
- @Input() ariaValueMax?: number;
847
- @Input() ariaValueMin?: number;
848
- @Input() ariaValueNow?: number;
849
- @Input() ariaValueText?: string;
850
- @Input() id?: string;
851
- @Input() role?: IAriaProps['role'];
852
-
853
- // This component's OWN host — the non-painting anchor `class="..."` at the use site resolves
854
- // onto (see anchorHostStyle's doc comment) — NOT the Pressable one level down.
855
- private readonly elementRef = inject(ElementRef);
856
-
857
- // The shared press-scheduling cell (delayPressIn timer + activation clock), persisted on the
858
- // instance; the machine's handlers are rebuilt per event over live @Input()s.
859
- private readonly runtime = createTouchableFeedbackRuntime();
860
- private readonly timers = createTimerScheduler();
861
-
862
- // The anchor's class-derived style goes first, then the explicit style, so an explicit [style]
863
- // still beats the ambient class.
864
- get mergedStyle(): IStyleProp<IViewStyle> {
865
- return [this.anchorStyle(), this.style];
866
- }
867
-
868
- private feedbackHandlers(): ITouchableFeedbackHandlers {
869
- return createTouchableFeedbackHandlers(
870
- {
871
- delayPressIn: this.delayPressIn ?? 0,
872
- delayPressOut: this.delayPressOut ?? 0,
873
- minPressDuration:
874
- this.minPressDuration ?? TOUCHABLE_MIN_PRESS_DURATION_MS,
875
- schedule: this.timers.schedule,
876
- now: Date.now,
877
- },
878
- this.runtime,
879
- {
880
- activate: (event: ISymbioteEvent): void => this.pressIn.emit(event),
881
- deactivate: (event: ISymbioteEvent): void => this.pressOut.emit(event),
882
- },
883
- );
884
- }
885
-
886
- handlePressIn(event: ISymbioteEvent): void {
887
- this.feedbackHandlers().handlePressIn(event);
888
- }
889
-
890
- handlePressOut(event: ISymbioteEvent): void {
891
- this.feedbackHandlers().handlePressOut(event);
892
- }
893
-
894
- ngOnDestroy(): void {
895
- this.timers.cancelAll();
896
- }
897
-
898
- // The anchor's class-derived style is written by the renderer's addClass/removeClass at the USE
899
- // SITE - it never appears in SimpleChanges, and nothing about it dirties THIS component's view.
900
- // A `class=` present at creation therefore worked, while one toggled later did not: the parent
901
- // refreshed, the class landed on the anchor, and this component's own view was never refreshed,
902
- // so whatever merged the anchor style in was never re-evaluated. Polling it into a signal from
903
- // ngDoCheck fixes both halves: ngDoCheck runs during the PARENT's refresh even when this view is
904
- // skipped, and the signal write is what then marks this view for refresh. `signal.set`'s own
905
- // Object.is makes an unchanged poll a no-op, so there is no loop.
906
- private readonly anchorStyle = signal<IStyleProp<IViewStyle> | undefined>(
907
- undefined,
908
- );
909
-
910
- ngDoCheck(): void {
911
- this.anchorStyle.set(anchorStyleProp<IViewStyle>(this.elementRef));
912
- }
913
- }