@octane-xplat/ui 0.7.3 → 0.9.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 (195) hide show
  1. package/README.md +4 -3
  2. package/dist/native/Button.tsrx.js +1 -1
  3. package/dist/native/KeyboardAvoiding.mobile.tsrx.js +2 -2
  4. package/dist/native/Markdown.tsrx.js +233 -0
  5. package/dist/native/Overlay.tsrx.js +15 -26
  6. package/dist/native/PinInput.tsrx.js +25 -7
  7. package/dist/native/Popover.tsrx.js +17 -18
  8. package/dist/native/Pressable.tsrx.js +4 -1
  9. package/dist/native/SearchInput.tsrx.js +6 -3
  10. package/dist/native/Sheet.tsrx.js +22 -37
  11. package/dist/native/TextArea.tsrx.js +6 -3
  12. package/dist/native/TextInput.tsrx.js +6 -3
  13. package/dist/native/VirtualList.tsrx.js +305 -121
  14. package/dist/native/index.shared.js +7 -5
  15. package/dist/native/keyboard-inset.mobile.js +5 -5
  16. package/dist/native/navigation-request.js +26 -0
  17. package/dist/native/octane-client-build.json +1 -1
  18. package/dist/native/overlay-lifetime.mobile.js +65 -0
  19. package/dist/native/pan.tsrx.js +16 -2
  20. package/dist/native/route-table.js +90 -10
  21. package/dist/native/route.js +26 -16
  22. package/dist/native/shared.js +7 -5
  23. package/dist/native/sheet-service.js +1 -1
  24. package/dist/native/svg.mobile.js +1 -1
  25. package/dist/native/text-focus.js +10 -0
  26. package/dist/native/text-write.js +18 -11
  27. package/dist/native/toast-anchor.tsrx.js +1 -1
  28. package/dist/native/ui.js +7 -6
  29. package/dist/native/vendor/ui-svg/index.android.js +2 -2
  30. package/dist/native/vendor/ui-svg/index.ios.js +2 -2
  31. package/dist/native/vendor/ui-svg/{index.common.js → src/index.common.js} +1 -1
  32. package/dist/native/virtual-list-cell-pool.js +63 -0
  33. package/dist/web/Button.web.tsrx.js +1 -1
  34. package/dist/web/KeyboardAvoiding.web.tsrx.js +78 -0
  35. package/dist/web/Markdown.tsrx.js +98 -0
  36. package/dist/web/Overlay.web.tsrx.js +81 -32
  37. package/dist/web/PinInput.web.tsrx.js +24 -10
  38. package/dist/web/Pressable.web.tsrx.js +169 -53
  39. package/dist/web/SearchInput.web.tsrx.js +2 -2
  40. package/dist/web/Sheet.web.tsrx.js +20 -7
  41. package/dist/web/TextArea.web.tsrx.js +22 -17
  42. package/dist/web/TextInput.web.tsrx.js +2 -2
  43. package/dist/web/VirtualList.web.tsrx.js +220 -109
  44. package/dist/web/WebView.web.tsrx.js +3 -3
  45. package/dist/web/{index.shared.js → index.shared.web.js} +7 -5
  46. package/dist/web/modal-focus.web.js +95 -0
  47. package/dist/web/navigation-request.js +26 -0
  48. package/dist/web/octane-client-build.json +1 -1
  49. package/dist/web/pan.web.tsrx.js +27 -10
  50. package/dist/web/route-table.js +90 -10
  51. package/dist/web/route.web.js +88 -22
  52. package/dist/web/sheet-service.web.js +8 -0
  53. package/dist/web/theme/colorScheme.web.js +31 -4
  54. package/dist/web/ui.js +8 -6
  55. package/dist/web/virtual-list-cell-pool.js +63 -0
  56. package/package.json +21 -19
  57. package/platforms/android/native-api-usage.json +7 -7
  58. package/src/CommandPalette.tsrx +1 -0
  59. package/src/Grid.tsrx +2 -0
  60. package/src/Icon.macos.tsrx +1 -0
  61. package/src/KeyboardAvoiding.macos.tsrx +7 -1
  62. package/src/KeyboardAvoiding.mobile.tsrx +2 -2
  63. package/src/KeyboardAvoiding.tsrx +15 -0
  64. package/src/KeyboardAvoiding.web.tsrx +15 -0
  65. package/src/Markdown.tsrx +121 -0
  66. package/src/Meter.tsrx +1 -0
  67. package/src/Overlay.tsrx +15 -30
  68. package/src/Overlay.web.tsrx +12 -3
  69. package/src/PinInput.macos.tsrx +20 -6
  70. package/src/PinInput.mobile.test.ts +107 -0
  71. package/src/PinInput.tsrx +20 -6
  72. package/src/PinInput.web.test.tsrx +42 -0
  73. package/src/PinInput.web.tsrx +20 -6
  74. package/src/Popover.tsrx +17 -17
  75. package/src/Pressable.tsrx +1 -1
  76. package/src/Pressable.web.test.tsrx +36 -0
  77. package/src/Pressable.web.tsrx +37 -6
  78. package/src/RouteHost.macos.tsrx +1 -0
  79. package/src/SearchInput.tsrx +4 -3
  80. package/src/SearchInput.web.tsrx +1 -1
  81. package/src/Sheet.tsrx +20 -41
  82. package/src/Sheet.web.tsrx +9 -1
  83. package/src/Text.tsrx +2 -0
  84. package/src/TextArea.tsrx +6 -5
  85. package/src/TextArea.web.test.tsrx +39 -0
  86. package/src/TextArea.web.tsrx +7 -5
  87. package/src/TextInput.tsrx +6 -6
  88. package/src/TextInput.web.tsrx +1 -1
  89. package/src/VirtualList.macos.tsrx +93 -6
  90. package/src/VirtualList.mobile.test.tsrx +232 -0
  91. package/src/VirtualList.tsrx +285 -81
  92. package/src/VirtualList.web.tsrx +131 -25
  93. package/src/WebView.tsrx +1 -0
  94. package/src/WebView.web.tsrx +3 -0
  95. package/src/android/BottomNavigationView.android.tsrx +1 -0
  96. package/src/android/MaterialDialog.android.tsrx +1 -0
  97. package/src/anim.macos.tsrx +1 -0
  98. package/src/apply-native-modifiers.native.ts +4 -1
  99. package/src/child-array.ts +12 -7
  100. package/src/colorScheme.macos.ts +1 -0
  101. package/src/controls.macos.tsrx +4 -1
  102. package/src/data-driver.mobile.test.ts +120 -0
  103. package/src/data-lifecycle.mobile.test.ts +251 -0
  104. package/src/escape-props.ts +2 -0
  105. package/src/grid-auto-placement.ts +54 -12
  106. package/src/grid-placement.ts +1 -1
  107. package/src/hosted-unsupported.macos.tsrx +1 -0
  108. package/src/index.macos.ts +23 -3
  109. package/src/index.mobile.ts +0 -1
  110. package/src/index.shared.ts +22 -1
  111. package/src/index.shared.web.ts +291 -0
  112. package/src/index.web.ts +1 -1
  113. package/src/input-readiness.web.test.tsrx +82 -0
  114. package/src/ios/UITabBar.ios.tsrx +1 -0
  115. package/src/keyboard-inset.mobile.test.ts +62 -0
  116. package/src/keyboard-inset.mobile.ts +63 -43
  117. package/src/layout-shells.macos.tsrx +1 -5
  118. package/src/macos-extras.macos.tsrx +2 -0
  119. package/src/modal-focus.web.test.tsrx +63 -0
  120. package/src/modal-focus.web.ts +162 -0
  121. package/src/navigation-request.ts +37 -0
  122. package/src/overlay-lifecycle.mobile.test.ts +316 -0
  123. package/src/overlay-lifetime.mobile.ts +107 -0
  124. package/src/pan.mobile.test.tsrx +116 -0
  125. package/src/pan.tsrx +20 -2
  126. package/src/pan.web.tsrx +35 -7
  127. package/src/platformProps.ts +1 -0
  128. package/src/popover.mobile.test.ts +9 -1
  129. package/src/pressable-accessibility.mobile.test.ts +30 -0
  130. package/src/props.ts +163 -3
  131. package/src/refresh.ts +6 -1
  132. package/src/refresh.web.test.ts +77 -77
  133. package/src/route-android.test.ts +162 -0
  134. package/src/route-history.web.test.ts +80 -0
  135. package/src/route-navigation.web.test.ts +173 -0
  136. package/src/route-table.test.ts +188 -9
  137. package/src/route-table.ts +138 -10
  138. package/src/route.macos.ts +56 -13
  139. package/src/route.ts +54 -24
  140. package/src/route.web.ts +141 -24
  141. package/src/sheet-detents.ts +5 -3
  142. package/src/sheet-service.macos.ts +5 -1
  143. package/src/sheet-service.web.ts +8 -0
  144. package/src/sheet-snap.test.ts +23 -23
  145. package/src/sheet-snap.ts +6 -1
  146. package/src/svg.mobile.ts +9 -3
  147. package/src/tap-to-blur.ios.ts +48 -32
  148. package/src/tap-to-blur.mobile.ts +23 -15
  149. package/src/text-focus.ts +12 -0
  150. package/src/text-input.mobile.test.ts +89 -0
  151. package/src/text-write.ts +21 -11
  152. package/src/theme/colorScheme.linux.ts +2 -4
  153. package/src/theme/colorScheme.web.ts +51 -4
  154. package/src/theme/theme-scheme.macos.ts +8 -2
  155. package/src/theme/tokens.css +1736 -1730
  156. package/src/translate.macos.ts +4 -1
  157. package/src/virtual-list-cell-pool.test.ts +53 -0
  158. package/src/virtual-list-cell-pool.ts +81 -0
  159. package/src/virtual-list-layout.test.ts +11 -8
  160. package/src/virtual-list-layout.ts +4 -8
  161. package/src/windows.linux.ts +7 -2
  162. package/src/windows.macos.ts +1 -0
  163. package/types/generated/.tsrx-typegen-manifest.json +13 -3
  164. package/types/generated/KeyboardAvoiding.d.ts +3 -0
  165. package/types/generated/KeyboardAvoiding.web.d.ts +2 -0
  166. package/types/generated/Markdown.d.ts +59 -0
  167. package/types/generated/TextArea.d.ts +2 -2
  168. package/types/generated/TextArea.web.d.ts +1 -1
  169. package/types/generated/TextInput.d.ts +2 -3
  170. package/types/generated/VirtualList.d.ts +3 -3
  171. package/types/generated/index.mobile.d.ts +0 -1
  172. package/types/generated/index.shared.d.ts +6 -3
  173. package/types/generated/index.shared.web.d.ts +114 -0
  174. package/types/generated/index.web.d.ts +1 -1
  175. package/types/generated/modal-focus.web.d.ts +3 -0
  176. package/types/generated/navigation-request.d.ts +10 -0
  177. package/types/generated/overlay-lifetime.mobile.d.ts +10 -0
  178. package/types/generated/props.d.ts +111 -3
  179. package/types/generated/route-table.d.ts +14 -3
  180. package/types/generated/svg.mobile.d.ts +2 -2
  181. package/types/generated/text-focus.d.ts +3 -0
  182. package/types/generated/text-write.d.ts +3 -1
  183. package/types/generated/theme/colorScheme.web.d.ts +5 -0
  184. package/types/generated/virtual-list-cell-pool.d.ts +18 -0
  185. package/types/index.macos.d.ts +15 -3
  186. /package/src/vendor/ui-svg/{index.android.ts → src/index.android.ts} +0 -0
  187. /package/src/vendor/ui-svg/{index.common.ts → src/index.common.ts} +0 -0
  188. /package/src/vendor/ui-svg/{index.ios.ts → src/index.ios.ts} +0 -0
  189. /package/src/vendor/ui-svg/{index.ts → src/index.ts} +0 -0
  190. /package/src/vendor/ui-svg/{typings → src/typings}/SVGKit.d.ts +0 -0
  191. /package/src/vendor/ui-svg/{typings → src/typings}/android.d.ts +0 -0
  192. /package/src/vendor/ui-svg/{typings → src/typings}/ios.d.ts +0 -0
  193. /package/types/generated/vendor/ui-svg/{index.common.d.ts → src/index.common.d.ts} +0 -0
  194. /package/types/generated/vendor/ui-svg/{index.d.ts → src/index.d.ts} +0 -0
  195. /package/types/generated/vendor/ui-svg/{index.ios.d.ts → src/index.ios.d.ts} +0 -0
package/README.md CHANGED
@@ -7,10 +7,11 @@
7
7
  > the NativeScript toolchain (Xcode/JDK + `ns`).
8
8
 
9
9
  Start with the [app creator](../create/README.md) when building a new app with
10
- an agent. xplat's five-target direction covers web, iOS, Android, macOS, and
11
- Windows; this package's established implementations cover web and mobile,
10
+ an agent. Xplat's target direction covers web, iOS, Android, macOS, Windows,
11
+ and Linux; this package's established implementations cover web and mobile,
12
12
  with a bounded experimental macOS surface. The Windows scaffold has not yet
13
- been run on Windows, so UI support there remains unverified. See [target support](https://octane-xplat.goddardai.org/spec#choose-your-targets).
13
+ been run on Windows, so UI support there remains unverified; Linux renders
14
+ the DOM surface inside an experimental WebKitGTK host. See [target support](https://octane-xplat.goddardai.org/spec#choose-your-targets).
14
15
 
15
16
  To add the UI package to an existing configured app:
16
17
 
@@ -1,6 +1,6 @@
1
1
  import { cx } from "./cx.js";
2
- import { Pressable } from "./Pressable.tsrx.js";
3
2
  import { ActivityIndicator } from "./ActivityIndicator.tsrx.js";
3
+ import { Pressable } from "./Pressable.tsrx.js";
4
4
  import { defineUniversalComponent, markWarm, universalComponent, universalPlan, universalProps, universalValue, useBatch, warmChild } from "@nativescript-community/octane";
5
5
  //#region src/Button.tsrx
6
6
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
@@ -46,10 +46,10 @@ function useKeyboardInset() {
46
46
  }
47
47
  function useAndroidResize() {
48
48
  useEffect(() => {
49
- const nativeWindow = Application.android?.foregroundActivity?.window;
49
+ const nativeWindow = Application.android?.foregroundActivity?.getWindow();
50
50
  if (!nativeWindow) return;
51
51
  const params = android.view.WindowManager.LayoutParams;
52
- const previous = nativeWindow.attributes.softInputMode;
52
+ const previous = nativeWindow.getAttributes().softInputMode;
53
53
  const adjusted = previous & ~params.SOFT_INPUT_MASK_ADJUST | params.SOFT_INPUT_ADJUST_RESIZE;
54
54
  nativeWindow.setSoftInputMode(adjusted);
55
55
  return () => nativeWindow.setSoftInputMode(previous);
@@ -0,0 +1,233 @@
1
+ import { View } from "./View.tsrx.js";
2
+ import { Text } from "./Text.tsrx.js";
3
+ import { Screen } from "./Screen.tsrx.js";
4
+ import { ScrollView } from "./ScrollView.tsrx.js";
5
+ import { defineUniversalComponent, universalChildren, universalComponent, universalPlan, universalProps, universalValue } from "@nativescript-community/octane";
6
+ //#region src/Markdown.tsrx
7
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
8
+ "kind": "slot",
9
+ "slot": 0
10
+ });
11
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
12
+ "kind": "slot",
13
+ "slot": 0
14
+ });
15
+ var __octaneUniversalPlan2 = universalPlan("nativescript", {
16
+ "kind": "slot",
17
+ "slot": 0
18
+ });
19
+ var __octaneUniversalPlan3 = universalPlan("nativescript", {
20
+ "kind": "slot",
21
+ "slot": 0
22
+ });
23
+ var __octaneUniversalPlan4 = universalPlan("nativescript", {
24
+ "kind": "slot",
25
+ "slot": 0
26
+ });
27
+ var __octaneUniversalPlan5 = universalPlan("nativescript", {
28
+ "kind": "slot",
29
+ "slot": 0
30
+ });
31
+ var __octaneUniversalPlan6 = universalPlan("nativescript", {
32
+ "kind": "slot",
33
+ "slot": 0
34
+ });
35
+ var __octaneUniversalPlan7 = universalPlan("nativescript", {
36
+ "kind": "slot",
37
+ "slot": 0
38
+ });
39
+ var __octaneUniversalPlan8 = universalPlan("nativescript", {
40
+ "kind": "slot",
41
+ "slot": 0
42
+ });
43
+ var __octaneUniversalPlan9 = universalPlan("nativescript", {
44
+ "kind": "slot",
45
+ "slot": 0
46
+ });
47
+ var __octaneUniversalPlan10 = universalPlan("nativescript", {
48
+ "kind": "slot",
49
+ "slot": 0
50
+ });
51
+ var __octaneUniversalPlan11 = universalPlan("nativescript", {
52
+ "kind": "range",
53
+ "children": [{
54
+ "kind": "slot",
55
+ "slot": 0
56
+ }, {
57
+ "kind": "slot",
58
+ "slot": 1
59
+ }]
60
+ });
61
+ var __octaneUniversalPlan12 = universalPlan("nativescript", {
62
+ "kind": "slot",
63
+ "slot": 0
64
+ });
65
+ var __octaneUniversalPlan13 = universalPlan("nativescript", {
66
+ "kind": "slot",
67
+ "slot": 0
68
+ });
69
+ var __octaneUniversalPlan14 = universalPlan("nativescript", {
70
+ "kind": "slot",
71
+ "slot": 0
72
+ });
73
+ var __octaneUniversalPlan15 = universalPlan("nativescript", {
74
+ "kind": "slot",
75
+ "slot": 0
76
+ });
77
+ var __octaneUniversalPlan16 = universalPlan("nativescript", {
78
+ "kind": "slot",
79
+ "slot": 0
80
+ });
81
+ var __octaneUniversalPlan17 = universalPlan("nativescript", {
82
+ "kind": "slot",
83
+ "slot": 0
84
+ });
85
+ var __octaneUniversalPlan18 = universalPlan("nativescript", {
86
+ "kind": "slot",
87
+ "slot": 0
88
+ });
89
+ var __octaneUniversalPlan19 = universalPlan("nativescript", {
90
+ "kind": "slot",
91
+ "slot": 0
92
+ });
93
+ var headingClass = [
94
+ "text-2xl font-bold",
95
+ "text-xl font-semibold",
96
+ "text-lg font-semibold"
97
+ ];
98
+ var Inlines = defineUniversalComponent("nativescript", function Inlines(props) {
99
+ const out = [];
100
+ for (const n of props.nodes ?? []) switch (n.t) {
101
+ case "code":
102
+ out.push(universalValue(__octaneUniversalPlan0, [universalComponent("nativescript", Text, universalProps([[
103
+ "set",
104
+ "style",
105
+ { fontFamily: "ui-monospace" }
106
+ ]], n.text))]));
107
+ break;
108
+ case "bold":
109
+ out.push(universalValue(__octaneUniversalPlan2, [universalComponent("nativescript", Text, universalProps([[
110
+ "set",
111
+ "className",
112
+ "font-bold"
113
+ ]], universalChildren("nativescript", () => {
114
+ return universalValue(__octaneUniversalPlan1, [universalComponent("nativescript", Inlines, universalProps([[
115
+ "set",
116
+ "nodes",
117
+ n.children
118
+ ]]))]);
119
+ })))]));
120
+ break;
121
+ case "em":
122
+ out.push(universalValue(__octaneUniversalPlan4, [universalComponent("nativescript", Text, universalProps([[
123
+ "set",
124
+ "style",
125
+ { fontStyle: "italic" }
126
+ ]], universalChildren("nativescript", () => {
127
+ return universalValue(__octaneUniversalPlan3, [universalComponent("nativescript", Inlines, universalProps([[
128
+ "set",
129
+ "nodes",
130
+ n.children
131
+ ]]))]);
132
+ })))]));
133
+ break;
134
+ case "link":
135
+ out.push(universalValue(__octaneUniversalPlan5, [universalComponent("nativescript", Text, universalProps([[
136
+ "set",
137
+ "style",
138
+ { textDecorationLine: "underline" }
139
+ ]], n.text))]));
140
+ break;
141
+ default: out.push(n.text);
142
+ }
143
+ return out;
144
+ }, { "module": "@nativescript-community/octane" });
145
+ var Markdown = defineUniversalComponent("nativescript", function Markdown(props) {
146
+ return universalValue(__octaneUniversalPlan16, [universalComponent("nativescript", View, universalProps([[
147
+ "set",
148
+ "className",
149
+ "gap-3"
150
+ ]], (props.data?.children ?? []).map((node) => {
151
+ switch (node.t) {
152
+ case "h": return universalValue(__octaneUniversalPlan7, [universalComponent("nativescript", Text, universalProps([[
153
+ "set",
154
+ "className",
155
+ headingClass[node.depth - 1] ?? "font-semibold"
156
+ ]], universalChildren("nativescript", () => {
157
+ return universalValue(__octaneUniversalPlan6, [universalComponent("nativescript", Inlines, universalProps([[
158
+ "set",
159
+ "nodes",
160
+ node.children
161
+ ]]))]);
162
+ })))]);
163
+ case "p": return universalValue(__octaneUniversalPlan9, [universalComponent("nativescript", Text, universalProps([], universalChildren("nativescript", () => {
164
+ return universalValue(__octaneUniversalPlan8, [universalComponent("nativescript", Inlines, universalProps([[
165
+ "set",
166
+ "nodes",
167
+ node.children
168
+ ]]))]);
169
+ })))]);
170
+ case "code": return universalValue(__octaneUniversalPlan10, [universalComponent("nativescript", Text, universalProps([[
171
+ "set",
172
+ "className",
173
+ "text-sm"
174
+ ], [
175
+ "set",
176
+ "style",
177
+ { fontFamily: "ui-monospace" }
178
+ ]], node.text))]);
179
+ case "list": return node.items.map((item, i) => universalValue(__octaneUniversalPlan12, [universalComponent("nativescript", Text, universalProps([], universalChildren("nativescript", () => {
180
+ return universalValue(__octaneUniversalPlan11, [node.ordered ? `${i + 1}. ` : "• ", universalComponent("nativescript", Inlines, universalProps([[
181
+ "set",
182
+ "nodes",
183
+ item
184
+ ]]))]);
185
+ })))]));
186
+ case "quote": return universalValue(__octaneUniversalPlan14, [universalComponent("nativescript", Text, universalProps([[
187
+ "set",
188
+ "className",
189
+ "text-muted"
190
+ ], [
191
+ "set",
192
+ "style",
193
+ { fontStyle: "italic" }
194
+ ]], universalChildren("nativescript", () => {
195
+ return universalValue(__octaneUniversalPlan13, [universalComponent("nativescript", Inlines, universalProps([[
196
+ "set",
197
+ "nodes",
198
+ node.children
199
+ ]]))]);
200
+ })))]);
201
+ case "hr": return universalValue(__octaneUniversalPlan15, [universalComponent("nativescript", View, universalProps([[
202
+ "set",
203
+ "style",
204
+ {
205
+ height: 1,
206
+ backgroundColor: "var(--color-border)"
207
+ }
208
+ ]]))]);
209
+ default: return null;
210
+ }
211
+ })))]);
212
+ }, { "module": "@nativescript-community/octane" });
213
+ var MarkdownScreen = defineUniversalComponent("nativescript", function MarkdownScreen(props) {
214
+ return universalValue(__octaneUniversalPlan19, [universalComponent("nativescript", Screen, universalProps([[
215
+ "set",
216
+ "className",
217
+ "vx-app"
218
+ ]], universalChildren("nativescript", () => {
219
+ return universalValue(__octaneUniversalPlan18, [universalComponent("nativescript", ScrollView, universalProps([[
220
+ "set",
221
+ "style",
222
+ { padding: 16 }
223
+ ]], universalChildren("nativescript", () => {
224
+ return universalValue(__octaneUniversalPlan17, [universalComponent("nativescript", Markdown, universalProps([[
225
+ "set",
226
+ "data",
227
+ props.data
228
+ ]]))]);
229
+ })))]);
230
+ })))]);
231
+ }, { "module": "@nativescript-community/octane" });
232
+ //#endregion
233
+ export { Markdown, MarkdownScreen };
@@ -1,14 +1,16 @@
1
1
  import { cx } from "./cx.js";
2
- import { applyThemeClasses } from "./theme/theme-scheme.js";
3
2
  import { rootLayoutFor } from "./root-layout.mobile.js";
3
+ import { applyThemeClasses } from "./theme/theme-scheme.js";
4
+ import { createOverlayLifetime } from "./overlay-lifetime.mobile.js";
4
5
  import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
5
6
  import { GridLayout, isAndroid, isIOS } from "@nativescript/core";
6
7
  //#region src/Overlay.tsrx
7
- var _hs$ = /* @__PURE__ */ hookSlots(4);
8
+ var _hs$ = /* @__PURE__ */ hookSlots(5);
8
9
  var _h$0 = /* @__PURE__ */ Symbol(_hs$);
9
10
  var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
10
11
  var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
11
12
  var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
13
+ var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
12
14
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
13
15
  "kind": "range",
14
16
  "children": [{
@@ -33,19 +35,12 @@ var Overlay = defineUniversalComponent("nativescript", function Overlay(props) {
33
35
  useEffect(() => {
34
36
  const current = shown.current;
35
37
  if (!props.open) {
36
- if (!current) return;
37
- current.dismissOnClose = false;
38
- shown.current = null;
39
- const rl = rootLayout();
40
- if (rl && rl?.hasChild?.(current.host)) rl.close(current.host).then(() => current.root.unmount?.(), (error) => {
41
- console.error("[Overlay] close failed", error);
42
- current.root.unmount?.();
43
- });
44
- else current.root.unmount?.();
38
+ current?.lifetime.close();
45
39
  return;
46
40
  }
47
41
  if (current) {
48
42
  current.root.render(OverlayBody, { children: props.children });
43
+ current.unbindTheme?.();
49
44
  current.unbindTheme = applyThemeClasses(current.host, cx("vx-overlay-host", props.className));
50
45
  if (props.style) Object.assign(current.host.style, props.style);
51
46
  Object.assign(current.host, isIOS ? props.ios : isAndroid ? props.android : void 0);
@@ -60,31 +55,24 @@ var Overlay = defineUniversalComponent("nativescript", function Overlay(props) {
60
55
  if (props.style) Object.assign(host.style, props.style);
61
56
  Object.assign(host, isIOS ? props.ios : isAndroid ? props.android : void 0);
62
57
  const root = createNativeScriptRoot(host);
58
+ const lifetime = createOverlayLifetime(rl, host, root, "Overlay", (dismissed) => {
59
+ if (shown.current?.host === host) shown.current = null;
60
+ if (dismissed) dismiss.current?.();
61
+ });
63
62
  const opened = {
64
63
  host,
65
64
  root,
66
- dismissOnClose: true,
65
+ lifetime,
67
66
  unbindTheme
68
67
  };
68
+ lifetime.own(() => opened.unbindTheme?.());
69
69
  shown.current = opened;
70
70
  root.render(OverlayBody, { children: props.children });
71
- host.on("closed", () => {
72
- if (shown.current === opened) shown.current = null;
73
- opened.unbindTheme?.();
74
- root.unmount?.();
75
- if (opened.dismissOnClose) dismiss.current?.();
76
- });
77
- const open = () => rl.open(host, props.shadeCover ? { shadeCover: {
71
+ lifetime.open(props.shadeCover ? { shadeCover: {
78
72
  opacity: .45,
79
73
  color: "#000000",
80
74
  tapToClose: true
81
- } } : {}).catch((error) => {
82
- if (shown.current === opened) shown.current = null;
83
- console.error("[Overlay] open failed", error);
84
- root.unmount?.();
85
- });
86
- if (rl.hasChild?.(host)) rl.close(host).then(open, (error) => console.error("[Overlay] stale host close failed", error));
87
- else open();
75
+ } } : {});
88
76
  }, [
89
77
  props.open,
90
78
  props.children,
@@ -94,6 +82,7 @@ var Overlay = defineUniversalComponent("nativescript", function Overlay(props) {
94
82
  props.ios,
95
83
  props.android
96
84
  ], _h$3);
85
+ useEffect(() => () => shown.current?.lifetime.close(), [], _h$4);
97
86
  return universalValue(__octaneUniversalPlan1, [(v) => {
98
87
  hostView.current = v;
99
88
  }, {
@@ -1,9 +1,13 @@
1
1
  import { cx } from "./cx.js";
2
2
  import { applyEscapeProps } from "./escape-props.js";
3
3
  import { TextInput } from "./TextInput.tsrx.js";
4
- import { defineUniversalComponent, hookSlots, universalComponent, universalFor, universalPlan, universalProps, universalValue, useState } from "@nativescript-community/octane";
4
+ import { defineUniversalComponent, hookSlots, universalComponent, universalFor, universalPlan, universalProps, universalValue, useEffect, useRef, useState } from "@nativescript-community/octane";
5
5
  //#region src/PinInput.tsrx
6
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
6
+ var _hs$ = /* @__PURE__ */ hookSlots(4);
7
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
8
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
9
+ var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
10
+ var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
7
11
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
8
12
  "kind": "slot",
9
13
  "slot": 0
@@ -28,7 +32,15 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
28
32
  const [internal, setInternal] = useState("", _h$0);
29
33
  const controlled = props.value !== void 0;
30
34
  const value = controlled ? props.value : internal;
31
- const handles = [];
35
+ const handles = useRef([], _h$1);
36
+ const pendingFocus = useRef(null, _h$2);
37
+ useEffect(() => {
38
+ const next = pendingFocus.current;
39
+ if (next !== null && next <= value.length) {
40
+ pendingFocus.current = null;
41
+ handles.current[next]?.focus();
42
+ }
43
+ }, [value], _h$3);
32
44
  const setValue = (next) => {
33
45
  const clipped = next.slice(0, length);
34
46
  if (!controlled) setInternal(clipped);
@@ -37,10 +49,16 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
37
49
  };
38
50
  const cellValue = (i) => value[i] ?? "";
39
51
  const enter = (i, text) => {
52
+ if (props.disabled || i > value.length) return;
40
53
  const ch = text.slice(-1);
41
- const next = (value.slice(0, i) + ch + value.slice(i + 1)).slice(0, length);
54
+ const next = ch ? (value.slice(0, i) + ch + value.slice(i + 1)).slice(0, length) : value.slice(0, i);
55
+ pendingFocus.current = ch && i < length - 1 ? i + 1 : null;
42
56
  setValue(next);
43
- if (ch && i < length - 1) handles[i + 1]?.focus();
57
+ if (pendingFocus.current !== null && pendingFocus.current <= value.length) {
58
+ const index = pendingFocus.current;
59
+ pendingFocus.current = null;
60
+ handles.current[index]?.focus();
61
+ }
44
62
  };
45
63
  return universalValue(__octaneUniversalPlan1, [
46
64
  (v) => applyEscapeProps(v, props),
@@ -67,7 +85,7 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
67
85
  [
68
86
  "set",
69
87
  "editable",
70
- !props.disabled
88
+ !props.disabled && i <= value.length
71
89
  ],
72
90
  [
73
91
  "set",
@@ -83,7 +101,7 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
83
101
  "set",
84
102
  "bind",
85
103
  (h) => {
86
- handles[i] = h;
104
+ handles.current[i] = h;
87
105
  }
88
106
  ]
89
107
  ]))]);
@@ -1,12 +1,13 @@
1
1
  import { cx } from "./cx.js";
2
+ import { rootLayoutFor } from "./root-layout.mobile.js";
2
3
  import { applyNativeProps } from "./platformProps.js";
3
4
  import { positionPopover } from "./popover-position.js";
4
5
  import { applyThemeClasses, useThemeScheme } from "./theme/theme-scheme.js";
5
- import { rootLayoutFor } from "./root-layout.mobile.js";
6
+ import { createOverlayLifetime } from "./overlay-lifetime.mobile.js";
6
7
  import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef, useState, withSlot } from "@nativescript-community/octane";
7
8
  import { GridLayout, Screen, isIOS } from "@nativescript/core";
8
9
  //#region src/Popover.tsrx
9
- var _hs$ = /* @__PURE__ */ hookSlots(9);
10
+ var _hs$ = /* @__PURE__ */ hookSlots(11);
10
11
  var _h$0 = /* @__PURE__ */ Symbol(_hs$);
11
12
  var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
12
13
  var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
@@ -16,6 +17,8 @@ var _h$5 = /* @__PURE__ */ Symbol(_hs$ + 5);
16
17
  var _h$6 = /* @__PURE__ */ Symbol(_hs$ + 6);
17
18
  var _h$7 = /* @__PURE__ */ Symbol(_hs$ + 7);
18
19
  var _h$8 = /* @__PURE__ */ Symbol(_hs$ + 8);
20
+ var _h$9 = /* @__PURE__ */ Symbol(_hs$ + 9);
21
+ var _h$10 = /* @__PURE__ */ Symbol(_hs$ + 10);
19
22
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
20
23
  "kind": "host",
21
24
  "type": "gridlayout",
@@ -151,18 +154,12 @@ var PopoverLayer = defineUniversalComponent("nativescript", function PopoverLaye
151
154
  }, { "module": "@nativescript-community/octane" });
152
155
  var Popover = defineUniversalComponent("nativescript", function Popover(props) {
153
156
  const shown = useRef(null, _h$7);
157
+ const dismiss = useRef(props.onDismiss, _h$8);
158
+ dismiss.current = props.onDismiss;
154
159
  useEffect(() => {
155
160
  const cur = shown.current;
156
161
  if (!props.open) {
157
- if (!cur) return;
158
- shown.current = null;
159
- cur.unbindTheme?.();
160
- const owner = cur.host.parent;
161
- if (owner?.hasChild?.(cur.host)) owner.close(cur.host).then(() => cur.root.unmount?.(), (error) => {
162
- console.error("[Popover] close failed", error);
163
- cur.root.unmount?.();
164
- });
165
- else cur.root.unmount?.();
162
+ cur?.lifetime.close();
166
163
  return;
167
164
  }
168
165
  const anchor = props.anchor?.current;
@@ -180,20 +177,21 @@ var Popover = defineUniversalComponent("nativescript", function Popover(props) {
180
177
  host.horizontalAlignment = "stretch";
181
178
  host.verticalAlignment = "stretch";
182
179
  const root = createNativeScriptRoot(host);
180
+ const lifetime = createOverlayLifetime(rl, host, root, "Popover", (dismissed) => {
181
+ if (shown.current?.host === host) shown.current = null;
182
+ if (dismissed) dismiss.current?.();
183
+ });
184
+ lifetime.own(unbindTheme);
183
185
  shown.current = {
184
186
  host,
185
187
  root,
186
- unbindTheme
188
+ lifetime
187
189
  };
188
190
  root.render(PopoverLayer, {
189
191
  ...props,
190
192
  anchorView: anchor
191
193
  });
192
- rl.open(host).catch((error) => {
193
- if (shown.current?.host === host) shown.current = null;
194
- console.error("[Popover] open failed", error);
195
- root.unmount?.();
196
- });
194
+ lifetime.open();
197
195
  }, [
198
196
  props.open,
199
197
  props.children,
@@ -201,7 +199,8 @@ var Popover = defineUniversalComponent("nativescript", function Popover(props) {
201
199
  props.className,
202
200
  props.style,
203
201
  props.dismissOnOutsideTap
204
- ], _h$8);
202
+ ], _h$9);
203
+ useEffect(() => () => shown.current?.lifetime.close(), [], _h$10);
205
204
  return universalValue(__octaneUniversalPlan2, []);
206
205
  }, { "module": "@nativescript-community/octane" });
207
206
  //#endregion
@@ -76,7 +76,10 @@ var Pressable = defineUniversalComponent("nativescript", function Pressable(prop
76
76
  [
77
77
  "set",
78
78
  "accessibilityState",
79
- nativeAccessibilityState(props.accessibilityState)
79
+ nativeAccessibilityState({
80
+ ...props.accessibilityState,
81
+ disabled: props.disabled || props.accessibilityState?.disabled
82
+ })
80
83
  ],
81
84
  [
82
85
  "set",
@@ -1,7 +1,8 @@
1
1
  import { cx } from "./cx.js";
2
2
  import { applyEscapeProps } from "./escape-props.js";
3
3
  import { Icon } from "./Icon.tsrx.js";
4
- import { writeText } from "./text-write.js";
4
+ import { isWritingText, writeText } from "./text-write.js";
5
+ import { blurText } from "./text-focus.js";
5
6
  import { defineUniversalComponent, hookSlots, markWarm, universalComponent, universalPlan, universalProps, universalValue, useBatch, useEffect, useRef, useState, warmChild } from "@nativescript-community/octane";
6
7
  //#region src/SearchInput.tsrx
7
8
  var _hs$ = /* @__PURE__ */ hookSlots(3);
@@ -116,13 +117,15 @@ var SearchInput = defineUniversalComponent("nativescript", markWarm(function Sea
116
117
  if (!v) return;
117
118
  props.bind?.({
118
119
  focus: () => v.focus(),
119
- blur: () => v.dismissSoftInput?.() ?? v.blur(),
120
+ blur: () => blurText(v),
120
121
  native: v
121
122
  });
122
123
  },
123
124
  props.placeholder,
124
125
  props.editable ?? true,
125
- (e) => setValue(e.value),
126
+ (e) => {
127
+ if (!isWritingText(e.object)) setValue(e.value);
128
+ },
126
129
  props.onSubmit,
127
130
  props.onFocus,
128
131
  props.onBlur,
@@ -1,16 +1,19 @@
1
1
  import { cx } from "./cx.js";
2
- import { applyThemeClasses } from "./theme/theme-scheme.js";
3
2
  import { rootLayoutFor } from "./root-layout.mobile.js";
4
3
  import { attachTapToBlur } from "./tap-to-blur.ios.js";
4
+ import { applyThemeClasses } from "./theme/theme-scheme.js";
5
+ import { createOverlayLifetime } from "./overlay-lifetime.mobile.js";
5
6
  import { attachSheetDetents } from "./sheet-detents.js";
6
7
  import { bindBottomInsetToKeyboard } from "./keyboard-inset.mobile.js";
7
8
  import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
8
9
  import { GridLayout, isAndroid, isIOS } from "@nativescript/core";
9
10
  //#region src/Sheet.tsrx
10
- var _hs$ = /* @__PURE__ */ hookSlots(3);
11
+ var _hs$ = /* @__PURE__ */ hookSlots(5);
11
12
  var _h$0 = /* @__PURE__ */ Symbol(_hs$);
12
13
  var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
13
14
  var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
15
+ var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
16
+ var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
14
17
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
15
18
  "kind": "range",
16
19
  "children": [{
@@ -29,19 +32,12 @@ var SheetBody = defineUniversalComponent("nativescript", function SheetBody(prop
29
32
  var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
30
33
  const sentinel = useRef(null, _h$0);
31
34
  const shown = useRef(null, _h$1);
35
+ const dismiss = useRef(props.onDismiss, _h$2);
36
+ dismiss.current = props.onDismiss;
32
37
  useEffect(() => {
33
38
  const cur = shown.current;
34
39
  if (!props.open) {
35
- if (!cur) return;
36
- shown.current = null;
37
- cur.programmatic = true;
38
- cur.unbindTheme?.();
39
- cur.unbindKeyboard?.();
40
- cur.root.unmount?.();
41
- const owner = cur.host.parent;
42
- if (owner?.hasChild?.(cur.host)) owner.close(cur.host).catch((error) => {
43
- console.error("[Sheet] close failed", error);
44
- });
40
+ cur?.lifetime.close();
45
41
  return;
46
42
  }
47
43
  const rl = rootLayoutFor(sentinel.current);
@@ -57,32 +53,26 @@ var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
57
53
  if (props.style) Object.assign(host.style, props.style);
58
54
  Object.assign(host, isIOS ? props.ios : isAndroid ? props.android : void 0);
59
55
  const root = createNativeScriptRoot(host);
56
+ const lifetime = createOverlayLifetime(rl, host, root, "Sheet", (dismissed) => {
57
+ if (shown.current?.host === host) shown.current = null;
58
+ if (dismissed) dismiss.current?.();
59
+ });
60
+ lifetime.own(unbindTheme);
60
61
  const detents = props.detents?.length ? attachSheetDetents(host, props.detents, () => {
61
62
  host.parent?.close?.(host)?.catch?.((error) => {
62
63
  console.error("[Sheet] close failed", error);
63
64
  });
64
65
  }) : null;
65
- const unbindKeyboard = bindBottomInsetToKeyboard(host);
66
- attachTapToBlur(host);
67
- const opened = {
66
+ lifetime.own(bindBottomInsetToKeyboard(host));
67
+ lifetime.own(attachTapToBlur(host));
68
+ if (detents) lifetime.own(detents.detach);
69
+ shown.current = {
68
70
  host,
69
71
  root,
70
- unbindTheme,
71
- unbindKeyboard,
72
- programmatic: false,
73
- detach: detents?.detach
72
+ lifetime
74
73
  };
75
- shown.current = opened;
76
74
  root.render(SheetBody, { children: props.children });
77
- host.on("closed", () => {
78
- if (shown.current === opened) shown.current = null;
79
- opened.detach?.();
80
- opened.unbindKeyboard?.();
81
- opened.unbindTheme?.();
82
- opened.root.unmount?.();
83
- if (!opened.programmatic) props.onDismiss?.();
84
- });
85
- rl.open(host, {
75
+ lifetime.open({
86
76
  ...props.shadeCover ?? true ? { shadeCover: {
87
77
  opacity: .4,
88
78
  tapToClose: true
@@ -97,13 +87,7 @@ var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
97
87
  duration: 200
98
88
  }
99
89
  } }
100
- }).then(() => detents?.enter()).catch((error) => {
101
- if (shown.current === opened) shown.current = null;
102
- opened.unbindKeyboard?.();
103
- opened.unbindTheme?.();
104
- opened.root.unmount?.();
105
- console.error("[Sheet] open failed", error);
106
- });
90
+ }, () => detents?.enter());
107
91
  }, [
108
92
  props.open,
109
93
  props.children,
@@ -112,7 +96,8 @@ var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
112
96
  props.shadeCover,
113
97
  props.ios,
114
98
  props.android
115
- ], _h$2);
99
+ ], _h$3);
100
+ useEffect(() => () => shown.current?.lifetime.close(), [], _h$4);
116
101
  return universalValue(__octaneUniversalPlan1, [(v) => {
117
102
  sentinel.current = v;
118
103
  }, {