@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.
- package/README.md +46 -0
- package/dist/native/octane-client-build.json +1 -1
- package/dist/native/ui.js +55 -40
- package/dist/native/ui10.js +20 -11
- package/dist/native/ui11.js +42 -109
- package/dist/native/ui12.js +17 -84
- package/dist/native/ui13.js +11 -41
- package/dist/native/ui14.js +133 -76
- package/dist/native/ui15.js +43 -92
- package/dist/native/ui16.js +106 -45
- package/dist/native/ui17.js +29 -42
- package/dist/native/ui18.js +34 -53
- package/dist/native/ui19.js +246 -32
- package/dist/native/ui20.js +27 -16
- package/dist/native/ui21.js +376 -86
- package/dist/native/ui22.js +26 -114
- package/dist/native/ui23.js +49 -97
- package/dist/native/ui24.js +79 -53
- package/dist/native/ui25.js +138 -16
- package/dist/native/ui26.js +8 -23
- package/dist/native/ui27.js +60 -34
- package/dist/native/ui28.js +36 -142
- package/dist/native/ui29.js +101 -21
- package/dist/native/ui3.js +22 -1
- package/dist/native/ui30.js +14 -31
- package/dist/native/ui31.js +55 -36
- package/dist/native/ui32.js +49 -61
- package/dist/native/ui33.js +36 -28
- package/dist/native/ui34.js +51 -8
- package/dist/native/ui35.js +98 -20
- package/dist/native/ui36.js +9 -33
- package/dist/native/ui37.js +42 -15
- package/dist/native/ui38.js +186 -57
- package/dist/native/ui39.js +96 -26
- package/dist/native/ui4.js +22 -20
- package/dist/native/ui40.js +179 -8
- package/dist/native/ui41.js +52 -98
- package/dist/native/ui42.js +14 -145
- package/dist/native/ui43.js +16 -19
- package/dist/native/ui44.js +6 -6
- package/dist/native/ui45.js +38 -0
- package/dist/native/ui46.js +267 -0
- package/dist/native/ui47.js +28 -0
- package/dist/native/ui48.js +35 -0
- package/dist/native/ui49.js +41 -0
- package/dist/native/ui5.js +37 -77
- package/dist/native/ui50.js +72 -0
- package/dist/native/ui51.js +66 -0
- package/dist/native/ui52.js +64 -0
- package/dist/native/ui53.js +27 -0
- package/dist/native/ui54.js +13 -0
- package/dist/native/ui55.js +92 -0
- package/dist/native/ui56.js +34 -0
- package/dist/native/ui57.js +19 -0
- package/dist/native/ui58.js +156 -0
- package/dist/native/ui59.js +33 -0
- package/dist/native/ui6.js +94 -9
- package/dist/native/ui60.js +14 -0
- package/dist/native/ui61.js +22 -0
- package/dist/native/ui62.js +8 -0
- package/dist/native/ui63.js +108 -0
- package/dist/native/ui64.js +76 -0
- package/dist/native/ui7.js +42 -26
- package/dist/native/ui8.js +22 -12
- package/dist/native/ui9.js +18 -9
- package/dist/web/octane-client-build.json +1 -1
- package/dist/web/ui.js +53 -40
- package/dist/web/ui10.js +33 -186
- package/dist/web/ui11.js +28 -409
- package/dist/web/ui12.js +21 -68
- package/dist/web/ui13.js +265 -96
- package/dist/web/ui14.js +85 -95
- package/dist/web/ui15.js +368 -25
- package/dist/web/ui16.js +13 -101
- package/dist/web/ui17.js +246 -42
- package/dist/web/ui18.js +237 -28
- package/dist/web/ui19.js +36 -10
- package/dist/web/ui20.js +73 -102
- package/dist/web/ui21.js +102 -73
- package/dist/web/ui22.js +95 -55
- package/dist/web/ui23.js +94 -55
- package/dist/web/ui24.js +31 -15
- package/dist/web/ui25.js +105 -19
- package/dist/web/ui26.js +29 -23
- package/dist/web/ui27.js +12 -123
- package/dist/web/ui28.js +9 -110
- package/dist/web/ui29.js +52 -102
- package/dist/web/ui3.js +29 -18
- package/dist/web/ui30.js +32 -41
- package/dist/web/ui31.js +120 -39
- package/dist/web/ui32.js +41 -74
- package/dist/web/ui33.js +148 -32
- package/dist/web/ui34.js +145 -62
- package/dist/web/ui35.js +140 -7
- package/dist/web/ui36.js +86 -41
- package/dist/web/ui37.js +19 -44
- package/dist/web/ui38.js +5 -15
- package/dist/web/ui39.js +24 -86
- package/dist/web/ui4.js +46 -152
- package/dist/web/ui40.js +150 -37
- package/dist/web/ui41.js +36 -10
- package/dist/web/ui42.js +40 -7
- package/dist/web/ui43.js +73 -19
- package/dist/web/ui44.js +40 -6
- package/dist/web/ui45.js +62 -0
- package/dist/web/ui46.js +50 -0
- package/dist/web/ui47.js +9 -0
- package/dist/web/ui48.js +45 -0
- package/dist/web/ui49.js +13 -0
- package/dist/web/ui5.js +131 -27
- package/dist/web/ui50.js +63 -0
- package/dist/web/ui51.js +47 -0
- package/dist/web/ui52.js +19 -0
- package/dist/web/ui53.js +273 -0
- package/dist/web/ui54.js +42 -0
- package/dist/web/ui55.js +17 -0
- package/dist/web/ui56.js +9 -0
- package/dist/web/ui57.js +22 -0
- package/dist/web/ui58.js +8 -0
- package/dist/web/ui59.js +44 -0
- package/dist/web/ui6.js +81 -45
- package/dist/web/ui60.js +46 -0
- package/dist/web/ui7.js +43 -21
- package/dist/web/ui8.js +27 -21
- package/dist/web/ui9.js +29 -18
- package/package.json +17 -4
- package/src/theme/tokens.css +597 -141
- package/types/index.d.ts +112 -58
- package/types/props.d.ts +291 -16
package/dist/native/ui42.js
CHANGED
|
@@ -1,148 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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 };
|
package/dist/native/ui43.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
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 {
|
|
19
|
+
export { styled };
|
package/dist/native/ui44.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/
|
|
3
|
-
|
|
4
|
-
function
|
|
5
|
-
|
|
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 {
|
|
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 };
|