@octane-xplat/ui 0.2.0 → 0.3.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/dist/native/octane-client-build.json +1 -1
- package/dist/native/ui.js +40 -19
- package/dist/native/ui10.js +19 -48
- package/dist/native/ui11.js +118 -56
- package/dist/native/ui12.js +114 -16
- package/dist/native/ui13.js +54 -18
- package/dist/native/ui14.js +76 -13
- package/dist/native/ui15.js +128 -18
- package/dist/native/ui16.js +48 -136
- package/dist/native/ui17.js +42 -19
- package/dist/native/ui18.js +50 -9
- package/dist/native/ui19.js +34 -12
- package/dist/native/ui2.js +10 -48
- package/dist/native/ui20.js +17 -0
- package/dist/native/ui21.js +93 -0
- package/dist/native/ui22.js +124 -0
- package/dist/native/ui23.js +103 -0
- package/dist/native/ui24.js +58 -0
- package/dist/native/ui25.js +19 -0
- package/dist/native/ui26.js +27 -0
- package/dist/native/ui27.js +35 -0
- package/dist/native/ui28.js +146 -0
- package/dist/native/ui29.js +28 -0
- package/dist/native/ui3.js +17 -20
- package/dist/native/ui30.js +35 -0
- package/dist/native/ui31.js +39 -0
- package/dist/native/ui32.js +70 -0
- package/dist/native/ui33.js +30 -0
- package/dist/native/ui34.js +10 -0
- package/dist/native/ui35.js +27 -0
- package/dist/native/ui36.js +34 -0
- package/dist/native/ui37.js +17 -0
- package/dist/native/ui38.js +68 -0
- package/dist/native/ui39.js +33 -0
- package/dist/native/ui4.js +21 -48
- package/dist/native/ui40.js +14 -0
- package/dist/native/ui41.js +104 -0
- package/dist/native/ui42.js +148 -0
- package/dist/native/ui43.js +22 -0
- package/dist/native/ui44.js +8 -0
- package/dist/native/ui5.js +70 -27
- package/dist/native/ui6.js +36 -20
- package/dist/native/ui7.js +24 -61
- package/dist/native/ui8.js +16 -18
- package/dist/native/ui9.js +16 -13
- package/dist/web/octane-client-build.json +1 -1
- package/dist/web/ui.js +40 -19
- package/dist/web/ui10.js +187 -31
- package/dist/web/ui11.js +419 -53
- package/dist/web/ui12.js +83 -15
- package/dist/web/ui13.js +107 -19
- package/dist/web/ui14.js +98 -18
- package/dist/web/ui15.js +83 -47
- package/dist/web/ui16.js +100 -93
- package/dist/web/ui17.js +36 -22
- package/dist/web/ui18.js +29 -15
- package/dist/web/ui19.js +9 -7
- package/dist/web/ui2.js +15 -103
- package/dist/web/ui20.js +114 -0
- package/dist/web/ui21.js +82 -0
- package/dist/web/ui22.js +68 -0
- package/dist/web/ui23.js +57 -0
- package/dist/web/ui24.js +16 -0
- package/dist/web/ui25.js +22 -0
- package/dist/web/ui26.js +39 -0
- package/dist/web/ui27.js +127 -0
- package/dist/web/ui28.js +112 -0
- package/dist/web/ui29.js +108 -0
- package/dist/web/ui3.js +19 -27
- package/dist/web/ui30.js +43 -0
- package/dist/web/ui31.js +42 -0
- package/dist/web/ui32.js +77 -0
- package/dist/web/ui33.js +43 -0
- package/dist/web/ui34.js +67 -0
- package/dist/web/ui35.js +9 -0
- package/dist/web/ui36.js +45 -0
- package/dist/web/ui37.js +47 -0
- package/dist/web/ui38.js +17 -0
- package/dist/web/ui39.js +100 -0
- package/dist/web/ui4.js +145 -17
- package/dist/web/ui40.js +41 -0
- package/dist/web/ui41.js +17 -0
- package/dist/web/ui42.js +9 -0
- package/dist/web/ui43.js +22 -0
- package/dist/web/ui44.js +8 -0
- package/dist/web/ui5.js +54 -52
- package/dist/web/ui6.js +43 -16
- package/dist/web/ui7.js +29 -36
- package/dist/web/ui8.js +29 -18
- package/dist/web/ui9.js +24 -16
- package/package.json +14 -3
- package/src/theme/tokens.css +166 -0
- package/types/index.d.ts +108 -1
- package/types/props.d.ts +333 -8
|
@@ -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,39 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { useSafeAreaInsets } from "./ui30.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
|
+
["ref", 0],
|
|
12
|
+
["className", 1],
|
|
13
|
+
["style", 2]
|
|
14
|
+
],
|
|
15
|
+
"children": [{
|
|
16
|
+
"kind": "slot",
|
|
17
|
+
"slot": 3
|
|
18
|
+
}]
|
|
19
|
+
});
|
|
20
|
+
var SafeArea = defineUniversalComponent("nativescript", function SafeArea(props) {
|
|
21
|
+
const insets = withSlot(_h$0, useSafeAreaInsets);
|
|
22
|
+
const platformProps = Application.ios != null ? props.ios : props.android;
|
|
23
|
+
return universalValue(__octaneUniversalPlan0, [
|
|
24
|
+
(host) => {
|
|
25
|
+
if (host && platformProps) Object.assign(host, platformProps);
|
|
26
|
+
},
|
|
27
|
+
cx("vx-safe-area", props.className),
|
|
28
|
+
{
|
|
29
|
+
...props.style,
|
|
30
|
+
paddingTop: insets.top,
|
|
31
|
+
paddingRight: insets.right,
|
|
32
|
+
paddingBottom: insets.bottom,
|
|
33
|
+
paddingLeft: insets.left
|
|
34
|
+
},
|
|
35
|
+
props.children
|
|
36
|
+
]);
|
|
37
|
+
}, { "module": "@nativescript-community/octane" });
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SafeArea };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useState, withSlot } from "@nativescript-community/octane";
|
|
3
|
+
import { Application } from "@nativescript/core";
|
|
4
|
+
//#region src/KeyboardAvoiding.native.tsrx
|
|
5
|
+
var _hs$ = /* @__PURE__ */ hookSlots(5);
|
|
6
|
+
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
7
|
+
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
8
|
+
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
9
|
+
var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
|
|
10
|
+
var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
|
|
11
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
12
|
+
"kind": "host",
|
|
13
|
+
"type": "scrollview",
|
|
14
|
+
"bindings": [
|
|
15
|
+
["className", 0],
|
|
16
|
+
["style", 1],
|
|
17
|
+
["ref", 2]
|
|
18
|
+
],
|
|
19
|
+
"children": [{
|
|
20
|
+
"kind": "host",
|
|
21
|
+
"type": "flexboxlayout",
|
|
22
|
+
"props": { "flexDirection": "column" },
|
|
23
|
+
"bindings": [["style", 3]],
|
|
24
|
+
"children": [{
|
|
25
|
+
"kind": "slot",
|
|
26
|
+
"slot": 4
|
|
27
|
+
}]
|
|
28
|
+
}]
|
|
29
|
+
});
|
|
30
|
+
function useKeyboardInset() {
|
|
31
|
+
const [inset, setInset] = useState(0, _h$0);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!Application.ios) return;
|
|
34
|
+
const center = NSNotificationCenter.defaultCenter;
|
|
35
|
+
const token = center.addObserverForNameObjectQueueUsingBlock(UIKeyboardWillChangeFrameNotification, null, NSOperationQueue.mainQueue, (note) => {
|
|
36
|
+
const frame = note.userInfo.objectForKey(UIKeyboardFrameEndUserInfoKey);
|
|
37
|
+
const screenHeight = UIScreen.mainScreen.bounds.size.height;
|
|
38
|
+
setInset(Math.max(0, screenHeight - frame.origin.y));
|
|
39
|
+
});
|
|
40
|
+
return () => center.removeObserver(token);
|
|
41
|
+
}, [], _h$1);
|
|
42
|
+
return inset;
|
|
43
|
+
}
|
|
44
|
+
function useAndroidResize() {
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const nativeWindow = Application.android?.foregroundActivity?.window;
|
|
47
|
+
if (!nativeWindow) return;
|
|
48
|
+
const params = android.view.WindowManager.LayoutParams;
|
|
49
|
+
const previous = nativeWindow.attributes.softInputMode;
|
|
50
|
+
const adjusted = previous & ~params.SOFT_INPUT_MASK_ADJUST | params.SOFT_INPUT_ADJUST_RESIZE;
|
|
51
|
+
nativeWindow.setSoftInputMode(adjusted);
|
|
52
|
+
return () => nativeWindow.setSoftInputMode(previous);
|
|
53
|
+
}, [], _h$2);
|
|
54
|
+
}
|
|
55
|
+
var KeyboardAvoiding = defineUniversalComponent("nativescript", function KeyboardAvoiding(props) {
|
|
56
|
+
const keyboardInset = withSlot(_h$3, useKeyboardInset);
|
|
57
|
+
withSlot(_h$4, useAndroidResize);
|
|
58
|
+
const platformProps = Application.ios != null ? props.ios : props.android;
|
|
59
|
+
return universalValue(__octaneUniversalPlan0, [
|
|
60
|
+
cx("vx-keyboard-avoiding", props.className),
|
|
61
|
+
props.style,
|
|
62
|
+
(host) => {
|
|
63
|
+
if (host && platformProps) Object.assign(host, platformProps);
|
|
64
|
+
},
|
|
65
|
+
keyboardInset ? { paddingBottom: keyboardInset } : void 0,
|
|
66
|
+
props.children
|
|
67
|
+
]);
|
|
68
|
+
}, { "module": "@nativescript-community/octane" });
|
|
69
|
+
//#endregion
|
|
70
|
+
export { KeyboardAvoiding };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
3
|
+
import { Application } from "@nativescript/core";
|
|
4
|
+
//#region src/Drawer.native.tsrx
|
|
5
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
6
|
+
"kind": "host",
|
|
7
|
+
"type": "flexboxlayout",
|
|
8
|
+
"bindings": [
|
|
9
|
+
["ref", 0],
|
|
10
|
+
["className", 1],
|
|
11
|
+
["style", 2]
|
|
12
|
+
],
|
|
13
|
+
"children": [{
|
|
14
|
+
"kind": "slot",
|
|
15
|
+
"slot": 3
|
|
16
|
+
}]
|
|
17
|
+
});
|
|
18
|
+
var Drawer = defineUniversalComponent("nativescript", function Drawer(props) {
|
|
19
|
+
const platformProps = Application.ios != null ? props.ios : props.android;
|
|
20
|
+
return universalValue(__octaneUniversalPlan0, [
|
|
21
|
+
(host) => {
|
|
22
|
+
if (host && platformProps) Object.assign(host, platformProps);
|
|
23
|
+
},
|
|
24
|
+
cx("vx-drawer", props.className),
|
|
25
|
+
props.style,
|
|
26
|
+
props.main
|
|
27
|
+
]);
|
|
28
|
+
}, { "module": "@nativescript-community/octane" });
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Drawer };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isAndroid, isIOS } from "@nativescript/core";
|
|
2
|
+
//#region src/platformProps.native.ts
|
|
3
|
+
/** Apply the matching native escape-hatch bag after the primitive's props. */
|
|
4
|
+
function applyNativeProps(el, props) {
|
|
5
|
+
if (!el) return;
|
|
6
|
+
const bag = isIOS ? props.ios : isAndroid ? props.android : void 0;
|
|
7
|
+
if (bag) Object.assign(el, bag);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { applyNativeProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { applyNativeProps } from "./ui34.js";
|
|
3
|
+
import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
4
|
+
//#region src/ActivityIndicator.native.tsrx
|
|
5
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
6
|
+
"kind": "host",
|
|
7
|
+
"type": "activityindicator",
|
|
8
|
+
"bindings": [
|
|
9
|
+
["id", 0],
|
|
10
|
+
["className", 1],
|
|
11
|
+
["style", 2],
|
|
12
|
+
["busy", 3],
|
|
13
|
+
["ref", 4]
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
var ActivityIndicator = defineUniversalComponent("nativescript", function ActivityIndicator(props) {
|
|
17
|
+
if (props.busy === false) return null;
|
|
18
|
+
return universalValue(__octaneUniversalPlan0, [
|
|
19
|
+
props.id,
|
|
20
|
+
cx(props.className),
|
|
21
|
+
props.style,
|
|
22
|
+
props.busy ?? true,
|
|
23
|
+
(el) => applyNativeProps(el, props)
|
|
24
|
+
]);
|
|
25
|
+
}, { "module": "@nativescript-community/octane" });
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ActivityIndicator };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { applyNativeProps } from "./ui34.js";
|
|
3
|
+
import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
4
|
+
//#region src/Slider.native.tsrx
|
|
5
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
6
|
+
"kind": "host",
|
|
7
|
+
"type": "slider",
|
|
8
|
+
"bindings": [
|
|
9
|
+
["id", 0],
|
|
10
|
+
["className", 1],
|
|
11
|
+
["style", 2],
|
|
12
|
+
["value", 3],
|
|
13
|
+
["minValue", 4],
|
|
14
|
+
["maxValue", 5],
|
|
15
|
+
["isEnabled", 6],
|
|
16
|
+
["onValueChange", 7],
|
|
17
|
+
["ref", 8]
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
var Slider = defineUniversalComponent("nativescript", function Slider(props) {
|
|
21
|
+
return universalValue(__octaneUniversalPlan0, [
|
|
22
|
+
props.id,
|
|
23
|
+
cx(props.className),
|
|
24
|
+
props.style,
|
|
25
|
+
props.value,
|
|
26
|
+
props.minValue ?? 0,
|
|
27
|
+
props.maxValue ?? 100,
|
|
28
|
+
props.disabled ? false : true,
|
|
29
|
+
(e) => props.onValueChange?.(e.value),
|
|
30
|
+
(el) => applyNativeProps(el, props)
|
|
31
|
+
]);
|
|
32
|
+
}, { "module": "@nativescript-community/octane" });
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Slider };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/icons.ts
|
|
2
|
+
/**
|
|
3
|
+
* App-owned icon registry. `svg` is SVG path `d` data (not a full SVG
|
|
4
|
+
* markup string). Native `font` glyphs render only when the app ships that font.
|
|
5
|
+
*/
|
|
6
|
+
var icons = /* @__PURE__ */ new Map();
|
|
7
|
+
function registerIcon(name, glyph) {
|
|
8
|
+
icons.set(name, glyph);
|
|
9
|
+
}
|
|
10
|
+
function registerIcons(record) {
|
|
11
|
+
for (const [name, glyph] of Object.entries(record)) icons.set(name, glyph);
|
|
12
|
+
}
|
|
13
|
+
function getIcon(name) {
|
|
14
|
+
return icons.get(name);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getIcon, registerIcon, registerIcons };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { applyNativeProps } from "./ui34.js";
|
|
3
|
+
import { getIcon } from "./ui37.js";
|
|
4
|
+
import { defineUniversalComponent, universalIf, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
5
|
+
//#region src/Icon.native.tsrx
|
|
6
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
7
|
+
"kind": "host",
|
|
8
|
+
"type": "label",
|
|
9
|
+
"bindings": [
|
|
10
|
+
["id", 0],
|
|
11
|
+
["className", 1],
|
|
12
|
+
["text", 2],
|
|
13
|
+
["style", 3],
|
|
14
|
+
["ref", 4]
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
var __octaneUniversalPlan1 = universalPlan("nativescript", {
|
|
18
|
+
"kind": "host",
|
|
19
|
+
"type": "image",
|
|
20
|
+
"bindings": [
|
|
21
|
+
["id", 0],
|
|
22
|
+
["className", 1],
|
|
23
|
+
["src", 2],
|
|
24
|
+
["style", 3],
|
|
25
|
+
["ref", 4]
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
var __octaneUniversalPlan2 = universalPlan("nativescript", {
|
|
29
|
+
"kind": "slot",
|
|
30
|
+
"slot": 0
|
|
31
|
+
});
|
|
32
|
+
var __octaneUniversalPlan3 = universalPlan("nativescript", {
|
|
33
|
+
"kind": "slot",
|
|
34
|
+
"slot": 0
|
|
35
|
+
});
|
|
36
|
+
var Icon = defineUniversalComponent("nativescript", function Icon(props) {
|
|
37
|
+
const glyph = getIcon(props.name);
|
|
38
|
+
if (!glyph) return null;
|
|
39
|
+
const size = props.size ?? 24;
|
|
40
|
+
return universalValue(__octaneUniversalPlan3, [universalIf(glyph.font, () => {
|
|
41
|
+
return universalValue(__octaneUniversalPlan0, [
|
|
42
|
+
props.id,
|
|
43
|
+
cx(props.className),
|
|
44
|
+
glyph.font.glyph,
|
|
45
|
+
{
|
|
46
|
+
fontFamily: glyph.font.family,
|
|
47
|
+
fontSize: size,
|
|
48
|
+
color: props.color
|
|
49
|
+
},
|
|
50
|
+
(el) => applyNativeProps(el, props)
|
|
51
|
+
]);
|
|
52
|
+
}, () => {
|
|
53
|
+
return universalValue(__octaneUniversalPlan2, [universalIf(glyph.src, () => {
|
|
54
|
+
return universalValue(__octaneUniversalPlan1, [
|
|
55
|
+
props.id,
|
|
56
|
+
cx(props.className),
|
|
57
|
+
glyph.src,
|
|
58
|
+
{
|
|
59
|
+
width: size,
|
|
60
|
+
height: size
|
|
61
|
+
},
|
|
62
|
+
(el) => applyNativeProps(el, props)
|
|
63
|
+
]);
|
|
64
|
+
})]);
|
|
65
|
+
})]);
|
|
66
|
+
}, { "module": "@nativescript-community/octane" });
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Icon };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { applyNativeProps } from "./ui34.js";
|
|
3
|
+
import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
4
|
+
import { AccessibilityRole } from "@nativescript/core";
|
|
5
|
+
//#region src/Heading.native.tsrx
|
|
6
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
7
|
+
"kind": "host",
|
|
8
|
+
"type": "label",
|
|
9
|
+
"bindings": [
|
|
10
|
+
["id", 0],
|
|
11
|
+
["className", 1],
|
|
12
|
+
["style", 2],
|
|
13
|
+
["accessibilityRole", 3],
|
|
14
|
+
["ref", 4]
|
|
15
|
+
],
|
|
16
|
+
"children": [{
|
|
17
|
+
"kind": "slot",
|
|
18
|
+
"slot": 5
|
|
19
|
+
}]
|
|
20
|
+
});
|
|
21
|
+
var Heading = defineUniversalComponent("nativescript", function Heading(props) {
|
|
22
|
+
const level = props.level ?? 2;
|
|
23
|
+
return universalValue(__octaneUniversalPlan0, [
|
|
24
|
+
props.id,
|
|
25
|
+
cx(`vx-h${level}`, props.className),
|
|
26
|
+
props.style,
|
|
27
|
+
AccessibilityRole.Header,
|
|
28
|
+
(el) => applyNativeProps(el, props),
|
|
29
|
+
props.children
|
|
30
|
+
]);
|
|
31
|
+
}, { "module": "@nativescript-community/octane" });
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Heading };
|
package/dist/native/ui4.js
CHANGED
|
@@ -1,49 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
var __octaneUniversalPlan2 = universalPlan("nativescript", {
|
|
22
|
-
"kind": "slot",
|
|
23
|
-
"slot": 0
|
|
24
|
-
});
|
|
25
|
-
var InText = createContext(false);
|
|
26
|
-
var TextScope = defineUniversalComponent("nativescript", function TextScope(props) {
|
|
27
|
-
return InText({
|
|
28
|
-
value: true,
|
|
29
|
-
children: props.children
|
|
30
|
-
});
|
|
31
|
-
}, { "module": "@nativescript-community/octane" });
|
|
32
|
-
var Text = defineUniversalComponent("nativescript", function Text(props) {
|
|
33
|
-
const inText = useContext(InText);
|
|
34
|
-
return universalValue(__octaneUniversalPlan2, [universalIf(inText, () => {
|
|
35
|
-
return universalValue(__octaneUniversalPlan0, [
|
|
36
|
-
props.className,
|
|
37
|
-
props.style,
|
|
38
|
-
props.children
|
|
39
|
-
]);
|
|
40
|
-
}, () => {
|
|
41
|
-
return universalValue(__octaneUniversalPlan1, [
|
|
42
|
-
props.className,
|
|
43
|
-
props.style,
|
|
44
|
-
universalComponent("nativescript", TextScope, universalProps([], props.children))
|
|
45
|
-
]);
|
|
46
|
-
})]);
|
|
47
|
-
}, { "module": "@nativescript-community/octane" });
|
|
1
|
+
//#region src/layout-child.native.ts
|
|
2
|
+
/** NativeScript reads these attributes from each child view during parent
|
|
3
|
+
* layout. Values are forwarded with NativeScript's own property names. */
|
|
4
|
+
function layoutChildProps(props) {
|
|
5
|
+
const result = {};
|
|
6
|
+
for (const key of [
|
|
7
|
+
"row",
|
|
8
|
+
"col",
|
|
9
|
+
"rowSpan",
|
|
10
|
+
"colSpan",
|
|
11
|
+
"dock",
|
|
12
|
+
"left",
|
|
13
|
+
"top",
|
|
14
|
+
"flexGrow",
|
|
15
|
+
"flexShrink",
|
|
16
|
+
"alignSelf",
|
|
17
|
+
"order"
|
|
18
|
+
]) if (props[key] !== void 0) result[key] = props[key];
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
48
21
|
//#endregion
|
|
49
|
-
export {
|
|
22
|
+
export { layoutChildProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from "./ui2.js";
|
|
2
|
+
import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
3
|
+
//#region src/PlatformBadge.native.tsrx
|
|
4
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
5
|
+
"kind": "host",
|
|
6
|
+
"type": "label",
|
|
7
|
+
"props": { "text": "ios|android" },
|
|
8
|
+
"bindings": [["className", 0]]
|
|
9
|
+
});
|
|
10
|
+
var PlatformBadge = defineUniversalComponent("nativescript", function PlatformBadge(props) {
|
|
11
|
+
return universalValue(__octaneUniversalPlan0, [cx(props.className)]);
|
|
12
|
+
}, { "module": "@nativescript-community/octane" });
|
|
13
|
+
//#endregion
|
|
14
|
+
export { PlatformBadge };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
//#region src/route-table.ts
|
|
2
|
+
var EXT = /\.(tsrx|tsx|ts|mts|cts|js|mjs|cjs|jsx)$/;
|
|
3
|
+
var SUFFIX = /\.(web|native|ios|android)$/;
|
|
4
|
+
var PARAM = /^\[(.+)\]$/;
|
|
5
|
+
/** Component pick rule for route/layout modules: default export, then a
|
|
6
|
+
* `screen` named export, then a single function export. Route files use
|
|
7
|
+
* named exports (decision #13) — a lone component is unambiguous. */
|
|
8
|
+
function pick(mod, file) {
|
|
9
|
+
if (typeof mod?.default === "function") return mod.default;
|
|
10
|
+
if (typeof mod?.screen === "function") return mod.screen;
|
|
11
|
+
const fns = Object.keys(mod ?? {}).filter((k) => typeof mod[k] === "function");
|
|
12
|
+
if (fns.length === 1) return mod[fns[0]];
|
|
13
|
+
console.warn("[octane-xplat] route file " + file + (fns.length ? ` has ${fns.length} component-shaped exports (${fns.join(", ")}) — add a default or 'screen' export` : " has no component export") + " — skipped");
|
|
14
|
+
}
|
|
15
|
+
function deriveRouteManifest(files, prefer, dir = "app") {
|
|
16
|
+
const prefix = dir.replace(/^\.?\/?/, "").replace(/\/+$/, "") + "/";
|
|
17
|
+
const seen = /* @__PURE__ */ new Map();
|
|
18
|
+
const layoutRank = /* @__PURE__ */ new Map();
|
|
19
|
+
const layouts = {};
|
|
20
|
+
const warned = /* @__PURE__ */ new Set();
|
|
21
|
+
for (const key of Object.keys(files).sort()) {
|
|
22
|
+
let rel = key.replace(/^\.?\//, "");
|
|
23
|
+
if (rel.startsWith(prefix)) rel = rel.slice(prefix.length);
|
|
24
|
+
rel = rel.replace(EXT, "");
|
|
25
|
+
const parts = rel.split("/");
|
|
26
|
+
let base = parts[parts.length - 1];
|
|
27
|
+
const sm = SUFFIX.exec(base);
|
|
28
|
+
const suffix = sm?.[1];
|
|
29
|
+
if (sm) base = base.slice(0, base.length - sm[0].length);
|
|
30
|
+
if (suffix && !prefer.includes(suffix)) continue;
|
|
31
|
+
const rank = suffix ? prefer.indexOf(suffix) : prefer.length;
|
|
32
|
+
if (base === "_layout") {
|
|
33
|
+
const d = parts.slice(0, -1).join("/");
|
|
34
|
+
const prev = layoutRank.get(d);
|
|
35
|
+
if (prev !== void 0 && prev <= rank) continue;
|
|
36
|
+
const component = pick(files[key], key);
|
|
37
|
+
if (component) {
|
|
38
|
+
layouts[d] = component;
|
|
39
|
+
layoutRank.set(d, rank);
|
|
40
|
+
}
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const segs = parts.slice(0, -1).concat(base);
|
|
44
|
+
if (segs[segs.length - 1] === "index") segs.pop();
|
|
45
|
+
const segments = segs.map((s) => {
|
|
46
|
+
const p = PARAM.exec(s);
|
|
47
|
+
return p ? ":" + p[1] : s;
|
|
48
|
+
});
|
|
49
|
+
const name = segments.join("/") || "index";
|
|
50
|
+
const meta = {
|
|
51
|
+
name,
|
|
52
|
+
segments,
|
|
53
|
+
params: segments.filter((s) => s.startsWith(":")).map((s) => s.slice(1)),
|
|
54
|
+
file: key
|
|
55
|
+
};
|
|
56
|
+
const prev = seen.get(name);
|
|
57
|
+
if (prev && prev.rank <= rank) {
|
|
58
|
+
if (prev.rank === rank && !warned.has(name)) {
|
|
59
|
+
warned.add(name);
|
|
60
|
+
console.warn(`[octane-xplat] route '${name}' is defined by both ${prev.meta.file} and ${key} — keeping ${prev.meta.file}`);
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const component = pick(files[key], key);
|
|
65
|
+
if (component) seen.set(name, {
|
|
66
|
+
rank,
|
|
67
|
+
meta,
|
|
68
|
+
component
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const screens = {};
|
|
72
|
+
const routes = [];
|
|
73
|
+
for (const { meta, component } of seen.values()) {
|
|
74
|
+
screens[meta.name] = component;
|
|
75
|
+
routes.push(meta);
|
|
76
|
+
}
|
|
77
|
+
routes.sort((a, b) => b.segments.reduce((n, s) => n + (s.startsWith(":") ? 1 : 2), 0) - a.segments.reduce((n, s) => n + (s.startsWith(":") ? 1 : 2), 0) || a.name.localeCompare(b.name));
|
|
78
|
+
return {
|
|
79
|
+
screens,
|
|
80
|
+
routes,
|
|
81
|
+
layouts
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Serialize a Route to a URL path (no origin): manifest routes substitute
|
|
85
|
+
* `:param` segments from params (leftover params → query string);
|
|
86
|
+
* non-manifest names keep the legacy `/<stack>/<name>?params` shape. */
|
|
87
|
+
function buildRoutePath(routes, r) {
|
|
88
|
+
const meta = routes.find((m) => m.name === r.name);
|
|
89
|
+
let segs;
|
|
90
|
+
let rest = r.params;
|
|
91
|
+
if (meta) {
|
|
92
|
+
segs = meta.segments.map((s) => {
|
|
93
|
+
if (!s.startsWith(":")) return s;
|
|
94
|
+
const v = r.params[s.slice(1)];
|
|
95
|
+
if (v === void 0) console.warn(`[octane-xplat] route '${r.name}' pushed without path param ${s}`);
|
|
96
|
+
return encodeURIComponent(String(v ?? ""));
|
|
97
|
+
});
|
|
98
|
+
rest = Object.fromEntries(Object.entries(r.params).filter(([k]) => !meta.params.includes(k)));
|
|
99
|
+
} else segs = [r.name];
|
|
100
|
+
const q = Object.entries(rest).map(([k, v]) => encodeURIComponent(k) + "=" + encodeURIComponent(String(v))).join("&");
|
|
101
|
+
return (((r.stack === "root" ? "" : "/" + r.stack) + "/" + segs.join("/")).replace(/\/+$/, "") || "/") + (q ? "?" + q : "");
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { buildRoutePath, deriveRouteManifest };
|