@octane-xplat/ui 0.7.2 → 0.9.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 +4 -3
- package/dist/native/Button.tsrx.js +1 -1
- package/dist/native/CommandPalette.tsrx.js +7 -1
- package/dist/native/Grid.tsrx.js +31 -2
- package/dist/native/KeyboardAvoiding.mobile.tsrx.js +2 -2
- package/dist/native/Markdown.tsrx.js +233 -0
- package/dist/native/Overlay.tsrx.js +15 -26
- package/dist/native/Pagination.tsrx.js +15 -12
- package/dist/native/PinInput.tsrx.js +25 -7
- package/dist/native/Popover.tsrx.js +33 -23
- package/dist/native/Pressable.tsrx.js +4 -1
- package/dist/native/Screen.tsrx.js +1 -1
- package/dist/native/SearchInput.tsrx.js +6 -3
- package/dist/native/Sheet.tsrx.js +23 -38
- package/dist/native/Slider.tsrx.js +23 -14
- package/dist/native/Text.tsrx.js +16 -0
- package/dist/native/TextArea.tsrx.js +6 -3
- package/dist/native/TextInput.tsrx.js +6 -3
- package/dist/native/VirtualList.tsrx.js +305 -121
- package/dist/native/WebView.tsrx.js +17 -2
- package/dist/native/_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js +9 -0
- package/dist/native/escape-props.js +2 -0
- package/dist/native/grid-auto-placement.js +83 -0
- package/dist/native/grid-placement.js +20 -0
- package/dist/native/index.shared.js +7 -5
- package/dist/native/keyboard-inset.mobile.js +5 -5
- package/dist/native/navigation-request.js +26 -0
- package/dist/native/octane-client-build.json +1 -1
- package/dist/native/overlay-lifetime.mobile.js +65 -0
- package/dist/native/pan.tsrx.js +16 -2
- package/dist/native/route-table.js +90 -10
- package/dist/native/route.js +26 -16
- package/dist/native/shared.js +7 -5
- package/dist/native/sheet-service.js +2 -2
- package/dist/native/svg.mobile.js +1 -1
- package/dist/native/{tap-to-blur.mobile.js → tap-to-blur.ios.js} +20 -32
- package/dist/native/text-focus.js +10 -0
- package/dist/native/text-write.js +18 -11
- package/dist/native/toast-anchor.tsrx.js +1 -1
- package/dist/native/ui.js +7 -6
- package/dist/native/useMeasure.tsrx.js +17 -18
- package/dist/native/vendor/ui-svg/index.android.js +2 -2
- package/dist/native/vendor/ui-svg/index.ios.js +2 -2
- package/dist/native/vendor/ui-svg/{index.common.js → src/index.common.js} +1 -1
- package/dist/native/virtual-list-cell-pool.js +63 -0
- package/dist/web/Button.web.tsrx.js +1 -1
- package/dist/web/KeyboardAvoiding.web.tsrx.js +78 -0
- package/dist/web/Markdown.tsrx.js +98 -0
- package/dist/web/Overlay.web.tsrx.js +81 -32
- package/dist/web/PinInput.web.tsrx.js +24 -10
- package/dist/web/Pressable.web.tsrx.js +169 -53
- package/dist/web/SearchInput.web.tsrx.js +2 -2
- package/dist/web/Sheet.web.tsrx.js +20 -7
- package/dist/web/TextArea.web.tsrx.js +22 -17
- package/dist/web/TextInput.web.tsrx.js +2 -2
- package/dist/web/VirtualList.web.tsrx.js +220 -109
- package/dist/web/WebView.web.tsrx.js +3 -3
- package/dist/web/{index.shared.js → index.shared.web.js} +7 -5
- package/dist/web/modal-focus.web.js +95 -0
- package/dist/web/navigation-request.js +26 -0
- package/dist/web/octane-client-build.json +1 -1
- package/dist/web/pan.web.tsrx.js +27 -10
- package/dist/web/route-table.js +90 -10
- package/dist/web/route.web.js +88 -22
- package/dist/web/sheet-service.web.js +8 -0
- package/dist/web/theme/colorScheme.web.js +31 -4
- package/dist/web/ui.js +8 -6
- package/dist/web/virtual-list-cell-pool.js +63 -0
- package/package.json +21 -19
- package/platforms/android/native-api-usage.json +7 -7
- package/src/CommandPalette.tsrx +8 -1
- package/src/Grid.tsrx +32 -1
- package/src/Icon.macos.tsrx +1 -0
- package/src/KeyboardAvoiding.macos.tsrx +7 -1
- package/src/KeyboardAvoiding.mobile.tsrx +2 -2
- package/src/KeyboardAvoiding.tsrx +15 -0
- package/src/KeyboardAvoiding.web.tsrx +15 -0
- package/src/Markdown.tsrx +121 -0
- package/src/Meter.tsrx +1 -0
- package/src/Overlay.tsrx +15 -30
- package/src/Overlay.web.tsrx +12 -3
- package/src/Pagination.tsrx +6 -4
- package/src/PinInput.macos.tsrx +20 -6
- package/src/PinInput.mobile.test.ts +107 -0
- package/src/PinInput.tsrx +20 -6
- package/src/PinInput.web.test.tsrx +42 -0
- package/src/PinInput.web.tsrx +20 -6
- package/src/Popover.tsrx +36 -22
- package/src/Pressable.tsrx +1 -1
- package/src/Pressable.web.test.tsrx +36 -0
- package/src/Pressable.web.tsrx +37 -6
- package/src/RouteHost.macos.tsrx +1 -0
- package/src/Screen.tsrx +1 -1
- package/src/SearchInput.tsrx +4 -3
- package/src/SearchInput.web.tsrx +1 -1
- package/src/Sheet.tsrx +21 -42
- package/src/Sheet.web.tsrx +9 -1
- package/src/Slider.tsrx +13 -11
- package/src/Text.tsrx +36 -0
- package/src/TextArea.tsrx +6 -5
- package/src/TextArea.web.test.tsrx +39 -0
- package/src/TextArea.web.tsrx +7 -5
- package/src/TextInput.tsrx +6 -6
- package/src/TextInput.web.tsrx +1 -1
- package/src/VirtualList.macos.tsrx +93 -6
- package/src/VirtualList.mobile.test.tsrx +232 -0
- package/src/VirtualList.tsrx +285 -81
- package/src/VirtualList.web.tsrx +131 -25
- package/src/WebView.tsrx +20 -10
- package/src/WebView.web.tsrx +3 -0
- package/src/android/BottomNavigationView.android.tsrx +1 -0
- package/src/android/MaterialDialog.android.tsrx +1 -0
- package/src/anim.macos.tsrx +1 -0
- package/src/apply-native-modifiers.native.ts +4 -1
- package/src/child-array.ts +12 -7
- package/src/colorScheme.macos.ts +1 -0
- package/src/controls.macos.tsrx +4 -1
- package/src/data-driver.mobile.test.ts +120 -0
- package/src/data-lifecycle.mobile.test.ts +251 -0
- package/src/escape-props.ts +13 -1
- package/src/grid-auto-placement.ts +163 -0
- package/src/grid-placement.ts +29 -0
- package/src/hosted-unsupported.macos.tsrx +1 -0
- package/src/index.macos.ts +23 -3
- package/src/index.mobile.ts +0 -1
- package/src/index.shared.ts +22 -1
- package/src/index.shared.web.ts +291 -0
- package/src/index.web.ts +1 -1
- package/src/input-readiness.web.test.tsrx +82 -0
- package/src/ios/UITabBar.ios.tsrx +1 -0
- package/src/keyboard-inset.mobile.test.ts +62 -0
- package/src/keyboard-inset.mobile.ts +63 -43
- package/src/layout-shells.macos.tsrx +1 -5
- package/src/macos-extras.macos.tsrx +2 -0
- package/src/modal-focus.web.test.tsrx +63 -0
- package/src/modal-focus.web.ts +162 -0
- package/src/navigation-request.ts +37 -0
- package/src/overlay-lifecycle.mobile.test.ts +316 -0
- package/src/overlay-lifetime.mobile.ts +107 -0
- package/src/pan.mobile.test.tsrx +116 -0
- package/src/pan.tsrx +20 -2
- package/src/pan.web.tsrx +35 -7
- package/src/platformProps.ts +1 -0
- package/src/popover.mobile.test.ts +9 -1
- package/src/pressable-accessibility.mobile.test.ts +30 -0
- package/src/props.ts +163 -3
- package/src/refresh.ts +6 -1
- package/src/refresh.web.test.ts +77 -77
- package/src/route-android.test.ts +162 -0
- package/src/route-history.web.test.ts +80 -0
- package/src/route-navigation.web.test.ts +173 -0
- package/src/route-table.test.ts +188 -9
- package/src/route-table.ts +138 -10
- package/src/route.macos.ts +56 -13
- package/src/route.ts +54 -24
- package/src/route.web.ts +141 -24
- package/src/sheet-detents.ts +5 -3
- package/src/sheet-service.macos.ts +5 -1
- package/src/sheet-service.ts +1 -1
- package/src/sheet-service.web.ts +8 -0
- package/src/sheet-snap.test.ts +23 -23
- package/src/sheet-snap.ts +6 -1
- package/src/svg.mobile.ts +9 -3
- package/src/tap-to-blur.ios.ts +106 -0
- package/src/tap-to-blur.mobile.ts +21 -95
- package/src/text-focus.ts +12 -0
- package/src/text-input.mobile.test.ts +89 -0
- package/src/text-write.ts +21 -11
- package/src/theme/colorScheme.linux.ts +2 -4
- package/src/theme/colorScheme.web.ts +51 -4
- package/src/theme/theme-scheme.macos.ts +8 -2
- package/src/theme/tokens.css +1740 -1718
- package/src/translate.macos.ts +4 -1
- package/src/useMeasure.tsrx +20 -21
- package/src/virtual-list-cell-pool.test.ts +53 -0
- package/src/virtual-list-cell-pool.ts +81 -0
- package/src/virtual-list-layout.test.ts +11 -8
- package/src/virtual-list-layout.ts +4 -8
- package/src/windows.linux.ts +7 -2
- package/src/windows.macos.ts +1 -0
- package/types/generated/.tsrx-typegen-manifest.json +16 -3
- package/types/generated/Grid.d.ts +0 -1
- package/types/generated/KeyboardAvoiding.d.ts +3 -0
- package/types/generated/KeyboardAvoiding.web.d.ts +2 -0
- package/types/generated/Markdown.d.ts +59 -0
- package/types/generated/TextArea.d.ts +2 -2
- package/types/generated/TextArea.web.d.ts +1 -1
- package/types/generated/TextInput.d.ts +2 -3
- package/types/generated/VirtualList.d.ts +3 -3
- package/types/generated/escape-props.d.ts +4 -0
- package/types/generated/grid-auto-placement.d.ts +13 -0
- package/types/generated/grid-placement.d.ts +5 -0
- package/types/generated/index.mobile.d.ts +0 -1
- package/types/generated/index.shared.d.ts +6 -3
- package/types/generated/index.shared.web.d.ts +114 -0
- package/types/generated/index.web.d.ts +1 -1
- package/types/generated/modal-focus.web.d.ts +3 -0
- package/types/generated/navigation-request.d.ts +10 -0
- package/types/generated/overlay-lifetime.mobile.d.ts +10 -0
- package/types/generated/props.d.ts +111 -3
- package/types/generated/route-table.d.ts +14 -3
- package/types/generated/svg.mobile.d.ts +2 -2
- package/types/generated/tap-to-blur.ios.d.ts +13 -0
- package/types/generated/tap-to-blur.mobile.d.ts +1 -15
- package/types/generated/text-focus.d.ts +3 -0
- package/types/generated/text-write.d.ts +3 -1
- package/types/generated/theme/colorScheme.web.d.ts +5 -0
- package/types/generated/virtual-list-cell-pool.d.ts +18 -0
- package/types/index.macos.d.ts +15 -3
- /package/src/vendor/ui-svg/{index.android.ts → src/index.android.ts} +0 -0
- /package/src/vendor/ui-svg/{index.common.ts → src/index.common.ts} +0 -0
- /package/src/vendor/ui-svg/{index.ios.ts → src/index.ios.ts} +0 -0
- /package/src/vendor/ui-svg/{index.ts → src/index.ts} +0 -0
- /package/src/vendor/ui-svg/{typings → src/typings}/SVGKit.d.ts +0 -0
- /package/src/vendor/ui-svg/{typings → src/typings}/android.d.ts +0 -0
- /package/src/vendor/ui-svg/{typings → src/typings}/ios.d.ts +0 -0
- /package/types/generated/vendor/ui-svg/{index.common.d.ts → src/index.common.d.ts} +0 -0
- /package/types/generated/vendor/ui-svg/{index.d.ts → src/index.d.ts} +0 -0
- /package/types/generated/vendor/ui-svg/{index.ios.d.ts → src/index.ios.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
> the NativeScript toolchain (Xcode/JDK + `ns`).
|
|
8
8
|
|
|
9
9
|
Start with the [app creator](../create/README.md) when building a new app with
|
|
10
|
-
an agent.
|
|
11
|
-
|
|
10
|
+
an agent. Xplat's target direction covers web, iOS, Android, macOS, Windows,
|
|
11
|
+
and Linux; this package's established implementations cover web and mobile,
|
|
12
12
|
with a bounded experimental macOS surface. The Windows scaffold has not yet
|
|
13
|
-
been run on Windows, so UI support there remains unverified
|
|
13
|
+
been run on Windows, so UI support there remains unverified; Linux renders
|
|
14
|
+
the DOM surface inside an experimental WebKitGTK host. See [target support](https://octane-xplat.goddardai.org/spec#choose-your-targets).
|
|
14
15
|
|
|
15
16
|
To add the UI package to an existing configured app:
|
|
16
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
|
-
import { Pressable } from "./Pressable.tsrx.js";
|
|
3
2
|
import { ActivityIndicator } from "./ActivityIndicator.tsrx.js";
|
|
3
|
+
import { Pressable } from "./Pressable.tsrx.js";
|
|
4
4
|
import { defineUniversalComponent, markWarm, universalComponent, universalPlan, universalProps, universalValue, useBatch, warmChild } from "@nativescript-community/octane";
|
|
5
5
|
//#region src/Button.tsrx
|
|
6
6
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
@@ -3,6 +3,7 @@ import { Icon } from "./Icon.tsrx.js";
|
|
|
3
3
|
import { TextInput } from "./TextInput.tsrx.js";
|
|
4
4
|
import { Overlay } from "./Overlay.tsrx.js";
|
|
5
5
|
import { defineUniversalComponent, hookSlots, universalChildren, universalComponent, universalFor, universalPlan, universalProps, universalValue, useState } from "@nativescript-community/octane";
|
|
6
|
+
import { Screen } from "@nativescript/core";
|
|
6
7
|
//#region src/CommandPalette.tsrx
|
|
7
8
|
var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
|
|
8
9
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
@@ -31,6 +32,7 @@ var __octaneUniversalPlan3 = universalPlan("nativescript", {
|
|
|
31
32
|
"kind": "host",
|
|
32
33
|
"type": "flexboxlayout",
|
|
33
34
|
"props": {
|
|
35
|
+
"flexDirection": "column",
|
|
34
36
|
"horizontalAlignment": "center",
|
|
35
37
|
"verticalAlignment": "top",
|
|
36
38
|
"marginTop": 80
|
|
@@ -64,6 +66,10 @@ var CommandPalette = defineUniversalComponent("nativescript", function CommandPa
|
|
|
64
66
|
props.onOpenChange?.(next);
|
|
65
67
|
};
|
|
66
68
|
const shown = query ? props.items.filter((i) => (i.label ?? i.key).toLowerCase().includes(query.toLowerCase())) : props.items;
|
|
69
|
+
const panelStyle = {
|
|
70
|
+
...props.style,
|
|
71
|
+
maxWidth: props.style?.maxWidth ?? Screen.mainScreen.widthDIPs * .9
|
|
72
|
+
};
|
|
67
73
|
const select = (item) => {
|
|
68
74
|
if (item.disabled) return;
|
|
69
75
|
setOpen(false);
|
|
@@ -93,7 +99,7 @@ var CommandPalette = defineUniversalComponent("nativescript", function CommandPa
|
|
|
93
99
|
], universalChildren("nativescript", () => {
|
|
94
100
|
return universalValue(__octaneUniversalPlan3, [
|
|
95
101
|
cx("vx-commandpalette", props.className),
|
|
96
|
-
|
|
102
|
+
panelStyle,
|
|
97
103
|
props.id,
|
|
98
104
|
universalComponent("nativescript", TextInput, universalProps([
|
|
99
105
|
[
|
package/dist/native/Grid.tsrx.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
|
+
import { gridChildPlacement } from "./grid-placement.js";
|
|
2
3
|
import { applyEscapeProps, nativeAccessibilityRole, nativeAccessibilityState } from "./escape-props.js";
|
|
3
|
-
import {
|
|
4
|
+
import { autoPlaceGridChildren, ensureGridTracks } from "./grid-auto-placement.js";
|
|
5
|
+
import { defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
|
|
4
6
|
//#region src/Grid.tsrx
|
|
7
|
+
var _hs$ = /* @__PURE__ */ hookSlots(2);
|
|
8
|
+
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
9
|
+
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
5
10
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
6
11
|
"kind": "host",
|
|
7
12
|
"type": "gridlayout",
|
|
@@ -27,13 +32,37 @@ var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
|
27
32
|
});
|
|
28
33
|
var warnedAboutGap = false;
|
|
29
34
|
var Grid = defineUniversalComponent("nativescript", function Grid(props) {
|
|
35
|
+
const grid = useRef(null, _h$0);
|
|
30
36
|
if (props.gap != null && !warnedAboutGap) {
|
|
31
37
|
warnedAboutGap = true;
|
|
32
38
|
console.warn("[Grid] gap was removed; use child margins");
|
|
33
39
|
}
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const host = grid.current;
|
|
42
|
+
if (!host) return;
|
|
43
|
+
const views = [];
|
|
44
|
+
host.eachChildView((child) => {
|
|
45
|
+
views.push(child);
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
const placement = autoPlaceGridChildren(views.map(gridChildPlacement), props.rows, props.columns);
|
|
49
|
+
host.rows = ensureGridTracks(props.rows, placement.rowCount);
|
|
50
|
+
host.columns = ensureGridTracks(props.columns, placement.columnCount);
|
|
51
|
+
for (let index = 0; index < views.length; index++) {
|
|
52
|
+
views[index].row = placement.cells[index].row;
|
|
53
|
+
views[index].col = placement.cells[index].col;
|
|
54
|
+
}
|
|
55
|
+
}, [
|
|
56
|
+
props.children,
|
|
57
|
+
props.rows,
|
|
58
|
+
props.columns
|
|
59
|
+
], _h$1);
|
|
34
60
|
return universalValue(__octaneUniversalPlan0, [
|
|
35
61
|
props.id,
|
|
36
|
-
(view) =>
|
|
62
|
+
(view) => {
|
|
63
|
+
grid.current = view;
|
|
64
|
+
applyEscapeProps(view, props);
|
|
65
|
+
},
|
|
37
66
|
props.rows,
|
|
38
67
|
props.columns,
|
|
39
68
|
cx("vx-grid", props.className),
|
|
@@ -46,10 +46,10 @@ function useKeyboardInset() {
|
|
|
46
46
|
}
|
|
47
47
|
function useAndroidResize() {
|
|
48
48
|
useEffect(() => {
|
|
49
|
-
const nativeWindow = Application.android?.foregroundActivity?.
|
|
49
|
+
const nativeWindow = Application.android?.foregroundActivity?.getWindow();
|
|
50
50
|
if (!nativeWindow) return;
|
|
51
51
|
const params = android.view.WindowManager.LayoutParams;
|
|
52
|
-
const previous = nativeWindow.
|
|
52
|
+
const previous = nativeWindow.getAttributes().softInputMode;
|
|
53
53
|
const adjusted = previous & ~params.SOFT_INPUT_MASK_ADJUST | params.SOFT_INPUT_ADJUST_RESIZE;
|
|
54
54
|
nativeWindow.setSoftInputMode(adjusted);
|
|
55
55
|
return () => nativeWindow.setSoftInputMode(previous);
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { View } from "./View.tsrx.js";
|
|
2
|
+
import { Text } from "./Text.tsrx.js";
|
|
3
|
+
import { Screen } from "./Screen.tsrx.js";
|
|
4
|
+
import { ScrollView } from "./ScrollView.tsrx.js";
|
|
5
|
+
import { defineUniversalComponent, universalChildren, universalComponent, universalPlan, universalProps, universalValue } from "@nativescript-community/octane";
|
|
6
|
+
//#region src/Markdown.tsrx
|
|
7
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
8
|
+
"kind": "slot",
|
|
9
|
+
"slot": 0
|
|
10
|
+
});
|
|
11
|
+
var __octaneUniversalPlan1 = universalPlan("nativescript", {
|
|
12
|
+
"kind": "slot",
|
|
13
|
+
"slot": 0
|
|
14
|
+
});
|
|
15
|
+
var __octaneUniversalPlan2 = universalPlan("nativescript", {
|
|
16
|
+
"kind": "slot",
|
|
17
|
+
"slot": 0
|
|
18
|
+
});
|
|
19
|
+
var __octaneUniversalPlan3 = universalPlan("nativescript", {
|
|
20
|
+
"kind": "slot",
|
|
21
|
+
"slot": 0
|
|
22
|
+
});
|
|
23
|
+
var __octaneUniversalPlan4 = universalPlan("nativescript", {
|
|
24
|
+
"kind": "slot",
|
|
25
|
+
"slot": 0
|
|
26
|
+
});
|
|
27
|
+
var __octaneUniversalPlan5 = universalPlan("nativescript", {
|
|
28
|
+
"kind": "slot",
|
|
29
|
+
"slot": 0
|
|
30
|
+
});
|
|
31
|
+
var __octaneUniversalPlan6 = universalPlan("nativescript", {
|
|
32
|
+
"kind": "slot",
|
|
33
|
+
"slot": 0
|
|
34
|
+
});
|
|
35
|
+
var __octaneUniversalPlan7 = universalPlan("nativescript", {
|
|
36
|
+
"kind": "slot",
|
|
37
|
+
"slot": 0
|
|
38
|
+
});
|
|
39
|
+
var __octaneUniversalPlan8 = universalPlan("nativescript", {
|
|
40
|
+
"kind": "slot",
|
|
41
|
+
"slot": 0
|
|
42
|
+
});
|
|
43
|
+
var __octaneUniversalPlan9 = universalPlan("nativescript", {
|
|
44
|
+
"kind": "slot",
|
|
45
|
+
"slot": 0
|
|
46
|
+
});
|
|
47
|
+
var __octaneUniversalPlan10 = universalPlan("nativescript", {
|
|
48
|
+
"kind": "slot",
|
|
49
|
+
"slot": 0
|
|
50
|
+
});
|
|
51
|
+
var __octaneUniversalPlan11 = universalPlan("nativescript", {
|
|
52
|
+
"kind": "range",
|
|
53
|
+
"children": [{
|
|
54
|
+
"kind": "slot",
|
|
55
|
+
"slot": 0
|
|
56
|
+
}, {
|
|
57
|
+
"kind": "slot",
|
|
58
|
+
"slot": 1
|
|
59
|
+
}]
|
|
60
|
+
});
|
|
61
|
+
var __octaneUniversalPlan12 = universalPlan("nativescript", {
|
|
62
|
+
"kind": "slot",
|
|
63
|
+
"slot": 0
|
|
64
|
+
});
|
|
65
|
+
var __octaneUniversalPlan13 = universalPlan("nativescript", {
|
|
66
|
+
"kind": "slot",
|
|
67
|
+
"slot": 0
|
|
68
|
+
});
|
|
69
|
+
var __octaneUniversalPlan14 = universalPlan("nativescript", {
|
|
70
|
+
"kind": "slot",
|
|
71
|
+
"slot": 0
|
|
72
|
+
});
|
|
73
|
+
var __octaneUniversalPlan15 = universalPlan("nativescript", {
|
|
74
|
+
"kind": "slot",
|
|
75
|
+
"slot": 0
|
|
76
|
+
});
|
|
77
|
+
var __octaneUniversalPlan16 = universalPlan("nativescript", {
|
|
78
|
+
"kind": "slot",
|
|
79
|
+
"slot": 0
|
|
80
|
+
});
|
|
81
|
+
var __octaneUniversalPlan17 = universalPlan("nativescript", {
|
|
82
|
+
"kind": "slot",
|
|
83
|
+
"slot": 0
|
|
84
|
+
});
|
|
85
|
+
var __octaneUniversalPlan18 = universalPlan("nativescript", {
|
|
86
|
+
"kind": "slot",
|
|
87
|
+
"slot": 0
|
|
88
|
+
});
|
|
89
|
+
var __octaneUniversalPlan19 = universalPlan("nativescript", {
|
|
90
|
+
"kind": "slot",
|
|
91
|
+
"slot": 0
|
|
92
|
+
});
|
|
93
|
+
var headingClass = [
|
|
94
|
+
"text-2xl font-bold",
|
|
95
|
+
"text-xl font-semibold",
|
|
96
|
+
"text-lg font-semibold"
|
|
97
|
+
];
|
|
98
|
+
var Inlines = defineUniversalComponent("nativescript", function Inlines(props) {
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const n of props.nodes ?? []) switch (n.t) {
|
|
101
|
+
case "code":
|
|
102
|
+
out.push(universalValue(__octaneUniversalPlan0, [universalComponent("nativescript", Text, universalProps([[
|
|
103
|
+
"set",
|
|
104
|
+
"style",
|
|
105
|
+
{ fontFamily: "ui-monospace" }
|
|
106
|
+
]], n.text))]));
|
|
107
|
+
break;
|
|
108
|
+
case "bold":
|
|
109
|
+
out.push(universalValue(__octaneUniversalPlan2, [universalComponent("nativescript", Text, universalProps([[
|
|
110
|
+
"set",
|
|
111
|
+
"className",
|
|
112
|
+
"font-bold"
|
|
113
|
+
]], universalChildren("nativescript", () => {
|
|
114
|
+
return universalValue(__octaneUniversalPlan1, [universalComponent("nativescript", Inlines, universalProps([[
|
|
115
|
+
"set",
|
|
116
|
+
"nodes",
|
|
117
|
+
n.children
|
|
118
|
+
]]))]);
|
|
119
|
+
})))]));
|
|
120
|
+
break;
|
|
121
|
+
case "em":
|
|
122
|
+
out.push(universalValue(__octaneUniversalPlan4, [universalComponent("nativescript", Text, universalProps([[
|
|
123
|
+
"set",
|
|
124
|
+
"style",
|
|
125
|
+
{ fontStyle: "italic" }
|
|
126
|
+
]], universalChildren("nativescript", () => {
|
|
127
|
+
return universalValue(__octaneUniversalPlan3, [universalComponent("nativescript", Inlines, universalProps([[
|
|
128
|
+
"set",
|
|
129
|
+
"nodes",
|
|
130
|
+
n.children
|
|
131
|
+
]]))]);
|
|
132
|
+
})))]));
|
|
133
|
+
break;
|
|
134
|
+
case "link":
|
|
135
|
+
out.push(universalValue(__octaneUniversalPlan5, [universalComponent("nativescript", Text, universalProps([[
|
|
136
|
+
"set",
|
|
137
|
+
"style",
|
|
138
|
+
{ textDecorationLine: "underline" }
|
|
139
|
+
]], n.text))]));
|
|
140
|
+
break;
|
|
141
|
+
default: out.push(n.text);
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
}, { "module": "@nativescript-community/octane" });
|
|
145
|
+
var Markdown = defineUniversalComponent("nativescript", function Markdown(props) {
|
|
146
|
+
return universalValue(__octaneUniversalPlan16, [universalComponent("nativescript", View, universalProps([[
|
|
147
|
+
"set",
|
|
148
|
+
"className",
|
|
149
|
+
"gap-3"
|
|
150
|
+
]], (props.data?.children ?? []).map((node) => {
|
|
151
|
+
switch (node.t) {
|
|
152
|
+
case "h": return universalValue(__octaneUniversalPlan7, [universalComponent("nativescript", Text, universalProps([[
|
|
153
|
+
"set",
|
|
154
|
+
"className",
|
|
155
|
+
headingClass[node.depth - 1] ?? "font-semibold"
|
|
156
|
+
]], universalChildren("nativescript", () => {
|
|
157
|
+
return universalValue(__octaneUniversalPlan6, [universalComponent("nativescript", Inlines, universalProps([[
|
|
158
|
+
"set",
|
|
159
|
+
"nodes",
|
|
160
|
+
node.children
|
|
161
|
+
]]))]);
|
|
162
|
+
})))]);
|
|
163
|
+
case "p": return universalValue(__octaneUniversalPlan9, [universalComponent("nativescript", Text, universalProps([], universalChildren("nativescript", () => {
|
|
164
|
+
return universalValue(__octaneUniversalPlan8, [universalComponent("nativescript", Inlines, universalProps([[
|
|
165
|
+
"set",
|
|
166
|
+
"nodes",
|
|
167
|
+
node.children
|
|
168
|
+
]]))]);
|
|
169
|
+
})))]);
|
|
170
|
+
case "code": return universalValue(__octaneUniversalPlan10, [universalComponent("nativescript", Text, universalProps([[
|
|
171
|
+
"set",
|
|
172
|
+
"className",
|
|
173
|
+
"text-sm"
|
|
174
|
+
], [
|
|
175
|
+
"set",
|
|
176
|
+
"style",
|
|
177
|
+
{ fontFamily: "ui-monospace" }
|
|
178
|
+
]], node.text))]);
|
|
179
|
+
case "list": return node.items.map((item, i) => universalValue(__octaneUniversalPlan12, [universalComponent("nativescript", Text, universalProps([], universalChildren("nativescript", () => {
|
|
180
|
+
return universalValue(__octaneUniversalPlan11, [node.ordered ? `${i + 1}. ` : "• ", universalComponent("nativescript", Inlines, universalProps([[
|
|
181
|
+
"set",
|
|
182
|
+
"nodes",
|
|
183
|
+
item
|
|
184
|
+
]]))]);
|
|
185
|
+
})))]));
|
|
186
|
+
case "quote": return universalValue(__octaneUniversalPlan14, [universalComponent("nativescript", Text, universalProps([[
|
|
187
|
+
"set",
|
|
188
|
+
"className",
|
|
189
|
+
"text-muted"
|
|
190
|
+
], [
|
|
191
|
+
"set",
|
|
192
|
+
"style",
|
|
193
|
+
{ fontStyle: "italic" }
|
|
194
|
+
]], universalChildren("nativescript", () => {
|
|
195
|
+
return universalValue(__octaneUniversalPlan13, [universalComponent("nativescript", Inlines, universalProps([[
|
|
196
|
+
"set",
|
|
197
|
+
"nodes",
|
|
198
|
+
node.children
|
|
199
|
+
]]))]);
|
|
200
|
+
})))]);
|
|
201
|
+
case "hr": return universalValue(__octaneUniversalPlan15, [universalComponent("nativescript", View, universalProps([[
|
|
202
|
+
"set",
|
|
203
|
+
"style",
|
|
204
|
+
{
|
|
205
|
+
height: 1,
|
|
206
|
+
backgroundColor: "var(--color-border)"
|
|
207
|
+
}
|
|
208
|
+
]]))]);
|
|
209
|
+
default: return null;
|
|
210
|
+
}
|
|
211
|
+
})))]);
|
|
212
|
+
}, { "module": "@nativescript-community/octane" });
|
|
213
|
+
var MarkdownScreen = defineUniversalComponent("nativescript", function MarkdownScreen(props) {
|
|
214
|
+
return universalValue(__octaneUniversalPlan19, [universalComponent("nativescript", Screen, universalProps([[
|
|
215
|
+
"set",
|
|
216
|
+
"className",
|
|
217
|
+
"vx-app"
|
|
218
|
+
]], universalChildren("nativescript", () => {
|
|
219
|
+
return universalValue(__octaneUniversalPlan18, [universalComponent("nativescript", ScrollView, universalProps([[
|
|
220
|
+
"set",
|
|
221
|
+
"style",
|
|
222
|
+
{ padding: 16 }
|
|
223
|
+
]], universalChildren("nativescript", () => {
|
|
224
|
+
return universalValue(__octaneUniversalPlan17, [universalComponent("nativescript", Markdown, universalProps([[
|
|
225
|
+
"set",
|
|
226
|
+
"data",
|
|
227
|
+
props.data
|
|
228
|
+
]]))]);
|
|
229
|
+
})))]);
|
|
230
|
+
})))]);
|
|
231
|
+
}, { "module": "@nativescript-community/octane" });
|
|
232
|
+
//#endregion
|
|
233
|
+
export { Markdown, MarkdownScreen };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
|
-
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
3
2
|
import { rootLayoutFor } from "./root-layout.mobile.js";
|
|
3
|
+
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
4
|
+
import { createOverlayLifetime } from "./overlay-lifetime.mobile.js";
|
|
4
5
|
import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
|
|
5
6
|
import { GridLayout, isAndroid, isIOS } from "@nativescript/core";
|
|
6
7
|
//#region src/Overlay.tsrx
|
|
7
|
-
var _hs$ = /* @__PURE__ */ hookSlots(
|
|
8
|
+
var _hs$ = /* @__PURE__ */ hookSlots(5);
|
|
8
9
|
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
9
10
|
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
10
11
|
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
11
12
|
var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
|
|
13
|
+
var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
|
|
12
14
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
13
15
|
"kind": "range",
|
|
14
16
|
"children": [{
|
|
@@ -33,19 +35,12 @@ var Overlay = defineUniversalComponent("nativescript", function Overlay(props) {
|
|
|
33
35
|
useEffect(() => {
|
|
34
36
|
const current = shown.current;
|
|
35
37
|
if (!props.open) {
|
|
36
|
-
|
|
37
|
-
current.dismissOnClose = false;
|
|
38
|
-
shown.current = null;
|
|
39
|
-
const rl = rootLayout();
|
|
40
|
-
if (rl && rl?.hasChild?.(current.host)) rl.close(current.host).then(() => current.root.unmount?.(), (error) => {
|
|
41
|
-
console.error("[Overlay] close failed", error);
|
|
42
|
-
current.root.unmount?.();
|
|
43
|
-
});
|
|
44
|
-
else current.root.unmount?.();
|
|
38
|
+
current?.lifetime.close();
|
|
45
39
|
return;
|
|
46
40
|
}
|
|
47
41
|
if (current) {
|
|
48
42
|
current.root.render(OverlayBody, { children: props.children });
|
|
43
|
+
current.unbindTheme?.();
|
|
49
44
|
current.unbindTheme = applyThemeClasses(current.host, cx("vx-overlay-host", props.className));
|
|
50
45
|
if (props.style) Object.assign(current.host.style, props.style);
|
|
51
46
|
Object.assign(current.host, isIOS ? props.ios : isAndroid ? props.android : void 0);
|
|
@@ -60,31 +55,24 @@ var Overlay = defineUniversalComponent("nativescript", function Overlay(props) {
|
|
|
60
55
|
if (props.style) Object.assign(host.style, props.style);
|
|
61
56
|
Object.assign(host, isIOS ? props.ios : isAndroid ? props.android : void 0);
|
|
62
57
|
const root = createNativeScriptRoot(host);
|
|
58
|
+
const lifetime = createOverlayLifetime(rl, host, root, "Overlay", (dismissed) => {
|
|
59
|
+
if (shown.current?.host === host) shown.current = null;
|
|
60
|
+
if (dismissed) dismiss.current?.();
|
|
61
|
+
});
|
|
63
62
|
const opened = {
|
|
64
63
|
host,
|
|
65
64
|
root,
|
|
66
|
-
|
|
65
|
+
lifetime,
|
|
67
66
|
unbindTheme
|
|
68
67
|
};
|
|
68
|
+
lifetime.own(() => opened.unbindTheme?.());
|
|
69
69
|
shown.current = opened;
|
|
70
70
|
root.render(OverlayBody, { children: props.children });
|
|
71
|
-
|
|
72
|
-
if (shown.current === opened) shown.current = null;
|
|
73
|
-
opened.unbindTheme?.();
|
|
74
|
-
root.unmount?.();
|
|
75
|
-
if (opened.dismissOnClose) dismiss.current?.();
|
|
76
|
-
});
|
|
77
|
-
const open = () => rl.open(host, props.shadeCover ? { shadeCover: {
|
|
71
|
+
lifetime.open(props.shadeCover ? { shadeCover: {
|
|
78
72
|
opacity: .45,
|
|
79
73
|
color: "#000000",
|
|
80
74
|
tapToClose: true
|
|
81
|
-
} } : {})
|
|
82
|
-
if (shown.current === opened) shown.current = null;
|
|
83
|
-
console.error("[Overlay] open failed", error);
|
|
84
|
-
root.unmount?.();
|
|
85
|
-
});
|
|
86
|
-
if (rl.hasChild?.(host)) rl.close(host).then(open, (error) => console.error("[Overlay] stale host close failed", error));
|
|
87
|
-
else open();
|
|
75
|
+
} } : {});
|
|
88
76
|
}, [
|
|
89
77
|
props.open,
|
|
90
78
|
props.children,
|
|
@@ -94,6 +82,7 @@ var Overlay = defineUniversalComponent("nativescript", function Overlay(props) {
|
|
|
94
82
|
props.ios,
|
|
95
83
|
props.android
|
|
96
84
|
], _h$3);
|
|
85
|
+
useEffect(() => () => shown.current?.lifetime.close(), [], _h$4);
|
|
97
86
|
return universalValue(__octaneUniversalPlan1, [(v) => {
|
|
98
87
|
hostView.current = v;
|
|
99
88
|
}, {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
2
|
import { applyEscapeProps } from "./escape-props.js";
|
|
3
|
-
import { defineUniversalComponent, universalFor, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
3
|
+
import { defineUniversalComponent, universalFor, universalIf, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
4
4
|
//#region src/Pagination.tsrx
|
|
5
5
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
6
|
-
"kind": "range",
|
|
7
|
-
"children": []
|
|
8
|
-
});
|
|
9
|
-
var __octaneUniversalPlan1 = universalPlan("nativescript", {
|
|
10
6
|
"kind": "host",
|
|
11
7
|
"type": "label",
|
|
12
8
|
"props": {
|
|
@@ -14,7 +10,7 @@ var __octaneUniversalPlan1 = universalPlan("nativescript", {
|
|
|
14
10
|
"text": "…"
|
|
15
11
|
}
|
|
16
12
|
});
|
|
17
|
-
var
|
|
13
|
+
var __octaneUniversalPlan1 = universalPlan("nativescript", {
|
|
18
14
|
"kind": "host",
|
|
19
15
|
"type": "flexboxlayout",
|
|
20
16
|
"bindings": [["className", 0], ["onTap", 1]],
|
|
@@ -24,6 +20,10 @@ var __octaneUniversalPlan2 = universalPlan("nativescript", {
|
|
|
24
20
|
"bindings": [["text", 2]]
|
|
25
21
|
}]
|
|
26
22
|
});
|
|
23
|
+
var __octaneUniversalPlan2 = universalPlan("nativescript", {
|
|
24
|
+
"kind": "slot",
|
|
25
|
+
"slot": 0
|
|
26
|
+
});
|
|
27
27
|
var __octaneUniversalPlan3 = universalPlan("nativescript", {
|
|
28
28
|
"kind": "host",
|
|
29
29
|
"type": "flexboxlayout",
|
|
@@ -93,12 +93,15 @@ var Pagination = defineUniversalComponent("nativescript", function Pagination(pr
|
|
|
93
93
|
props.style,
|
|
94
94
|
() => go(current - 1),
|
|
95
95
|
universalFor(pages, (e, __octaneUniversalIndex) => e.key, (e, __octaneUniversalIndex) => {
|
|
96
|
-
e.page == null
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
return universalValue(__octaneUniversalPlan2, [universalIf(e.page == null, () => {
|
|
97
|
+
return universalValue(__octaneUniversalPlan0, []);
|
|
98
|
+
}, () => {
|
|
99
|
+
return universalValue(__octaneUniversalPlan1, [
|
|
100
|
+
cx("vx-page-btn", e.page === current && "vx-page-btn--on"),
|
|
101
|
+
() => go(e.page),
|
|
102
|
+
String(e.page)
|
|
103
|
+
]);
|
|
104
|
+
})]);
|
|
102
105
|
}),
|
|
103
106
|
() => go(current + 1)
|
|
104
107
|
]);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
2
|
import { applyEscapeProps } from "./escape-props.js";
|
|
3
3
|
import { TextInput } from "./TextInput.tsrx.js";
|
|
4
|
-
import { defineUniversalComponent, hookSlots, universalComponent, universalFor, universalPlan, universalProps, universalValue, useState } from "@nativescript-community/octane";
|
|
4
|
+
import { defineUniversalComponent, hookSlots, universalComponent, universalFor, universalPlan, universalProps, universalValue, useEffect, useRef, useState } from "@nativescript-community/octane";
|
|
5
5
|
//#region src/PinInput.tsrx
|
|
6
|
-
var
|
|
6
|
+
var _hs$ = /* @__PURE__ */ hookSlots(4);
|
|
7
|
+
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
8
|
+
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
9
|
+
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
10
|
+
var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
|
|
7
11
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
8
12
|
"kind": "slot",
|
|
9
13
|
"slot": 0
|
|
@@ -28,7 +32,15 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
|
|
|
28
32
|
const [internal, setInternal] = useState("", _h$0);
|
|
29
33
|
const controlled = props.value !== void 0;
|
|
30
34
|
const value = controlled ? props.value : internal;
|
|
31
|
-
const handles = [];
|
|
35
|
+
const handles = useRef([], _h$1);
|
|
36
|
+
const pendingFocus = useRef(null, _h$2);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const next = pendingFocus.current;
|
|
39
|
+
if (next !== null && next <= value.length) {
|
|
40
|
+
pendingFocus.current = null;
|
|
41
|
+
handles.current[next]?.focus();
|
|
42
|
+
}
|
|
43
|
+
}, [value], _h$3);
|
|
32
44
|
const setValue = (next) => {
|
|
33
45
|
const clipped = next.slice(0, length);
|
|
34
46
|
if (!controlled) setInternal(clipped);
|
|
@@ -37,10 +49,16 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
|
|
|
37
49
|
};
|
|
38
50
|
const cellValue = (i) => value[i] ?? "";
|
|
39
51
|
const enter = (i, text) => {
|
|
52
|
+
if (props.disabled || i > value.length) return;
|
|
40
53
|
const ch = text.slice(-1);
|
|
41
|
-
const next = (value.slice(0, i) + ch + value.slice(i + 1)).slice(0, length);
|
|
54
|
+
const next = ch ? (value.slice(0, i) + ch + value.slice(i + 1)).slice(0, length) : value.slice(0, i);
|
|
55
|
+
pendingFocus.current = ch && i < length - 1 ? i + 1 : null;
|
|
42
56
|
setValue(next);
|
|
43
|
-
if (
|
|
57
|
+
if (pendingFocus.current !== null && pendingFocus.current <= value.length) {
|
|
58
|
+
const index = pendingFocus.current;
|
|
59
|
+
pendingFocus.current = null;
|
|
60
|
+
handles.current[index]?.focus();
|
|
61
|
+
}
|
|
44
62
|
};
|
|
45
63
|
return universalValue(__octaneUniversalPlan1, [
|
|
46
64
|
(v) => applyEscapeProps(v, props),
|
|
@@ -67,7 +85,7 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
|
|
|
67
85
|
[
|
|
68
86
|
"set",
|
|
69
87
|
"editable",
|
|
70
|
-
!props.disabled
|
|
88
|
+
!props.disabled && i <= value.length
|
|
71
89
|
],
|
|
72
90
|
[
|
|
73
91
|
"set",
|
|
@@ -83,7 +101,7 @@ var PinInput = defineUniversalComponent("nativescript", function PinInput(props)
|
|
|
83
101
|
"set",
|
|
84
102
|
"bind",
|
|
85
103
|
(h) => {
|
|
86
|
-
handles[i] = h;
|
|
104
|
+
handles.current[i] = h;
|
|
87
105
|
}
|
|
88
106
|
]
|
|
89
107
|
]))]);
|