@octane-xplat/ui 0.5.0 → 0.6.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 +3 -0
- package/dist/native/Absolute.native.tsrx.js +43 -0
- package/dist/native/Accordion.native.tsrx.js +75 -0
- package/dist/native/ActivityIndicator.native.tsrx.js +35 -0
- package/dist/native/Alert.native.tsrx.js +74 -0
- package/dist/native/Avatar.native.tsrx.js +76 -0
- package/dist/native/AvatarGroup.native.tsrx.js +84 -0
- package/dist/native/Badge.native.tsrx.js +29 -0
- package/dist/native/Banner.native.tsrx.js +80 -0
- package/dist/native/Breadcrumb.native.tsrx.js +66 -0
- package/dist/native/Button.native.tsrx.js +62 -0
- package/dist/native/CameraView.native.tsrx.js +165 -0
- package/dist/native/Card.native.tsrx.js +64 -0
- package/dist/native/Checkbox.native.tsrx.js +58 -0
- package/dist/native/CheckboxGroup.native.tsrx.js +70 -0
- package/dist/native/Chip.native.tsrx.js +83 -0
- package/dist/native/Collapsible.native.tsrx.js +74 -0
- package/dist/native/CommandPalette.native.tsrx.js +143 -0
- package/dist/native/ContextMenu.native.tsrx.js +140 -0
- package/dist/native/Drawer.native.tsrx.js +60 -0
- package/dist/native/DropdownMenu.native.tsrx.js +155 -0
- package/dist/native/Empty.native.tsrx.js +82 -0
- package/dist/native/FieldGroup.native.tsrx.js +39 -0
- package/dist/native/FormField.native.tsrx.js +53 -0
- package/dist/native/{ui8.js → Grid.native.tsrx.js} +19 -8
- package/dist/native/{ui59.js → Heading.native.tsrx.js} +2 -2
- package/dist/native/{ui58.js → Icon.native.tsrx.js} +4 -4
- package/dist/native/{ui29.js → Image.native.tsrx.js} +4 -4
- package/dist/native/InputNumber.native.tsrx.js +146 -0
- package/dist/native/InputRating.native.tsrx.js +74 -0
- package/dist/native/InputTags.native.tsrx.js +131 -0
- package/dist/native/Kbd.native.tsrx.js +29 -0
- package/dist/native/{ui50.js → KeyboardAvoiding.native.tsrx.js} +1 -1
- package/dist/native/{ui17.js → Link.native.tsrx.js} +1 -1
- package/dist/native/{ui55.js → Meter.native.tsrx.js} +2 -2
- package/dist/native/{ui22.js → NavLink.native.tsrx.js} +3 -3
- package/dist/native/NavigationMenu.native.tsrx.js +67 -0
- package/dist/native/{ui35.js → Overlay.native.tsrx.js} +3 -3
- package/dist/native/Pager.native.tsrx.js +282 -0
- package/dist/native/Pagination.native.tsrx.js +107 -0
- package/dist/native/PinInput.native.tsrx.js +94 -0
- package/dist/native/{ui38.js → Popover.native.tsrx.js} +5 -5
- package/dist/native/{ui16.js → Pressable.native.tsrx.js} +20 -14
- package/dist/native/ProgressGroup.native.tsrx.js +66 -0
- package/dist/native/RadioGroup.native.tsrx.js +85 -0
- package/dist/native/{ui15.js → RichText.native.tsrx.js} +15 -22
- package/dist/native/Row.native.tsrx.js +98 -0
- package/dist/native/{ui49.js → SafeArea.native.tsrx.js} +2 -2
- package/dist/native/{ui45.js → Screen.native.tsrx.js} +3 -3
- package/dist/native/{ui26.js → ScrollBox.native.tsrx.js} +1 -1
- package/dist/native/ScrollView.native.tsrx.js +233 -0
- package/dist/native/SearchInput.native.tsrx.js +151 -0
- package/dist/native/SegmentedControl.native.tsrx.js +75 -0
- package/dist/native/Select.native.tsrx.js +202 -0
- package/dist/native/Separator.native.tsrx.js +25 -0
- package/dist/native/{ui63.js → Sheet.native.tsrx.js} +15 -7
- package/dist/native/Skeleton.native.tsrx.js +28 -0
- package/dist/native/Slider.native.tsrx.js +98 -0
- package/dist/native/{ui13.js → Spacer.native.tsrx.js} +2 -2
- package/dist/native/{ui9.js → Stack.native.tsrx.js} +20 -9
- package/dist/native/Stepper.native.tsrx.js +75 -0
- package/dist/native/Switch.native.tsrx.js +33 -0
- package/dist/native/Table.native.tsrx.js +103 -0
- package/dist/native/Tabs.native.tsrx.js +163 -0
- package/dist/native/{ui14.js → Text.native.tsrx.js} +4 -3
- package/dist/native/{ui24.js → TextArea.native.tsrx.js} +17 -16
- package/dist/native/{ui23.js → TextInput.native.tsrx.js} +21 -16
- package/dist/native/Timeline.native.tsrx.js +112 -0
- package/dist/native/Tree.native.tsrx.js +140 -0
- package/dist/native/User.native.tsrx.js +95 -0
- package/dist/native/Video.native.tsrx.js +248 -0
- package/dist/native/View.native.tsrx.js +98 -0
- package/dist/native/WebView.native.tsrx.js +110 -0
- package/dist/native/aliases.native.tsrx.js +38 -0
- package/dist/native/android/BottomNavigationView.android.tsrx.js +171 -0
- package/dist/native/android/CircularProgressIndicator.android.tsrx.js +27 -0
- package/dist/native/{ui51.js → android/DrawerLayout.android.tsrx.js} +5 -7
- package/dist/native/android/MaterialDialog.android.tsrx.js +62 -0
- package/dist/native/android/MaterialSwitch.android.tsrx.js +28 -0
- package/dist/native/android/RecyclerView.android.tsrx.js +248 -0
- package/dist/native/android/SeekBar.android.tsrx.js +34 -0
- package/dist/native/android/index.js +9 -0
- package/dist/native/android/openModal.android.js +39 -0
- package/dist/native/camera-permission.native.js +47 -0
- package/dist/native/child-array.js +15 -0
- package/dist/native/icons.js +25 -0
- package/dist/native/{ui11.js → ios/LiquidGlass.ios.tsrx.js} +4 -4
- package/dist/native/{ui12.js → ios/LiquidGlassContainer.ios.tsrx.js} +4 -4
- package/dist/native/ios/SideDrawer.ios.tsrx.js +64 -0
- package/dist/native/{ui53.js → ios/UIActivityIndicatorView.ios.tsrx.js} +5 -5
- package/dist/native/{ui32.js → ios/UIModal.ios.tsrx.js} +10 -6
- package/dist/native/{ui56.js → ios/UISlider.ios.tsrx.js} +5 -5
- package/dist/native/{ui47.js → ios/UISwitch.ios.tsrx.js} +5 -5
- package/dist/native/ios/UITabBar.ios.tsrx.js +166 -0
- package/dist/native/ios/UITableView.ios.tsrx.js +270 -0
- package/dist/native/ios/index.js +11 -0
- package/dist/native/{ui33.js → ios/openModal.ios.js} +5 -4
- package/dist/native/modal-presenter.native.js +19 -0
- package/dist/native/native/index.js +4 -0
- package/dist/native/octane-client-build.json +1 -1
- package/dist/native/{ui6.js → pan.native.tsrx.js} +9 -69
- package/dist/native/platform.native.js +10 -0
- package/dist/native/refresh-metrics.js +9 -0
- package/dist/native/refresh.native.js +177 -0
- package/dist/native/{ui34.js → root-layout.native.js} +6 -1
- package/dist/native/{ui21.js → route.native.js} +96 -12
- package/dist/native/sheet-detents.native.js +102 -0
- package/dist/native/{ui64.js → sheet-service.native.js} +19 -9
- package/dist/native/sheet-snap.js +35 -0
- package/dist/native/text-write.native.js +27 -0
- package/dist/native/{ui42.js → theme/status-bar-scheme.native.js} +2 -2
- package/dist/{web/ui29.js → native/theme/theme-scheme.js} +2 -2
- package/dist/native/{ui40.js → toast-anchor.native.tsrx.js} +3 -3
- package/dist/native/translate.native.js +11 -0
- package/dist/native/ui.js +93 -55
- package/dist/native/use-back.native.tsrx.js +9 -0
- package/dist/native/{ui52.js → useMeasure.native.tsrx.js} +1 -1
- package/dist/native/video-chrome.native.tsrx.js +365 -0
- package/dist/web/Absolute.web.tsrx.js +47 -0
- package/dist/web/Accordion.web.tsrx.js +85 -0
- package/dist/web/{ui48.js → ActivityIndicator.web.tsrx.js} +1 -1
- package/dist/web/Alert.web.tsrx.js +79 -0
- package/dist/web/Avatar.web.tsrx.js +106 -0
- package/dist/web/AvatarGroup.web.tsrx.js +108 -0
- package/dist/web/Badge.web.tsrx.js +37 -0
- package/dist/web/Banner.web.tsrx.js +79 -0
- package/dist/web/Breadcrumb.web.tsrx.js +135 -0
- package/dist/web/Button.web.tsrx.js +45 -0
- package/dist/web/CameraView.web.tsrx.js +310 -0
- package/dist/web/Card.web.tsrx.js +73 -0
- package/dist/web/Checkbox.web.tsrx.js +89 -0
- package/dist/web/CheckboxGroup.web.tsrx.js +79 -0
- package/dist/web/Chip.web.tsrx.js +64 -0
- package/dist/web/Collapsible.web.tsrx.js +94 -0
- package/dist/web/CommandPalette.web.tsrx.js +125 -0
- package/dist/web/ContextMenu.web.tsrx.js +154 -0
- package/dist/web/{ui45.js → Drawer.web.tsrx.js} +13 -9
- package/dist/web/DropdownMenu.web.tsrx.js +162 -0
- package/dist/web/Empty.web.tsrx.js +89 -0
- package/dist/web/FieldGroup.web.tsrx.js +57 -0
- package/dist/web/FormField.web.tsrx.js +92 -0
- package/dist/web/Grid.web.tsrx.js +65 -0
- package/dist/web/{ui54.js → Heading.web.tsrx.js} +2 -2
- package/dist/web/{ui53.js → Icon.web.tsrx.js} +2 -2
- package/dist/web/{ui25.js → Image.web.tsrx.js} +2 -2
- package/dist/web/InputNumber.web.tsrx.js +99 -0
- package/dist/web/InputRating.web.tsrx.js +72 -0
- package/dist/web/InputTags.web.tsrx.js +122 -0
- package/dist/web/Kbd.web.tsrx.js +37 -0
- package/dist/web/{ui50.js → Meter.web.tsrx.js} +1 -1
- package/dist/web/{ui19.js → NavLink.web.tsrx.js} +1 -1
- package/dist/web/NavigationMenu.web.tsrx.js +118 -0
- package/dist/web/{ui31.js → Overlay.web.tsrx.js} +2 -2
- package/dist/web/Pager.web.tsrx.js +337 -0
- package/dist/web/Pagination.web.tsrx.js +80 -0
- package/dist/web/PinInput.web.tsrx.js +72 -0
- package/dist/web/{ui33.js → Popover.web.tsrx.js} +3 -3
- package/dist/web/{ui15.js → Pressable.web.tsrx.js} +68 -95
- package/dist/web/ProgressGroup.web.tsrx.js +109 -0
- package/dist/web/RadioGroup.web.tsrx.js +69 -0
- package/dist/web/{ui14.js → RichText.web.tsrx.js} +2 -2
- package/dist/web/Row.web.tsrx.js +250 -0
- package/dist/web/{ui43.js → SafeArea.web.tsrx.js} +1 -1
- package/dist/web/{ui39.js → Screen.web.tsrx.js} +1 -1
- package/dist/web/{ui24.js → ScrollBox.web.tsrx.js} +1 -1
- package/dist/web/ScrollView.web.tsrx.js +388 -0
- package/dist/web/SearchInput.web.tsrx.js +137 -0
- package/dist/web/SegmentedControl.web.tsrx.js +75 -0
- package/dist/web/Select.web.tsrx.js +149 -0
- package/dist/web/Separator.web.tsrx.js +42 -0
- package/dist/web/Sheet.web.tsrx.js +81 -0
- package/dist/web/Skeleton.web.tsrx.js +56 -0
- package/dist/web/Slider.web.tsrx.js +97 -0
- package/dist/web/{ui12.js → Spacer.web.tsrx.js} +1 -1
- package/dist/web/Stack.web.tsrx.js +47 -0
- package/dist/web/Stepper.web.tsrx.js +65 -0
- package/dist/web/Switch.web.tsrx.js +59 -0
- package/dist/web/Table.web.tsrx.js +161 -0
- package/dist/web/{ui40.js → Tabs.web.tsrx.js} +33 -16
- package/dist/web/{ui13.js → Text.web.tsrx.js} +18 -50
- package/dist/web/{ui21.js → TextArea.web.tsrx.js} +4 -4
- package/dist/web/{ui20.js → TextInput.web.tsrx.js} +8 -8
- package/dist/web/Timeline.web.tsrx.js +172 -0
- package/dist/web/Tree.web.tsrx.js +146 -0
- package/dist/web/User.web.tsrx.js +116 -0
- package/dist/web/Video.web.tsrx.js +400 -0
- package/dist/web/View.web.tsrx.js +250 -0
- package/dist/web/WebView.web.tsrx.js +235 -0
- package/dist/web/aliases.web.tsrx.js +24 -0
- package/dist/web/{ui36.js → anim.web.tsrx.js} +3 -35
- package/dist/web/child-array.js +15 -0
- package/dist/web/icons.js +25 -0
- package/dist/web/octane-client-build.json +1 -1
- package/dist/web/pan.web.tsrx.js +66 -0
- package/dist/web/platform.web.js +9 -0
- package/dist/web/refresh-metrics.js +9 -0
- package/dist/web/refresh.web.js +133 -0
- package/dist/web/{ui18.js → route.web.js} +14 -2
- package/dist/web/sheet-detents.web.js +103 -0
- package/dist/web/{ui60.js → sheet-service.web.js} +5 -1
- package/dist/web/sheet-snap.js +35 -0
- package/dist/{native/ui31.js → web/theme/theme-scheme.js} +2 -2
- package/dist/web/{ui35.js → toast-anchor.web.tsrx.js} +3 -3
- package/dist/web/transform.web.js +43 -0
- package/dist/web/translate.web.js +13 -0
- package/dist/web/ui.js +91 -53
- package/dist/web/use-back.web.tsrx.js +9 -0
- package/dist/web/video-chrome.web.tsrx.js +207 -0
- package/dist/web/{ui34.js → web/Hoverable.web.tsrx.js} +6 -6
- package/dist/web/web/Tooltip.web.tsrx.js +183 -0
- package/dist/web/web/index.js +3 -0
- package/package.json +30 -3
- package/src/theme/tokens.css +1380 -200
- package/types/android.d.ts +53 -0
- package/types/index.d.ts +32 -17
- package/types/index.native.d.ts +273 -0
- package/types/index.web.d.ts +272 -0
- package/types/ios.d.ts +59 -0
- package/types/native.d.ts +5 -0
- package/types/props.d.ts +930 -40
- package/types/web.d.ts +17 -0
- package/dist/native/ui10.js +0 -32
- package/dist/native/ui25.js +0 -141
- package/dist/native/ui27.js +0 -61
- package/dist/native/ui39.js +0 -103
- package/dist/native/ui4.js +0 -24
- package/dist/native/ui46.js +0 -267
- package/dist/native/ui57.js +0 -19
- package/dist/native/ui60.js +0 -14
- package/dist/native/ui7.js +0 -52
- package/dist/web/ui10.js +0 -46
- package/dist/web/ui11.js +0 -42
- package/dist/web/ui22.js +0 -108
- package/dist/web/ui23.js +0 -96
- package/dist/web/ui26.js +0 -45
- package/dist/web/ui3.js +0 -31
- package/dist/web/ui30.js +0 -34
- package/dist/web/ui41.js +0 -43
- package/dist/web/ui44.js +0 -42
- package/dist/web/ui5.js +0 -168
- package/dist/web/ui51.js +0 -47
- package/dist/web/ui52.js +0 -19
- package/dist/web/ui55.js +0 -17
- package/dist/web/ui59.js +0 -44
- package/dist/web/ui6.js +0 -94
- package/dist/web/ui7.js +0 -62
- package/dist/web/ui8.js +0 -46
- package/dist/web/ui9.js +0 -46
- /package/dist/native/{ui20.js → RouteHost.native.tsrx.js} +0 -0
- /package/dist/native/{ui41.js → anim.native.tsrx.js} +0 -0
- /package/dist/native/{ui2.js → cx.js} +0 -0
- /package/dist/native/{ui3.js → escape-props.native.js} +0 -0
- /package/dist/native/{ui5.js → layout-child.native.js} +0 -0
- /package/dist/native/{ui54.js → meter-math.js} +0 -0
- /package/dist/native/{ui36.js → platformProps.native.js} +0 -0
- /package/dist/native/{ui37.js → popover-position.js} +0 -0
- /package/dist/native/{ui19.js → route-table.js} +0 -0
- /package/dist/native/{ui48.js → safeAreaInsets.native.tsrx.js} +0 -0
- /package/dist/native/{ui18.js → stacks.native.js} +0 -0
- /package/dist/native/{ui61.js → store.js} +0 -0
- /package/dist/native/{ui43.js → styled.native.tsrx.js} +0 -0
- /package/dist/native/{ui28.js → svg.native.js} +0 -0
- /package/dist/native/{ui30.js → theme/colorScheme.native.js} +0 -0
- /package/dist/native/{ui62.js → use-store.native.tsrx.js} +0 -0
- /package/dist/native/{ui44.js → windows.native.js} +0 -0
- /package/dist/web/{ui16.js → Link.web.tsrx.js} +0 -0
- /package/dist/web/{ui28.js → cx.js} +0 -0
- /package/dist/web/{ui2.js → escape-props.web.js} +0 -0
- /package/dist/web/{ui4.js → layout-child.web.js} +0 -0
- /package/dist/web/{ui49.js → meter-math.js} +0 -0
- /package/dist/web/{ui47.js → platformProps.web.js} +0 -0
- /package/dist/web/{ui32.js → popover-position.js} +0 -0
- /package/dist/web/{ui17.js → route-table.js} +0 -0
- /package/dist/web/{ui42.js → safeAreaInsets.web.tsrx.js} +0 -0
- /package/dist/web/{ui56.js → stacks.web.js} +0 -0
- /package/dist/web/{ui57.js → store.js} +0 -0
- /package/dist/web/{ui37.js → styled.web.tsrx.js} +0 -0
- /package/dist/web/{ui27.js → theme/colorScheme.web.js} +0 -0
- /package/dist/web/{ui58.js → use-store.web.tsrx.js} +0 -0
- /package/dist/web/{ui46.js → useMeasure.web.tsrx.js} +0 -0
- /package/dist/web/{ui38.js → windows.web.js} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { setTranslate } from "./translate.web.js";
|
|
2
|
+
import { detentOffset, normalizeDetents, snapDetentIndex } from "./sheet-snap.js";
|
|
3
|
+
//#region src/sheet-detents.web.ts
|
|
4
|
+
var SNAP_MS = 200;
|
|
5
|
+
/** Drag-to-snap detents on a `.vx-sheet` panel: a self-drawn grabber strip
|
|
6
|
+
* (the only drag target — it never fights inner scrolling) drives the
|
|
7
|
+
* panel's translateY; the panel is sized to the largest detent and parked
|
|
8
|
+
* at the offset for the current one. `closeNow` fires after the dismiss
|
|
9
|
+
* slide-out — the caller decides what closing means (declarative
|
|
10
|
+
* `onDismiss` or the `openSheet` resolution). In-window on every target —
|
|
11
|
+
* the OS detent presentations (UISheetPresentationController /
|
|
12
|
+
* BottomSheetDialog) host a modal VC/dialog window, not a RootLayout
|
|
13
|
+
* child, so the snap mechanics stay self-drawn for pixel parity. */
|
|
14
|
+
function attachSheetDetents(panel, detents, closeNow) {
|
|
15
|
+
const sorted = normalizeDetents(detents);
|
|
16
|
+
if (!sorted.length) return { detach: () => {} };
|
|
17
|
+
const vh = () => panel.parentElement?.clientHeight || window.innerHeight || 1;
|
|
18
|
+
const max = sorted[sorted.length - 1];
|
|
19
|
+
panel.classList.add("vx-sheet-detents");
|
|
20
|
+
panel.style.height = `${max * 100}%`;
|
|
21
|
+
const grabber = document.createElement("div");
|
|
22
|
+
grabber.className = "vx-sheet-grabber";
|
|
23
|
+
const grip = document.createElement("div");
|
|
24
|
+
grip.className = "vx-sheet-grip";
|
|
25
|
+
grabber.appendChild(grip);
|
|
26
|
+
panel.appendChild(grabber);
|
|
27
|
+
let cur = 0;
|
|
28
|
+
let ty = 0;
|
|
29
|
+
let dragging = false;
|
|
30
|
+
let y0 = 0;
|
|
31
|
+
let ty0 = 0;
|
|
32
|
+
let vy = 0;
|
|
33
|
+
let lastY = 0;
|
|
34
|
+
let lastT = 0;
|
|
35
|
+
const applyTy = (value) => {
|
|
36
|
+
ty = value;
|
|
37
|
+
setTranslate(panel, 0, value);
|
|
38
|
+
};
|
|
39
|
+
const animateTo = (value, then) => {
|
|
40
|
+
panel.style.transition = `transform ${SNAP_MS}ms ease-out`;
|
|
41
|
+
applyTy(value);
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
panel.style.transition = "";
|
|
44
|
+
then?.();
|
|
45
|
+
}, SNAP_MS);
|
|
46
|
+
};
|
|
47
|
+
const down = (e) => {
|
|
48
|
+
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
49
|
+
dragging = true;
|
|
50
|
+
grabber.setPointerCapture?.(e.pointerId);
|
|
51
|
+
y0 = e.clientY;
|
|
52
|
+
lastY = e.clientY;
|
|
53
|
+
lastT = Date.now();
|
|
54
|
+
ty0 = ty;
|
|
55
|
+
vy = 0;
|
|
56
|
+
panel.style.transition = "";
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
};
|
|
59
|
+
const move = (e) => {
|
|
60
|
+
if (!dragging) return;
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
const dt = (now - lastT) / 1e3;
|
|
63
|
+
if (dt > 0) vy = vy * .7 + (e.clientY - lastY) / dt * .3;
|
|
64
|
+
lastY = e.clientY;
|
|
65
|
+
lastT = now;
|
|
66
|
+
applyTy(Math.min(Math.max(ty0 + (e.clientY - y0), 0), vh()));
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
};
|
|
69
|
+
const up = () => {
|
|
70
|
+
if (!dragging) return;
|
|
71
|
+
dragging = false;
|
|
72
|
+
const next = snapDetentIndex(ty, vy, sorted, vh());
|
|
73
|
+
if (next < 0) animateTo(vh(), closeNow);
|
|
74
|
+
else {
|
|
75
|
+
cur = next;
|
|
76
|
+
animateTo(detentOffset(sorted, cur, vh()));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const pinGrabber = () => {
|
|
80
|
+
grabber.style.top = `${panel.scrollTop}px`;
|
|
81
|
+
};
|
|
82
|
+
panel.addEventListener("scroll", pinGrabber);
|
|
83
|
+
grabber.addEventListener("pointerdown", down);
|
|
84
|
+
grabber.addEventListener("pointermove", move);
|
|
85
|
+
grabber.addEventListener("pointerup", up);
|
|
86
|
+
grabber.addEventListener("pointercancel", up);
|
|
87
|
+
applyTy(vh());
|
|
88
|
+
const raf = requestAnimationFrame(() => animateTo(detentOffset(sorted, cur, vh())));
|
|
89
|
+
return { detach: () => {
|
|
90
|
+
cancelAnimationFrame(raf);
|
|
91
|
+
panel.removeEventListener("scroll", pinGrabber);
|
|
92
|
+
grabber.removeEventListener("pointerdown", down);
|
|
93
|
+
grabber.removeEventListener("pointermove", move);
|
|
94
|
+
grabber.removeEventListener("pointerup", up);
|
|
95
|
+
grabber.removeEventListener("pointercancel", up);
|
|
96
|
+
grabber.remove();
|
|
97
|
+
panel.classList.remove("vx-sheet-detents");
|
|
98
|
+
panel.style.height = "";
|
|
99
|
+
panel.style.transition = "";
|
|
100
|
+
} };
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { attachSheetDetents };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { applyThemeClasses } from "./
|
|
1
|
+
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
2
|
+
import { attachSheetDetents } from "./sheet-detents.web.js";
|
|
2
3
|
import { createRoot } from "octane";
|
|
3
4
|
//#region src/sheet-service.web.ts
|
|
4
5
|
var active = /* @__PURE__ */ new Set();
|
|
@@ -13,12 +14,14 @@ var openSheet = (Component, params, options = {}) => new Promise((resolve) => {
|
|
|
13
14
|
const unbindTheme = applyThemeClasses(layer, "vx-sheet-layer");
|
|
14
15
|
const panel = document.createElement("div");
|
|
15
16
|
panel.className = "vx-sheet";
|
|
17
|
+
if (options.detents?.length) panel.classList.add("vx-sheet-detents");
|
|
16
18
|
let finished = false;
|
|
17
19
|
const finish = (result) => {
|
|
18
20
|
if (finished) return;
|
|
19
21
|
finished = true;
|
|
20
22
|
active.delete(entry);
|
|
21
23
|
unbindTheme();
|
|
24
|
+
detents?.detach();
|
|
22
25
|
root.unmount();
|
|
23
26
|
layer.remove();
|
|
24
27
|
resolve(result);
|
|
@@ -35,6 +38,7 @@ var openSheet = (Component, params, options = {}) => new Promise((resolve) => {
|
|
|
35
38
|
}
|
|
36
39
|
layer.appendChild(panel);
|
|
37
40
|
document.body.appendChild(layer);
|
|
41
|
+
const detents = options.detents?.length ? attachSheetDetents(panel, options.detents, () => finish()) : null;
|
|
38
42
|
const root = createRoot(panel);
|
|
39
43
|
root.render(Component, {
|
|
40
44
|
params,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Sorted, filtered, deduped detent fractions. Empty → the caller keeps
|
|
2
|
+
* the content-sized sheet behavior (detents off). */
|
|
3
|
+
function normalizeDetents(input) {
|
|
4
|
+
if (!input?.length) return [];
|
|
5
|
+
return [...new Set(input.filter((d) => d > 0 && d <= 1))].sort((a, b) => a - b);
|
|
6
|
+
}
|
|
7
|
+
/** Resting translateY for a detent: the panel is `max * vh` tall, so the
|
|
8
|
+
* portion below the screen edge is `(max - detent) * vh`. */
|
|
9
|
+
function detentOffset(detents, index, vh) {
|
|
10
|
+
return (detents[detents.length - 1] - detents[index]) * vh;
|
|
11
|
+
}
|
|
12
|
+
/** Snap target for a release at translateY `ty` with vertical velocity
|
|
13
|
+
* `vy` (positive = dragging down). Returns the detent index, or -1 to
|
|
14
|
+
* dismiss: released below half of the smallest detent, or a downward
|
|
15
|
+
* fling while at/below it. */
|
|
16
|
+
function snapDetentIndex(ty, vy, detents, vh) {
|
|
17
|
+
const max = detents[detents.length - 1];
|
|
18
|
+
const frac = Math.min(Math.max(max - ty / vh, 0), 1);
|
|
19
|
+
if (vy > 500) {
|
|
20
|
+
let i = -1;
|
|
21
|
+
while (i + 1 < detents.length && detents[i + 1] < frac - 1e-6) i++;
|
|
22
|
+
return i;
|
|
23
|
+
}
|
|
24
|
+
if (vy < -500) {
|
|
25
|
+
let i = detents.length - 1;
|
|
26
|
+
while (i - 1 >= 0 && detents[i - 1] > frac + 1e-6) i--;
|
|
27
|
+
return i;
|
|
28
|
+
}
|
|
29
|
+
if (frac < detents[0] * .5) return -1;
|
|
30
|
+
let best = 0;
|
|
31
|
+
for (let i = 1; i < detents.length; i++) if (Math.abs(detents[i] - frac) < Math.abs(detents[best] - frac)) best = i;
|
|
32
|
+
return best;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { detentOffset, normalizeDetents, snapDetentIndex };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getColorScheme, subscribeSystemScheme } from "./colorScheme.web.js";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
3
|
import { hookSlots, useSyncExternalStore } from "octane";
|
|
4
4
|
//#region src/theme/theme-scheme.ts
|
|
5
5
|
var preference = "system";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cx } from "./
|
|
2
|
-
import { applyThemeClasses } from "./
|
|
3
|
-
import { Popover } from "./
|
|
1
|
+
import { cx } from "./cx.js";
|
|
2
|
+
import { applyThemeClasses } from "./theme/theme-scheme.js";
|
|
3
|
+
import { Popover } from "./Popover.web.tsrx.js";
|
|
4
4
|
import { bag1, bag3, clone, componentSlot, componentSlotVoid, createRoot, ifBlock, markChildrenBlock, template } from "octane";
|
|
5
5
|
import { childTextHoleUpdate } from "octane/internal/client";
|
|
6
6
|
//#region src/toast-anchor.web.tsrx
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/transform.web.ts
|
|
2
|
+
/** Per-element transform composition for imperative writes. The DOM has a
|
|
3
|
+
* single `transform` string where native has discrete view props, so web
|
|
4
|
+
* keeps the last-written value per transform prop and re-joins them —
|
|
5
|
+
* an AnimatedValue on `rotate` and a setTranslate drag on the same
|
|
6
|
+
* element don't clobber each other. */
|
|
7
|
+
var transformProps = {
|
|
8
|
+
translateX: (v) => `translateX(${v}px)`,
|
|
9
|
+
translateY: (v) => `translateY(${v}px)`,
|
|
10
|
+
translateZ: (v) => `translateZ(${v}px)`,
|
|
11
|
+
scale: (v) => `scale(${v})`,
|
|
12
|
+
scaleX: (v) => `scaleX(${v})`,
|
|
13
|
+
scaleY: (v) => `scaleY(${v})`,
|
|
14
|
+
rotate: (v) => `rotate(${v}deg)`,
|
|
15
|
+
rotateX: (v) => `rotateX(${v}deg)`,
|
|
16
|
+
rotateY: (v) => `rotateY(${v}deg)`,
|
|
17
|
+
skewX: (v) => `skewX(${v}deg)`,
|
|
18
|
+
skewY: (v) => `skewY(${v}deg)`
|
|
19
|
+
};
|
|
20
|
+
var transformStates = /* @__PURE__ */ new WeakMap();
|
|
21
|
+
/** Write one transform prop without disturbing the element's other
|
|
22
|
+
* transform components (or its stylesheet/base transform). */
|
|
23
|
+
function writeTransformProp(el, prop, value) {
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(transformProps, prop)) {
|
|
25
|
+
const transformProp = prop;
|
|
26
|
+
let state = transformStates.get(el);
|
|
27
|
+
if (!state) {
|
|
28
|
+
const computed = getComputedStyle(el).transform;
|
|
29
|
+
state = {
|
|
30
|
+
base: computed === "none" ? "" : computed,
|
|
31
|
+
values: /* @__PURE__ */ new Map()
|
|
32
|
+
};
|
|
33
|
+
transformStates.set(el, state);
|
|
34
|
+
}
|
|
35
|
+
state.values.set(transformProp, value);
|
|
36
|
+
const transforms = Object.entries(transformProps).filter(([name]) => state.values.has(name)).map(([name, toTransform]) => toTransform(state.values.get(name)));
|
|
37
|
+
el.style.transform = [state.base, ...transforms].filter(Boolean).join(" ");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
el.style[prop] = value;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { writeTransformProp };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { writeTransformProp } from "./transform.web.js";
|
|
2
|
+
//#region src/translate.web.ts
|
|
3
|
+
/** Imperative translate write on a bound view — the gesture seam. Called
|
|
4
|
+
* per frame from pan handlers (docs/animation-gestures.md: animation
|
|
5
|
+
* writes imperative, state stays declarative). Composes with other
|
|
6
|
+
* transform writes on the same element via ./transform.web. */
|
|
7
|
+
var setTranslate = (el, x = 0, y = 0) => {
|
|
8
|
+
if (!el) return;
|
|
9
|
+
writeTransformProp(el, "translateX", x);
|
|
10
|
+
writeTransformProp(el, "translateY", y);
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { setTranslate };
|
package/dist/web/ui.js
CHANGED
|
@@ -1,53 +1,91 @@
|
|
|
1
|
-
import { View } from "./
|
|
2
|
-
import { Row } from "./
|
|
3
|
-
import { Grid } from "./
|
|
4
|
-
import { Stack } from "./
|
|
5
|
-
import { Absolute } from "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
|
|
1
|
+
import { View } from "./View.web.tsrx.js";
|
|
2
|
+
import { Row } from "./Row.web.tsrx.js";
|
|
3
|
+
import { Grid } from "./Grid.web.tsrx.js";
|
|
4
|
+
import { Stack } from "./Stack.web.tsrx.js";
|
|
5
|
+
import { Absolute } from "./Absolute.web.tsrx.js";
|
|
6
|
+
import { setTranslate } from "./translate.web.js";
|
|
7
|
+
import { Spacer } from "./Spacer.web.tsrx.js";
|
|
8
|
+
import { Text } from "./Text.web.tsrx.js";
|
|
9
|
+
import { RichText, RichTextSpan } from "./RichText.web.tsrx.js";
|
|
10
|
+
import { Pressable } from "./Pressable.web.tsrx.js";
|
|
11
|
+
import { ActivityIndicator } from "./ActivityIndicator.web.tsrx.js";
|
|
12
|
+
import { Button } from "./Button.web.tsrx.js";
|
|
13
|
+
import { Collapsible } from "./Collapsible.web.tsrx.js";
|
|
14
|
+
import { Accordion } from "./Accordion.web.tsrx.js";
|
|
15
|
+
import { Checkbox } from "./Checkbox.web.tsrx.js";
|
|
16
|
+
import { RadioGroup } from "./RadioGroup.web.tsrx.js";
|
|
17
|
+
import { getColorScheme, useColorScheme } from "./theme/colorScheme.web.js";
|
|
18
|
+
import { applyThemeClasses, getThemePreference, getThemeScheme, onThemeSchemeChange, setThemePreference, themeSchemeClasses, useThemeScheme } from "./theme/theme-scheme.js";
|
|
19
|
+
import { Popover } from "./Popover.web.tsrx.js";
|
|
20
|
+
import { registerIcon, registerIcons } from "./icons.js";
|
|
21
|
+
import { Icon } from "./Icon.web.tsrx.js";
|
|
22
|
+
import { DropdownMenu } from "./DropdownMenu.web.tsrx.js";
|
|
23
|
+
import { ContextMenu } from "./ContextMenu.web.tsrx.js";
|
|
24
|
+
import { Badge } from "./Badge.web.tsrx.js";
|
|
25
|
+
import { Separator } from "./Separator.web.tsrx.js";
|
|
26
|
+
import { Skeleton } from "./Skeleton.web.tsrx.js";
|
|
27
|
+
import { Avatar } from "./Avatar.web.tsrx.js";
|
|
28
|
+
import { AvatarGroup } from "./AvatarGroup.web.tsrx.js";
|
|
29
|
+
import { FormField } from "./FormField.web.tsrx.js";
|
|
30
|
+
import { FieldGroup } from "./FieldGroup.web.tsrx.js";
|
|
31
|
+
import { TextInput } from "./TextInput.web.tsrx.js";
|
|
32
|
+
import { InputNumber } from "./InputNumber.web.tsrx.js";
|
|
33
|
+
import { PinInput } from "./PinInput.web.tsrx.js";
|
|
34
|
+
import { Select } from "./Select.web.tsrx.js";
|
|
35
|
+
import { Combobox, InputMenu, SelectMenu } from "./aliases.web.tsrx.js";
|
|
36
|
+
import { InputTags } from "./InputTags.web.tsrx.js";
|
|
37
|
+
import { InputRating } from "./InputRating.web.tsrx.js";
|
|
38
|
+
import { CheckboxGroup } from "./CheckboxGroup.web.tsrx.js";
|
|
39
|
+
import { Breadcrumb } from "./Breadcrumb.web.tsrx.js";
|
|
40
|
+
import { Pagination } from "./Pagination.web.tsrx.js";
|
|
41
|
+
import { Stepper } from "./Stepper.web.tsrx.js";
|
|
42
|
+
import { NavigationMenu } from "./NavigationMenu.web.tsrx.js";
|
|
43
|
+
import { Overlay } from "./Overlay.web.tsrx.js";
|
|
44
|
+
import { CommandPalette } from "./CommandPalette.web.tsrx.js";
|
|
45
|
+
import { Table } from "./Table.web.tsrx.js";
|
|
46
|
+
import { Timeline } from "./Timeline.web.tsrx.js";
|
|
47
|
+
import { Tree } from "./Tree.web.tsrx.js";
|
|
48
|
+
import { Alert } from "./Alert.web.tsrx.js";
|
|
49
|
+
import { Card } from "./Card.web.tsrx.js";
|
|
50
|
+
import { Chip } from "./Chip.web.tsrx.js";
|
|
51
|
+
import { Kbd } from "./Kbd.web.tsrx.js";
|
|
52
|
+
import { Empty } from "./Empty.web.tsrx.js";
|
|
53
|
+
import { Banner } from "./Banner.web.tsrx.js";
|
|
54
|
+
import { User } from "./User.web.tsrx.js";
|
|
55
|
+
import { Meter } from "./Meter.web.tsrx.js";
|
|
56
|
+
import { ProgressGroup } from "./ProgressGroup.web.tsrx.js";
|
|
57
|
+
import { Link } from "./Link.web.tsrx.js";
|
|
58
|
+
import { deriveRouteManifest } from "./route-table.js";
|
|
59
|
+
import { addBackInterceptor, canGoBack, currentModalRoute, currentRoute, hrefFor, popRoute, pushDeepLink, pushRoute, redirect, registerRoutes, registerScreens, routeFor, routeStacks, screenFor, useCanGoBack, useModalRoute, useRoute } from "./route.web.js";
|
|
60
|
+
import { NavLink } from "./NavLink.web.tsrx.js";
|
|
61
|
+
import { TextArea } from "./TextArea.web.tsrx.js";
|
|
62
|
+
import { SearchInput } from "./SearchInput.web.tsrx.js";
|
|
63
|
+
import { SegmentedControl } from "./SegmentedControl.web.tsrx.js";
|
|
64
|
+
import { ScrollView } from "./ScrollView.web.tsrx.js";
|
|
65
|
+
import { ScrollBox } from "./ScrollBox.web.tsrx.js";
|
|
66
|
+
import { Pager } from "./Pager.web.tsrx.js";
|
|
67
|
+
import { Image } from "./Image.web.tsrx.js";
|
|
68
|
+
import { WebView } from "./WebView.web.tsrx.js";
|
|
69
|
+
import { useMeasure } from "./useMeasure.web.tsrx.js";
|
|
70
|
+
import { Slider } from "./Slider.web.tsrx.js";
|
|
71
|
+
import { Video } from "./Video.web.tsrx.js";
|
|
72
|
+
import { CameraView } from "./CameraView.web.tsrx.js";
|
|
73
|
+
import { showToast } from "./toast-anchor.web.tsrx.js";
|
|
74
|
+
import { useAnimation } from "./anim.web.tsrx.js";
|
|
75
|
+
import { styled } from "./styled.web.tsrx.js";
|
|
76
|
+
import { openWindow } from "./windows.web.js";
|
|
77
|
+
import { Screen } from "./Screen.web.tsrx.js";
|
|
78
|
+
import { Tabs } from "./Tabs.web.tsrx.js";
|
|
79
|
+
import { Switch } from "./Switch.web.tsrx.js";
|
|
80
|
+
import { useSafeAreaInsets } from "./safeAreaInsets.web.tsrx.js";
|
|
81
|
+
import { SafeArea } from "./SafeArea.web.tsrx.js";
|
|
82
|
+
import { Drawer } from "./Drawer.web.tsrx.js";
|
|
83
|
+
import { Heading } from "./Heading.web.tsrx.js";
|
|
84
|
+
import { isNative } from "./platform.web.js";
|
|
85
|
+
import { getStack, registerStack, stackEntries } from "./stacks.web.js";
|
|
86
|
+
import { useBackInterceptor } from "./use-back.web.tsrx.js";
|
|
87
|
+
import { createStore } from "./store.js";
|
|
88
|
+
import { useStore } from "./use-store.web.tsrx.js";
|
|
89
|
+
import { Sheet } from "./Sheet.web.tsrx.js";
|
|
90
|
+
import { closeSheet, openSheet } from "./sheet-service.web.js";
|
|
91
|
+
export { Absolute, Accordion, ActivityIndicator, Alert, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, Button, CameraView, Card, Checkbox, CheckboxGroup, Chip, Collapsible, View as Column, Combobox, CommandPalette, ContextMenu, Drawer, DropdownMenu, Empty, FieldGroup, FormField, Grid, Heading, Icon, Image, InputMenu, InputNumber, InputRating, InputTags, Kbd, Link, Meter, NavLink, NavigationMenu, Overlay, Pager, 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, Tree, User, Video, View, WebView, addBackInterceptor, applyThemeClasses, canGoBack, closeSheet, createStore, currentModalRoute, currentRoute, deriveRouteManifest, getColorScheme, getStack, getThemePreference, getThemeScheme, hrefFor, isNative, 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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { addBackInterceptor } from "./route.web.js";
|
|
2
|
+
import { hookSlots, useEffect } from "octane";
|
|
3
|
+
//#region src/use-back.web.tsrx
|
|
4
|
+
var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
|
|
5
|
+
function useBackInterceptor(fn) {
|
|
6
|
+
useEffect(() => addBackInterceptor(fn), [fn], _h$0);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { useBackInterceptor };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { View } from "./View.web.tsrx.js";
|
|
2
|
+
import { Row } from "./Row.web.tsrx.js";
|
|
3
|
+
import { Text } from "./Text.web.tsrx.js";
|
|
4
|
+
import { Pressable } from "./Pressable.web.tsrx.js";
|
|
5
|
+
import { Icon } from "./Icon.web.tsrx.js";
|
|
6
|
+
import { Image } from "./Image.web.tsrx.js";
|
|
7
|
+
import { Slider } from "./Slider.web.tsrx.js";
|
|
8
|
+
import { bag4, child, clone, componentSlot, componentSlotVoid, drainFrag, hookSlots, ifBlock, markChildrenBlock, markWarm, registerWarmPlan, template, useEffect, useState, warmChild } from "octane";
|
|
9
|
+
import { textHoleUpdate } from "octane/internal/client";
|
|
10
|
+
//#region src/video-chrome.web.tsrx
|
|
11
|
+
var _t$0 = /* @__PURE__ */ template("<!>", 0, 1);
|
|
12
|
+
var _hs$ = /* @__PURE__ */ hookSlots(12);
|
|
13
|
+
function __then$0(__props, __s, __extra) {
|
|
14
|
+
const __block = __s.block;
|
|
15
|
+
const props = __extra[0];
|
|
16
|
+
componentSlotVoid(__s, 0, __block.parentNode, Image, {
|
|
17
|
+
"className": "vx-video-poster",
|
|
18
|
+
"src": props.poster,
|
|
19
|
+
"ios": { stretch: "aspectFill" },
|
|
20
|
+
"android": { stretch: "aspectFill" }
|
|
21
|
+
}, __block.endMarker, void 0, 2, void 0, void 0, "c:1f04b0e4");
|
|
22
|
+
}
|
|
23
|
+
var __childrenBody = {};
|
|
24
|
+
var __childrenBody$ = {};
|
|
25
|
+
function __then$5(__props, __s, __extra) {
|
|
26
|
+
const __block = __s.block;
|
|
27
|
+
const props = __extra[0];
|
|
28
|
+
function __children$7(__props, __s, __extra) {
|
|
29
|
+
const __block = __s.block;
|
|
30
|
+
function __children$9(__props, __s, __extra) {
|
|
31
|
+
const __block = __s.block;
|
|
32
|
+
componentSlot(__s, 0, __block.parentNode, Icon, {
|
|
33
|
+
"name": "xplat-play",
|
|
34
|
+
"size": 28,
|
|
35
|
+
"color": "#fff"
|
|
36
|
+
}, __block.endMarker, void 0, 2, void 0, void 0, "c:1921eb83");
|
|
37
|
+
}
|
|
38
|
+
componentSlotVoid(__s, 0, __block.parentNode, View, {
|
|
39
|
+
"className": "vx-video-centerbtn",
|
|
40
|
+
"children": markChildrenBlock(__children$9, __childrenBody)
|
|
41
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:6b9e94c8");
|
|
42
|
+
}
|
|
43
|
+
componentSlotVoid(__s, 0, __block.parentNode, Pressable, {
|
|
44
|
+
"className": "vx-video-center",
|
|
45
|
+
"justifyContent": "center",
|
|
46
|
+
"alignItems": "center",
|
|
47
|
+
"accessibilityRole": "button",
|
|
48
|
+
"accessibilityLabel": "Play",
|
|
49
|
+
"onPress": props.onTogglePlay,
|
|
50
|
+
"children": markChildrenBlock(__children$7, __childrenBody$)
|
|
51
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:422fa4c4");
|
|
52
|
+
}
|
|
53
|
+
var __childrenBody$2 = {};
|
|
54
|
+
var __childrenBody$3 = {};
|
|
55
|
+
var __childrenBody$4 = {};
|
|
56
|
+
var __childrenBody$5 = {};
|
|
57
|
+
var __childrenBody$6 = {};
|
|
58
|
+
var __childrenBody$7 = {};
|
|
59
|
+
function __then$4(__props, __s, __extra) {
|
|
60
|
+
const __block = __s.block;
|
|
61
|
+
const props = __extra[0];
|
|
62
|
+
function __children$13(__props, __s, __extra) {
|
|
63
|
+
const __block = __s.block;
|
|
64
|
+
function __children$15(__props, __s, __extra) {
|
|
65
|
+
const __block = __s.block;
|
|
66
|
+
function __children$17(__props, __s, __extra) {
|
|
67
|
+
const __block = __s.block;
|
|
68
|
+
componentSlot(__s, 0, __block.parentNode, Icon, {
|
|
69
|
+
"name": props.playing ? "xplat-pause" : "xplat-play",
|
|
70
|
+
"size": 20,
|
|
71
|
+
"color": "#fff"
|
|
72
|
+
}, __block.endMarker, void 0, 2, void 0, void 0, "c:52dcc579");
|
|
73
|
+
}
|
|
74
|
+
function __children$20(__props, __s, __extra) {
|
|
75
|
+
const __block = __s.block;
|
|
76
|
+
let _b = __s.slots[0];
|
|
77
|
+
if (_b === void 0) {
|
|
78
|
+
let _m0, _m1;
|
|
79
|
+
const _root = clone(_t$0);
|
|
80
|
+
_m0 = __block.parentNode;
|
|
81
|
+
_m1 = child(_root);
|
|
82
|
+
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
83
|
+
_b = bag4(__s, null, _m0, _m1, null, void 0);
|
|
84
|
+
}
|
|
85
|
+
{
|
|
86
|
+
const _v = stamp(props.position);
|
|
87
|
+
_b.c = textHoleUpdate(__s, 1, _b.a, _v, _b.c, _b.d, _b.b, true, true);
|
|
88
|
+
_b.d = _v;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function __children$24(__props, __s, __extra) {
|
|
92
|
+
const __block = __s.block;
|
|
93
|
+
let _b = __s.slots[0];
|
|
94
|
+
if (_b === void 0) {
|
|
95
|
+
let _m0, _m1;
|
|
96
|
+
const _root = clone(_t$0);
|
|
97
|
+
_m0 = __block.parentNode;
|
|
98
|
+
_m1 = child(_root);
|
|
99
|
+
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
100
|
+
_b = bag4(__s, null, _m0, _m1, null, void 0);
|
|
101
|
+
}
|
|
102
|
+
{
|
|
103
|
+
const _v = stamp(props.duration);
|
|
104
|
+
_b.c = textHoleUpdate(__s, 1, _b.a, _v, _b.c, _b.d, _b.b, true, true);
|
|
105
|
+
_b.d = _v;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function __children$27(__props, __s, __extra) {
|
|
109
|
+
const __block = __s.block;
|
|
110
|
+
componentSlot(__s, 0, __block.parentNode, Icon, {
|
|
111
|
+
"name": props.muted ? "xplat-volume-off" : "xplat-volume",
|
|
112
|
+
"size": 20,
|
|
113
|
+
"color": "#fff"
|
|
114
|
+
}, __block.endMarker, void 0, 2, void 0, void 0, "c:3158cbfc");
|
|
115
|
+
}
|
|
116
|
+
componentSlotVoid(__s, 0, __block.parentNode, Pressable, {
|
|
117
|
+
"className": "vx-video-btn",
|
|
118
|
+
"accessibilityRole": "button",
|
|
119
|
+
"accessibilityLabel": props.playing ? "Pause" : "Play",
|
|
120
|
+
"onPress": props.onTogglePlay,
|
|
121
|
+
"children": markChildrenBlock(__children$17, __childrenBody$2)
|
|
122
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:b0e57e42");
|
|
123
|
+
componentSlotVoid(__s, 1, __block.parentNode, Text, {
|
|
124
|
+
"className": "vx-video-time",
|
|
125
|
+
"children": markChildrenBlock(__children$20, __childrenBody$3)
|
|
126
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:c5cb75e7");
|
|
127
|
+
componentSlotVoid(__s, 2, __block.parentNode, Slider, {
|
|
128
|
+
"className": "vx-video-slider",
|
|
129
|
+
"style": { flexGrow: 1 },
|
|
130
|
+
"value": props.position,
|
|
131
|
+
"minValue": 0,
|
|
132
|
+
"maxValue": props.duration > 0 ? props.duration : 1,
|
|
133
|
+
"onValueChange": props.onSeek
|
|
134
|
+
}, __block.endMarker, void 0, 2, void 0, void 0, "c:983b3c9e");
|
|
135
|
+
componentSlotVoid(__s, 3, __block.parentNode, Text, {
|
|
136
|
+
"className": "vx-video-time",
|
|
137
|
+
"children": markChildrenBlock(__children$24, __childrenBody$4)
|
|
138
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:fb6ef5fe");
|
|
139
|
+
componentSlotVoid(__s, 4, __block.parentNode, Pressable, {
|
|
140
|
+
"className": "vx-video-btn",
|
|
141
|
+
"accessibilityRole": "button",
|
|
142
|
+
"accessibilityLabel": props.muted ? "Unmute" : "Mute",
|
|
143
|
+
"onPress": props.onToggleMute,
|
|
144
|
+
"children": markChildrenBlock(__children$27, __childrenBody$5)
|
|
145
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:4aa80908");
|
|
146
|
+
}
|
|
147
|
+
componentSlotVoid(__s, 0, __block.parentNode, Row, {
|
|
148
|
+
"className": "vx-video-bar",
|
|
149
|
+
"alignItems": "center",
|
|
150
|
+
"gap": 8,
|
|
151
|
+
"children": markChildrenBlock(__children$15, __childrenBody$6)
|
|
152
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:199677e9");
|
|
153
|
+
}
|
|
154
|
+
ifBlock(__s, 0, __block.parentNode, !props.playing, __then$5, null, __block.endMarker, __extra);
|
|
155
|
+
componentSlotVoid(__s, 1, __block.parentNode, View, {
|
|
156
|
+
"className": "vx-video-barwrap",
|
|
157
|
+
"justifyContent": "end",
|
|
158
|
+
"children": markChildrenBlock(__children$13, __childrenBody$7)
|
|
159
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:b4f78ef1");
|
|
160
|
+
}
|
|
161
|
+
function stamp(ms) {
|
|
162
|
+
const total = Math.max(0, Math.floor(ms / 1e3));
|
|
163
|
+
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
164
|
+
}
|
|
165
|
+
var VideoChrome = /* @__PURE__ */ markWarm(function VideoChrome(props, __s, __extra) {
|
|
166
|
+
const __block = __s.block;
|
|
167
|
+
const [visible, setVisible] = useState(true, _hs$ + 0);
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (!props.playing || !visible) return;
|
|
170
|
+
const t = setTimeout(() => setVisible(false), 2500);
|
|
171
|
+
return () => clearTimeout(t);
|
|
172
|
+
}, [props.playing, visible], _hs$ + 1);
|
|
173
|
+
const __warmPlan = VideoChrome.__warm;
|
|
174
|
+
if (typeof __warmPlan === "function") registerWarmPlan(__warmPlan, props);
|
|
175
|
+
else registerWarmPlan(() => {
|
|
176
|
+
if (props.poster && !props.started) warmChild(Image, {
|
|
177
|
+
className: "vx-video-poster",
|
|
178
|
+
src: props.poster,
|
|
179
|
+
ios: { stretch: "aspectFill" },
|
|
180
|
+
android: { stretch: "aspectFill" }
|
|
181
|
+
});
|
|
182
|
+
}, void 0);
|
|
183
|
+
{
|
|
184
|
+
const __ifCondition = props.poster && !props.started;
|
|
185
|
+
ifBlock(__s, 0, __block.parentNode, __ifCondition, __then$0, null, __block.endMarker, __ifCondition ? [props] : void 0);
|
|
186
|
+
}
|
|
187
|
+
componentSlotVoid(__s, 1, __block.parentNode, Pressable, {
|
|
188
|
+
"className": "vx-video-tap",
|
|
189
|
+
"accessibilityRole": "button",
|
|
190
|
+
"accessibilityLabel": visible ? "Hide video controls" : "Show video controls",
|
|
191
|
+
"onPress": () => setVisible(props.playing ? !visible : true)
|
|
192
|
+
}, __block.endMarker, void 0, 2, void 0, void 0, "c:9cac9799");
|
|
193
|
+
{
|
|
194
|
+
const __ifCondition$ = visible;
|
|
195
|
+
ifBlock(__s, 2, __block.parentNode, __ifCondition$, __then$4, null, __block.endMarker, __ifCondition$ ? [props] : void 0);
|
|
196
|
+
}
|
|
197
|
+
}, (__wp) => {
|
|
198
|
+
const props = __wp;
|
|
199
|
+
if (props.poster && !props.started) warmChild(Image, {
|
|
200
|
+
className: "vx-video-poster",
|
|
201
|
+
src: props.poster,
|
|
202
|
+
ios: { stretch: "aspectFill" },
|
|
203
|
+
android: { stretch: "aspectFill" }
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
//#endregion
|
|
207
|
+
export { VideoChrome };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { View } from "
|
|
2
|
-
import { Popover } from "
|
|
1
|
+
import { View } from "../View.web.tsrx.js";
|
|
2
|
+
import { Popover } from "../Popover.web.tsrx.js";
|
|
3
3
|
import { bag4, bag5, child, clone, componentSlotVoid, drainFrag, hookSlots, markChildrenBlock, sibling, template, useEffect, useRef, useState } from "octane";
|
|
4
4
|
import { compilerMemoRegion, hookMemoCreate, hookMemoPublishInvariant, textHoleUpdate } from "octane/internal/client";
|
|
5
|
-
//#region src/Hoverable.web.tsrx
|
|
5
|
+
//#region src/web/Hoverable.web.tsrx
|
|
6
6
|
var _t$0 = /* @__PURE__ */ template("<!>", 0, 1);
|
|
7
7
|
var _t$1 = /* @__PURE__ */ template("<!><!>", 3, 1);
|
|
8
8
|
var _hs$ = /* @__PURE__ */ hookSlots(7);
|
|
@@ -112,7 +112,7 @@ var Hoverable = function Hoverable(props, __s, __extra) {
|
|
|
112
112
|
"className": props.cardClassName,
|
|
113
113
|
"style": props.cardStyle,
|
|
114
114
|
"children": markChildrenBlock(__children$6, __childrenBody)
|
|
115
|
-
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:
|
|
115
|
+
}, __block.endMarker, void 0, void 0, void 0, void 0, "c:c1227cf9");
|
|
116
116
|
}
|
|
117
117
|
let _b = __s.slots[0];
|
|
118
118
|
if (_b === void 0) {
|
|
@@ -136,7 +136,7 @@ var Hoverable = function Hoverable(props, __s, __extra) {
|
|
|
136
136
|
"placement": props.placement ?? "bottom",
|
|
137
137
|
"dismissOnOutsideTap": false,
|
|
138
138
|
"children": markChildrenBlock(__children$4, __childrenBody$)
|
|
139
|
-
}, _b.e, void 0, void 0, void 0, void 0, "c:
|
|
139
|
+
}, _b.e, void 0, void 0, void 0, void 0, "c:b985f665");
|
|
140
140
|
}
|
|
141
141
|
componentSlotVoid(__s, 0, __block.parentNode, View, {
|
|
142
142
|
"className": props.className,
|
|
@@ -144,7 +144,7 @@ var Hoverable = function Hoverable(props, __s, __extra) {
|
|
|
144
144
|
"bind": bindAnchor,
|
|
145
145
|
"web": props.web,
|
|
146
146
|
"children": markChildrenBlock(__children$1, __childrenBody$2)
|
|
147
|
-
}, __block.endMarker, void 0, void 0, true, void 0, "c:
|
|
147
|
+
}, __block.endMarker, void 0, void 0, true, void 0, "c:3f5159c9");
|
|
148
148
|
};
|
|
149
149
|
//#endregion
|
|
150
150
|
export { Hoverable };
|