@octane-xplat/ui 0.3.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 (129) hide show
  1. package/README.md +46 -0
  2. package/dist/native/octane-client-build.json +1 -1
  3. package/dist/native/ui.js +55 -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 +133 -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 +79 -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/ui3.js +22 -1
  25. package/dist/native/ui30.js +14 -31
  26. package/dist/native/ui31.js +55 -36
  27. package/dist/native/ui32.js +49 -61
  28. package/dist/native/ui33.js +36 -28
  29. package/dist/native/ui34.js +51 -8
  30. package/dist/native/ui35.js +98 -20
  31. package/dist/native/ui36.js +9 -33
  32. package/dist/native/ui37.js +42 -15
  33. package/dist/native/ui38.js +186 -57
  34. package/dist/native/ui39.js +96 -26
  35. package/dist/native/ui4.js +22 -20
  36. package/dist/native/ui40.js +179 -8
  37. package/dist/native/ui41.js +52 -98
  38. package/dist/native/ui42.js +14 -145
  39. package/dist/native/ui43.js +16 -19
  40. package/dist/native/ui44.js +6 -6
  41. package/dist/native/ui45.js +38 -0
  42. package/dist/native/ui46.js +267 -0
  43. package/dist/native/ui47.js +28 -0
  44. package/dist/native/ui48.js +35 -0
  45. package/dist/native/ui49.js +41 -0
  46. package/dist/native/ui5.js +37 -77
  47. package/dist/native/ui50.js +72 -0
  48. package/dist/native/ui51.js +66 -0
  49. package/dist/native/ui52.js +64 -0
  50. package/dist/native/ui53.js +27 -0
  51. package/dist/native/ui54.js +13 -0
  52. package/dist/native/ui55.js +92 -0
  53. package/dist/native/ui56.js +34 -0
  54. package/dist/native/ui57.js +19 -0
  55. package/dist/native/ui58.js +156 -0
  56. package/dist/native/ui59.js +33 -0
  57. package/dist/native/ui6.js +94 -9
  58. package/dist/native/ui60.js +14 -0
  59. package/dist/native/ui61.js +22 -0
  60. package/dist/native/ui62.js +8 -0
  61. package/dist/native/ui63.js +108 -0
  62. package/dist/native/ui64.js +76 -0
  63. package/dist/native/ui7.js +42 -26
  64. package/dist/native/ui8.js +22 -12
  65. package/dist/native/ui9.js +18 -9
  66. package/dist/web/octane-client-build.json +1 -1
  67. package/dist/web/ui.js +53 -40
  68. package/dist/web/ui10.js +33 -186
  69. package/dist/web/ui11.js +28 -409
  70. package/dist/web/ui12.js +21 -68
  71. package/dist/web/ui13.js +265 -96
  72. package/dist/web/ui14.js +85 -95
  73. package/dist/web/ui15.js +368 -25
  74. package/dist/web/ui16.js +13 -101
  75. package/dist/web/ui17.js +246 -42
  76. package/dist/web/ui18.js +237 -28
  77. package/dist/web/ui19.js +36 -10
  78. package/dist/web/ui20.js +73 -102
  79. package/dist/web/ui21.js +102 -73
  80. package/dist/web/ui22.js +95 -55
  81. package/dist/web/ui23.js +94 -55
  82. package/dist/web/ui24.js +31 -15
  83. package/dist/web/ui25.js +105 -19
  84. package/dist/web/ui26.js +29 -23
  85. package/dist/web/ui27.js +12 -123
  86. package/dist/web/ui28.js +9 -110
  87. package/dist/web/ui29.js +52 -102
  88. package/dist/web/ui3.js +29 -18
  89. package/dist/web/ui30.js +32 -41
  90. package/dist/web/ui31.js +120 -39
  91. package/dist/web/ui32.js +41 -74
  92. package/dist/web/ui33.js +148 -32
  93. package/dist/web/ui34.js +145 -62
  94. package/dist/web/ui35.js +140 -7
  95. package/dist/web/ui36.js +86 -41
  96. package/dist/web/ui37.js +19 -44
  97. package/dist/web/ui38.js +5 -15
  98. package/dist/web/ui39.js +24 -86
  99. package/dist/web/ui4.js +46 -152
  100. package/dist/web/ui40.js +150 -37
  101. package/dist/web/ui41.js +36 -10
  102. package/dist/web/ui42.js +40 -7
  103. package/dist/web/ui43.js +73 -19
  104. package/dist/web/ui44.js +40 -6
  105. package/dist/web/ui45.js +62 -0
  106. package/dist/web/ui46.js +50 -0
  107. package/dist/web/ui47.js +9 -0
  108. package/dist/web/ui48.js +45 -0
  109. package/dist/web/ui49.js +13 -0
  110. package/dist/web/ui5.js +131 -27
  111. package/dist/web/ui50.js +63 -0
  112. package/dist/web/ui51.js +47 -0
  113. package/dist/web/ui52.js +19 -0
  114. package/dist/web/ui53.js +273 -0
  115. package/dist/web/ui54.js +42 -0
  116. package/dist/web/ui55.js +17 -0
  117. package/dist/web/ui56.js +9 -0
  118. package/dist/web/ui57.js +22 -0
  119. package/dist/web/ui58.js +8 -0
  120. package/dist/web/ui59.js +44 -0
  121. package/dist/web/ui6.js +81 -45
  122. package/dist/web/ui60.js +46 -0
  123. package/dist/web/ui7.js +43 -21
  124. package/dist/web/ui8.js +27 -21
  125. package/dist/web/ui9.js +29 -18
  126. package/package.json +17 -4
  127. package/src/theme/tokens.css +597 -141
  128. package/types/index.d.ts +112 -58
  129. package/types/props.d.ts +291 -16
@@ -1,148 +1,17 @@
1
- import { getStack, onStackRegistered, stackEntries } from "./ui27.js";
2
- import { buildRoutePath } from "./ui41.js";
3
- import { createNativeScriptRoot } from "@nativescript-community/octane";
4
- import { Application, GridLayout, Page } from "@nativescript/core";
5
- import { hookSlots as hookSlots$1, useSyncExternalStore as useSyncExternalStore$1 } from "octane";
6
- //#region src/route.native.ts
7
- /** Native twin of route.web — same Route contract over Frame/Page stacks.
8
- * `pushRoute` resolves a stack ('root' = the app's root Frame — an
9
- * explicit registerStack('root') or, by default, the Frame returned by
10
- * Application.getRootView(); named stacks come from TabSpec.stack panes
11
- * or registerStack) and pushes a Page hosting the registered screen —
12
- * each pushed Page is its own Octane root (decision #9: pages never
13
- * share context with their presenter). Params land as props; named-stack
14
- * pushes get `_stack` injected so the screen can popRoute its own stack.
15
- *
16
- * Registration contract (the footgun this module exists to defuse):
17
- * - `registerScreens(table)` once — pushRoute resolves `name` through it.
18
- * - 'root' needs nothing when the app boots a Frame as its root view
19
- * (the standard shape); non-Frame roots can't host pushes at all.
20
- * - named stacks register via `TabSpec.stack` or `registerStack`.
21
- * Every drop path warns loudly — silent no-ops are how apps ship a
22
- * default route on native while working fine on web. */
23
- var screens = {};
24
- var routes = [];
25
- /** Register the app's name → screen table (call once, from the shared
26
- * routes module). Native `pushRoute` resolves `route.name` through it;
27
- * on web the table feeds `screenFor` for outlets without a
28
- * `resolveScreen` prop. `manifest` (from deriveRouteManifest) is stored
29
- * for parity — the web leaf matches URLs through it; native navigation
30
- * is name+params and only needs the table. */
31
- function registerScreens(table, manifest) {
32
- screens = table;
33
- routes = manifest ?? [];
34
- }
35
- /** One-call registration for route-dir apps — screens + URL patterns +
36
- * layouts all come from deriveRouteManifest. */
37
- function registerRoutes(manifest) {
38
- registerScreens(manifest.screens, manifest.routes);
39
- }
40
- function screenFor(name) {
41
- return screens[name];
42
- }
43
- var tracked = /* @__PURE__ */ new WeakSet();
44
- var listeners = /* @__PURE__ */ new Set();
45
- var pageRoutes = /* @__PURE__ */ new WeakMap();
46
- var warned = /* @__PURE__ */ new Set();
47
- function emit() {
48
- listeners.forEach((l) => l());
49
- }
50
- function warnOnce(key, msg) {
51
- if (warned.has(key)) return;
52
- warned.add(key);
53
- console.warn("[octane-xplat] " + msg);
54
- }
55
- /** Attach the route-store emission hook once per frame. `navigatedTo`
56
- * fires on push AND on pop (the revealed page re-fires it), so one
57
- * listener keeps every useRoute snapshot honest. */
58
- function trackFrame(frame) {
59
- if (tracked.has(frame)) return;
60
- tracked.add(frame);
61
- frame.on("navigatedTo", emit);
62
- }
63
- function resolveStack(stack) {
64
- const frame = getStack(stack);
65
- if (frame) trackFrame(frame);
66
- return frame;
67
- }
68
- onStackRegistered((_name, frame) => {
69
- trackFrame(frame);
70
- emit();
71
- });
72
- function pushRoute(r) {
73
- const frame = resolveStack(r.stack);
74
- if (!frame) {
75
- warnOnce("stack:" + r.stack, r.stack === "root" ? `pushRoute('${r.name}') dropped — no root Frame. Boot with a Frame as the app root (Application.run create() returning new Frame) or call registerStack('root', frame).` : `pushRoute('${r.name}') dropped — no stack '${r.stack}' is registered. Named stacks come from TabSpec.stack on <Tabs> or registerStack('${r.stack}', frame).`);
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" });
76
7
  return;
77
8
  }
78
- const C = screenFor(r.name);
79
- if (!C) {
80
- warnOnce("screen:" + r.name, `pushRoute('${r.name}') dropped — '${r.name}' isn't in the screen table. Call registerScreens({ ${r.name}: ... }) at boot.`);
81
- return;
82
- }
83
- if (Application.android && r.stack !== "root") warnOnce("android:" + r.stack, `pushRoute into named stack '${r.stack}' on Android — upstream #11444: the page mounts but currentPage/backStack/goBack never land (pages accumulate). Named-stack pushes are iOS-only until fixed.`);
84
- if (!frame.isLoaded) frame.callLoaded?.();
85
- const props = r.stack === "root" ? r.params : {
86
- ...r.params,
87
- _stack: r.stack
88
- };
89
- try {
90
- frame.navigate({ create: () => {
91
- const page = new Page();
92
- page.id = r.name + "-page";
93
- page.actionBarHidden = true;
94
- pageRoutes.set(page, r);
95
- const host = new GridLayout();
96
- page.content = host;
97
- createNativeScriptRoot(host).render(C, props);
98
- return page;
99
- } });
100
- } catch (e) {
101
- console.warn("[octane-xplat] pushRoute(" + r.name + ") threw: " + e?.message);
102
- }
103
- }
104
- /** Pop the top page of a stack ('root' default). Quiet no-op at the base
105
- * page — matching web, where back at the app root is a no-op; loud only
106
- * when the stack itself doesn't exist. */
107
- function popRoute(stack = "root") {
108
- const frame = resolveStack(stack);
109
- if (!frame) {
110
- warnOnce("pop:" + stack, `popRoute('${stack}') dropped — no such stack is registered.`);
111
- return;
112
- }
113
- frame.goBack();
114
- }
115
- /** Route stamped on a stack's current page, or null at its base page. */
116
- function routeFor(stack) {
117
- const page = resolveStack(stack)?.currentPage;
118
- return (page && pageRoutes.get(page)) ?? null;
119
- }
120
- /** The top route across stacks — root's current route wins (a root push
121
- * covers the shell); otherwise the most recently registered named stack
122
- * showing a pushed page. Native has no boot URL, so this is an
123
- * approximation of web's "current URL route", not a deep link. */
124
- function currentRoute() {
125
- const root = routeFor("root");
126
- if (root) return root;
127
- const named = [...stackEntries()].reverse();
128
- for (const [name] of named) {
129
- const r = routeFor(name);
130
- if (r) return r;
131
- }
132
- return null;
133
- }
134
- /** Path-string parity for the web leaf's hrefFor — a canonical
135
- * /<stack>/<path> rendering of the route (deep-linking consumes it
136
- * there). Native navigation itself is name+params, not URLs. */
137
- function hrefFor(r) {
138
- return buildRoutePath(routes, r);
139
- }
140
- function useRoute(stack) {
141
- return useSyncExternalStore$1((cb) => {
142
- listeners.add(cb);
143
- return () => listeners.delete(cb);
144
- }, () => routeFor(stack), _h$0);
145
- }
146
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots$1(1));
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);
13
+ }
14
+ onThemeSchemeChange(applyStatusBarScheme);
15
+ Application.on("displayed", applyStatusBarScheme);
16
+ applyStatusBarScheme();
147
17
  //#endregion
148
- export { currentRoute, hrefFor, popRoute, pushRoute, registerRoutes, registerScreens, routeFor, screenFor, useRoute };
@@ -1,22 +1,19 @@
1
- //#region src/store.ts
2
- function createStore(initial) {
3
- let value = initial;
4
- const listeners = /* @__PURE__ */ new Set();
5
- return {
6
- get: () => value,
7
- set(next) {
8
- const v = typeof next === "function" ? next(value) : next;
9
- if (Object.is(v, value)) return;
10
- value = v;
11
- for (const l of [...listeners]) l();
12
- },
13
- subscribe(notify) {
14
- listeners.add(notify);
15
- return () => {
16
- listeners.delete(notify);
17
- };
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];
18
11
  }
19
- };
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);
20
17
  }
21
18
  //#endregion
22
- export { createStore };
19
+ export { styled };
@@ -1,8 +1,8 @@
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 { 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);
6
6
  }
7
7
  //#endregion
8
- export { useStore };
8
+ export { openWindow };
@@ -0,0 +1,38 @@
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" });
37
+ //#endregion
38
+ export { Screen };
@@ -0,0 +1,267 @@
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;
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" });
266
+ //#endregion
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 "./ui48.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 };