@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
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
|
+
import { rootLayoutFor } from "./root-layout.mobile.js";
|
|
2
3
|
import { applyNativeProps } from "./platformProps.js";
|
|
3
4
|
import { positionPopover } from "./popover-position.js";
|
|
4
5
|
import { applyThemeClasses, useThemeScheme } from "./theme/theme-scheme.js";
|
|
5
|
-
import {
|
|
6
|
+
import { createOverlayLifetime } from "./overlay-lifetime.mobile.js";
|
|
6
7
|
import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef, useState, withSlot } from "@nativescript-community/octane";
|
|
7
|
-
import { GridLayout } from "@nativescript/core";
|
|
8
|
+
import { GridLayout, Screen, isIOS } from "@nativescript/core";
|
|
8
9
|
//#region src/Popover.tsrx
|
|
9
|
-
var _hs$ = /* @__PURE__ */ hookSlots(
|
|
10
|
+
var _hs$ = /* @__PURE__ */ hookSlots(11);
|
|
10
11
|
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
11
12
|
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
12
13
|
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
@@ -15,6 +16,9 @@ var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
|
|
|
15
16
|
var _h$5 = /* @__PURE__ */ Symbol(_hs$ + 5);
|
|
16
17
|
var _h$6 = /* @__PURE__ */ Symbol(_hs$ + 6);
|
|
17
18
|
var _h$7 = /* @__PURE__ */ Symbol(_hs$ + 7);
|
|
19
|
+
var _h$8 = /* @__PURE__ */ Symbol(_hs$ + 8);
|
|
20
|
+
var _h$9 = /* @__PURE__ */ Symbol(_hs$ + 9);
|
|
21
|
+
var _h$10 = /* @__PURE__ */ Symbol(_hs$ + 10);
|
|
18
22
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
19
23
|
"kind": "host",
|
|
20
24
|
"type": "gridlayout",
|
|
@@ -85,7 +89,14 @@ var PopoverLayer = defineUniversalComponent("nativescript", function PopoverLaye
|
|
|
85
89
|
width: coordinateRoot.getActualSize().width,
|
|
86
90
|
height: coordinateRoot.getActualSize().height
|
|
87
91
|
}, props.placement ?? "bottom");
|
|
88
|
-
|
|
92
|
+
const insets = isIOS ? panelRef.current?.parent?.getSafeAreaInsets?.() : void 0;
|
|
93
|
+
const scale = isIOS ? Number(Screen.mainScreen.scale) || 1 : 1;
|
|
94
|
+
const panelPosition = {
|
|
95
|
+
...next,
|
|
96
|
+
left: next.left - Number(insets?.left ?? 0) / scale,
|
|
97
|
+
top: next.top - Number(insets?.top ?? 0) / scale
|
|
98
|
+
};
|
|
99
|
+
setPosition((current) => current?.left === panelPosition.left && current?.top === panelPosition.top && current?.placement === panelPosition.placement ? current : panelPosition);
|
|
89
100
|
if (panelSize?.width > 0 && panelSize?.height > 0) setSettled(true);
|
|
90
101
|
};
|
|
91
102
|
useEffect(() => {
|
|
@@ -116,16 +127,19 @@ var PopoverLayer = defineUniversalComponent("nativescript", function PopoverLaye
|
|
|
116
127
|
props.children,
|
|
117
128
|
props.style
|
|
118
129
|
], _h$3);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (position) (panelRef.current?.parent)?.requestLayout?.();
|
|
132
|
+
}, [position], _h$4);
|
|
119
133
|
useEffect(() => {
|
|
120
134
|
applyNativeProps(panelRef.current, props);
|
|
121
135
|
}, [
|
|
122
136
|
props.ios,
|
|
123
137
|
props.android,
|
|
124
138
|
settled
|
|
125
|
-
], _h$
|
|
139
|
+
], _h$5);
|
|
126
140
|
const dismiss = () => props.onDismiss?.();
|
|
127
141
|
return universalValue(__octaneUniversalPlan1, [
|
|
128
|
-
cx("vx-popover-layer", withSlot(_h$
|
|
142
|
+
cx("vx-popover-layer", withSlot(_h$6, useThemeScheme) === "dark" && "ns-dark"),
|
|
129
143
|
(props.dismissOnOutsideTap ?? true) && universalValue(__octaneUniversalPlan0, ["transparent", dismiss]),
|
|
130
144
|
panelRef,
|
|
131
145
|
position?.left ?? 0,
|
|
@@ -139,19 +153,13 @@ var PopoverLayer = defineUniversalComponent("nativescript", function PopoverLaye
|
|
|
139
153
|
]);
|
|
140
154
|
}, { "module": "@nativescript-community/octane" });
|
|
141
155
|
var Popover = defineUniversalComponent("nativescript", function Popover(props) {
|
|
142
|
-
const shown = useRef(null, _h$
|
|
156
|
+
const shown = useRef(null, _h$7);
|
|
157
|
+
const dismiss = useRef(props.onDismiss, _h$8);
|
|
158
|
+
dismiss.current = props.onDismiss;
|
|
143
159
|
useEffect(() => {
|
|
144
160
|
const cur = shown.current;
|
|
145
161
|
if (!props.open) {
|
|
146
|
-
|
|
147
|
-
shown.current = null;
|
|
148
|
-
cur.unbindTheme?.();
|
|
149
|
-
const owner = cur.host.parent;
|
|
150
|
-
if (owner?.hasChild?.(cur.host)) owner.close(cur.host).then(() => cur.root.unmount?.(), (error) => {
|
|
151
|
-
console.error("[Popover] close failed", error);
|
|
152
|
-
cur.root.unmount?.();
|
|
153
|
-
});
|
|
154
|
-
else cur.root.unmount?.();
|
|
162
|
+
cur?.lifetime.close();
|
|
155
163
|
return;
|
|
156
164
|
}
|
|
157
165
|
const anchor = props.anchor?.current;
|
|
@@ -169,20 +177,21 @@ var Popover = defineUniversalComponent("nativescript", function Popover(props) {
|
|
|
169
177
|
host.horizontalAlignment = "stretch";
|
|
170
178
|
host.verticalAlignment = "stretch";
|
|
171
179
|
const root = createNativeScriptRoot(host);
|
|
180
|
+
const lifetime = createOverlayLifetime(rl, host, root, "Popover", (dismissed) => {
|
|
181
|
+
if (shown.current?.host === host) shown.current = null;
|
|
182
|
+
if (dismissed) dismiss.current?.();
|
|
183
|
+
});
|
|
184
|
+
lifetime.own(unbindTheme);
|
|
172
185
|
shown.current = {
|
|
173
186
|
host,
|
|
174
187
|
root,
|
|
175
|
-
|
|
188
|
+
lifetime
|
|
176
189
|
};
|
|
177
190
|
root.render(PopoverLayer, {
|
|
178
191
|
...props,
|
|
179
192
|
anchorView: anchor
|
|
180
193
|
});
|
|
181
|
-
|
|
182
|
-
if (shown.current?.host === host) shown.current = null;
|
|
183
|
-
console.error("[Popover] open failed", error);
|
|
184
|
-
root.unmount?.();
|
|
185
|
-
});
|
|
194
|
+
lifetime.open();
|
|
186
195
|
}, [
|
|
187
196
|
props.open,
|
|
188
197
|
props.children,
|
|
@@ -190,7 +199,8 @@ var Popover = defineUniversalComponent("nativescript", function Popover(props) {
|
|
|
190
199
|
props.className,
|
|
191
200
|
props.style,
|
|
192
201
|
props.dismissOnOutsideTap
|
|
193
|
-
], _h$
|
|
202
|
+
], _h$9);
|
|
203
|
+
useEffect(() => () => shown.current?.lifetime.close(), [], _h$10);
|
|
194
204
|
return universalValue(__octaneUniversalPlan2, []);
|
|
195
205
|
}, { "module": "@nativescript-community/octane" });
|
|
196
206
|
//#endregion
|
|
@@ -76,7 +76,10 @@ var Pressable = defineUniversalComponent("nativescript", function Pressable(prop
|
|
|
76
76
|
[
|
|
77
77
|
"set",
|
|
78
78
|
"accessibilityState",
|
|
79
|
-
nativeAccessibilityState(
|
|
79
|
+
nativeAccessibilityState({
|
|
80
|
+
...props.accessibilityState,
|
|
81
|
+
disabled: props.disabled || props.accessibilityState?.disabled
|
|
82
|
+
})
|
|
80
83
|
],
|
|
81
84
|
[
|
|
82
85
|
"set",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
2
|
import { applyEscapeProps } from "./escape-props.js";
|
|
3
3
|
import { registerRootLayout, unregisterRootLayout } from "./root-layout.mobile.js";
|
|
4
|
-
import { attachTapToBlur } from "./tap-to-blur.
|
|
4
|
+
import { attachTapToBlur } from "./tap-to-blur.ios.js";
|
|
5
5
|
import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
|
|
6
6
|
//#region src/Screen.tsrx
|
|
7
7
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
2
|
import { applyEscapeProps } from "./escape-props.js";
|
|
3
3
|
import { Icon } from "./Icon.tsrx.js";
|
|
4
|
-
import { writeText } from "./text-write.js";
|
|
4
|
+
import { isWritingText, writeText } from "./text-write.js";
|
|
5
|
+
import { blurText } from "./text-focus.js";
|
|
5
6
|
import { defineUniversalComponent, hookSlots, markWarm, universalComponent, universalPlan, universalProps, universalValue, useBatch, useEffect, useRef, useState, warmChild } from "@nativescript-community/octane";
|
|
6
7
|
//#region src/SearchInput.tsrx
|
|
7
8
|
var _hs$ = /* @__PURE__ */ hookSlots(3);
|
|
@@ -116,13 +117,15 @@ var SearchInput = defineUniversalComponent("nativescript", markWarm(function Sea
|
|
|
116
117
|
if (!v) return;
|
|
117
118
|
props.bind?.({
|
|
118
119
|
focus: () => v.focus(),
|
|
119
|
-
blur: () =>
|
|
120
|
+
blur: () => blurText(v),
|
|
120
121
|
native: v
|
|
121
122
|
});
|
|
122
123
|
},
|
|
123
124
|
props.placeholder,
|
|
124
125
|
props.editable ?? true,
|
|
125
|
-
(e) =>
|
|
126
|
+
(e) => {
|
|
127
|
+
if (!isWritingText(e.object)) setValue(e.value);
|
|
128
|
+
},
|
|
126
129
|
props.onSubmit,
|
|
127
130
|
props.onFocus,
|
|
128
131
|
props.onBlur,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
|
-
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
3
2
|
import { rootLayoutFor } from "./root-layout.mobile.js";
|
|
4
|
-
import { attachTapToBlur } from "./tap-to-blur.
|
|
3
|
+
import { attachTapToBlur } from "./tap-to-blur.ios.js";
|
|
4
|
+
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
5
|
+
import { createOverlayLifetime } from "./overlay-lifetime.mobile.js";
|
|
5
6
|
import { attachSheetDetents } from "./sheet-detents.js";
|
|
6
7
|
import { bindBottomInsetToKeyboard } from "./keyboard-inset.mobile.js";
|
|
7
8
|
import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
|
|
8
9
|
import { GridLayout, isAndroid, isIOS } from "@nativescript/core";
|
|
9
10
|
//#region src/Sheet.tsrx
|
|
10
|
-
var _hs$ = /* @__PURE__ */ hookSlots(
|
|
11
|
+
var _hs$ = /* @__PURE__ */ hookSlots(5);
|
|
11
12
|
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
12
13
|
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
13
14
|
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
15
|
+
var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
|
|
16
|
+
var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
|
|
14
17
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
15
18
|
"kind": "range",
|
|
16
19
|
"children": [{
|
|
@@ -29,19 +32,12 @@ var SheetBody = defineUniversalComponent("nativescript", function SheetBody(prop
|
|
|
29
32
|
var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
|
|
30
33
|
const sentinel = useRef(null, _h$0);
|
|
31
34
|
const shown = useRef(null, _h$1);
|
|
35
|
+
const dismiss = useRef(props.onDismiss, _h$2);
|
|
36
|
+
dismiss.current = props.onDismiss;
|
|
32
37
|
useEffect(() => {
|
|
33
38
|
const cur = shown.current;
|
|
34
39
|
if (!props.open) {
|
|
35
|
-
|
|
36
|
-
shown.current = null;
|
|
37
|
-
cur.programmatic = true;
|
|
38
|
-
cur.unbindTheme?.();
|
|
39
|
-
cur.unbindKeyboard?.();
|
|
40
|
-
cur.root.unmount?.();
|
|
41
|
-
const owner = cur.host.parent;
|
|
42
|
-
if (owner?.hasChild?.(cur.host)) owner.close(cur.host).catch((error) => {
|
|
43
|
-
console.error("[Sheet] close failed", error);
|
|
44
|
-
});
|
|
40
|
+
cur?.lifetime.close();
|
|
45
41
|
return;
|
|
46
42
|
}
|
|
47
43
|
const rl = rootLayoutFor(sentinel.current);
|
|
@@ -57,32 +53,26 @@ var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
|
|
|
57
53
|
if (props.style) Object.assign(host.style, props.style);
|
|
58
54
|
Object.assign(host, isIOS ? props.ios : isAndroid ? props.android : void 0);
|
|
59
55
|
const root = createNativeScriptRoot(host);
|
|
56
|
+
const lifetime = createOverlayLifetime(rl, host, root, "Sheet", (dismissed) => {
|
|
57
|
+
if (shown.current?.host === host) shown.current = null;
|
|
58
|
+
if (dismissed) dismiss.current?.();
|
|
59
|
+
});
|
|
60
|
+
lifetime.own(unbindTheme);
|
|
60
61
|
const detents = props.detents?.length ? attachSheetDetents(host, props.detents, () => {
|
|
61
62
|
host.parent?.close?.(host)?.catch?.((error) => {
|
|
62
63
|
console.error("[Sheet] close failed", error);
|
|
63
64
|
});
|
|
64
65
|
}) : null;
|
|
65
|
-
|
|
66
|
-
attachTapToBlur(host);
|
|
67
|
-
|
|
66
|
+
lifetime.own(bindBottomInsetToKeyboard(host));
|
|
67
|
+
lifetime.own(attachTapToBlur(host));
|
|
68
|
+
if (detents) lifetime.own(detents.detach);
|
|
69
|
+
shown.current = {
|
|
68
70
|
host,
|
|
69
71
|
root,
|
|
70
|
-
|
|
71
|
-
unbindKeyboard,
|
|
72
|
-
programmatic: false,
|
|
73
|
-
detach: detents?.detach
|
|
72
|
+
lifetime
|
|
74
73
|
};
|
|
75
|
-
shown.current = opened;
|
|
76
74
|
root.render(SheetBody, { children: props.children });
|
|
77
|
-
|
|
78
|
-
if (shown.current === opened) shown.current = null;
|
|
79
|
-
opened.detach?.();
|
|
80
|
-
opened.unbindKeyboard?.();
|
|
81
|
-
opened.unbindTheme?.();
|
|
82
|
-
opened.root.unmount?.();
|
|
83
|
-
if (!opened.programmatic) props.onDismiss?.();
|
|
84
|
-
});
|
|
85
|
-
rl.open(host, {
|
|
75
|
+
lifetime.open({
|
|
86
76
|
...props.shadeCover ?? true ? { shadeCover: {
|
|
87
77
|
opacity: .4,
|
|
88
78
|
tapToClose: true
|
|
@@ -97,13 +87,7 @@ var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
|
|
|
97
87
|
duration: 200
|
|
98
88
|
}
|
|
99
89
|
} }
|
|
100
|
-
}
|
|
101
|
-
if (shown.current === opened) shown.current = null;
|
|
102
|
-
opened.unbindKeyboard?.();
|
|
103
|
-
opened.unbindTheme?.();
|
|
104
|
-
opened.root.unmount?.();
|
|
105
|
-
console.error("[Sheet] open failed", error);
|
|
106
|
-
});
|
|
90
|
+
}, () => detents?.enter());
|
|
107
91
|
}, [
|
|
108
92
|
props.open,
|
|
109
93
|
props.children,
|
|
@@ -112,7 +96,8 @@ var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
|
|
|
112
96
|
props.shadeCover,
|
|
113
97
|
props.ios,
|
|
114
98
|
props.android
|
|
115
|
-
], _h$
|
|
99
|
+
], _h$3);
|
|
100
|
+
useEffect(() => () => shown.current?.lifetime.close(), [], _h$4);
|
|
116
101
|
return universalValue(__octaneUniversalPlan1, [(v) => {
|
|
117
102
|
sentinel.current = v;
|
|
118
103
|
}, {
|
|
@@ -15,7 +15,7 @@ var _h$5 = /* @__PURE__ */ Symbol(_hs$ + 5);
|
|
|
15
15
|
var _h$6 = /* @__PURE__ */ Symbol(_hs$ + 6);
|
|
16
16
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
17
17
|
"kind": "host",
|
|
18
|
-
"type": "
|
|
18
|
+
"type": "absolutelayout",
|
|
19
19
|
"bindings": [
|
|
20
20
|
["id", 0],
|
|
21
21
|
["className", 1],
|
|
@@ -28,25 +28,20 @@ var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
|
28
28
|
{
|
|
29
29
|
"kind": "host",
|
|
30
30
|
"type": "flexboxlayout",
|
|
31
|
-
"props": { "className": "vx-slider-track" }
|
|
31
|
+
"props": { "className": "vx-slider-track" },
|
|
32
|
+
"bindings": [["style", 6]]
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
"kind": "host",
|
|
35
36
|
"type": "flexboxlayout",
|
|
36
|
-
"props": {
|
|
37
|
-
|
|
38
|
-
"horizontalAlignment": "left"
|
|
39
|
-
},
|
|
40
|
-
"bindings": [["style", 6]]
|
|
37
|
+
"props": { "className": "vx-slider-fill" },
|
|
38
|
+
"bindings": [["style", 7]]
|
|
41
39
|
},
|
|
42
40
|
{
|
|
43
41
|
"kind": "host",
|
|
44
42
|
"type": "flexboxlayout",
|
|
45
|
-
"props": {
|
|
46
|
-
|
|
47
|
-
"horizontalAlignment": "left"
|
|
48
|
-
},
|
|
49
|
-
"bindings": [["style", 7]]
|
|
43
|
+
"props": { "className": "vx-slider-thumb" },
|
|
44
|
+
"bindings": [["style", 8]]
|
|
50
45
|
}
|
|
51
46
|
]
|
|
52
47
|
});
|
|
@@ -64,6 +59,10 @@ var Slider = defineUniversalComponent("nativescript", function Slider(props) {
|
|
|
64
59
|
host.current = el;
|
|
65
60
|
measure.bind(el);
|
|
66
61
|
}, [], _h$4);
|
|
62
|
+
const thumbSize = 20;
|
|
63
|
+
const trackTop = 12;
|
|
64
|
+
const thumbTop = 4;
|
|
65
|
+
const thumbLeft = Math.min(Math.max(ratio * width - thumbSize / 2, 0), Math.max(width - thumbSize, 0));
|
|
67
66
|
useEffect(() => {
|
|
68
67
|
applyNativeProps(host.current, props);
|
|
69
68
|
}, [props], _h$5);
|
|
@@ -90,8 +89,18 @@ var Slider = defineUniversalComponent("nativescript", function Slider(props) {
|
|
|
90
89
|
nativeAccessibilityRole("adjustable"),
|
|
91
90
|
onPan,
|
|
92
91
|
bindHost,
|
|
93
|
-
{
|
|
94
|
-
|
|
92
|
+
{
|
|
93
|
+
width,
|
|
94
|
+
translateY: trackTop
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
width: ratio * width,
|
|
98
|
+
translateY: trackTop
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
translateX: thumbLeft,
|
|
102
|
+
translateY: thumbTop
|
|
103
|
+
}
|
|
95
104
|
]);
|
|
96
105
|
}, { "module": "@nativescript-community/octane" });
|
|
97
106
|
//#endregion
|
package/dist/native/Text.tsrx.js
CHANGED
|
@@ -2,6 +2,7 @@ import { cx } from "./cx.js";
|
|
|
2
2
|
import { applyEscapeProps, nativeAccessibilityRole, nativeAccessibilityState } from "./escape-props.js";
|
|
3
3
|
import { layoutChildProps } from "./layout-child.js";
|
|
4
4
|
import { createContext, defineUniversalComponent, universalComponent, universalIf, universalPlan, universalProps, universalValue, useContext } from "@nativescript-community/octane";
|
|
5
|
+
import { Application } from "@nativescript/core";
|
|
5
6
|
//#region src/Text.tsrx
|
|
6
7
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
7
8
|
"kind": "host",
|
|
@@ -34,8 +35,23 @@ var TextScope = defineUniversalComponent("nativescript", function TextScope(prop
|
|
|
34
35
|
}, { "module": "@nativescript-community/octane" });
|
|
35
36
|
var Text = defineUniversalComponent("nativescript", function Text(props) {
|
|
36
37
|
const inText = useContext(InText);
|
|
38
|
+
const fontWeightValue = String(props.style?.fontWeight ?? "").toLowerCase();
|
|
39
|
+
const fontWeight = /^\d+$/.test(fontWeightValue) ? Number(fontWeightValue) : {
|
|
40
|
+
normal: 400,
|
|
41
|
+
bold: 700,
|
|
42
|
+
thin: 100,
|
|
43
|
+
"extra-light": 200,
|
|
44
|
+
light: 300,
|
|
45
|
+
medium: 500,
|
|
46
|
+
"semi-bold": 600,
|
|
47
|
+
"extra-bold": 800,
|
|
48
|
+
black: 900
|
|
49
|
+
}[fontWeightValue];
|
|
50
|
+
const lineHeight = props.style?.lineHeight;
|
|
37
51
|
const textStyle = {
|
|
38
52
|
...props.style,
|
|
53
|
+
...(Application.ios || Application.android) && typeof lineHeight === "number" && Number.isFinite(lineHeight) && lineHeight > 0 && props.style?.height == null && props.style?.minHeight == null ? { minHeight: lineHeight } : {},
|
|
54
|
+
...Application.ios && props.style?.fontVariationSettings == null && fontWeight !== void 0 && fontWeight >= 100 && fontWeight <= 900 ? { fontVariationSettings: `'wght' ${fontWeight}` } : {},
|
|
39
55
|
...props.ellipsize || props.numberOfLines ? { flexShrink: 1 } : {},
|
|
40
56
|
...props.ellipsize ? {
|
|
41
57
|
whiteSpace: "nowrap",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
2
|
import { applyEscapeProps } from "./escape-props.js";
|
|
3
|
-
import { writeText } from "./text-write.js";
|
|
3
|
+
import { isWritingText, writeText } from "./text-write.js";
|
|
4
|
+
import { blurText } from "./text-focus.js";
|
|
4
5
|
import { defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
|
|
5
6
|
import { Utils } from "@nativescript/core";
|
|
6
7
|
//#region src/TextArea.tsrx
|
|
@@ -61,7 +62,7 @@ var TextArea = defineUniversalComponent("nativescript", function TextArea(props)
|
|
|
61
62
|
applyEscapeProps(v, props);
|
|
62
63
|
props.bind?.({
|
|
63
64
|
focus: () => v.focus(),
|
|
64
|
-
blur: () =>
|
|
65
|
+
blur: () => blurText(v),
|
|
65
66
|
native: v
|
|
66
67
|
});
|
|
67
68
|
},
|
|
@@ -75,7 +76,9 @@ var TextArea = defineUniversalComponent("nativescript", function TextArea(props)
|
|
|
75
76
|
props.returnKeyType,
|
|
76
77
|
props.editable ?? true,
|
|
77
78
|
(e) => fit(e.object),
|
|
78
|
-
(e) =>
|
|
79
|
+
(e) => {
|
|
80
|
+
if (!isWritingText(e.object)) props.onChange?.(e.value);
|
|
81
|
+
},
|
|
79
82
|
submitOnReturn ? props.onSubmit : void 0,
|
|
80
83
|
props.onFocus,
|
|
81
84
|
props.onBlur
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
2
|
import { applyEscapeProps } from "./escape-props.js";
|
|
3
|
-
import { writeText } from "./text-write.js";
|
|
3
|
+
import { isWritingText, writeText } from "./text-write.js";
|
|
4
|
+
import { blurText } from "./text-focus.js";
|
|
4
5
|
import { defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
|
|
5
6
|
//#region src/TextInput.tsrx
|
|
6
7
|
var _hs$ = /* @__PURE__ */ hookSlots(2);
|
|
@@ -35,7 +36,7 @@ var TextInput = defineUniversalComponent("nativescript", function TextInput(prop
|
|
|
35
36
|
applyEscapeProps(v, props);
|
|
36
37
|
props.bind?.({
|
|
37
38
|
focus: () => v.focus(),
|
|
38
|
-
blur: () =>
|
|
39
|
+
blur: () => blurText(v),
|
|
39
40
|
native: v
|
|
40
41
|
});
|
|
41
42
|
},
|
|
@@ -50,7 +51,9 @@ var TextInput = defineUniversalComponent("nativescript", function TextInput(prop
|
|
|
50
51
|
props.keyboardType === "default" ? void 0 : props.keyboardType,
|
|
51
52
|
props.returnKeyType,
|
|
52
53
|
props.editable ?? true,
|
|
53
|
-
(e) =>
|
|
54
|
+
(e) => {
|
|
55
|
+
if (!isWritingText(e.object)) props.onChange?.(e.value);
|
|
56
|
+
},
|
|
54
57
|
props.onSubmit,
|
|
55
58
|
props.onFocus,
|
|
56
59
|
props.onBlur
|