@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,8 +1,17 @@
1
- import { Application } from "@nativescript/core";
2
- //#region src/windows.native.ts
3
- /** Open another NativeScript window and pass app-owned data to its resolver. */
4
- function openWindow(options = {}) {
5
- Application.openWindow(options);
1
+ import { getThemeScheme, onThemeSchemeChange } from "./ui31.js";
2
+ import { Application, Utils } from "@nativescript/core";
3
+ //#region src/theme/status-bar-scheme.native.ts
4
+ function applyStatusBarScheme() {
5
+ if (Application.android) {
6
+ Utils.setDarkModeHandler?.({ handler: () => getThemeScheme() === "dark" });
7
+ return;
8
+ }
9
+ const style = getThemeScheme() === "dark" ? "light" : "dark";
10
+ const root = Application.getRootView();
11
+ if (root) root.statusBarStyle = style;
12
+ if (Application.ios) Application.ios.nativeApp?.setStatusBarStyle?.(style === "light" ? 1 : 0);
6
13
  }
14
+ onThemeSchemeChange(applyStatusBarScheme);
15
+ Application.on("displayed", applyStatusBarScheme);
16
+ applyStatusBarScheme();
7
17
  //#endregion
8
- export { openWindow };
@@ -1,38 +1,19 @@
1
- import { cx } from "./ui2.js";
2
- import { applyEscapeProps } from "./ui3.js";
3
- import { registerRootLayout, unregisterRootLayout } from "./ui34.js";
4
- import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
5
- //#region src/Screen.native.tsrx
6
- var __octaneUniversalPlan0 = universalPlan("nativescript", {
7
- "kind": "host",
8
- "type": "rootlayout",
9
- "bindings": [
10
- ["id", 0],
11
- ["ref", 1],
12
- ["onLoaded", 2],
13
- ["onUnloaded", 3]
14
- ],
15
- "children": [{
16
- "kind": "host",
17
- "type": "flexboxlayout",
18
- "props": { "flexDirection": "column" },
19
- "bindings": [["className", 4], ["style", 5]],
20
- "children": [{
21
- "kind": "slot",
22
- "slot": 6
23
- }]
24
- }]
25
- });
26
- var Screen = defineUniversalComponent("nativescript", function Screen(props) {
27
- return universalValue(__octaneUniversalPlan0, [
28
- props.id,
29
- (v) => applyEscapeProps(v, props),
30
- (e) => registerRootLayout(e.object),
31
- (e) => unregisterRootLayout(e.object),
32
- cx(props.className),
33
- props.style,
34
- props.children
35
- ]);
36
- }, { "module": "@nativescript-community/octane" });
1
+ import "@nativescript-community/octane";
2
+ import { defineUniversalComponent as defineUniversalComponent$1, universalComponent as universalComponent$1 } from "octane/universal/native";
3
+ //#region src/styled.native.tsrx
4
+ function styled(Base, def) {
5
+ function Styled(props) {
6
+ const cls = [def.base];
7
+ const rest = { ...props };
8
+ for (const k of Object.keys(def.variants ?? {})) {
9
+ if (props[k]) cls.push(def.variants[k]);
10
+ delete rest[k];
11
+ }
12
+ if (props.className) cls.push(props.className);
13
+ rest.className = cls;
14
+ return universalComponent$1("nativescript", Base, rest);
15
+ }
16
+ return defineUniversalComponent$1("nativescript", Styled);
17
+ }
37
18
  //#endregion
38
- export { Screen };
19
+ export { styled };
@@ -1,267 +1,8 @@
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;
1
+ import { Application } from "@nativescript/core";
2
+ //#region src/windows.native.ts
3
+ /** Open another NativeScript window and pass app-owned data to its resolver. */
4
+ function openWindow(options = {}) {
5
+ Application.openWindow(options);
131
6
  }
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" });
266
7
  //#endregion
267
- export { Tabs };
8
+ export { openWindow };
@@ -1,28 +1,38 @@
1
1
  import { cx } from "./ui2.js";
2
2
  import { applyEscapeProps } from "./ui3.js";
3
+ import { registerRootLayout, unregisterRootLayout } from "./ui34.js";
3
4
  import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
4
- //#region src/Switch.native.tsrx
5
+ //#region src/Screen.native.tsrx
5
6
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
6
7
  "kind": "host",
7
- "type": "switch",
8
+ "type": "rootlayout",
8
9
  "bindings": [
9
- ["ref", 0],
10
- ["id", 1],
11
- ["className", 2],
12
- ["style", 3],
13
- ["checked", 4],
14
- ["onCheckedChange", 5]
15
- ]
10
+ ["id", 0],
11
+ ["ref", 1],
12
+ ["onLoaded", 2],
13
+ ["onUnloaded", 3]
14
+ ],
15
+ "children": [{
16
+ "kind": "host",
17
+ "type": "flexboxlayout",
18
+ "props": { "flexDirection": "column" },
19
+ "bindings": [["className", 4], ["style", 5]],
20
+ "children": [{
21
+ "kind": "slot",
22
+ "slot": 6
23
+ }]
24
+ }]
16
25
  });
17
- var Switch = defineUniversalComponent("nativescript", function Switch(props) {
26
+ var Screen = defineUniversalComponent("nativescript", function Screen(props) {
18
27
  return universalValue(__octaneUniversalPlan0, [
19
- (v) => applyEscapeProps(v, props),
20
28
  props.id,
29
+ (v) => applyEscapeProps(v, props),
30
+ (e) => registerRootLayout(e.object),
31
+ (e) => unregisterRootLayout(e.object),
21
32
  cx(props.className),
22
33
  props.style,
23
- props.checked,
24
- (e) => props.onCheckedChange?.(e.value)
34
+ props.children
25
35
  ]);
26
36
  }, { "module": "@nativescript-community/octane" });
27
37
  //#endregion
28
- export { Switch };
38
+ export { Screen };