@symbiote-native/angular 0.0.0-canary-20260724081123

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 (276) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -0
  3. package/babel-linker.cjs +7 -0
  4. package/babel-register-composed.cjs +127 -0
  5. package/bin/symbiote-angular-dev.cjs +93 -0
  6. package/build/angular/anchor-host-registry.d.ts +2 -0
  7. package/build/angular/anchor-host-registry.js +84 -0
  8. package/build/angular/anchor-host-registry.js.map +1 -0
  9. package/build/angular/bootstrap.d.ts +7 -0
  10. package/build/angular/bootstrap.js +15 -0
  11. package/build/angular/bootstrap.js.map +1 -0
  12. package/build/angular/components/activity-indicator/index.android.d.ts +12 -0
  13. package/build/angular/components/activity-indicator/index.android.js +21 -0
  14. package/build/angular/components/activity-indicator/index.android.js.map +1 -0
  15. package/build/angular/components/activity-indicator/index.d.ts +1 -0
  16. package/build/angular/components/activity-indicator/index.ios.d.ts +8 -0
  17. package/build/angular/components/activity-indicator/index.ios.js +21 -0
  18. package/build/angular/components/activity-indicator/index.ios.js.map +1 -0
  19. package/build/angular/components/activity-indicator/index.js +4 -0
  20. package/build/angular/components/activity-indicator/index.js.map +1 -0
  21. package/build/angular/components/activity-indicator/shared.d.ts +67 -0
  22. package/build/angular/components/activity-indicator/shared.js +260 -0
  23. package/build/angular/components/activity-indicator/shared.js.map +1 -0
  24. package/build/angular/components/button.d.ts +63 -0
  25. package/build/angular/components/button.js +332 -0
  26. package/build/angular/components/button.js.map +1 -0
  27. package/build/angular/components/flat-list/index.d.ts +122 -0
  28. package/build/angular/components/flat-list/index.js +688 -0
  29. package/build/angular/components/flat-list/index.js.map +1 -0
  30. package/build/angular/components/image/index.android.d.ts +10 -0
  31. package/build/angular/components/image/index.android.js +59 -0
  32. package/build/angular/components/image/index.android.js.map +1 -0
  33. package/build/angular/components/image/index.d.ts +1 -0
  34. package/build/angular/components/image/index.ios.d.ts +10 -0
  35. package/build/angular/components/image/index.ios.js +59 -0
  36. package/build/angular/components/image/index.ios.js.map +1 -0
  37. package/build/angular/components/image/index.js +3 -0
  38. package/build/angular/components/image/index.js.map +1 -0
  39. package/build/angular/components/image/shared.d.ts +101 -0
  40. package/build/angular/components/image/shared.js +406 -0
  41. package/build/angular/components/image/shared.js.map +1 -0
  42. package/build/angular/components/image-background.d.ts +81 -0
  43. package/build/angular/components/image-background.js +418 -0
  44. package/build/angular/components/image-background.js.map +1 -0
  45. package/build/angular/components/input-accessory-view/index.d.ts +60 -0
  46. package/build/angular/components/input-accessory-view/index.js +251 -0
  47. package/build/angular/components/input-accessory-view/index.js.map +1 -0
  48. package/build/angular/components/keyboard-avoiding-view/index.d.ts +82 -0
  49. package/build/angular/components/keyboard-avoiding-view/index.js +358 -0
  50. package/build/angular/components/keyboard-avoiding-view/index.js.map +1 -0
  51. package/build/angular/components/modal/index.d.ts +92 -0
  52. package/build/angular/components/modal/index.js +360 -0
  53. package/build/angular/components/modal/index.js.map +1 -0
  54. package/build/angular/components/pressable/index.d.ts +123 -0
  55. package/build/angular/components/pressable/index.js +420 -0
  56. package/build/angular/components/pressable/index.js.map +1 -0
  57. package/build/angular/components/refresh-control/index.d.ts +86 -0
  58. package/build/angular/components/refresh-control/index.js +342 -0
  59. package/build/angular/components/refresh-control/index.js.map +1 -0
  60. package/build/angular/components/safe-area-view/index.d.ts +57 -0
  61. package/build/angular/components/safe-area-view/index.js +248 -0
  62. package/build/angular/components/safe-area-view/index.js.map +1 -0
  63. package/build/angular/components/scroll-view/index.android.d.ts +21 -0
  64. package/build/angular/components/scroll-view/index.android.js +235 -0
  65. package/build/angular/components/scroll-view/index.android.js.map +1 -0
  66. package/build/angular/components/scroll-view/index.d.ts +3 -0
  67. package/build/angular/components/scroll-view/index.ios.d.ts +9 -0
  68. package/build/angular/components/scroll-view/index.ios.js +86 -0
  69. package/build/angular/components/scroll-view/index.ios.js.map +1 -0
  70. package/build/angular/components/scroll-view/index.js +6 -0
  71. package/build/angular/components/scroll-view/index.js.map +1 -0
  72. package/build/angular/components/scroll-view/projection.d.ts +32 -0
  73. package/build/angular/components/scroll-view/projection.js +334 -0
  74. package/build/angular/components/scroll-view/projection.js.map +1 -0
  75. package/build/angular/components/scroll-view/shared.d.ts +230 -0
  76. package/build/angular/components/scroll-view/shared.js +682 -0
  77. package/build/angular/components/scroll-view/shared.js.map +1 -0
  78. package/build/angular/components/scroll-view/sticky-header.d.ts +40 -0
  79. package/build/angular/components/scroll-view/sticky-header.js +225 -0
  80. package/build/angular/components/scroll-view/sticky-header.js.map +1 -0
  81. package/build/angular/components/section-list/index.d.ts +116 -0
  82. package/build/angular/components/section-list/index.js +641 -0
  83. package/build/angular/components/section-list/index.js.map +1 -0
  84. package/build/angular/components/switch/index.android.d.ts +20 -0
  85. package/build/angular/components/switch/index.android.js +70 -0
  86. package/build/angular/components/switch/index.android.js.map +1 -0
  87. package/build/angular/components/switch/index.d.ts +1 -0
  88. package/build/angular/components/switch/index.ios.d.ts +19 -0
  89. package/build/angular/components/switch/index.ios.js +69 -0
  90. package/build/angular/components/switch/index.ios.js.map +1 -0
  91. package/build/angular/components/switch/index.js +4 -0
  92. package/build/angular/components/switch/index.js.map +1 -0
  93. package/build/angular/components/switch/shared.d.ts +40 -0
  94. package/build/angular/components/switch/shared.js +127 -0
  95. package/build/angular/components/switch/shared.js.map +1 -0
  96. package/build/angular/components/text-input.d.ts +153 -0
  97. package/build/angular/components/text-input.js +599 -0
  98. package/build/angular/components/text-input.js.map +1 -0
  99. package/build/angular/components/touchable/index.d.ts +245 -0
  100. package/build/angular/components/touchable/index.js +1186 -0
  101. package/build/angular/components/touchable/index.js.map +1 -0
  102. package/build/angular/components/touchable-native-feedback/index.d.ts +83 -0
  103. package/build/angular/components/touchable-native-feedback/index.js +371 -0
  104. package/build/angular/components/touchable-native-feedback/index.js.map +1 -0
  105. package/build/angular/components/virtualized-list/directives.d.ts +54 -0
  106. package/build/angular/components/virtualized-list/directives.js +153 -0
  107. package/build/angular/components/virtualized-list/directives.js.map +1 -0
  108. package/build/angular/components/virtualized-list/index.d.ts +253 -0
  109. package/build/angular/components/virtualized-list/index.js +1031 -0
  110. package/build/angular/components/virtualized-list/index.js.map +1 -0
  111. package/build/angular/components/virtualized-section-list/directives.d.ts +37 -0
  112. package/build/angular/components/virtualized-section-list/directives.js +76 -0
  113. package/build/angular/components/virtualized-section-list/directives.js.map +1 -0
  114. package/build/angular/components/virtualized-section-list/index.d.ts +178 -0
  115. package/build/angular/components/virtualized-section-list/index.js +720 -0
  116. package/build/angular/components/virtualized-section-list/index.js.map +1 -0
  117. package/build/angular/components.d.ts +39 -0
  118. package/build/angular/components.js +38 -0
  119. package/build/angular/components.js.map +1 -0
  120. package/build/angular/create-portal/index.d.ts +22 -0
  121. package/build/angular/create-portal/index.js +74 -0
  122. package/build/angular/create-portal/index.js.map +1 -0
  123. package/build/angular/create-tunnel/index.d.ts +34 -0
  124. package/build/angular/create-tunnel/index.js +126 -0
  125. package/build/angular/create-tunnel/index.js.map +1 -0
  126. package/build/angular/descriptor-to-angular/index.d.ts +22 -0
  127. package/build/angular/descriptor-to-angular/index.js +142 -0
  128. package/build/angular/descriptor-to-angular/index.js.map +1 -0
  129. package/build/angular/host-instance/index.d.ts +2 -0
  130. package/build/angular/host-instance/index.js +37 -0
  131. package/build/angular/host-instance/index.js.map +1 -0
  132. package/build/angular/index.d.ts +22 -0
  133. package/build/angular/index.js +46 -0
  134. package/build/angular/index.js.map +1 -0
  135. package/build/angular/modules/animated/animated-leaf-binder/index.d.ts +14 -0
  136. package/build/angular/modules/animated/animated-leaf-binder/index.js +91 -0
  137. package/build/angular/modules/animated/animated-leaf-binder/index.js.map +1 -0
  138. package/build/angular/modules/animated/animated-leaf-binder.d.ts +14 -0
  139. package/build/angular/modules/animated/animated-leaf-binder.js +91 -0
  140. package/build/angular/modules/animated/animated-leaf-binder.js.map +1 -0
  141. package/build/angular/modules/animated/create-animated-component.d.ts +59 -0
  142. package/build/angular/modules/animated/create-animated-component.js +364 -0
  143. package/build/angular/modules/animated/create-animated-component.js.map +1 -0
  144. package/build/angular/modules/animated/index.d.ts +51 -0
  145. package/build/angular/modules/animated/index.js +59 -0
  146. package/build/angular/modules/animated/index.js.map +1 -0
  147. package/build/angular/modules/app-registry/index.d.ts +7 -0
  148. package/build/angular/modules/app-registry/index.js +23 -0
  149. package/build/angular/modules/app-registry/index.js.map +1 -0
  150. package/build/angular/modules/status-bar/index.d.ts +20 -0
  151. package/build/angular/modules/status-bar/index.js +59 -0
  152. package/build/angular/modules/status-bar/index.js.map +1 -0
  153. package/build/angular/primitives/index.d.ts +63 -0
  154. package/build/angular/primitives/index.js +189 -0
  155. package/build/angular/primitives/index.js.map +1 -0
  156. package/build/angular/primitives/shared.d.ts +88 -0
  157. package/build/angular/primitives/shared.js +171 -0
  158. package/build/angular/primitives/shared.js.map +1 -0
  159. package/build/angular/render/index.d.ts +11 -0
  160. package/build/angular/render/index.js +171 -0
  161. package/build/angular/render/index.js.map +1 -0
  162. package/build/angular/renderer/index.d.ts +37 -0
  163. package/build/angular/renderer/index.js +301 -0
  164. package/build/angular/renderer/index.js.map +1 -0
  165. package/build/angular/services/color-scheme.service.d.ts +16 -0
  166. package/build/angular/services/color-scheme.service.js +31 -0
  167. package/build/angular/services/color-scheme.service.js.map +1 -0
  168. package/build/angular/services/index.d.ts +2 -0
  169. package/build/angular/services/index.js +3 -0
  170. package/build/angular/services/index.js.map +1 -0
  171. package/build/angular/services/window-dimensions.service.d.ts +16 -0
  172. package/build/angular/services/window-dimensions.service.js +42 -0
  173. package/build/angular/services/window-dimensions.service.js.map +1 -0
  174. package/metro-config.cjs +48 -0
  175. package/metro-css-parser.cjs +13 -0
  176. package/package.json +80 -0
  177. package/src/__tests__/responder-change-detection.test.ts +102 -0
  178. package/src/__tests__/responder-nested-cd.test.ts +113 -0
  179. package/src/anchor-host-registry.ts +88 -0
  180. package/src/angular-gaps.test.ts +142 -0
  181. package/src/angular-imports.test.ts +100 -0
  182. package/src/bootstrap.ts +26 -0
  183. package/src/components/activity-indicator/activity-indicator-class-style.test.ts +44 -0
  184. package/src/components/activity-indicator/activity-indicator.test.ts +131 -0
  185. package/src/components/activity-indicator/index.android.ts +16 -0
  186. package/src/components/activity-indicator/index.ios.ts +17 -0
  187. package/src/components/activity-indicator/index.ts +4 -0
  188. package/src/components/activity-indicator/shared.ts +206 -0
  189. package/src/components/button.ts +193 -0
  190. package/src/components/flat-list/column-wrapper-style-class.test.ts +116 -0
  191. package/src/components/flat-list/flat-list-array-style.test.ts +131 -0
  192. package/src/components/flat-list/flat-list-class-style.test.ts +74 -0
  193. package/src/components/flat-list/flat-list-scroll-containment.test.ts +107 -0
  194. package/src/components/flat-list/flat-list.test.ts +99 -0
  195. package/src/components/flat-list/index.ts +574 -0
  196. package/src/components/image/image-class-style.test.ts +46 -0
  197. package/src/components/image/index.android.ts +48 -0
  198. package/src/components/image/index.ios.ts +48 -0
  199. package/src/components/image/index.ts +3 -0
  200. package/src/components/image/shared.ts +479 -0
  201. package/src/components/image-background-class-style.test.ts +48 -0
  202. package/src/components/image-background-style-class.test.ts +79 -0
  203. package/src/components/image-background.ts +270 -0
  204. package/src/components/input-accessory-view/index.ts +185 -0
  205. package/src/components/input-accessory-view/input-accessory-view.test.ts +43 -0
  206. package/src/components/keyboard-avoiding-view/index.ts +303 -0
  207. package/src/components/keyboard-avoiding-view/keyboard-avoiding-view.test.ts +54 -0
  208. package/src/components/modal/index.ts +299 -0
  209. package/src/components/modal/modal.test.ts +43 -0
  210. package/src/components/pressable/index.ts +373 -0
  211. package/src/components/pressable/pressable.test.ts +85 -0
  212. package/src/components/refresh-control/index.ts +284 -0
  213. package/src/components/refresh-control/refresh-control.test.ts +41 -0
  214. package/src/components/safe-area-view/index.ts +177 -0
  215. package/src/components/safe-area-view/safe-area-view.test.ts +43 -0
  216. package/src/components/scroll-view/android-scroll-view-axis-projection.test.ts +123 -0
  217. package/src/components/scroll-view/content-container-style-class.test.ts +75 -0
  218. package/src/components/scroll-view/index.android.ts +190 -0
  219. package/src/components/scroll-view/index.ios.ts +79 -0
  220. package/src/components/scroll-view/index.ts +7 -0
  221. package/src/components/scroll-view/projection.ts +414 -0
  222. package/src/components/scroll-view/scroll-view-class-style.test.ts +134 -0
  223. package/src/components/scroll-view/scroll-view-projection.test.ts +194 -0
  224. package/src/components/scroll-view/shared.ts +844 -0
  225. package/src/components/scroll-view/sticky-header.ts +255 -0
  226. package/src/components/section-list/index.ts +445 -0
  227. package/src/components/switch/android-switch-class.test.ts +42 -0
  228. package/src/components/switch/index.android.ts +61 -0
  229. package/src/components/switch/index.ios.ts +60 -0
  230. package/src/components/switch/index.ts +4 -0
  231. package/src/components/switch/shared.ts +197 -0
  232. package/src/components/switch/switch.test.ts +92 -0
  233. package/src/components/text-input-class-style.test.ts +54 -0
  234. package/src/components/text-input.ts +531 -0
  235. package/src/components/touchable/index.ts +629 -0
  236. package/src/components/touchable/touchable.test.ts +102 -0
  237. package/src/components/touchable-native-feedback/index.ts +254 -0
  238. package/src/components/touchable-native-feedback/touchable-native-feedback.test.ts +49 -0
  239. package/src/components/virtualized-list/directives.ts +168 -0
  240. package/src/components/virtualized-list/index.ts +992 -0
  241. package/src/components/virtualized-list/virtualized-list-class-style.test.ts +76 -0
  242. package/src/components/virtualized-section-list/directives.ts +90 -0
  243. package/src/components/virtualized-section-list/index.ts +601 -0
  244. package/src/components/virtualized-section-list/virtualized-section-list-class-style.test.ts +60 -0
  245. package/src/components.ts +149 -0
  246. package/src/create-portal/create-portal.test.ts +90 -0
  247. package/src/create-portal/index.ts +74 -0
  248. package/src/create-tunnel/create-tunnel.test.ts +120 -0
  249. package/src/create-tunnel/index.ts +136 -0
  250. package/src/descriptor-to-angular/descriptor-outlet.test.ts +94 -0
  251. package/src/descriptor-to-angular/index.ts +190 -0
  252. package/src/host-instance/host-instance.test.ts +49 -0
  253. package/src/host-instance/index.ts +36 -0
  254. package/src/index.ts +261 -0
  255. package/src/modules/animated/animated-leaf-binder/animated-leaf-binder.test.ts +116 -0
  256. package/src/modules/animated/animated-leaf-binder/index.ts +101 -0
  257. package/src/modules/animated/animated-leaf-binder.test.ts +116 -0
  258. package/src/modules/animated/animated-leaf-binder.ts +101 -0
  259. package/src/modules/animated/animated-scroll-view.test.ts +102 -0
  260. package/src/modules/animated/create-animated-component.ts +365 -0
  261. package/src/modules/animated/index.ts +105 -0
  262. package/src/modules/app-registry/app-registry.test.ts +106 -0
  263. package/src/modules/app-registry/index.ts +60 -0
  264. package/src/modules/status-bar/index.ts +57 -0
  265. package/src/modules/status-bar/status-bar.test.ts +50 -0
  266. package/src/primitives/index.ts +119 -0
  267. package/src/primitives/shared.ts +190 -0
  268. package/src/render/index.ts +235 -0
  269. package/src/render/render.test.ts +147 -0
  270. package/src/renderer/index.ts +347 -0
  271. package/src/renderer/renderer.test.ts +203 -0
  272. package/src/services/color-scheme.service.ts +27 -0
  273. package/src/services/index.ts +2 -0
  274. package/src/services/services.test.ts +163 -0
  275. package/src/services/window-dimensions.service.ts +41 -0
  276. package/tsconfig.angular.base.json +30 -0
@@ -0,0 +1,531 @@
1
+ // TextInput, the Angular lifecycle half. The folds/maps (value->text, the W3C/alias resolution)
2
+ // and the controlled-write predicate live in @symbiote-native/components/state, the render (intrinsic
3
+ // + native-prop mapping) in @symbiote-native/components/view, both shared verbatim with the React and
4
+ // Vue adapters. Here Angular supplies only the lifecycle: renderTextInput picks ONE of two host
5
+ // intrinsics at runtime (symbiote-text-input / symbiote-text-input-multiline) via `@if`/`@else`,
6
+ // each wired through the shared `SymbioteHostPropsDirective` (`[symbioteHostProps]="hostProps"`,
7
+ // `../primitives/shared.ts`) so the flat resolved prop bag doesn't need enumerating as individual
8
+ // `[prop]` bindings; a @ViewChild reading that directive (by its `#host` template ref, across
9
+ // either branch) exposes `.node` — the host BY IDENTITY (so imperative commands hit the engine's
10
+ // WeakMap mirror). A plain field holds the acknowledged event count, ngOnChanges runs the
11
+ // controlled-write command, ngAfterViewInit drives the mount autoFocus, and the class itself is
12
+ // the imperative handle (ITextInputHandle). The Angular twin of React's useRef/useState +
13
+ // useLayoutEffect + useImperativeHandle and Vue's shallowRef + watch(flush:'post') + expose().
14
+ //
15
+ // Two Angular-specific seams. (1) Events: Angular forbids [onX] property bindings, so the host's
16
+ // change/focus/blur + the remaining native events ride the structural (event) channel and route
17
+ // to real @Output() EventEmitters (valueChange is DERIVED from change, never a native event —
18
+ // React/Vue fold both into one onValueChange(text, event) callback, but Angular's EventEmitter
19
+ // only carries one value, so valueChange stays text-only to keep [(value)] banana-in-a-box
20
+ // working; `change` stays a second, separate @Output() for the raw event). The
21
+ // non-function props travel the flat-bag path via the host-props directive. (2) Commit timing:
22
+ // Angular's change detection is async/batched (zoneless), so a native command wired at lifecycle
23
+ // time has no Fabric tag yet; the controlled write + autoFocus defer through whenCommitted, the
24
+ // same gotcha Vue hits. The controlled handshake hinges on commanding native back with the
25
+ // ACKNOWLEDGED event count (setTextAndSelection), never a plain prop re-push — see
26
+ // @symbiote-native/components/state/text-input.
27
+
28
+ import {
29
+ CUSTOM_ELEMENTS_SCHEMA,
30
+ ChangeDetectionStrategy,
31
+ Component,
32
+ ElementRef,
33
+ EventEmitter,
34
+ inject,
35
+ Input,
36
+ Output,
37
+ ViewChild,
38
+ type AfterViewInit,
39
+ type OnChanges,
40
+ type OnDestroy,
41
+ type SimpleChanges,
42
+ } from '@angular/core';
43
+ import {
44
+ foldText,
45
+ eventCountFromChange,
46
+ textFromChange,
47
+ shouldCommandText,
48
+ renderTextInput,
49
+ resolveAccessibilityProps,
50
+ resolveTextInputProps,
51
+ INITIAL_EVENT_COUNT,
52
+ SELECTION_NONE,
53
+ type IAccessibilityProps,
54
+ type IAccessibilityStateValue,
55
+ type IAriaProps,
56
+ type IEnterKeyHint,
57
+ type IFoldedTextInputProps,
58
+ type IInputMode,
59
+ type ISubmitBehavior,
60
+ type ITextInputEventHandler,
61
+ type ITextInputHandle,
62
+ type ITextInputSelection,
63
+ } from '@symbiote-native/components';
64
+ import {
65
+ blurTextInput,
66
+ dispatchViewCommand,
67
+ dlog,
68
+ isSymbioteEvent,
69
+ isSymbioteNode,
70
+ setInputBlurred,
71
+ setInputFocused,
72
+ whenCommitted,
73
+ type IStyleProp,
74
+ type ISymbioteEvent,
75
+ type ISymbioteNode,
76
+ type ITextStyle,
77
+ } from '@symbiote-native/engine';
78
+ import {
79
+ anchorHostStyle,
80
+ MultilineTextInputHost,
81
+ SymbioteHostPropsDirective,
82
+ TextInputHost,
83
+ } from '../primitives';
84
+
85
+ export type { ITextInputHandle, ITextInputSelection, IInputMode, IEnterKeyHint, ISubmitBehavior };
86
+
87
+ // Mirrors React's ITextInputProps minus nothing (TextInput has no children) — declared
88
+ // per-adapter over the shared accessibility base because Angular's input surface aliases the
89
+ // aria-* keys to camelCase @Inputs, unlike the plain agnostic fields shared across adapters.
90
+ export interface IAngularTextInputProps extends IAccessibilityProps, IAriaProps {
91
+ value?: string;
92
+ defaultValue?: string;
93
+ placeholder?: string;
94
+ placeholderTextColor?: string;
95
+ editable?: boolean;
96
+ keyboardType?: string;
97
+ secureTextEntry?: boolean;
98
+ maxLength?: number;
99
+ multiline?: boolean;
100
+ selection?: ITextInputSelection;
101
+ autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
102
+ autoCorrect?: boolean;
103
+ autoComplete?: string;
104
+ textContentType?: string;
105
+ autoFocus?: boolean;
106
+ showSoftInputOnFocus?: boolean;
107
+ returnKeyType?: string;
108
+ selectTextOnFocus?: boolean;
109
+ scrollEnabled?: boolean;
110
+ numberOfLines?: number;
111
+ textAlign?: 'left' | 'center' | 'right';
112
+ blurOnSubmit?: boolean;
113
+ inputMode?: IInputMode;
114
+ enterKeyHint?: IEnterKeyHint;
115
+ readOnly?: boolean;
116
+ submitBehavior?: ISubmitBehavior;
117
+ cursorColor?: string;
118
+ selectionColor?: string;
119
+ selectionHandleColor?: string;
120
+ underlineColorAndroid?: string;
121
+ inputAccessoryViewID?: string;
122
+ style?: IStyleProp<ITextStyle>;
123
+ onValueChange?: (text: string) => void;
124
+ onChange?: ITextInputEventHandler;
125
+ onFocus?: ITextInputEventHandler;
126
+ onBlur?: ITextInputEventHandler;
127
+ onEndEditing?: ITextInputEventHandler;
128
+ onSubmitEditing?: ITextInputEventHandler;
129
+ onKeyPress?: ITextInputEventHandler;
130
+ onSelectionChange?: ITextInputEventHandler;
131
+ onContentSizeChange?: ITextInputEventHandler;
132
+ }
133
+
134
+ // What the TextInput component itself takes as plain @Input()s: the full surface minus every
135
+ // callback-shaped event, which it exposes as real @Output() EventEmitters instead (see the class
136
+ // below) — mirrors Pressable's IAngularPressableInputs / IAngularPressableProps split.
137
+ export type IAngularTextInputInputs = Omit<
138
+ IAngularTextInputProps,
139
+ | 'onValueChange'
140
+ | 'onChange'
141
+ | 'onFocus'
142
+ | 'onBlur'
143
+ | 'onEndEditing'
144
+ | 'onSubmitEditing'
145
+ | 'onKeyPress'
146
+ | 'onSelectionChange'
147
+ | 'onContentSizeChange'
148
+ | 'onAccessibilityAction'
149
+ | 'onAccessibilityTap'
150
+ | 'onMagicTap'
151
+ | 'onAccessibilityEscape'
152
+ >;
153
+
154
+ @Component({
155
+ selector: 'TextInput',
156
+ standalone: true,
157
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
158
+ imports: [SymbioteHostPropsDirective, TextInputHost, MultilineTextInputHost],
159
+ changeDetection: ChangeDetectionStrategy.OnPush,
160
+ template: `
161
+ @if (isMultiline) {
162
+ <symbiote-text-input-multiline
163
+ #host
164
+ [symbioteHostProps]="hostProps"
165
+ (change)="handleChange($event)"
166
+ (focus)="handleFocus($event)"
167
+ (blur)="handleBlur($event)"
168
+ (selectionChange)="emit(selectionChange, $event)"
169
+ (submitEditing)="emit(submitEditing, $event)"
170
+ (keyPress)="emit(keyPress, $event)"
171
+ (endEditing)="emit(endEditing, $event)"
172
+ (contentSizeChange)="emit(contentSizeChange, $event)"
173
+ (accessibilityAction)="emit(accessibilityAction, $event)"
174
+ (accessibilityTap)="emit(accessibilityTap, $event)"
175
+ (magicTap)="emit(magicTap, $event)"
176
+ (accessibilityEscape)="emit(accessibilityEscape, $event)"
177
+ ></symbiote-text-input-multiline>
178
+ } @else {
179
+ <symbiote-text-input
180
+ #host
181
+ [symbioteHostProps]="hostProps"
182
+ (change)="handleChange($event)"
183
+ (focus)="handleFocus($event)"
184
+ (blur)="handleBlur($event)"
185
+ (selectionChange)="emit(selectionChange, $event)"
186
+ (submitEditing)="emit(submitEditing, $event)"
187
+ (keyPress)="emit(keyPress, $event)"
188
+ (endEditing)="emit(endEditing, $event)"
189
+ (contentSizeChange)="emit(contentSizeChange, $event)"
190
+ (accessibilityAction)="emit(accessibilityAction, $event)"
191
+ (accessibilityTap)="emit(accessibilityTap, $event)"
192
+ (magicTap)="emit(magicTap, $event)"
193
+ (accessibilityEscape)="emit(accessibilityEscape, $event)"
194
+ ></symbiote-text-input>
195
+ }
196
+ `,
197
+ })
198
+ export class TextInput
199
+ implements IAngularTextInputInputs, ITextInputHandle, OnChanges, AfterViewInit, OnDestroy
200
+ {
201
+ @Input() value?: string;
202
+ @Input() defaultValue?: string;
203
+ @Input() placeholder?: string;
204
+ @Input() placeholderTextColor?: string;
205
+ @Input() editable?: boolean;
206
+ @Input() keyboardType?: string;
207
+ @Input() secureTextEntry?: boolean;
208
+ @Input() maxLength?: number;
209
+ @Input() multiline?: boolean;
210
+ @Input() selection?: ITextInputSelection;
211
+ @Input() autoCapitalize?: IAngularTextInputProps['autoCapitalize'];
212
+ @Input() autoCorrect?: boolean;
213
+ @Input() autoComplete?: string;
214
+ @Input() textContentType?: string;
215
+ @Input() autoFocus?: boolean;
216
+ @Input() showSoftInputOnFocus?: boolean;
217
+ @Input() returnKeyType?: string;
218
+ @Input() selectTextOnFocus?: boolean;
219
+ @Input() scrollEnabled?: boolean;
220
+ @Input() numberOfLines?: number;
221
+ @Input() textAlign?: IAngularTextInputProps['textAlign'];
222
+ @Input() blurOnSubmit?: boolean;
223
+ @Input() inputMode?: IInputMode;
224
+ @Input() enterKeyHint?: IEnterKeyHint;
225
+ @Input() readOnly?: boolean;
226
+ @Input() submitBehavior?: ISubmitBehavior;
227
+ @Input() cursorColor?: string;
228
+ @Input() selectionColor?: string;
229
+ @Input() selectionHandleColor?: string;
230
+ @Input() underlineColorAndroid?: string;
231
+ @Input() inputAccessoryViewID?: string;
232
+ @Input() style?: IStyleProp<ITextStyle>;
233
+ @Input() testID?: string;
234
+ @Input() nativeID?: string;
235
+
236
+ // The event lifecycle as real Angular events: `(valueChange)="onText($event)"`, not
237
+ // `[onValueChange]="onText"`. `focus`/`blur` collide with this same class's OWN imperative
238
+ // `focus()`/`blur()` handle methods (ITextInputHandle — the RN ref API a parent calls via
239
+ // `@ViewChild(TextInput)`), so those two alias their public @Output() binding name back to
240
+ // `focus`/`blur` while the class member itself is named `focusEvent`/`blurEvent` — the same
241
+ // `@Output(bindingName) memberName` alias this file already uses for `@Input('aria-label')`.
242
+ // `value`/`valueChange` names match Switch/Slider exactly, so `[(value)]="text"` (banana-in-a-box)
243
+ // works here too — see `valueChange`'s single-arg (text-only) signature above.
244
+ @Output() readonly valueChange = new EventEmitter<string>();
245
+ @Output() readonly change = new EventEmitter<ISymbioteEvent>();
246
+ @Output('focus') readonly focusEvent = new EventEmitter<ISymbioteEvent>();
247
+ @Output('blur') readonly blurEvent = new EventEmitter<ISymbioteEvent>();
248
+ @Output() readonly endEditing = new EventEmitter<ISymbioteEvent>();
249
+ @Output() readonly submitEditing = new EventEmitter<ISymbioteEvent>();
250
+ @Output() readonly keyPress = new EventEmitter<ISymbioteEvent>();
251
+ @Output() readonly selectionChange = new EventEmitter<ISymbioteEvent>();
252
+ @Output() readonly contentSizeChange = new EventEmitter<ISymbioteEvent>();
253
+ @Output() readonly accessibilityAction = new EventEmitter<ISymbioteEvent>();
254
+ @Output() readonly accessibilityTap = new EventEmitter<ISymbioteEvent>();
255
+ @Output() readonly magicTap = new EventEmitter<ISymbioteEvent>();
256
+ @Output() readonly accessibilityEscape = new EventEmitter<ISymbioteEvent>();
257
+
258
+ @Input() accessible?: boolean;
259
+ @Input() accessibilityLabel?: string;
260
+ @Input() accessibilityHint?: string;
261
+ @Input() accessibilityRole?: IAccessibilityProps['accessibilityRole'];
262
+ @Input() accessibilityState?: IAccessibilityStateValue;
263
+ @Input() accessibilityValue?: IAccessibilityProps['accessibilityValue'];
264
+ @Input() accessibilityActions?: IAccessibilityProps['accessibilityActions'];
265
+ @Input() accessibilityLabelledBy?: string | string[];
266
+ @Input() importantForAccessibility?: IAccessibilityProps['importantForAccessibility'];
267
+ @Input() accessibilityLiveRegion?: IAccessibilityProps['accessibilityLiveRegion'];
268
+ @Input() screenReaderFocusable?: boolean;
269
+ @Input() accessibilityViewIsModal?: boolean;
270
+ @Input() accessibilityElementsHidden?: boolean;
271
+ @Input() accessibilityIgnoresInvertColors?: boolean;
272
+ @Input() accessibilityLanguage?: string;
273
+ @Input() accessibilityRespondsToUserInteraction?: boolean;
274
+ @Input() accessibilityShowsLargeContentViewer?: boolean;
275
+ @Input() accessibilityLargeContentTitle?: string;
276
+ @Input() role?: IAriaProps['role'];
277
+ @Input('aria-label') ariaLabel?: string;
278
+ @Input('aria-labelledby') ariaLabelledBy?: string;
279
+ @Input('aria-live') ariaLive?: IAriaProps['aria-live'];
280
+ @Input('aria-hidden') ariaHidden?: boolean;
281
+ @Input('aria-busy') ariaBusy?: boolean;
282
+ @Input('aria-checked') ariaChecked?: boolean | 'mixed';
283
+ @Input('aria-disabled') ariaDisabled?: boolean;
284
+ @Input('aria-expanded') ariaExpanded?: boolean;
285
+ @Input('aria-selected') ariaSelected?: boolean;
286
+
287
+ @ViewChild('host', { read: SymbioteHostPropsDirective })
288
+ private hostRef?: SymbioteHostPropsDirective;
289
+
290
+ // This component's OWN host — the non-painting anchor `class="..."` at the use site resolves
291
+ // onto (see anchorHostStyle's doc comment) — NOT `hostRef` above, which targets the real inner
292
+ // symbiote-text-input(-multiline) one level down.
293
+ private readonly elementRef = inject(ElementRef);
294
+
295
+ // The count native last acknowledged; the controlled write / clear / setSelection echo it so
296
+ // native's eventLag lands on 0 and the write applies. A plain field (read live by the imperative
297
+ // handle), the Angular twin of React's useState / Vue's ref.
298
+ private mostRecentEventCount = INITIAL_EVENT_COUNT;
299
+ // The last text native holds, as far as JS knows. Seeded on the first `value` change (the `text`
300
+ // prop already carries the mount value down via createNode, so the FIRST controlled value is not
301
+ // a divergence and must NOT re-command); later divergences flow through setTextAndSelection.
302
+ private lastNativeText: string | undefined;
303
+ // JS-side focus state, mirrored from the focus/blur events for isFocused(): native exposes no
304
+ // synchronous focus getter (RN's TextInputState holds the same).
305
+ private focused = false;
306
+ private cancelAutoFocus?: () => void;
307
+
308
+ get isMultiline(): boolean {
309
+ return this.multiline === true;
310
+ }
311
+
312
+ get hostProps(): Record<string, unknown> {
313
+ return renderTextInput({
314
+ multiline: this.isMultiline,
315
+ text: foldText(this.value, this.defaultValue),
316
+ mostRecentEventCount: this.mostRecentEventCount,
317
+ selection: this.selection,
318
+ folded: this.foldedNativeProps,
319
+ passthrough: this.buildPassthrough(),
320
+ }).props;
321
+ }
322
+
323
+ ngOnChanges(changes: SimpleChanges): void {
324
+ const valueChange = changes['value'];
325
+ if (valueChange === undefined) return;
326
+ // The first value is the seed, not a divergence: record it and do not command.
327
+ if (valueChange.firstChange) {
328
+ this.lastNativeText = foldText(this.value, this.defaultValue);
329
+ return;
330
+ }
331
+ this.commitControlledValue();
332
+ }
333
+
334
+ // autoFocus is driven in JS, not as a native prop: once the node is committed, command `focus`
335
+ // down once (RN does the same via TextInputState.focusInput). Under Angular's async-batched
336
+ // commit the node has no Fabric tag at ngAfterViewInit, so whenCommitted defers the command to
337
+ // the commit that assigns the tag; cancelled on destroy so an un-committed pending focus leaks.
338
+ ngAfterViewInit(): void {
339
+ if (this.autoFocus !== true) return;
340
+ const node = this.hostNode;
341
+ if (node === undefined) return;
342
+ dlog('TextInput autoFocus -> focus command');
343
+ this.cancelAutoFocus = whenCommitted(node, () => dispatchViewCommand(node, 'focus', []));
344
+ }
345
+
346
+ ngOnDestroy(): void {
347
+ this.cancelAutoFocus?.();
348
+ }
349
+
350
+ handleChange(event: unknown): void {
351
+ if (!isSymbioteEvent(event)) return;
352
+ // Event seam: the controlled handshake hinges on the change payload carrying `text`
353
+ // (+ `eventCount`). iOS and Android Fabric can key these differently, so log the actual shape.
354
+ dlog(
355
+ `TextInput change keys=[${Object.keys(event.nativeEvent).join(',')}] ` +
356
+ `text=${JSON.stringify(event.nativeEvent.text)} count=${JSON.stringify(event.nativeEvent.eventCount)}`,
357
+ );
358
+ const text = textFromChange(event);
359
+ if (text !== undefined) {
360
+ // Record the text first, then the count, so the count never runs ahead of the text it
361
+ // stands for. The host re-pushes the count on the parent's value-driven CD, never here:
362
+ // pushing the stale `text` prop now (eventLag 0) would revert the keystroke.
363
+ this.lastNativeText = text;
364
+ this.valueChange.emit(text);
365
+ }
366
+ const count = eventCountFromChange(event);
367
+ if (count !== undefined) this.mostRecentEventCount = count;
368
+ this.change.emit(event);
369
+ }
370
+
371
+ handleFocus(event: unknown): void {
372
+ if (!isSymbioteEvent(event)) return;
373
+ this.focused = true;
374
+ // Track focus app-wide so Keyboard.dismiss can blur this input without a ref.
375
+ const node = this.hostNode;
376
+ if (node !== undefined) setInputFocused(node);
377
+ this.focusEvent.emit(event);
378
+ }
379
+
380
+ handleBlur(event: unknown): void {
381
+ if (!isSymbioteEvent(event)) return;
382
+ this.focused = false;
383
+ const node = this.hostNode;
384
+ if (node !== undefined) setInputBlurred(node);
385
+ this.blurEvent.emit(event);
386
+ }
387
+
388
+ // Forward an engine event onto the matching @Output(), narrowing the template's untyped $event
389
+ // first. Angular blocks [onX] property bindings, so every native event flows through (event).
390
+ emit(emitter: EventEmitter<ISymbioteEvent>, event: unknown): void {
391
+ if (isSymbioteEvent(event)) emitter.emit(event);
392
+ }
393
+
394
+ // The imperative API RN exposes on a TextInput ref; in Angular the component instance IS the
395
+ // handle (a parent reads it via @ViewChild(TextInput) and calls these). focus/blur drive native
396
+ // view commands; clear and setSelection reuse setTextAndSelection (the same stale-safe path as a
397
+ // controlled write) echoing the acknowledged event count.
398
+ focus(): void {
399
+ const node = this.hostNode;
400
+ if (node !== undefined) dispatchViewCommand(node, 'focus', []);
401
+ }
402
+
403
+ blur(): void {
404
+ // Routes through TextInputState so the app-wide focus tracking clears too.
405
+ blurTextInput(this.hostNode ?? null);
406
+ }
407
+
408
+ clear(): void {
409
+ const node = this.hostNode;
410
+ if (node === undefined) return;
411
+ dispatchViewCommand(node, 'setTextAndSelection', [this.mostRecentEventCount, '', 0, 0]);
412
+ this.lastNativeText = '';
413
+ }
414
+
415
+ isFocused(): boolean {
416
+ return this.focused;
417
+ }
418
+
419
+ setSelection(start: number, end: number): void {
420
+ const node = this.hostNode;
421
+ if (node === undefined) return;
422
+ const current = this.lastNativeText ?? '';
423
+ dispatchViewCommand(node, 'setTextAndSelection', [
424
+ this.mostRecentEventCount,
425
+ current,
426
+ start,
427
+ end,
428
+ ]);
429
+ }
430
+
431
+ // Controlled write: when JS-side `value` diverges from what native reported, command the new
432
+ // text down with the acknowledged count; a plain prop re-push would race the user's keystrokes.
433
+ // whenCommitted defers it past the async commit so the node's Fabric tag exists; the predicate
434
+ // narrows `value` to string and makes the call a no-op unless the text diverged.
435
+ private commitControlledValue(): void {
436
+ const node = this.hostNode;
437
+ if (node === undefined) return;
438
+ const value = this.value;
439
+ if (!shouldCommandText(this.lastNativeText, value)) return;
440
+ const selStart = this.selection?.start ?? SELECTION_NONE;
441
+ const selEnd = this.selection?.end ?? this.selection?.start ?? SELECTION_NONE;
442
+ const count = this.mostRecentEventCount;
443
+ dlog(`TextInput setTextAndSelection count=${count} text=${JSON.stringify(value)}`);
444
+ this.lastNativeText = value;
445
+ whenCommitted(node, () =>
446
+ dispatchViewCommand(node, 'setTextAndSelection', [count, value, selStart, selEnd]),
447
+ );
448
+ }
449
+
450
+ private buildPassthrough(): Record<string, unknown> {
451
+ return {
452
+ ...this.foldedAccessibility,
453
+ accessible: this.accessible,
454
+ testID: this.testID,
455
+ nativeID: this.nativeID,
456
+ placeholder: this.placeholder,
457
+ placeholderTextColor: this.placeholderTextColor,
458
+ maxLength: this.maxLength,
459
+ secureTextEntry: this.secureTextEntry,
460
+ autoCapitalize: this.autoCapitalize,
461
+ autoCorrect: this.autoCorrect,
462
+ selectTextOnFocus: this.selectTextOnFocus,
463
+ scrollEnabled: this.scrollEnabled,
464
+ numberOfLines: this.numberOfLines,
465
+ textAlign: this.textAlign,
466
+ inputAccessoryViewID: this.inputAccessoryViewID,
467
+ style: [anchorHostStyle(this.elementRef), this.style],
468
+ };
469
+ }
470
+
471
+ private get foldedNativeProps(): IFoldedTextInputProps {
472
+ return resolveTextInputProps({
473
+ inputMode: this.inputMode,
474
+ keyboardType: this.keyboardType,
475
+ enterKeyHint: this.enterKeyHint,
476
+ returnKeyType: this.returnKeyType,
477
+ readOnly: this.readOnly,
478
+ editable: this.editable,
479
+ submitBehavior: this.submitBehavior,
480
+ blurOnSubmit: this.blurOnSubmit,
481
+ multiline: this.isMultiline,
482
+ cursorColor: this.cursorColor,
483
+ selectionColor: this.selectionColor,
484
+ selectionHandleColor: this.selectionHandleColor,
485
+ autoComplete: this.autoComplete,
486
+ textContentType: this.textContentType,
487
+ showSoftInputOnFocus: this.showSoftInputOnFocus,
488
+ underlineColorAndroid: this.underlineColorAndroid,
489
+ });
490
+ }
491
+
492
+ // Fold the web aria-*/role aliases into the canonical accessibility* props once per render, so
493
+ // the host node never sees an aria-* key (native ignores them) — the shared transform every
494
+ // adapter runs. TextInput is its own host element (not a View wrapper), so it folds a11y here.
495
+ private get foldedAccessibility(): Partial<IAngularTextInputProps> {
496
+ return resolveAccessibilityProps({
497
+ accessibilityLabel: this.accessibilityLabel,
498
+ accessibilityHint: this.accessibilityHint,
499
+ accessibilityRole: this.accessibilityRole,
500
+ accessibilityState: this.accessibilityState,
501
+ accessibilityValue: this.accessibilityValue,
502
+ accessibilityActions: this.accessibilityActions,
503
+ accessibilityLabelledBy: this.accessibilityLabelledBy,
504
+ importantForAccessibility: this.importantForAccessibility,
505
+ accessibilityLiveRegion: this.accessibilityLiveRegion,
506
+ screenReaderFocusable: this.screenReaderFocusable,
507
+ accessibilityViewIsModal: this.accessibilityViewIsModal,
508
+ accessibilityElementsHidden: this.accessibilityElementsHidden,
509
+ accessibilityIgnoresInvertColors: this.accessibilityIgnoresInvertColors,
510
+ accessibilityLanguage: this.accessibilityLanguage,
511
+ accessibilityRespondsToUserInteraction: this.accessibilityRespondsToUserInteraction,
512
+ accessibilityShowsLargeContentViewer: this.accessibilityShowsLargeContentViewer,
513
+ accessibilityLargeContentTitle: this.accessibilityLargeContentTitle,
514
+ role: this.role,
515
+ 'aria-label': this.ariaLabel,
516
+ 'aria-labelledby': this.ariaLabelledBy,
517
+ 'aria-live': this.ariaLive,
518
+ 'aria-hidden': this.ariaHidden,
519
+ 'aria-busy': this.ariaBusy,
520
+ 'aria-checked': this.ariaChecked,
521
+ 'aria-disabled': this.ariaDisabled,
522
+ 'aria-expanded': this.ariaExpanded,
523
+ 'aria-selected': this.ariaSelected,
524
+ });
525
+ }
526
+
527
+ private get hostNode(): ISymbioteNode | undefined {
528
+ const native = this.hostRef?.node;
529
+ return isSymbioteNode(native) ? native : undefined;
530
+ }
531
+ }