@octane-xplat/ui 0.7.3 → 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/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/PinInput.tsrx.js +25 -7
- package/dist/native/Popover.tsrx.js +17 -18
- package/dist/native/Pressable.tsrx.js +4 -1
- package/dist/native/SearchInput.tsrx.js +6 -3
- package/dist/native/Sheet.tsrx.js +22 -37
- 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/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 +1 -1
- package/dist/native/svg.mobile.js +1 -1
- 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/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 +1 -0
- package/src/Grid.tsrx +2 -0
- 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/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 +17 -17
- 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/SearchInput.tsrx +4 -3
- package/src/SearchInput.web.tsrx +1 -1
- package/src/Sheet.tsrx +20 -41
- package/src/Sheet.web.tsrx +9 -1
- package/src/Text.tsrx +2 -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 +1 -0
- 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 +2 -0
- package/src/grid-auto-placement.ts +54 -12
- package/src/grid-placement.ts +1 -1
- 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.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 +48 -32
- package/src/tap-to-blur.mobile.ts +23 -15
- 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 +1736 -1730
- package/src/translate.macos.ts +4 -1
- 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 +13 -3
- 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/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/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,5 +1,10 @@
|
|
|
1
1
|
//#region src/text-write.ts
|
|
2
|
-
|
|
2
|
+
var writing = /* @__PURE__ */ new WeakSet();
|
|
3
|
+
/** Whether a textChange is the synchronous echo of our controlled write. */
|
|
4
|
+
function isWritingText(view) {
|
|
5
|
+
return writing.has(view);
|
|
6
|
+
}
|
|
7
|
+
/** Controlled `text` write for TextInput/TextArea/SearchInput leaves. The driver's
|
|
3
8
|
* generic prop path writes view.text verbatim; on Android the EditText
|
|
4
9
|
* setText resets the cursor to 0 on every controlled write. Park and
|
|
5
10
|
* restore the selection around the write (clamped to the new length so an
|
|
@@ -11,17 +16,19 @@ function writeText(view, value) {
|
|
|
11
16
|
const next = value ?? "";
|
|
12
17
|
if (!view || view.text === next) return;
|
|
13
18
|
const et = view.android;
|
|
14
|
-
|
|
19
|
+
const start = et?.getSelectionStart?.() ?? -1;
|
|
20
|
+
const end = et?.getSelectionEnd?.() ?? -1;
|
|
21
|
+
const nested = writing.has(view);
|
|
22
|
+
writing.add(view);
|
|
23
|
+
try {
|
|
15
24
|
view.text = next;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const len = next.length;
|
|
23
|
-
et.setSelection(Math.min(start, len), Math.min(end >= 0 ? end : start, len));
|
|
25
|
+
if (start >= 0) {
|
|
26
|
+
const len = next.length;
|
|
27
|
+
et.setSelection(Math.min(start, len), Math.min(end >= 0 ? end : start, len));
|
|
28
|
+
}
|
|
29
|
+
} finally {
|
|
30
|
+
if (!nested) writing.delete(view);
|
|
24
31
|
}
|
|
25
32
|
}
|
|
26
33
|
//#endregion
|
|
27
|
-
export { writeText };
|
|
34
|
+
export { isWritingText, writeText };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
2
1
|
import { topRootLayout } from "./root-layout.mobile.js";
|
|
2
|
+
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
3
3
|
import { Popover } from "./Popover.tsrx.js";
|
|
4
4
|
import { createNativeScriptRoot, defineUniversalComponent, universalChildren, universalComponent, universalIf, universalPlan, universalProps, universalValue } from "@nativescript-community/octane";
|
|
5
5
|
import { GridLayout, isAndroid, isIOS } from "@nativescript/core";
|
package/dist/native/ui.js
CHANGED
|
@@ -6,9 +6,12 @@ import { Absolute } from "./Absolute.tsrx.js";
|
|
|
6
6
|
import { setTranslate } from "./translate.js";
|
|
7
7
|
import { Spacer } from "./Spacer.tsrx.js";
|
|
8
8
|
import { Text } from "./Text.tsrx.js";
|
|
9
|
+
import { Screen } from "./Screen.tsrx.js";
|
|
10
|
+
import { ActivityIndicator } from "./ActivityIndicator.tsrx.js";
|
|
11
|
+
import { ScrollView } from "./ScrollView.tsrx.js";
|
|
12
|
+
import { Markdown, MarkdownScreen } from "./Markdown.tsrx.js";
|
|
9
13
|
import { RichText, RichTextSpan } from "./RichText.tsrx.js";
|
|
10
14
|
import { Pressable } from "./Pressable.tsrx.js";
|
|
11
|
-
import { ActivityIndicator } from "./ActivityIndicator.tsrx.js";
|
|
12
15
|
import { Button } from "./Button.tsrx.js";
|
|
13
16
|
import { Collapsible } from "./Collapsible.tsrx.js";
|
|
14
17
|
import { Accordion } from "./Accordion.tsrx.js";
|
|
@@ -58,14 +61,13 @@ import { Meter } from "./Meter.tsrx.js";
|
|
|
58
61
|
import { ProgressGroup } from "./ProgressGroup.tsrx.js";
|
|
59
62
|
import { Link } from "./Link.tsrx.js";
|
|
60
63
|
import { getStack, registerStack, stackEntries } from "./stacks.js";
|
|
61
|
-
import { defineRoutes, deriveRouteManifest, mergeRouteManifests } from "./route-table.js";
|
|
64
|
+
import { defineRoutes, deriveRouteManifest, manifestToJson, mergeRouteManifests } from "./route-table.js";
|
|
62
65
|
import { addBackInterceptor, addRoutes, canGoBack, currentModalRoute, currentRoute, hrefFor, layoutsForRoute, popRoute, pushDeepLink, pushRoute, redirect, registerRoutes, registerScreens, routeFor, routeStacks, screenFor, useCanGoBack, useModalRoute, useRoute } from "./route.js";
|
|
63
66
|
import { NavLink } from "./NavLink.tsrx.js";
|
|
64
67
|
import { TextArea } from "./TextArea.tsrx.js";
|
|
65
68
|
import { SearchInput } from "./SearchInput.tsrx.js";
|
|
66
69
|
import { SegmentedControl } from "./SegmentedControl.tsrx.js";
|
|
67
70
|
import { ScrollBox } from "./ScrollBox.tsrx.js";
|
|
68
|
-
import { ScrollView } from "./ScrollView.tsrx.js";
|
|
69
71
|
import { VirtualList } from "./VirtualList.tsrx.js";
|
|
70
72
|
import { WebView } from "./WebView.tsrx.js";
|
|
71
73
|
import { Hoverable } from "./Hoverable.mobile.tsrx.js";
|
|
@@ -74,11 +76,11 @@ import { showToast } from "./toast-anchor.tsrx.js";
|
|
|
74
76
|
import { useAnimation } from "./anim.tsrx.js";
|
|
75
77
|
import { styled } from "./styled.tsrx.js";
|
|
76
78
|
import { openWindow } from "./windows.js";
|
|
77
|
-
import { Screen } from "./Screen.tsrx.js";
|
|
78
79
|
import { Tabs } from "./Tabs.tsrx.js";
|
|
79
80
|
import { Switch } from "./Switch.tsrx.js";
|
|
80
81
|
import { useSafeAreaInsets } from "./safeAreaInsets.tsrx.js";
|
|
81
82
|
import { SafeArea } from "./SafeArea.tsrx.js";
|
|
83
|
+
import { KeyboardAvoiding } from "./KeyboardAvoiding.mobile.tsrx.js";
|
|
82
84
|
import { Drawer } from "./Drawer.tsrx.js";
|
|
83
85
|
import { useMeasure } from "./useMeasure.tsrx.js";
|
|
84
86
|
import { Slider } from "./Slider.tsrx.js";
|
|
@@ -90,6 +92,5 @@ import { useStore } from "./use-store.tsrx.js";
|
|
|
90
92
|
import { Sheet } from "./Sheet.tsrx.js";
|
|
91
93
|
import { closeSheet, openSheet } from "./sheet-service.js";
|
|
92
94
|
import "./index.shared.js";
|
|
93
|
-
import { KeyboardAvoiding } from "./KeyboardAvoiding.mobile.tsrx.js";
|
|
94
95
|
import "./theme/status-bar-scheme.mobile.js";
|
|
95
|
-
export { Absolute, Accordion, ActivityIndicator, Alert, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, Button, Card, Checkbox, CheckboxGroup, Chip, Collapsible, View as Column, Combobox, CommandPalette, ContextMenu, Drawer, DropdownMenu, Empty, FieldGroup, FormField, Grid, Heading, Hoverable, Icon, Image, InputMenu, InputNumber, InputRating, InputTags, Kbd, KeyboardAvoiding, Link, ListItem, Meter, NavLink, NavigationMenu, Overlay, Pagination, PinInput, Popover, Pressable, ProgressGroup, RadioGroup, RichText, RichTextSpan, Row, SafeArea, Screen, ScrollBox, ScrollView, SearchInput, SegmentedControl, Select, SelectMenu, Separator, Sheet, Skeleton, Slider, Spacer, Stack, Stepper, Switch, Table, Tabs, Text, TextArea, TextInput, Timeline, Tooltip, Tree, User, View, VirtualList, WebView, addBackInterceptor, addRoutes, applyThemeClasses, canGoBack, closeSheet, createStore, currentModalRoute, currentRoute, defineRoutes, deriveRouteManifest, getColorScheme, getStack, getThemePreference, getThemeScheme, hrefFor, isNative, layoutsForRoute, mergeRouteManifests, onThemeSchemeChange, openSheet, openWindow, popRoute, pushDeepLink, pushRoute, redirect, registerIcon, registerIcons, registerRoutes, registerScreens, registerStack, routeFor, routeStacks, screenFor, setThemePreference, setTranslate, showToast, stackEntries, styled, themeSchemeClasses, useAnimation, useBackInterceptor, useCanGoBack, useColorScheme, useMeasure, useModalRoute, useRoute, useSafeAreaInsets, useStore, useThemeScheme };
|
|
96
|
+
export { Absolute, Accordion, ActivityIndicator, Alert, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, Button, Card, Checkbox, CheckboxGroup, Chip, Collapsible, View as Column, Combobox, CommandPalette, ContextMenu, Drawer, DropdownMenu, Empty, FieldGroup, FormField, Grid, Heading, Hoverable, Icon, Image, InputMenu, InputNumber, InputRating, InputTags, Kbd, KeyboardAvoiding, Link, ListItem, Markdown, MarkdownScreen, Meter, NavLink, NavigationMenu, Overlay, Pagination, PinInput, Popover, Pressable, ProgressGroup, RadioGroup, RichText, RichTextSpan, Row, SafeArea, Screen, ScrollBox, ScrollView, SearchInput, SegmentedControl, Select, SelectMenu, Separator, Sheet, Skeleton, Slider, Spacer, Stack, Stepper, Switch, Table, Tabs, Text, TextArea, TextInput, Timeline, Tooltip, Tree, User, View, VirtualList, WebView, addBackInterceptor, addRoutes, applyThemeClasses, canGoBack, closeSheet, createStore, currentModalRoute, currentRoute, defineRoutes, deriveRouteManifest, getColorScheme, getStack, getThemePreference, getThemeScheme, hrefFor, isNative, layoutsForRoute, manifestToJson, mergeRouteManifests, onThemeSchemeChange, openSheet, openWindow, popRoute, pushDeepLink, pushRoute, redirect, registerIcon, registerIcons, registerRoutes, registerScreens, registerStack, routeFor, routeStacks, screenFor, setThemePreference, setTranslate, showToast, stackEntries, styled, themeSchemeClasses, useAnimation, useBackInterceptor, useCanGoBack, useColorScheme, useMeasure, useModalRoute, useRoute, useSafeAreaInsets, useStore, useThemeScheme };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SVGView as SVGView$1, srcProperty } from "./index.common.js";
|
|
1
|
+
import { SVGView as SVGView$1, srcProperty } from "./src/index.common.js";
|
|
2
2
|
import { File, Font, ImageAsset, ImageSource, Utils, knownFolders, path } from "@nativescript/core";
|
|
3
|
-
//#region src/vendor/ui-svg/index.android.ts
|
|
3
|
+
//#region src/vendor/ui-svg/src/index.android.ts
|
|
4
4
|
function getSVG(src) {
|
|
5
5
|
if (!src) return null;
|
|
6
6
|
let imagePath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SVGView as SVGView$1, srcProperty, stretchProperty } from "./index.common.js";
|
|
1
|
+
import { SVGView as SVGView$1, srcProperty, stretchProperty } from "./src/index.common.js";
|
|
2
2
|
import { File, ImageAsset, Utils, knownFolders, path } from "@nativescript/core";
|
|
3
|
-
//#region src/vendor/ui-svg/index.ios.ts
|
|
3
|
+
//#region src/vendor/ui-svg/src/index.ios.ts
|
|
4
4
|
function getUIImageScaleType(scaleType) {
|
|
5
5
|
switch (scaleType) {
|
|
6
6
|
case "aspectFill": return 2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSType, Property, View } from "@nativescript/core";
|
|
2
|
-
//#region src/vendor/ui-svg/index.common.ts
|
|
2
|
+
//#region src/vendor/ui-svg/src/index.common.ts
|
|
3
3
|
var srcProperty = new Property({ name: "src" });
|
|
4
4
|
var stretchProperty = new Property({ name: "stretch" });
|
|
5
5
|
var SVGView = class extends View {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region src/virtual-list-cell-pool.ts
|
|
2
|
+
/** Reuse physical hosts without retaining an off-window logical row subtree. */
|
|
3
|
+
var VirtualListCellPool = class {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.cells = [];
|
|
6
|
+
this.byId = /* @__PURE__ */ new Map();
|
|
7
|
+
this.nextId = 0;
|
|
8
|
+
}
|
|
9
|
+
update(entries) {
|
|
10
|
+
if (entries.length === 0) {
|
|
11
|
+
this.clear();
|
|
12
|
+
return this.cells;
|
|
13
|
+
}
|
|
14
|
+
const wanted = new Set(entries.map((entry) => entry.rowKey));
|
|
15
|
+
let cells = this.cells.map((cell) => cell.entry && !wanted.has(cell.entry.rowKey) ? {
|
|
16
|
+
...cell,
|
|
17
|
+
entry: null,
|
|
18
|
+
rows: [],
|
|
19
|
+
generation: cell.generation + 1
|
|
20
|
+
} : cell);
|
|
21
|
+
const retained = new Map(cells.filter((cell) => cell.entry).map((cell) => [cell.entry.rowKey, cell.id]));
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const retainedId = retained.get(entry.rowKey);
|
|
24
|
+
let index = retainedId === void 0 ? cells.findIndex((cell) => !cell.entry && cell.typeKey === entry.typeKey) : cells.findIndex((cell) => cell.id === retainedId);
|
|
25
|
+
if (index === -1) {
|
|
26
|
+
index = cells.length;
|
|
27
|
+
cells.push({
|
|
28
|
+
id: this.nextId++,
|
|
29
|
+
typeKey: entry.typeKey,
|
|
30
|
+
generation: 0,
|
|
31
|
+
entry: null,
|
|
32
|
+
rows: []
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const cell = cells[index];
|
|
36
|
+
if (cell.entry !== entry) cells[index] = {
|
|
37
|
+
...cell,
|
|
38
|
+
entry,
|
|
39
|
+
rows: [entry],
|
|
40
|
+
generation: cell.generation + 1
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
let spare = 0;
|
|
44
|
+
cells = cells.filter((cell) => cell.entry || spare++ < 8);
|
|
45
|
+
cells.sort((a, b) => (a.entry?.index ?? Infinity) - (b.entry?.index ?? Infinity) || a.id - b.id);
|
|
46
|
+
this.cells = cells;
|
|
47
|
+
this.byId = new Map(cells.map((cell) => [cell.id, cell]));
|
|
48
|
+
return cells;
|
|
49
|
+
}
|
|
50
|
+
get(id) {
|
|
51
|
+
return this.byId.get(id);
|
|
52
|
+
}
|
|
53
|
+
isCurrent(id, rowKey, generation) {
|
|
54
|
+
const cell = this.byId.get(id);
|
|
55
|
+
return cell?.entry?.rowKey === rowKey && cell.generation === generation;
|
|
56
|
+
}
|
|
57
|
+
clear() {
|
|
58
|
+
this.cells = [];
|
|
59
|
+
this.byId.clear();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { VirtualListCellPool };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Pressable } from "./Pressable.web.tsrx.js";
|
|
2
1
|
import { ActivityIndicator } from "./ActivityIndicator.web.tsrx.js";
|
|
2
|
+
import { Pressable } from "./Pressable.web.tsrx.js";
|
|
3
3
|
import { Fragment, bag4, child, clone, componentSlotVoid, createScopedElement, drainFrag, markChildrenBlock, positionalChildren, template } from "octane";
|
|
4
4
|
import { createElementFromConfig, textHoleUpdate } from "octane/internal/client";
|
|
5
5
|
//#region src/Button.web.tsrx
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { cx } from "./cx.js";
|
|
2
|
+
import { __s, bag8, clone, snapshotSpread, template } from "octane";
|
|
3
|
+
import { bindSignalChild, bindSignalHostPropSources, enableSignalBindings } from "octane/internal/client";
|
|
4
|
+
//#region src/KeyboardAvoiding.web.tsrx
|
|
5
|
+
enableSignalBindings(1, true);
|
|
6
|
+
var _t$0 = /* @__PURE__ */ template("<div></div>");
|
|
7
|
+
var _rm$1 = [
|
|
8
|
+
"s",
|
|
9
|
+
"f",
|
|
10
|
+
"e"
|
|
11
|
+
];
|
|
12
|
+
var KeyboardAvoiding = /* @__PURE__ */ __s(function KeyboardAvoiding(props, __s, __extra) {
|
|
13
|
+
let _b = __s.slots[0];
|
|
14
|
+
if (_b === void 0) {
|
|
15
|
+
let _m0, _m1, _m2, _m3, _m4, _m5;
|
|
16
|
+
const _root = clone(_t$0);
|
|
17
|
+
_m0 = props.id;
|
|
18
|
+
_m1 = cx("vx-keyboard-avoiding", props.className);
|
|
19
|
+
_m2 = props.style;
|
|
20
|
+
_m3 = snapshotSpread(props.web);
|
|
21
|
+
_m4 = _root;
|
|
22
|
+
_m5 = bindSignalHostPropSources(__s, void 0, _root, [
|
|
23
|
+
[
|
|
24
|
+
false,
|
|
25
|
+
"id",
|
|
26
|
+
_m0
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
false,
|
|
30
|
+
"className",
|
|
31
|
+
_m1
|
|
32
|
+
],
|
|
33
|
+
[
|
|
34
|
+
false,
|
|
35
|
+
"style",
|
|
36
|
+
_m2
|
|
37
|
+
],
|
|
38
|
+
[true, _m3]
|
|
39
|
+
], "b:1d590fbc", true);
|
|
40
|
+
_b = bag8(__s, _root, _m0, _m1, _m2, _m3, _m4, _m5, null, void 0);
|
|
41
|
+
__s.refFields = _rm$1;
|
|
42
|
+
} else {
|
|
43
|
+
{
|
|
44
|
+
const _v = props.id;
|
|
45
|
+
if (_b.a !== _v) _b.a = _v;
|
|
46
|
+
}
|
|
47
|
+
{
|
|
48
|
+
const _v = cx("vx-keyboard-avoiding", props.className);
|
|
49
|
+
if (_b.b !== _v) _b.b = _v;
|
|
50
|
+
}
|
|
51
|
+
{
|
|
52
|
+
const _v = props.style;
|
|
53
|
+
if (_b.c !== _v) _b.c = _v;
|
|
54
|
+
}
|
|
55
|
+
_b.d = snapshotSpread(props.web);
|
|
56
|
+
_b.f = bindSignalHostPropSources(__s, _b.f, _b.e, [
|
|
57
|
+
[
|
|
58
|
+
false,
|
|
59
|
+
"id",
|
|
60
|
+
_b.a
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
false,
|
|
64
|
+
"className",
|
|
65
|
+
_b.b
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
false,
|
|
69
|
+
"style",
|
|
70
|
+
_b.c
|
|
71
|
+
],
|
|
72
|
+
[true, _b.d]
|
|
73
|
+
], "b:1d590fbc", true);
|
|
74
|
+
}
|
|
75
|
+
_b.i = bindSignalChild(__s, _b.i, 1, _b.e, props.children, "b:da0dd4e6", null, void 0, void 0, void 0, true);
|
|
76
|
+
});
|
|
77
|
+
//#endregion
|
|
78
|
+
export { KeyboardAvoiding };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { View } from "./View.web.tsrx.js";
|
|
2
|
+
import { Text } from "./Text.web.tsrx.js";
|
|
3
|
+
import { Screen } from "./Screen.web.tsrx.js";
|
|
4
|
+
import { ScrollView } from "./ScrollView.web.tsrx.js";
|
|
5
|
+
import { bag4, child, clone, componentSlotVoid, createScopedElement, createScopedValue, drainFrag, markChildrenBlock, positionalChildren, template } from "octane";
|
|
6
|
+
import { createElementFromConfig, textHoleUpdate } from "octane/internal/client";
|
|
7
|
+
//#region src/Markdown.tsrx
|
|
8
|
+
var _t$0 = /* @__PURE__ */ template("<!>", 0, 1);
|
|
9
|
+
var __childrenBody = {};
|
|
10
|
+
var __childrenBody$ = {};
|
|
11
|
+
var __childrenBody$2 = {};
|
|
12
|
+
var headingClass = [
|
|
13
|
+
"text-2xl font-bold",
|
|
14
|
+
"text-xl font-semibold",
|
|
15
|
+
"text-lg font-semibold"
|
|
16
|
+
];
|
|
17
|
+
function Inlines(props) {
|
|
18
|
+
const out = [];
|
|
19
|
+
for (const n of props.nodes ?? []) switch (n.t) {
|
|
20
|
+
case "code":
|
|
21
|
+
out.push(createScopedValue(() => createScopedElement(Text, { style: { fontFamily: "ui-monospace" } }, () => n.text, "c:36e0510a")));
|
|
22
|
+
break;
|
|
23
|
+
case "bold":
|
|
24
|
+
out.push(createScopedElement(Text, { className: "font-bold" }, () => createScopedValue(() => createElementFromConfig("c:a63de03b", Inlines, { nodes: n.children })), "c:a21df08c"));
|
|
25
|
+
break;
|
|
26
|
+
case "em":
|
|
27
|
+
out.push(createScopedValue(() => createScopedElement(Text, { style: { fontStyle: "italic" } }, () => createScopedValue(() => createElementFromConfig("c:85bfa585", Inlines, { nodes: n.children })), "c:8c2aeee1")));
|
|
28
|
+
break;
|
|
29
|
+
case "link":
|
|
30
|
+
out.push(createScopedValue(() => createScopedElement(Text, { style: { textDecorationLine: "underline" } }, () => n.text, "c:68791c66")));
|
|
31
|
+
break;
|
|
32
|
+
default: out.push(n.text);
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
var Markdown = function Markdown(props, __s, __extra) {
|
|
37
|
+
const __block = __s.block;
|
|
38
|
+
function __children$1(__props, __s, __extra) {
|
|
39
|
+
const __block = __s.block;
|
|
40
|
+
let _b = __s.slots[0];
|
|
41
|
+
if (_b === void 0) {
|
|
42
|
+
let _m0, _m1;
|
|
43
|
+
const _root = clone(_t$0);
|
|
44
|
+
_m0 = __block.parentNode;
|
|
45
|
+
_m1 = child(_root);
|
|
46
|
+
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
47
|
+
_b = bag4(__s, null, _m0, _m1, null, void 0);
|
|
48
|
+
}
|
|
49
|
+
{
|
|
50
|
+
const _v = (props.data?.children ?? []).map((node) => {
|
|
51
|
+
switch (node.t) {
|
|
52
|
+
case "h": return createScopedElement(Text, { className: headingClass[node.depth - 1] ?? "font-semibold" }, () => createScopedValue(() => createElementFromConfig("c:848cdc8b", Inlines, { nodes: node.children })), "c:c64bb68d");
|
|
53
|
+
case "p": return createScopedElement(Text, {}, () => createScopedValue(() => createElementFromConfig("c:ee68c6f0", Inlines, { nodes: node.children })), "c:79fb1caa");
|
|
54
|
+
case "code": return createScopedElement(Text, {
|
|
55
|
+
className: "text-sm",
|
|
56
|
+
style: { fontFamily: "ui-monospace" }
|
|
57
|
+
}, () => node.text, "c:4a6d02c9");
|
|
58
|
+
case "list": return node.items.map((item, i) => createScopedElement(Text, {}, () => positionalChildren([node.ordered ? `${i + 1}. ` : "• ", createScopedValue(() => createElementFromConfig("c:fda35112", Inlines, { nodes: item }))]), "c:6892e48e"));
|
|
59
|
+
case "quote": return createScopedElement(Text, {
|
|
60
|
+
className: "text-muted",
|
|
61
|
+
style: { fontStyle: "italic" }
|
|
62
|
+
}, () => createScopedValue(() => createElementFromConfig("c:d67a588c", Inlines, { nodes: node.children })), "c:2da3002c");
|
|
63
|
+
case "hr": return createElementFromConfig("c:a5e792d6", View, { style: {
|
|
64
|
+
height: 1,
|
|
65
|
+
backgroundColor: "var(--color-border)"
|
|
66
|
+
} });
|
|
67
|
+
default: return null;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
_b.c = textHoleUpdate(__s, 1, _b.a, _v, _b.c, _b.d, _b.b, true, true);
|
|
71
|
+
_b.d = _v;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
componentSlotVoid(__s, 0, __block.parentNode, View, {
|
|
75
|
+
"className": "gap-3",
|
|
76
|
+
"children": markChildrenBlock(__children$1, __childrenBody)
|
|
77
|
+
}, __block.endMarker, void 0, void 0, true, void 0, "c:866fe269");
|
|
78
|
+
};
|
|
79
|
+
var MarkdownScreen = function MarkdownScreen(props, __s, __extra) {
|
|
80
|
+
const __block = __s.block;
|
|
81
|
+
function __children$4(__props, __s, __extra) {
|
|
82
|
+
const __block = __s.block;
|
|
83
|
+
function __children$6(__props, __s, __extra) {
|
|
84
|
+
const __block = __s.block;
|
|
85
|
+
componentSlotVoid(__s, 0, __block.parentNode, Markdown, { "data": props.data }, __block.endMarker, void 0, void 0, void 0, void 0, "c:35a6792a");
|
|
86
|
+
}
|
|
87
|
+
componentSlotVoid(__s, 0, __block.parentNode, ScrollView, {
|
|
88
|
+
"style": { padding: 16 },
|
|
89
|
+
"children": markChildrenBlock(__children$6, __childrenBody$)
|
|
90
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:12e138f2");
|
|
91
|
+
}
|
|
92
|
+
componentSlotVoid(__s, 0, __block.parentNode, Screen, {
|
|
93
|
+
"className": "vx-app",
|
|
94
|
+
"children": markChildrenBlock(__children$4, __childrenBody$2)
|
|
95
|
+
}, __block.endMarker, void 0, void 0, true, void 0, "c:d76e208c");
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { Markdown, MarkdownScreen };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { cx } from "./cx.js";
|
|
2
2
|
import { useThemeScheme } from "./theme/theme-scheme.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { isolateModalFocus } from "./modal-focus.web.js";
|
|
4
|
+
import { bag1, bag13, bag2, child, clone, delegateEvents, drainFrag, hookSlots, ifBlock, markDangerouslySetInnerHTMLChildren, portal, queueRefAttach, queueRefDetach, setAriaAttribute, setEventHandler, sibling, snapshotSpread, template, useEffect, useRef, withSlot } from "octane";
|
|
5
|
+
import { bindSignalAttribute, bindSignalChild, bindSignalHostPropSources, enableSignalBindings, replaceRef, setPlainAttribute } from "octane/internal/client";
|
|
5
6
|
//#region src/Overlay.web.tsrx
|
|
6
7
|
enableSignalBindings(1, true);
|
|
7
8
|
delegateEvents(["click"]);
|
|
8
9
|
var _t$0 = /* @__PURE__ */ template("<div class=\"vx-overlay-shade\"></div>");
|
|
9
10
|
var _t$1 = /* @__PURE__ */ template("<div><!><div class=\"vx-overlay-content\"></div></div>");
|
|
10
11
|
var _t$2 = /* @__PURE__ */ template("<!>", 0, 1);
|
|
11
|
-
var
|
|
12
|
+
var _hs$ = /* @__PURE__ */ hookSlots(5);
|
|
13
|
+
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
12
14
|
function __then$2(__props, __s, __extra) {
|
|
13
15
|
const props = __extra[0];
|
|
14
16
|
let _b = __s.slots[0];
|
|
@@ -22,83 +24,112 @@ function __then$2(__props, __s, __extra) {
|
|
|
22
24
|
}
|
|
23
25
|
var _rm$5 = [
|
|
24
26
|
"s",
|
|
27
|
+
"f",
|
|
25
28
|
"e",
|
|
26
|
-
"
|
|
29
|
+
"r",
|
|
30
|
+
"h",
|
|
31
|
+
"g"
|
|
27
32
|
];
|
|
28
33
|
function __portal$1(__props, __s, __extra) {
|
|
29
34
|
const dark = __extra[0];
|
|
30
|
-
const
|
|
35
|
+
const layer = __extra[1];
|
|
36
|
+
const panel = __extra[2];
|
|
37
|
+
const props = __extra[3];
|
|
31
38
|
let _b = __s.slots[0];
|
|
32
39
|
if (_b === void 0) {
|
|
33
|
-
let _m0, _m1, _m2, _m3, _m4, _m5, _m6;
|
|
40
|
+
let _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7, _m10;
|
|
34
41
|
const _root = clone(_t$1);
|
|
35
|
-
_m0 =
|
|
36
|
-
_m1 =
|
|
42
|
+
_m0 = layer;
|
|
43
|
+
_m1 = cx("vx-overlay", dark && "dark", props.className);
|
|
44
|
+
_m2 = {
|
|
37
45
|
...props.style,
|
|
38
46
|
position: "fixed",
|
|
39
47
|
inset: 0
|
|
40
48
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
_m3 = snapshotSpread(props.web);
|
|
50
|
+
_m4 = _root;
|
|
51
|
+
_m5 = bindSignalHostPropSources(__s, void 0, _root, [
|
|
44
52
|
[
|
|
45
53
|
false,
|
|
46
|
-
"
|
|
54
|
+
"ref",
|
|
47
55
|
_m0
|
|
48
56
|
],
|
|
49
57
|
[
|
|
50
58
|
false,
|
|
51
|
-
"
|
|
59
|
+
"className",
|
|
52
60
|
_m1
|
|
53
61
|
],
|
|
54
|
-
[
|
|
55
|
-
|
|
62
|
+
[
|
|
63
|
+
false,
|
|
64
|
+
"style",
|
|
65
|
+
_m2
|
|
66
|
+
],
|
|
67
|
+
[true, _m3]
|
|
68
|
+
], "b:7f6ad544", true);
|
|
56
69
|
const _el0 = sibling(child(_root), 1);
|
|
57
|
-
|
|
70
|
+
queueRefAttach(__s, _m7 = panel, _m6 = _el0);
|
|
71
|
+
(__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.h, _b.g));
|
|
58
72
|
setEventHandler(_el0, "$$click", (event) => event.stopPropagation());
|
|
59
73
|
markDangerouslySetInnerHTMLChildren(_root);
|
|
60
|
-
|
|
61
|
-
_b =
|
|
74
|
+
_m10 = child(_root);
|
|
75
|
+
_b = bag13(__s, _root, _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7, void 0, void 0, _m10, null, void 0);
|
|
62
76
|
__s.refFields = _rm$5;
|
|
63
77
|
} else {
|
|
64
78
|
{
|
|
65
|
-
const _v =
|
|
79
|
+
const _v = layer;
|
|
66
80
|
if (_b.a !== _v) _b.a = _v;
|
|
67
81
|
}
|
|
82
|
+
{
|
|
83
|
+
const _v = cx("vx-overlay", dark && "dark", props.className);
|
|
84
|
+
if (_b.b !== _v) _b.b = _v;
|
|
85
|
+
}
|
|
68
86
|
{
|
|
69
87
|
const _v = {
|
|
70
88
|
...props.style,
|
|
71
89
|
position: "fixed",
|
|
72
90
|
inset: 0
|
|
73
91
|
};
|
|
74
|
-
if (_b.
|
|
92
|
+
if (_b.c !== _v) _b.c = _v;
|
|
75
93
|
}
|
|
76
|
-
_b.
|
|
77
|
-
_b.
|
|
94
|
+
_b.d = snapshotSpread(props.web);
|
|
95
|
+
_b.f = bindSignalHostPropSources(__s, _b.f, _b.e, [
|
|
78
96
|
[
|
|
79
97
|
false,
|
|
80
|
-
"
|
|
98
|
+
"ref",
|
|
81
99
|
_b.a
|
|
82
100
|
],
|
|
83
101
|
[
|
|
84
102
|
false,
|
|
85
|
-
"
|
|
103
|
+
"className",
|
|
86
104
|
_b.b
|
|
87
105
|
],
|
|
88
|
-
[
|
|
89
|
-
|
|
90
|
-
|
|
106
|
+
[
|
|
107
|
+
false,
|
|
108
|
+
"style",
|
|
109
|
+
_b.c
|
|
110
|
+
],
|
|
111
|
+
[true, _b.d]
|
|
112
|
+
], "b:7f6ad544", true);
|
|
113
|
+
{
|
|
114
|
+
const _r = panel;
|
|
115
|
+
if (_r !== _b.h) _b.h = replaceRef(__s, _b.h, _r, _b.g);
|
|
116
|
+
}
|
|
117
|
+
setEventHandler(_b.g, "$$click", (event) => event.stopPropagation());
|
|
91
118
|
}
|
|
119
|
+
_b.i = bindSignalAttribute(__s, _b.i, _b.g, "role", props.shadeCover ? "dialog" : void 0, "b:298552a8", setPlainAttribute);
|
|
120
|
+
_b.j = bindSignalAttribute(__s, _b.j, _b.g, "aria-modal", props.shadeCover ? true : void 0, "b:c758a3c3", setAriaAttribute);
|
|
92
121
|
{
|
|
93
122
|
const __ifCondition = props.shadeCover;
|
|
94
|
-
ifBlock(__s, 1, _b.
|
|
123
|
+
ifBlock(__s, 1, _b.e, __ifCondition, __then$2, null, _b.k, __ifCondition ? [props] : void 0);
|
|
95
124
|
}
|
|
96
|
-
_b.
|
|
125
|
+
_b.n = bindSignalChild(__s, _b.n, 2, _b.g, props.children, "b:2c10ad65", null, void 0, void 0, void 0, true);
|
|
97
126
|
}
|
|
98
127
|
function __then$0(__props, __s, __extra) {
|
|
99
128
|
const __block = __s.block;
|
|
100
129
|
const dark = __extra[0];
|
|
101
|
-
const
|
|
130
|
+
const layer = __extra[1];
|
|
131
|
+
const panel = __extra[2];
|
|
132
|
+
const props = __extra[3];
|
|
102
133
|
let _b = __s.slots[0];
|
|
103
134
|
if (_b === void 0) {
|
|
104
135
|
let _m0, _m1;
|
|
@@ -108,15 +139,33 @@ function __then$0(__props, __s, __extra) {
|
|
|
108
139
|
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
109
140
|
_b = bag2(__s, null, _m0, _m1);
|
|
110
141
|
}
|
|
111
|
-
portal(__s, 1, document.body, __portal$1, void 0, _b.a, [
|
|
142
|
+
portal(__s, 1, document.body, __portal$1, void 0, _b.a, [
|
|
143
|
+
dark,
|
|
144
|
+
layer,
|
|
145
|
+
panel,
|
|
146
|
+
props
|
|
147
|
+
], void 0, _b.b);
|
|
112
148
|
}
|
|
113
149
|
var Overlay = function Overlay(props, __s, __extra) {
|
|
114
150
|
const __block = __s.block;
|
|
115
151
|
const dark = withSlot(_h$0, useThemeScheme) === "dark";
|
|
152
|
+
const layer = useRef(null, _hs$ + 1);
|
|
153
|
+
const panel = useRef(null, _hs$ + 2);
|
|
154
|
+
const dismiss = useRef(props.onDismiss, _hs$ + 3);
|
|
155
|
+
dismiss.current = props.onDismiss;
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (!props.open || !props.shadeCover || !layer.current || !panel.current) return;
|
|
158
|
+
return isolateModalFocus(layer.current, panel.current, () => dismiss.current?.());
|
|
159
|
+
}, [props.open, props.shadeCover], _hs$ + 4);
|
|
116
160
|
if (__s.block.pending && !__s.block.crossRenderUpdate) return;
|
|
117
161
|
{
|
|
118
162
|
const __ifCondition$ = props.open;
|
|
119
|
-
ifBlock(__s, 0, __block.parentNode, __ifCondition$, __then$0, null, __block.endMarker, __ifCondition$ ? [
|
|
163
|
+
ifBlock(__s, 0, __block.parentNode, __ifCondition$, __then$0, null, __block.endMarker, __ifCondition$ ? [
|
|
164
|
+
dark,
|
|
165
|
+
layer,
|
|
166
|
+
panel,
|
|
167
|
+
props
|
|
168
|
+
] : void 0);
|
|
120
169
|
}
|
|
121
170
|
};
|
|
122
171
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { applyEscapeProps } from "./escape-props.web.js";
|
|
2
2
|
import { TextInput } from "./TextInput.web.tsrx.js";
|
|
3
|
-
import { __s, bag7, clone, createScopedValue, hookSlots, queueRefAttach, queueRefDetach, setStyle, template, useState } from "octane";
|
|
3
|
+
import { __s, bag7, clone, createScopedValue, hookSlots, queueRefAttach, queueRefDetach, setStyle, template, useEffect, useRef, useState } from "octane";
|
|
4
4
|
import { bindSignalAttribute, bindSignalChild, createElementFromConfig, enableSignalBindings, replaceRef, setPlainAttribute, updateFreshClassName } from "octane/internal/client";
|
|
5
5
|
//#region src/PinInput.web.tsrx
|
|
6
6
|
enableSignalBindings(1, true);
|
|
7
7
|
var _t$0 = /* @__PURE__ */ template("<div role=\"group\"></div>");
|
|
8
|
-
var _hs$ = /* @__PURE__ */ hookSlots(
|
|
8
|
+
var _hs$ = /* @__PURE__ */ hookSlots(4);
|
|
9
9
|
var _rm$1 = [
|
|
10
10
|
"r",
|
|
11
11
|
"b",
|
|
@@ -16,7 +16,15 @@ var PinInput = /* @__PURE__ */ __s(function PinInput(props, __s, __extra) {
|
|
|
16
16
|
const [internal, setInternal] = useState("", _hs$ + 0);
|
|
17
17
|
const controlled = props.value !== void 0;
|
|
18
18
|
const value = controlled ? props.value : internal;
|
|
19
|
-
const handles = [];
|
|
19
|
+
const handles = useRef([], _hs$ + 1);
|
|
20
|
+
const pendingFocus = useRef(null, _hs$ + 2);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const next = pendingFocus.current;
|
|
23
|
+
if (next !== null && next <= value.length) {
|
|
24
|
+
pendingFocus.current = null;
|
|
25
|
+
handles.current[next]?.focus();
|
|
26
|
+
}
|
|
27
|
+
}, [value], _hs$ + 3);
|
|
20
28
|
const setValue = (next) => {
|
|
21
29
|
const clipped = next.slice(0, length);
|
|
22
30
|
if (!controlled) setInternal(clipped);
|
|
@@ -25,10 +33,16 @@ var PinInput = /* @__PURE__ */ __s(function PinInput(props, __s, __extra) {
|
|
|
25
33
|
};
|
|
26
34
|
const cellValue = (i) => value[i] ?? "";
|
|
27
35
|
const enter = (i, text) => {
|
|
36
|
+
if (props.disabled || i > value.length) return;
|
|
28
37
|
const ch = text.slice(-1);
|
|
29
|
-
const next = (value.slice(0, i) + ch + value.slice(i + 1)).slice(0, length);
|
|
38
|
+
const next = ch ? (value.slice(0, i) + ch + value.slice(i + 1)).slice(0, length) : value.slice(0, i);
|
|
39
|
+
pendingFocus.current = ch && i < length - 1 ? i + 1 : null;
|
|
30
40
|
setValue(next);
|
|
31
|
-
if (
|
|
41
|
+
if (pendingFocus.current !== null && pendingFocus.current <= value.length) {
|
|
42
|
+
const index = pendingFocus.current;
|
|
43
|
+
pendingFocus.current = null;
|
|
44
|
+
handles.current[index]?.focus();
|
|
45
|
+
}
|
|
32
46
|
};
|
|
33
47
|
let _b = __s.slots[0];
|
|
34
48
|
if (_b === void 0) {
|
|
@@ -42,7 +56,7 @@ var PinInput = /* @__PURE__ */ __s(function PinInput(props, __s, __extra) {
|
|
|
42
56
|
const _r = (e) => applyEscapeProps(e, props);
|
|
43
57
|
if (_r !== _b.b) _b.b = replaceRef(__s, _b.b, _r, _b.a);
|
|
44
58
|
}
|
|
45
|
-
_b.c = bindSignalAttribute(__s, _b.c, _b.a, "id", props.id, "b:
|
|
59
|
+
_b.c = bindSignalAttribute(__s, _b.c, _b.a, "id", props.id, "b:1e485ce0", setPlainAttribute);
|
|
46
60
|
_b.d = updateFreshClassName([
|
|
47
61
|
"vx-pininput",
|
|
48
62
|
props.disabled ? "vx-pininput--disabled" : void 0,
|
|
@@ -55,18 +69,18 @@ var PinInput = /* @__PURE__ */ __s(function PinInput(props, __s, __extra) {
|
|
|
55
69
|
_b.e = _v;
|
|
56
70
|
}
|
|
57
71
|
}
|
|
58
|
-
_b.h = bindSignalChild(__s, _b.h, 1, _b.a, Array.from({ length }, (_, i) => createScopedValue(() => createElementFromConfig("c:
|
|
72
|
+
_b.h = bindSignalChild(__s, _b.h, 1, _b.a, Array.from({ length }, (_, i) => createScopedValue(() => createElementFromConfig("c:7e2411cc", TextInput, {
|
|
59
73
|
key: i,
|
|
60
74
|
className: "vx-pininput-cell",
|
|
61
75
|
keyboardType: "number",
|
|
62
76
|
secure: props.secure,
|
|
63
|
-
editable: !props.disabled,
|
|
77
|
+
editable: !props.disabled && i <= value.length,
|
|
64
78
|
value: cellValue(i),
|
|
65
79
|
onChange: (text) => enter(i, text),
|
|
66
80
|
bind: (h) => {
|
|
67
|
-
handles[i] = h;
|
|
81
|
+
handles.current[i] = h;
|
|
68
82
|
}
|
|
69
|
-
}))), "b:
|
|
83
|
+
}))), "b:d669efd3", null, void 0, void 0, void 0, true);
|
|
70
84
|
});
|
|
71
85
|
//#endregion
|
|
72
86
|
export { PinInput };
|