@octane-xplat/ui 0.3.0 → 0.4.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 (123) hide show
  1. package/README.md +46 -0
  2. package/dist/native/octane-client-build.json +1 -1
  3. package/dist/native/ui.js +52 -40
  4. package/dist/native/ui10.js +20 -11
  5. package/dist/native/ui11.js +42 -109
  6. package/dist/native/ui12.js +17 -84
  7. package/dist/native/ui13.js +11 -41
  8. package/dist/native/ui14.js +118 -76
  9. package/dist/native/ui15.js +43 -92
  10. package/dist/native/ui16.js +106 -45
  11. package/dist/native/ui17.js +29 -42
  12. package/dist/native/ui18.js +34 -53
  13. package/dist/native/ui19.js +246 -32
  14. package/dist/native/ui20.js +27 -16
  15. package/dist/native/ui21.js +376 -86
  16. package/dist/native/ui22.js +26 -114
  17. package/dist/native/ui23.js +49 -97
  18. package/dist/native/ui24.js +78 -53
  19. package/dist/native/ui25.js +138 -16
  20. package/dist/native/ui26.js +8 -23
  21. package/dist/native/ui27.js +60 -34
  22. package/dist/native/ui28.js +36 -142
  23. package/dist/native/ui29.js +101 -21
  24. package/dist/native/ui30.js +14 -31
  25. package/dist/native/ui31.js +55 -36
  26. package/dist/native/ui32.js +49 -61
  27. package/dist/native/ui33.js +36 -28
  28. package/dist/native/ui34.js +51 -8
  29. package/dist/native/ui35.js +98 -20
  30. package/dist/native/ui36.js +9 -33
  31. package/dist/native/ui37.js +42 -15
  32. package/dist/native/ui38.js +186 -57
  33. package/dist/native/ui39.js +96 -24
  34. package/dist/native/ui4.js +22 -20
  35. package/dist/native/ui40.js +57 -13
  36. package/dist/native/ui41.js +15 -100
  37. package/dist/native/ui42.js +6 -146
  38. package/dist/native/ui43.js +37 -21
  39. package/dist/native/ui44.js +265 -6
  40. package/dist/native/ui45.js +28 -0
  41. package/dist/native/ui46.js +35 -0
  42. package/dist/native/ui47.js +41 -0
  43. package/dist/native/ui48.js +72 -0
  44. package/dist/native/ui49.js +66 -0
  45. package/dist/native/ui5.js +37 -77
  46. package/dist/native/ui50.js +27 -0
  47. package/dist/native/ui51.js +13 -0
  48. package/dist/native/ui52.js +92 -0
  49. package/dist/native/ui53.js +34 -0
  50. package/dist/native/ui54.js +17 -0
  51. package/dist/native/ui55.js +156 -0
  52. package/dist/native/ui56.js +33 -0
  53. package/dist/native/ui57.js +14 -0
  54. package/dist/native/ui58.js +22 -0
  55. package/dist/native/ui59.js +8 -0
  56. package/dist/native/ui6.js +52 -9
  57. package/dist/native/ui60.js +108 -0
  58. package/dist/native/ui61.js +76 -0
  59. package/dist/native/ui7.js +42 -26
  60. package/dist/native/ui8.js +22 -12
  61. package/dist/native/ui9.js +18 -9
  62. package/dist/web/octane-client-build.json +1 -1
  63. package/dist/web/ui.js +51 -40
  64. package/dist/web/ui10.js +33 -186
  65. package/dist/web/ui11.js +28 -409
  66. package/dist/web/ui12.js +21 -68
  67. package/dist/web/ui13.js +201 -97
  68. package/dist/web/ui14.js +85 -95
  69. package/dist/web/ui15.js +368 -25
  70. package/dist/web/ui16.js +13 -101
  71. package/dist/web/ui17.js +246 -42
  72. package/dist/web/ui18.js +237 -28
  73. package/dist/web/ui19.js +36 -10
  74. package/dist/web/ui20.js +73 -102
  75. package/dist/web/ui21.js +102 -73
  76. package/dist/web/ui22.js +95 -55
  77. package/dist/web/ui23.js +94 -55
  78. package/dist/web/ui24.js +31 -15
  79. package/dist/web/ui25.js +105 -19
  80. package/dist/web/ui26.js +29 -23
  81. package/dist/web/ui27.js +12 -123
  82. package/dist/web/ui28.js +9 -110
  83. package/dist/web/ui29.js +52 -102
  84. package/dist/web/ui3.js +29 -18
  85. package/dist/web/ui30.js +32 -41
  86. package/dist/web/ui31.js +120 -39
  87. package/dist/web/ui32.js +41 -74
  88. package/dist/web/ui33.js +148 -32
  89. package/dist/web/ui34.js +54 -51
  90. package/dist/web/ui35.js +55 -7
  91. package/dist/web/ui36.js +18 -41
  92. package/dist/web/ui37.js +6 -46
  93. package/dist/web/ui38.js +37 -16
  94. package/dist/web/ui39.js +135 -81
  95. package/dist/web/ui4.js +46 -152
  96. package/dist/web/ui40.js +39 -37
  97. package/dist/web/ui41.js +41 -16
  98. package/dist/web/ui42.js +74 -7
  99. package/dist/web/ui43.js +40 -20
  100. package/dist/web/ui44.js +60 -6
  101. package/dist/web/ui45.js +9 -0
  102. package/dist/web/ui46.js +45 -0
  103. package/dist/web/ui47.js +13 -0
  104. package/dist/web/ui48.js +63 -0
  105. package/dist/web/ui49.js +47 -0
  106. package/dist/web/ui5.js +131 -27
  107. package/dist/web/ui50.js +17 -0
  108. package/dist/web/ui51.js +149 -0
  109. package/dist/web/ui52.js +42 -0
  110. package/dist/web/ui53.js +17 -0
  111. package/dist/web/ui54.js +9 -0
  112. package/dist/web/ui55.js +22 -0
  113. package/dist/web/ui56.js +8 -0
  114. package/dist/web/ui57.js +44 -0
  115. package/dist/web/ui58.js +46 -0
  116. package/dist/web/ui6.js +81 -45
  117. package/dist/web/ui7.js +43 -21
  118. package/dist/web/ui8.js +27 -21
  119. package/dist/web/ui9.js +29 -18
  120. package/package.json +13 -4
  121. package/src/theme/tokens.css +369 -138
  122. package/types/index.d.ts +102 -58
  123. package/types/props.d.ts +233 -13
@@ -1,8 +1,267 @@
1
- import { hookSlots, useSyncExternalStore } from "@nativescript-community/octane";
2
- //#region src/use-store.native.tsrx
3
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
4
- function useStore(store, select) {
5
- return useSyncExternalStore(store.subscribe, select === void 0 ? store.get : () => select(store.get()), _h$0);
1
+ import { cx } from "./ui2.js";
2
+ import { Text } from "./ui14.js";
3
+ import { Pressable } from "./ui16.js";
4
+ import { registerStack } from "./ui18.js";
5
+ import { RouteHost } from "./ui20.js";
6
+ import { layoutsForRoute, screenFor, useRoute } from "./ui21.js";
7
+ import { createNativeScriptRoot, defineUniversalComponent, hookSlots, memo, universalChildren, universalComponent, universalFor, universalIf, universalPlan, universalProps, universalValue, useState, withSlot } from "@nativescript-community/octane";
8
+ import { Application, Frame, GridLayout, Page, TabViewItem } from "@nativescript/core";
9
+ //#region src/Tabs.native.tsrx
10
+ var _hs$ = /* @__PURE__ */ hookSlots(2);
11
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
12
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
13
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
14
+ "kind": "range",
15
+ "children": [{
16
+ "kind": "slot",
17
+ "slot": 0
18
+ }]
19
+ });
20
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
21
+ "kind": "host",
22
+ "type": "tabview",
23
+ "bindings": [
24
+ ["id", 0],
25
+ ["className", 1],
26
+ ["style", 2],
27
+ ["items", 3],
28
+ ["selectedIndex", 4],
29
+ ["onSelectedIndexChanged", 5],
30
+ ["onLoaded", 6]
31
+ ]
32
+ });
33
+ var __octaneUniversalPlan2 = universalPlan("nativescript", {
34
+ "kind": "slot",
35
+ "slot": 0
36
+ });
37
+ var __octaneUniversalPlan3 = universalPlan("nativescript", {
38
+ "kind": "slot",
39
+ "slot": 0
40
+ });
41
+ var __octaneUniversalPlan4 = universalPlan("nativescript", {
42
+ "kind": "slot",
43
+ "slot": 0
44
+ });
45
+ var __octaneUniversalPlan5 = universalPlan("nativescript", {
46
+ "kind": "range",
47
+ "children": [{
48
+ "kind": "slot",
49
+ "slot": 0
50
+ }]
51
+ });
52
+ var __octaneUniversalPlan6 = universalPlan("nativescript", {
53
+ "kind": "host",
54
+ "type": "gridlayout",
55
+ "props": { "rows": "auto,*" },
56
+ "bindings": [
57
+ ["id", 0],
58
+ ["className", 1],
59
+ ["style", 2]
60
+ ],
61
+ "children": [{
62
+ "kind": "host",
63
+ "type": "gridlayout",
64
+ "props": {
65
+ "row": 0,
66
+ "className": "vx-tabbar"
67
+ },
68
+ "bindings": [["columns", 3]],
69
+ "children": [{
70
+ "kind": "slot",
71
+ "slot": 4
72
+ }]
73
+ }, {
74
+ "kind": "host",
75
+ "type": "gridlayout",
76
+ "props": { "row": 1 },
77
+ "bindings": [["className", 5]],
78
+ "children": [{
79
+ "kind": "slot",
80
+ "slot": 6
81
+ }]
82
+ }]
83
+ });
84
+ var __octaneUniversalPlan7 = universalPlan("nativescript", {
85
+ "kind": "slot",
86
+ "slot": 0
87
+ });
88
+ var __octaneUniversalPlan8 = universalPlan("nativescript", {
89
+ "kind": "slot",
90
+ "slot": 0
91
+ });
92
+ var __octaneUniversalPlan9 = universalPlan("nativescript", {
93
+ "kind": "slot",
94
+ "slot": 0
95
+ });
96
+ var TabPane = defineUniversalComponent("nativescript", function TabPane(props) {
97
+ return universalValue(__octaneUniversalPlan0, [props.render()]);
98
+ }, { "module": "@nativescript-community/octane" });
99
+ var paneRoots = /* @__PURE__ */ new WeakMap();
100
+ var tabsByView = /* @__PURE__ */ new WeakMap();
101
+ var itemsCache = /* @__PURE__ */ new WeakMap();
102
+ function itemsFor(tabs) {
103
+ let items = itemsCache.get(tabs);
104
+ if (items !== void 0) return items;
105
+ items = tabs.map((t) => {
106
+ const item = new TabViewItem();
107
+ item.title = t.title;
108
+ if (t.stack) {
109
+ const frame = new Frame();
110
+ frame.once("loaded", () => {
111
+ frame.navigate({ create: () => {
112
+ const page = new Page();
113
+ page.actionBarHidden = true;
114
+ const pane = new GridLayout();
115
+ page.content = pane;
116
+ createNativeScriptRoot(pane).render(TabPane, { render: t.render });
117
+ return page;
118
+ } });
119
+ });
120
+ registerStack(t.stack, frame);
121
+ item.view = frame;
122
+ return item;
123
+ }
124
+ const cv = new GridLayout();
125
+ tabsByView.set(cv, t.render);
126
+ item.view = cv;
127
+ return item;
128
+ });
129
+ itemsCache.set(tabs, items);
130
+ return items;
6
131
  }
132
+ function mountPanes(e) {
133
+ const tv = e.object;
134
+ for (const item of tv.items) {
135
+ const cv = item.view;
136
+ if (!(cv instanceof GridLayout) || paneRoots.has(cv)) continue;
137
+ const render = tabsByView.get(cv);
138
+ if (!render) continue;
139
+ const root = createNativeScriptRoot(cv);
140
+ paneRoots.set(cv, root);
141
+ root.render(TabPane, { render });
142
+ }
143
+ console.log("[probe] tabs mounted panes=" + tv.items.length);
144
+ }
145
+ var TabsInner = defineUniversalComponent("nativescript", function TabsInner(props) {
146
+ return universalValue(__octaneUniversalPlan1, [
147
+ props.id,
148
+ cx(props.className),
149
+ props.style,
150
+ itemsFor(props.tabs),
151
+ props.selectedIndex,
152
+ (e) => props.onSelectedIndexChanged?.(e.value),
153
+ mountPanes
154
+ ]);
155
+ }, { "module": "@nativescript-community/octane" });
156
+ var MemoTabs = memo(TabsInner, (a, b) => a.tabs === b.tabs && a.selectedIndex === b.selectedIndex);
157
+ function screenParams(route) {
158
+ const params = {
159
+ ...route.params,
160
+ ...route.context ?? {},
161
+ _stack: route.stack,
162
+ _pushed: true
163
+ };
164
+ if (Object.prototype.hasOwnProperty.call(route, "loaderData")) params.data = route.loaderData;
165
+ if (Object.prototype.hasOwnProperty.call(route, "loaderError")) params.error = route.loaderError;
166
+ return params;
167
+ }
168
+ var SwapTabs = defineUniversalComponent("nativescript", function SwapTabs(props) {
169
+ const [internal, setInternal] = useState(0, _h$0);
170
+ const active = props.selectedIndex ?? internal;
171
+ const tab = props.tabs[active];
172
+ const route = withSlot(_h$1, useRoute, tab?.stack ?? "");
173
+ const Screen = route ? screenFor(route.name) : void 0;
174
+ const columns = props.tabs.map(() => "*").join(",");
175
+ return universalValue(__octaneUniversalPlan6, [
176
+ props.id,
177
+ cx(props.className),
178
+ props.style,
179
+ columns,
180
+ universalFor(props.tabs, (t, i) => t.title, (t, i) => {
181
+ return universalValue(__octaneUniversalPlan3, [universalComponent("nativescript", Pressable, universalProps([
182
+ [
183
+ "set",
184
+ "col",
185
+ i
186
+ ],
187
+ [
188
+ "set",
189
+ "className",
190
+ cx("vx-tab", active === i ? "active" : "")
191
+ ],
192
+ [
193
+ "set",
194
+ "onPress",
195
+ () => {
196
+ setInternal(i);
197
+ props.onSelectedIndexChanged?.(i);
198
+ }
199
+ ]
200
+ ], universalChildren("nativescript", () => {
201
+ return universalValue(__octaneUniversalPlan2, [universalComponent("nativescript", Text, universalProps([], t.title))]);
202
+ })))]);
203
+ }),
204
+ cx("vx-tabpane", route?.presentation === "fade" ? "vx-route--fade" : ""),
205
+ universalIf(route && Screen, () => {
206
+ return universalValue(__octaneUniversalPlan4, [universalComponent("nativescript", RouteHost, universalProps([
207
+ [
208
+ "set",
209
+ "screen",
210
+ Screen
211
+ ],
212
+ [
213
+ "set",
214
+ "layouts",
215
+ layoutsForRoute(route.name)
216
+ ],
217
+ [
218
+ "set",
219
+ "params",
220
+ screenParams(route)
221
+ ]
222
+ ]))]);
223
+ }, () => {
224
+ return universalValue(__octaneUniversalPlan5, [tab?.render()]);
225
+ })
226
+ ]);
227
+ }, { "module": "@nativescript-community/octane" });
228
+ var Tabs = defineUniversalComponent("nativescript", function Tabs(props) {
229
+ return universalValue(__octaneUniversalPlan9, [universalIf(Application.android, () => {
230
+ return universalValue(__octaneUniversalPlan7, [universalComponent("nativescript", SwapTabs, universalProps([["spread", props]]))]);
231
+ }, () => {
232
+ return universalValue(__octaneUniversalPlan8, [universalComponent("nativescript", MemoTabs, universalProps([
233
+ [
234
+ "set",
235
+ "id",
236
+ props.id
237
+ ],
238
+ [
239
+ "set",
240
+ "className",
241
+ props.className
242
+ ],
243
+ [
244
+ "set",
245
+ "style",
246
+ props.style
247
+ ],
248
+ [
249
+ "set",
250
+ "tabs",
251
+ props.tabs
252
+ ],
253
+ [
254
+ "set",
255
+ "selectedIndex",
256
+ props.selectedIndex
257
+ ],
258
+ [
259
+ "set",
260
+ "onSelectedIndexChanged",
261
+ props.onSelectedIndexChanged
262
+ ]
263
+ ]))]);
264
+ })]);
265
+ }, { "module": "@nativescript-community/octane" });
7
266
  //#endregion
8
- export { useStore };
267
+ export { Tabs };
@@ -0,0 +1,28 @@
1
+ import { cx } from "./ui2.js";
2
+ import { applyEscapeProps } from "./ui3.js";
3
+ import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
4
+ //#region src/Switch.native.tsrx
5
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
6
+ "kind": "host",
7
+ "type": "switch",
8
+ "bindings": [
9
+ ["ref", 0],
10
+ ["id", 1],
11
+ ["className", 2],
12
+ ["style", 3],
13
+ ["checked", 4],
14
+ ["onCheckedChange", 5]
15
+ ]
16
+ });
17
+ var Switch = defineUniversalComponent("nativescript", function Switch(props) {
18
+ return universalValue(__octaneUniversalPlan0, [
19
+ (v) => applyEscapeProps(v, props),
20
+ props.id,
21
+ cx(props.className),
22
+ props.style,
23
+ props.checked,
24
+ (e) => props.onCheckedChange?.(e.value)
25
+ ]);
26
+ }, { "module": "@nativescript-community/octane" });
27
+ //#endregion
28
+ export { Switch };
@@ -0,0 +1,35 @@
1
+ import { hookSlots, useEffect, useState } from "@nativescript-community/octane";
2
+ import { Application } from "@nativescript/core";
3
+ //#region src/safeAreaInsets.native.tsrx
4
+ var _hs$ = /* @__PURE__ */ hookSlots(2);
5
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
6
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
7
+ function measure() {
8
+ const insets = (Application.ios?.rootController?.view)?.safeAreaInsets;
9
+ if (insets) return {
10
+ top: insets.top,
11
+ right: insets.right,
12
+ bottom: insets.bottom,
13
+ left: insets.left
14
+ };
15
+ return {
16
+ top: 0,
17
+ right: 0,
18
+ bottom: 0,
19
+ left: 0
20
+ };
21
+ }
22
+ function useSafeAreaInsets() {
23
+ const [insets, setInsets] = useState(measure, _h$0);
24
+ useEffect(() => {
25
+ const update = () => setInsets(measure());
26
+ Application.on(Application.orientationChangedEvent, update);
27
+ update();
28
+ return () => {
29
+ Application.off(Application.orientationChangedEvent, update);
30
+ };
31
+ }, [], _h$1);
32
+ return insets;
33
+ }
34
+ //#endregion
35
+ export { useSafeAreaInsets };
@@ -0,0 +1,41 @@
1
+ import { cx } from "./ui2.js";
2
+ import { useSafeAreaInsets } from "./ui46.js";
3
+ import { defineUniversalComponent, hookSlots, universalPlan, universalValue, withSlot } from "@nativescript-community/octane";
4
+ import { Application } from "@nativescript/core";
5
+ //#region src/SafeArea.native.tsrx
6
+ var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
7
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
8
+ "kind": "host",
9
+ "type": "flexboxlayout",
10
+ "bindings": [
11
+ ["id", 0],
12
+ ["ref", 1],
13
+ ["className", 2],
14
+ ["style", 3]
15
+ ],
16
+ "children": [{
17
+ "kind": "slot",
18
+ "slot": 4
19
+ }]
20
+ });
21
+ var SafeArea = defineUniversalComponent("nativescript", function SafeArea(props) {
22
+ const insets = withSlot(_h$0, useSafeAreaInsets);
23
+ const platformProps = Application.ios != null ? props.ios : props.android;
24
+ return universalValue(__octaneUniversalPlan0, [
25
+ props.id,
26
+ (host) => {
27
+ if (host && platformProps) Object.assign(host, platformProps);
28
+ },
29
+ cx("vx-safe-area", props.className),
30
+ {
31
+ ...props.style,
32
+ paddingTop: insets.top,
33
+ paddingRight: insets.right,
34
+ paddingBottom: insets.bottom,
35
+ paddingLeft: insets.left
36
+ },
37
+ props.children
38
+ ]);
39
+ }, { "module": "@nativescript-community/octane" });
40
+ //#endregion
41
+ export { SafeArea };
@@ -0,0 +1,72 @@
1
+ import { cx } from "./ui2.js";
2
+ import { defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useState, withSlot } from "@nativescript-community/octane";
3
+ import { Application } from "@nativescript/core";
4
+ //#region src/KeyboardAvoiding.native.tsrx
5
+ var _hs$ = /* @__PURE__ */ hookSlots(5);
6
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
7
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
8
+ var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
9
+ var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
10
+ var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
11
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
12
+ "kind": "host",
13
+ "type": "scrollview",
14
+ "bindings": [
15
+ ["id", 0],
16
+ ["className", 1],
17
+ ["style", 2],
18
+ ["ref", 3]
19
+ ],
20
+ "children": [{
21
+ "kind": "host",
22
+ "type": "flexboxlayout",
23
+ "props": { "flexDirection": "column" },
24
+ "bindings": [["style", 4]],
25
+ "children": [{
26
+ "kind": "slot",
27
+ "slot": 5
28
+ }]
29
+ }]
30
+ });
31
+ function useKeyboardInset() {
32
+ const [inset, setInset] = useState(0, _h$0);
33
+ useEffect(() => {
34
+ if (!Application.ios) return;
35
+ const center = NSNotificationCenter.defaultCenter;
36
+ const token = center.addObserverForNameObjectQueueUsingBlock(UIKeyboardWillChangeFrameNotification, null, NSOperationQueue.mainQueue, (note) => {
37
+ const frame = note.userInfo.objectForKey(UIKeyboardFrameEndUserInfoKey);
38
+ const screenHeight = UIScreen.mainScreen.bounds.size.height;
39
+ setInset(Math.max(0, screenHeight - frame.origin.y));
40
+ });
41
+ return () => center.removeObserver(token);
42
+ }, [], _h$1);
43
+ return inset;
44
+ }
45
+ function useAndroidResize() {
46
+ useEffect(() => {
47
+ const nativeWindow = Application.android?.foregroundActivity?.window;
48
+ if (!nativeWindow) return;
49
+ const params = android.view.WindowManager.LayoutParams;
50
+ const previous = nativeWindow.attributes.softInputMode;
51
+ const adjusted = previous & ~params.SOFT_INPUT_MASK_ADJUST | params.SOFT_INPUT_ADJUST_RESIZE;
52
+ nativeWindow.setSoftInputMode(adjusted);
53
+ return () => nativeWindow.setSoftInputMode(previous);
54
+ }, [], _h$2);
55
+ }
56
+ var KeyboardAvoiding = defineUniversalComponent("nativescript", function KeyboardAvoiding(props) {
57
+ const keyboardInset = withSlot(_h$3, useKeyboardInset);
58
+ withSlot(_h$4, useAndroidResize);
59
+ const platformProps = Application.ios != null ? props.ios : props.android;
60
+ return universalValue(__octaneUniversalPlan0, [
61
+ props.id,
62
+ cx("vx-keyboard-avoiding", props.className),
63
+ props.style,
64
+ (host) => {
65
+ if (host && platformProps) Object.assign(host, platformProps);
66
+ },
67
+ keyboardInset ? { paddingBottom: keyboardInset } : void 0,
68
+ props.children
69
+ ]);
70
+ }, { "module": "@nativescript-community/octane" });
71
+ //#endregion
72
+ export { KeyboardAvoiding };
@@ -0,0 +1,66 @@
1
+ import { cx } from "./ui2.js";
2
+ import { defineUniversalComponent, hookSlots, registerElement, universalIf, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
3
+ import { Application } from "@nativescript/core";
4
+ import { Drawer, install } from "@nativescript-community/ui-drawer";
5
+ //#region src/Drawer.native.tsrx
6
+ var _hs$ = /* @__PURE__ */ hookSlots(2);
7
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
8
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
9
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
10
+ "kind": "host",
11
+ "type": "gridlayout",
12
+ "props": { "hostSlot": "leftDrawer" },
13
+ "children": [{
14
+ "kind": "slot",
15
+ "slot": 0
16
+ }]
17
+ });
18
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
19
+ "kind": "host",
20
+ "type": "drawer",
21
+ "bindings": [
22
+ ["id", 0],
23
+ ["ref", 1],
24
+ ["className", 2],
25
+ ["style", 3]
26
+ ],
27
+ "children": [{
28
+ "kind": "host",
29
+ "type": "gridlayout",
30
+ "props": { "hostSlot": "mainContent" },
31
+ "children": [{
32
+ "kind": "slot",
33
+ "slot": 4
34
+ }]
35
+ }, {
36
+ "kind": "slot",
37
+ "slot": 5
38
+ }]
39
+ });
40
+ install();
41
+ registerElement("drawer", Drawer);
42
+ var Drawer$1 = defineUniversalComponent("nativescript", function Drawer(props) {
43
+ const host = useRef(null, _h$0);
44
+ const platformProps = Application.ios != null ? props.ios : props.android;
45
+ useEffect(() => {
46
+ const d = host.current;
47
+ if (!d) return;
48
+ if (props.open && !d.isOpened("left")) d.open("left").catch(() => {});
49
+ else if (!props.open && d.isOpened("left")) d.close("left").catch(() => {});
50
+ }, [props.open], _h$1);
51
+ return universalValue(__octaneUniversalPlan1, [
52
+ props.id,
53
+ (d) => {
54
+ host.current = d;
55
+ if (d && platformProps) Object.assign(d, platformProps);
56
+ },
57
+ cx("vx-drawer", props.className),
58
+ props.style,
59
+ props.main,
60
+ universalIf(props.drawer != null, () => {
61
+ return universalValue(__octaneUniversalPlan0, [props.drawer]);
62
+ })
63
+ ]);
64
+ }, { "module": "@nativescript-community/octane" });
65
+ //#endregion
66
+ export { Drawer$1 as Drawer };
@@ -1,78 +1,38 @@
1
- import { cx } from "./ui2.js";
2
- import { applyEscapeProps } from "./ui3.js";
3
- import { layoutChildProps } from "./ui4.js";
4
- import { defineUniversalComponent, hookSlots, universalPlan, universalProps, universalValue, useCallback } from "@nativescript-community/octane";
5
- //#region src/View.native.tsrx
6
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
7
- var __octaneUniversalPlan0 = universalPlan("nativescript", {
8
- "kind": "host",
9
- "type": "flexboxlayout",
10
- "propsSlot": 0,
11
- "children": [{
12
- "kind": "slot",
13
- "slot": 1
14
- }]
15
- });
16
- var PAN_STATE = [
17
- "cancelled",
18
- "began",
19
- "moved",
20
- "ended"
21
- ];
22
- var View = defineUniversalComponent("nativescript", function View(props) {
23
- const onPan = useCallback((e) => props.onPan?.({
24
- x: e.deltaX,
25
- y: e.deltaY,
26
- dx: e.deltaX,
27
- dy: e.deltaY,
28
- vx: 0,
29
- vy: 0,
30
- state: PAN_STATE[e.state] ?? "moved",
31
- target: e.view ?? e.object
32
- }), [props.onPan], _h$0);
33
- return universalValue(__octaneUniversalPlan0, [universalProps([
34
- [
35
- "set",
36
- "id",
37
- props.id
38
- ],
39
- ["spread", layoutChildProps(props)],
40
- [
41
- "set",
42
- "ref",
43
- (v) => {
44
- if (v) {
45
- applyEscapeProps(v, props);
46
- props.bind?.(v);
47
- }
48
- }
49
- ],
50
- [
51
- "set",
52
- "flexDirection",
53
- "column"
54
- ],
55
- [
56
- "set",
57
- "className",
58
- cx(props.className)
59
- ],
60
- [
61
- "set",
62
- "style",
63
- props.style
64
- ],
65
- [
66
- "set",
67
- "onPan",
68
- props.onPan ? onPan : void 0
69
- ],
70
- [
71
- "set",
72
- "onSwipe",
73
- props.onSwipe
74
- ]
75
- ]), props.children]);
76
- }, { "module": "@nativescript-community/octane" });
1
+ //#region src/layout-child.native.ts
2
+ var FLEX_JUSTIFY = {
3
+ start: "flex-start",
4
+ end: "flex-end"
5
+ };
6
+ var FLEX_ALIGN = {
7
+ start: "flex-start",
8
+ end: "flex-end"
9
+ };
10
+ /** NativeScript reads these attributes from each child view during parent
11
+ * layout. Values are forwarded with NativeScript's own property names.
12
+ * The flex-container props (justifyContent/alignItems/flexWrap/gap) land on
13
+ * the host flexboxlayout itself — its own attributes, not child metadata. */
14
+ function layoutChildProps(props) {
15
+ const result = {};
16
+ for (const key of [
17
+ "row",
18
+ "col",
19
+ "rowSpan",
20
+ "colSpan",
21
+ "dock",
22
+ "left",
23
+ "top",
24
+ "flexGrow",
25
+ "flexShrink",
26
+ "alignSelf",
27
+ "order"
28
+ ]) if (props[key] !== void 0) result[key] = props[key];
29
+ if (props.justifyContent !== void 0) result.justifyContent = FLEX_JUSTIFY[props.justifyContent] ?? props.justifyContent;
30
+ if (props.alignItems !== void 0) result.alignItems = FLEX_ALIGN[props.alignItems] ?? props.alignItems;
31
+ if (props.flexWrap !== void 0) result.flexWrap = props.flexWrap === true ? "wrap" : props.flexWrap === false ? "nowrap" : props.flexWrap;
32
+ if (props.gap !== void 0) result.gap = props.gap;
33
+ if (props.rowGap !== void 0) result.rowGap = props.rowGap;
34
+ if (props.columnGap !== void 0) result.columnGap = props.columnGap;
35
+ return result;
36
+ }
77
37
  //#endregion
78
- export { View };
38
+ export { layoutChildProps };
@@ -0,0 +1,27 @@
1
+ import { cx } from "./ui2.js";
2
+ import { applyNativeProps } from "./ui36.js";
3
+ import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
4
+ //#region src/ActivityIndicator.native.tsrx
5
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
6
+ "kind": "host",
7
+ "type": "activityindicator",
8
+ "bindings": [
9
+ ["id", 0],
10
+ ["className", 1],
11
+ ["style", 2],
12
+ ["busy", 3],
13
+ ["ref", 4]
14
+ ]
15
+ });
16
+ var ActivityIndicator = defineUniversalComponent("nativescript", function ActivityIndicator(props) {
17
+ if (props.busy === false) return null;
18
+ return universalValue(__octaneUniversalPlan0, [
19
+ props.id,
20
+ cx(props.className),
21
+ props.style,
22
+ props.busy ?? true,
23
+ (el) => applyNativeProps(el, props)
24
+ ]);
25
+ }, { "module": "@nativescript-community/octane" });
26
+ //#endregion
27
+ export { ActivityIndicator };
@@ -0,0 +1,13 @@
1
+ //#region src/meter-math.ts
2
+ /** Clamp a progress value to its declared range for drawing and accessibility. */
3
+ function meterRange(value, max) {
4
+ const safeMax = Number.isFinite(max) && max > 0 ? max : 100;
5
+ const safeValue = Number.isFinite(value) ? Math.min(safeMax, Math.max(0, value)) : 0;
6
+ return {
7
+ max: safeMax,
8
+ value: safeValue,
9
+ ratio: safeValue / safeMax
10
+ };
11
+ }
12
+ //#endregion
13
+ export { meterRange };