@octane-xplat/ui 0.4.0 → 0.5.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 (67) hide show
  1. package/dist/native/octane-client-build.json +1 -1
  2. package/dist/native/ui.js +26 -23
  3. package/dist/native/ui14.js +16 -1
  4. package/dist/native/ui16.js +2 -2
  5. package/dist/native/ui24.js +2 -1
  6. package/dist/native/ui3.js +22 -1
  7. package/dist/native/ui39.js +89 -91
  8. package/dist/native/ui40.js +180 -53
  9. package/dist/native/ui41.js +55 -16
  10. package/dist/native/ui42.js +15 -6
  11. package/dist/native/ui43.js +18 -37
  12. package/dist/native/ui44.js +6 -265
  13. package/dist/native/ui45.js +24 -14
  14. package/dist/native/ui46.js +261 -29
  15. package/dist/native/ui47.js +17 -30
  16. package/dist/native/ui48.js +28 -65
  17. package/dist/native/ui49.js +21 -46
  18. package/dist/native/ui50.js +58 -13
  19. package/dist/native/ui51.js +65 -12
  20. package/dist/native/ui52.js +58 -86
  21. package/dist/native/ui53.js +8 -15
  22. package/dist/native/ui54.js +11 -15
  23. package/dist/native/ui55.js +82 -146
  24. package/dist/native/ui56.js +18 -17
  25. package/dist/native/ui57.js +18 -13
  26. package/dist/native/ui58.js +155 -21
  27. package/dist/native/ui59.js +32 -7
  28. package/dist/native/ui6.js +54 -12
  29. package/dist/native/ui60.js +8 -102
  30. package/dist/native/ui61.js +20 -74
  31. package/dist/native/ui62.js +8 -0
  32. package/dist/native/ui63.js +108 -0
  33. package/dist/native/ui64.js +76 -0
  34. package/dist/web/octane-client-build.json +1 -1
  35. package/dist/web/ui.js +26 -24
  36. package/dist/web/ui13.js +106 -41
  37. package/dist/web/ui34.js +147 -67
  38. package/dist/web/ui35.js +136 -51
  39. package/dist/web/ui36.js +86 -18
  40. package/dist/web/ui37.js +20 -5
  41. package/dist/web/ui38.js +6 -37
  42. package/dist/web/ui39.js +26 -142
  43. package/dist/web/ui40.js +143 -32
  44. package/dist/web/ui41.js +42 -41
  45. package/dist/web/ui42.js +40 -74
  46. package/dist/web/ui43.js +47 -13
  47. package/dist/web/ui44.js +13 -33
  48. package/dist/web/ui45.js +60 -7
  49. package/dist/web/ui46.js +47 -42
  50. package/dist/web/ui47.js +7 -11
  51. package/dist/web/ui48.js +30 -48
  52. package/dist/web/ui49.js +12 -46
  53. package/dist/web/ui50.js +62 -16
  54. package/dist/web/ui51.js +33 -135
  55. package/dist/web/ui52.js +18 -41
  56. package/dist/web/ui53.js +266 -10
  57. package/dist/web/ui54.js +41 -8
  58. package/dist/web/ui55.js +16 -21
  59. package/dist/web/ui56.js +7 -6
  60. package/dist/web/ui57.js +20 -42
  61. package/dist/web/ui58.js +6 -44
  62. package/dist/web/ui59.js +44 -0
  63. package/dist/web/ui60.js +46 -0
  64. package/package.json +5 -1
  65. package/src/theme/tokens.css +255 -30
  66. package/types/index.d.ts +10 -0
  67. package/types/props.d.ts +59 -4
@@ -1,35 +1,267 @@
1
- import { hookSlots, useEffect, useState } from "@nativescript-community/octane";
2
- import { Application } from "@nativescript/core";
3
- //#region src/safeAreaInsets.native.tsrx
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
4
10
  var _hs$ = /* @__PURE__ */ hookSlots(2);
5
11
  var _h$0 = /* @__PURE__ */ Symbol(_hs$);
6
12
  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
- };
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;
21
131
  }
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;
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;
33
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" });
34
266
  //#endregion
35
- export { useSafeAreaInsets };
267
+ export { Tabs };
@@ -1,41 +1,28 @@
1
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));
2
+ import { applyEscapeProps } from "./ui3.js";
3
+ import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
4
+ //#region src/Switch.native.tsrx
7
5
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
8
6
  "kind": "host",
9
- "type": "flexboxlayout",
7
+ "type": "switch",
10
8
  "bindings": [
11
- ["id", 0],
12
- ["ref", 1],
9
+ ["ref", 0],
10
+ ["id", 1],
13
11
  ["className", 2],
14
- ["style", 3]
15
- ],
16
- "children": [{
17
- "kind": "slot",
18
- "slot": 4
19
- }]
12
+ ["style", 3],
13
+ ["checked", 4],
14
+ ["onCheckedChange", 5]
15
+ ]
20
16
  });
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;
17
+ var Switch = defineUniversalComponent("nativescript", function Switch(props) {
24
18
  return universalValue(__octaneUniversalPlan0, [
19
+ (v) => applyEscapeProps(v, props),
25
20
  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
21
+ cx(props.className),
22
+ props.style,
23
+ props.checked,
24
+ (e) => props.onCheckedChange?.(e.value)
38
25
  ]);
39
26
  }, { "module": "@nativescript-community/octane" });
40
27
  //#endregion
41
- export { SafeArea };
28
+ export { Switch };
@@ -1,72 +1,35 @@
1
- import { cx } from "./ui2.js";
2
- import { defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useState, withSlot } from "@nativescript-community/octane";
1
+ import { hookSlots, useEffect, useState } from "@nativescript-community/octane";
3
2
  import { Application } from "@nativescript/core";
4
- //#region src/KeyboardAvoiding.native.tsrx
5
- var _hs$ = /* @__PURE__ */ hookSlots(5);
3
+ //#region src/safeAreaInsets.native.tsrx
4
+ var _hs$ = /* @__PURE__ */ hookSlots(2);
6
5
  var _h$0 = /* @__PURE__ */ Symbol(_hs$);
7
6
  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;
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
+ };
44
21
  }
45
- function useAndroidResize() {
22
+ function useSafeAreaInsets() {
23
+ const [insets, setInsets] = useState(measure, _h$0);
46
24
  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);
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;
55
33
  }
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
34
  //#endregion
72
- export { KeyboardAvoiding };
35
+ export { useSafeAreaInsets };
@@ -1,23 +1,12 @@
1
1
  import { cx } from "./ui2.js";
2
- import { defineUniversalComponent, hookSlots, registerElement, universalIf, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
2
+ import { useSafeAreaInsets } from "./ui48.js";
3
+ import { defineUniversalComponent, hookSlots, universalPlan, universalValue, withSlot } from "@nativescript-community/octane";
3
4
  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);
5
+ //#region src/SafeArea.native.tsrx
6
+ var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
9
7
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
10
8
  "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",
9
+ "type": "flexboxlayout",
21
10
  "bindings": [
22
11
  ["id", 0],
23
12
  ["ref", 1],
@@ -25,42 +14,28 @@ var __octaneUniversalPlan1 = universalPlan("nativescript", {
25
14
  ["style", 3]
26
15
  ],
27
16
  "children": [{
28
- "kind": "host",
29
- "type": "gridlayout",
30
- "props": { "hostSlot": "mainContent" },
31
- "children": [{
32
- "kind": "slot",
33
- "slot": 4
34
- }]
35
- }, {
36
17
  "kind": "slot",
37
- "slot": 5
18
+ "slot": 4
38
19
  }]
39
20
  });
40
- install();
41
- registerElement("drawer", Drawer);
42
- var Drawer$1 = defineUniversalComponent("nativescript", function Drawer(props) {
43
- const host = useRef(null, _h$0);
21
+ var SafeArea = defineUniversalComponent("nativescript", function SafeArea(props) {
22
+ const insets = withSlot(_h$0, useSafeAreaInsets);
44
23
  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, [
24
+ return universalValue(__octaneUniversalPlan0, [
52
25
  props.id,
53
- (d) => {
54
- host.current = d;
55
- if (d && platformProps) Object.assign(d, platformProps);
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
56
36
  },
57
- cx("vx-drawer", props.className),
58
- props.style,
59
- props.main,
60
- universalIf(props.drawer != null, () => {
61
- return universalValue(__octaneUniversalPlan0, [props.drawer]);
62
- })
37
+ props.children
63
38
  ]);
64
39
  }, { "module": "@nativescript-community/octane" });
65
40
  //#endregion
66
- export { Drawer$1 as Drawer };
41
+ export { SafeArea };
@@ -1,27 +1,72 @@
1
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
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);
5
11
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
6
12
  "kind": "host",
7
- "type": "activityindicator",
13
+ "type": "scrollview",
8
14
  "bindings": [
9
15
  ["id", 0],
10
16
  ["className", 1],
11
17
  ["style", 2],
12
- ["busy", 3],
13
- ["ref", 4]
14
- ]
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
+ }]
15
30
  });
16
- var ActivityIndicator = defineUniversalComponent("nativescript", function ActivityIndicator(props) {
17
- if (props.busy === false) return null;
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;
18
60
  return universalValue(__octaneUniversalPlan0, [
19
61
  props.id,
20
- cx(props.className),
62
+ cx("vx-keyboard-avoiding", props.className),
21
63
  props.style,
22
- props.busy ?? true,
23
- (el) => applyNativeProps(el, props)
64
+ (host) => {
65
+ if (host && platformProps) Object.assign(host, platformProps);
66
+ },
67
+ keyboardInset ? { paddingBottom: keyboardInset } : void 0,
68
+ props.children
24
69
  ]);
25
70
  }, { "module": "@nativescript-community/octane" });
26
71
  //#endregion
27
- export { ActivityIndicator };
72
+ export { KeyboardAvoiding };