@octane-xplat/sheet 0.0.1 → 0.10.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Alec Larson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,147 @@
1
- # @octane-xplat/sheet
1
+ # `@octane-xplat/sheet`
2
2
 
3
- Version 0.0.1 is a reservation stub so the automated release can publish this package name. It has no supported API. Use a later release for the implementation.
3
+ An install boundary for platform-specific modal bottom sheets: a SwiftUI
4
+ `.sheet` presentation on iOS, a Material 3 `ModalBottomSheet` on Android,
5
+ a native modal `<dialog>` on web, and a real `NSWindow` sheet
6
+ (`beginSheet`) on macOS.
7
+ Install the package in the app that renders a control. Import
8
+ `SwiftUIBottomSheet` from `@octane-xplat/sheet/ios`,
9
+ `MaterialBottomSheet` from `@octane-xplat/sheet/android`, `BottomSheet`
10
+ from `@octane-xplat/sheet/web`, or `AppKitSheet` from
11
+ `@octane-xplat/sheet/macos` in the matching platform-suffixed file.
12
+ There is no shared sheet API at the package root.
13
+
14
+ ```tsx
15
+ /** @jsxImportSource @nativescript-community/octane */
16
+ // SwiftUIBottomSheetExample.ios.tsx
17
+ import { SwiftUIBottomSheet } from '@octane-xplat/sheet/ios'
18
+ import { useState } from 'octane'
19
+ import { Button, Text } from '@octane-xplat/ui'
20
+
21
+ export function Details() {
22
+ const [open, setOpen] = useState(false)
23
+ return (
24
+ <>
25
+ <Button onPress={() => setOpen(true)}>Trip details</Button>
26
+ <SwiftUIBottomSheet
27
+ open={open}
28
+ detents={['medium', 'large']}
29
+ showDragIndicator
30
+ onDismissed={() => setOpen(false)}
31
+ content={() => <Text>Two bags packed</Text>}
32
+ />
33
+ </>
34
+ )
35
+ }
36
+ ```
37
+
38
+ ```tsx
39
+ /** @jsxImportSource @nativescript-community/octane */
40
+ // MaterialBottomSheetExample.android.tsx
41
+ import { MaterialBottomSheet } from '@octane-xplat/sheet/android'
42
+ import { useState } from 'octane'
43
+ import { Button, Text } from '@octane-xplat/ui'
44
+
45
+ export function Details() {
46
+ const [open, setOpen] = useState(false)
47
+ return (
48
+ <>
49
+ <Button onPress={() => setOpen(true)}>Trip details</Button>
50
+ <MaterialBottomSheet
51
+ open={open}
52
+ skipPartiallyExpanded
53
+ showDragHandle
54
+ onDismissed={() => setOpen(false)}
55
+ content={() => <Text>Two bags packed</Text>}
56
+ />
57
+ </>
58
+ )
59
+ }
60
+ ```
61
+
62
+ ```tsx
63
+ // BottomSheetExample.web.tsx
64
+ import { BottomSheet } from '@octane-xplat/sheet/web'
65
+ import { useState } from 'octane'
66
+ import { Button, Text } from '@octane-xplat/ui'
67
+
68
+ export function Details() {
69
+ const [open, setOpen] = useState(false)
70
+ return (
71
+ <>
72
+ <Button onPress={() => setOpen(true)}>Trip details</Button>
73
+ <BottomSheet
74
+ open={open}
75
+ onDismissed={() => setOpen(false)}
76
+ content={() => <Text>Two bags packed</Text>}
77
+ />
78
+ </>
79
+ )
80
+ }
81
+ ```
82
+
83
+ ```tsx
84
+ // AppKitSheetExample.macos.tsx
85
+ import { AppKitSheet } from '@octane-xplat/sheet/macos'
86
+ import { useState } from 'octane'
87
+ import { Button, Text } from '@octane-xplat/ui'
88
+
89
+ export function Details() {
90
+ const [open, setOpen] = useState(false)
91
+ return (
92
+ <>
93
+ <Button onPress={() => setOpen(true)}>Trip details</Button>
94
+ <AppKitSheet
95
+ open={open}
96
+ onDismissed={() => setOpen(false)}
97
+ content={() => <Text>Two bags packed</Text>}
98
+ />
99
+ </>
100
+ )
101
+ }
102
+ ```
103
+
104
+ Web apps must also import the sheet stylesheet from their app entry:
105
+
106
+ ```ts
107
+ import '@octane-xplat/sheet/web/styles.css'
108
+ ```
109
+
110
+ Sheet content is a render fn whose octane output mounts into a detached
111
+ root — the same embedding mechanism as `@octane-xplat/context-menu`'s
112
+ trigger. On iOS the registered view resolves through
113
+ `NativeScriptViewFactory`; on Android through the leaf's
114
+ `XplatViewRegistry` + `AndroidView` inside the sheet's dialog window.
115
+
116
+ ```tsx
117
+ /** @jsxImportSource @nativescript-community/octane */
118
+ // HostedContent.android.tsx
119
+ import { MaterialBottomSheet } from '@octane-xplat/sheet/android'
120
+ import { Text } from '@octane-xplat/ui'
121
+
122
+ export function HostedContent({ open }: { open: boolean }) {
123
+ return <MaterialBottomSheet open={open} content={() => <Text>Trip details</Text>} />
124
+ }
125
+ ```
126
+
127
+ - iOS: `open` (controlled `isPresented`), `onDismissed`,
128
+ `onPresentedChange`, `fitToContents` (ported size-reader →
129
+ `.presentationDetents([.height])`), `detents`
130
+ (`medium`/`large`/`fraction`/`height`), `showDragIndicator`,
131
+ `interactiveDismissDisabled`.
132
+ - Android: `open` + `onDismissed`, `skipPartiallyExpanded` (the M3 detent
133
+ model: partial vs fully expanded), `showDragHandle`,
134
+ `sheetGesturesEnabled`, `shouldDismissOnBackPress`,
135
+ `shouldDismissOnClickOutside`, and `containerColor`/`contentColor`/
136
+ `scrimColor` hex strings. Activity-owned key events are forwarded while
137
+ the sheet's dialog is open (ported from Expo).
138
+ - Web: native modal `<dialog>` with a named panel, focus entry/Tab
139
+ containment, trigger restoration (`finalFocusRef`), Escape and scrim
140
+ dismissal controls, and drag-handle dismissal. `label` supplies the dialog
141
+ name; pass `finalFocusRef` when pointer-opening so focus returns to the
142
+ invoking control across browsers.
143
+
144
+ The native implementations are adapted from `@expo/ui` (MIT,
145
+ `packages/expo-ui` sdk-57): `ios/BottomSheetView.swift` and
146
+ `android/.../ui/ModalBottomSheetView.kt`. Attribution headers sit on the
147
+ ported files.
@@ -0,0 +1,87 @@
1
+ import { createNativeScriptRoot, defineUniversalComponent, hookSlots, registerElement, universalPlan, universalValue, useEffect, useRef, useState } from "@nativescript-community/octane";
2
+ import { Application, GridLayout } from "@nativescript/core";
3
+ import { ComposeDataDriver, JetpackCompose, registerJetpackCompose } from "@nativescript/jetpack-compose";
4
+ //#region src/MaterialBottomSheet.android.tsrx
5
+ var _hs$ = /* @__PURE__ */ hookSlots(5);
6
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
7
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
8
+ var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
9
+ var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
10
+ var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
11
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
12
+ "kind": "range",
13
+ "children": [{
14
+ "kind": "slot",
15
+ "slot": 0
16
+ }]
17
+ });
18
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
19
+ "kind": "host",
20
+ "type": "xplatandroidsheet",
21
+ "props": { "composeId": "xplat-material-sheet" },
22
+ "bindings": [
23
+ ["id", 0],
24
+ ["className", 1],
25
+ ["style", 2],
26
+ ["data", 3],
27
+ ["onComposeEvent", 4]
28
+ ]
29
+ });
30
+ registerElement("xplatandroidsheet", JetpackCompose);
31
+ registerJetpackCompose("xplat-material-sheet", (owner) => new ComposeDataDriver(new com.octanexplat.sheet.XplatSheetProvider(), owner));
32
+ var seq = 0;
33
+ var ContentRoot = defineUniversalComponent("nativescript", function ContentRoot(props) {
34
+ return universalValue(__octaneUniversalPlan0, [props.render()]);
35
+ }, { "module": "@nativescript-community/octane" });
36
+ var MaterialBottomSheet = defineUniversalComponent("nativescript", function MaterialBottomSheet(props) {
37
+ const contentId = useRef("", _h$0);
38
+ if (!contentId.current) contentId.current = `xplatsheet${++seq}`;
39
+ const mounted = useRef(null, _h$1);
40
+ const [ready, setReady] = useState(false, _h$2);
41
+ useEffect(() => {
42
+ const host = new GridLayout();
43
+ const context = Application.android.foregroundActivity ?? Application.android.startActivity;
44
+ const nativeHost = host;
45
+ nativeHost._setupAsRootView(context);
46
+ nativeHost.callLoaded();
47
+ const root = createNativeScriptRoot(host);
48
+ if (props.content) root.render(ContentRoot, { render: props.content });
49
+ com.octanexplat.sheet.XplatViewRegistry.register(contentId.current, host.android);
50
+ mounted.current = {
51
+ host,
52
+ root
53
+ };
54
+ setReady(true);
55
+ return () => {
56
+ com.octanexplat.sheet.XplatViewRegistry.unregister(contentId.current);
57
+ root.unmount?.();
58
+ mounted.current = null;
59
+ setReady(false);
60
+ };
61
+ }, [], _h$3);
62
+ useEffect(() => {
63
+ if (props.content) mounted.current?.root?.render(ContentRoot, { render: props.content });
64
+ }, [props.content], _h$4);
65
+ return universalValue(__octaneUniversalPlan1, [
66
+ props.id,
67
+ props.className,
68
+ props.style,
69
+ {
70
+ open: props.open ?? false ? 1 : 0,
71
+ contentId: ready && props.content ? contentId.current : "",
72
+ skipPartiallyExpanded: props.skipPartiallyExpanded ?? false ? 1 : 0,
73
+ showDragHandle: props.showDragHandle ?? true ? 1 : 0,
74
+ sheetGesturesEnabled: props.sheetGesturesEnabled ?? true ? 1 : 0,
75
+ shouldDismissOnBackPress: props.shouldDismissOnBackPress ?? true ? 1 : 0,
76
+ shouldDismissOnClickOutside: props.shouldDismissOnClickOutside ?? true ? 1 : 0,
77
+ containerColor: props.containerColor,
78
+ contentColor: props.contentColor,
79
+ scrimColor: props.scrimColor
80
+ },
81
+ (event) => {
82
+ if (event.data?.dismissed) props.onDismissed?.();
83
+ }
84
+ ]);
85
+ }, { "module": "@nativescript-community/octane" });
86
+ //#endregion
87
+ export { MaterialBottomSheet };
@@ -0,0 +1,97 @@
1
+ import { createNativeScriptRoot, defineUniversalComponent, hookSlots, registerElement, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
2
+ import { SwiftUI, SwiftUIManager, UIDataDriver, registerSwiftUI } from "@nativescript/swift-ui";
3
+ import { GridLayout } from "@nativescript/core";
4
+ //#region src/SwiftUIBottomSheet.ios.tsrx
5
+ var _hs$ = /* @__PURE__ */ hookSlots(3);
6
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
7
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
8
+ var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
9
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
10
+ "kind": "range",
11
+ "children": [{
12
+ "kind": "slot",
13
+ "slot": 0
14
+ }]
15
+ });
16
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
17
+ "kind": "host",
18
+ "type": "xplatiossheet",
19
+ "props": { "swiftId": "xplat-swiftui-sheet" },
20
+ "bindings": [
21
+ ["id", 0],
22
+ ["className", 1],
23
+ ["style", 2],
24
+ ["data", 3],
25
+ ["onSwiftUIEvent", 4]
26
+ ]
27
+ });
28
+ registerElement("xplatiossheet", SwiftUI);
29
+ registerSwiftUI("xplat-swiftui-sheet", (owner) => new UIDataDriver(new XplatSheetProvider(), owner));
30
+ var hosts = /* @__PURE__ */ new Map();
31
+ var roots = /* @__PURE__ */ new Map();
32
+ function mountSubtree(id, render) {
33
+ let host = hosts.get(id);
34
+ if (!host) {
35
+ host = new GridLayout();
36
+ hosts.set(id, host);
37
+ SwiftUIManager.registerNativeScriptViews({ [id]: true }, {
38
+ create: (fullId) => hosts.get(fullId.split("-")[0]),
39
+ destroy: (fullId) => {
40
+ hosts.delete(fullId.split("-")[0]);
41
+ }
42
+ });
43
+ }
44
+ let root = roots.get(id);
45
+ if (!root) {
46
+ root = createNativeScriptRoot(host);
47
+ roots.set(id, root);
48
+ }
49
+ root.render(ContentRoot, { render });
50
+ }
51
+ function unmountSubtree(id) {
52
+ roots.get(id)?.unmount?.();
53
+ roots.delete(id);
54
+ hosts.delete(id);
55
+ }
56
+ var ContentRoot = defineUniversalComponent("nativescript", function ContentRoot(props) {
57
+ return universalValue(__octaneUniversalPlan0, [props.render()]);
58
+ }, { "module": "@nativescript-community/octane" });
59
+ var seq = 0;
60
+ var SwiftUIBottomSheet = defineUniversalComponent("nativescript", function SwiftUIBottomSheet(props) {
61
+ const contentId = useRef("", _h$0);
62
+ if (!contentId.current) contentId.current = `xplatsheet${++seq}`;
63
+ useEffect(() => {
64
+ if (props.content) mountSubtree(contentId.current, props.content);
65
+ return () => {
66
+ unmountSubtree(contentId.current);
67
+ };
68
+ }, [], _h$1);
69
+ useEffect(() => {
70
+ if (props.content) mountSubtree(contentId.current, props.content);
71
+ }, [props.content], _h$2);
72
+ return universalValue(__octaneUniversalPlan1, [
73
+ props.id,
74
+ props.className,
75
+ props.style,
76
+ {
77
+ isPresented: props.open ?? false,
78
+ contentId: props.content ? contentId.current : "",
79
+ fitToContents: props.fitToContents ?? false,
80
+ detents: props.detents ?? ["medium"],
81
+ customHeight: props.customHeight,
82
+ customFraction: props.customFraction,
83
+ showDragIndicator: props.showDragIndicator ?? false,
84
+ interactiveDismissDisabled: props.interactiveDismissDisabled ?? false
85
+ },
86
+ (event) => {
87
+ if (event.data?.dismissed) {
88
+ props.onDismissed?.();
89
+ return;
90
+ }
91
+ const presented = event.data?.isPresented;
92
+ if (typeof presented === "boolean") props.onPresentedChange?.(presented);
93
+ }
94
+ ]);
95
+ }, { "module": "@nativescript-community/octane" });
96
+ //#endregion
97
+ export { SwiftUIBottomSheet };
@@ -0,0 +1,2 @@
1
+ import { MaterialBottomSheet } from "../MaterialBottomSheet.android.tsrx.js";
2
+ export { MaterialBottomSheet };
@@ -0,0 +1,2 @@
1
+ import { SwiftUIBottomSheet } from "../SwiftUIBottomSheet.ios.tsrx.js";
2
+ export { SwiftUIBottomSheet };
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "buildId": "ea2c2633-b2c7-487d-a7b8-9061f5e34343",
4
+ "mode": "production",
5
+ "capabilities": {
6
+ "independentHydration": false
7
+ }
8
+ }
@@ -0,0 +1,124 @@
1
+ import { Fragment, createElement, createScopedElement, createScopedValue, hookSlots, positionalChildren, useEffect, useRef } from "octane";
2
+ import { compilerMemoRegion, hookMemoCreate, hookMemoPublishInvariant } from "octane/internal/client";
3
+ //#region src/BottomSheet.web.tsrx
4
+ var _hs$ = /* @__PURE__ */ hookSlots(5);
5
+ function tabStops(panel) {
6
+ return Array.from(panel.querySelectorAll("a[href],button,input:not([type=\"hidden\"]),textarea,select,[tabindex],[contenteditable=\"true\"]")).filter((element) => {
7
+ if (element.tabIndex < 0 || element.matches(":disabled") || element.closest("[inert],[hidden],[aria-hidden=\"true\"]")) return false;
8
+ for (let parent = element; parent; parent = parent.parentElement) {
9
+ const style = getComputedStyle(parent);
10
+ if (style.display === "none" || style.visibility === "hidden") return false;
11
+ }
12
+ return true;
13
+ });
14
+ }
15
+ var BottomSheet = function BottomSheet(props, __s, __extra) {
16
+ const __memoRegion = compilerMemoRegion(__s, _hs$ + 0);
17
+ let __hk = __memoRegion.hooks;
18
+ if (__hk === void 0) __memoRegion.hooks = __hk = hookMemoCreate(3);
19
+ const dialog = useRef(null, _hs$ + 0);
20
+ const panel = useRef(null, _hs$ + 1);
21
+ const drag = useRef(null, _hs$ + 2);
22
+ useEffect(() => {
23
+ const current = dialog.current;
24
+ if (!props.open || !current || current.open) return;
25
+ const trigger = props.finalFocusRef?.current ?? current.ownerDocument.activeElement;
26
+ const previousTabIndex = current.getAttribute("tabindex");
27
+ current.showModal();
28
+ const stops = panel.current ? tabStops(panel.current) : [];
29
+ const autofocus = current.querySelector("[autofocus]");
30
+ const initialFocus = (autofocus && !autofocus.matches(":disabled,[hidden],[inert]") ? autofocus : null) ?? stops[0] ?? current;
31
+ if (initialFocus === current && previousTabIndex === null) current.tabIndex = -1;
32
+ initialFocus.focus({ preventScroll: true });
33
+ return () => {
34
+ if (current.open) current.close();
35
+ if (previousTabIndex === null && initialFocus === current) current.removeAttribute("tabindex");
36
+ requestAnimationFrame(() => {
37
+ if (trigger?.isConnected && !trigger.closest("[inert]")) trigger.focus({ preventScroll: true });
38
+ });
39
+ };
40
+ }, [props.open], _hs$ + 3);
41
+ if (!props.open || typeof document === "undefined") return positionalChildren([]);
42
+ const resetDrag = __hk[0] ?? hookMemoPublishInvariant(__hk, 0, () => {
43
+ drag.current = null;
44
+ panel.current?.style.removeProperty("--xplat-sheet-drag-offset");
45
+ panel.current?.style.removeProperty("transition");
46
+ });
47
+ const onPointerDown = (event) => {
48
+ if (props.sheetGesturesEnabled === false || !event.isPrimary || event.button !== 0) return;
49
+ drag.current = {
50
+ pointerId: event.pointerId,
51
+ startY: event.clientY,
52
+ offsetY: 0
53
+ };
54
+ panel.current?.style.setProperty("transition", "none");
55
+ event.currentTarget.setPointerCapture(event.pointerId);
56
+ };
57
+ const onPointerMove = __hk[1] ?? hookMemoPublishInvariant(__hk, 1, (event) => {
58
+ const active = drag.current;
59
+ if (!active || active.pointerId !== event.pointerId) return;
60
+ active.offsetY = Math.max(0, event.clientY - active.startY);
61
+ panel.current?.style.setProperty("--xplat-sheet-drag-offset", `${active.offsetY}px`);
62
+ });
63
+ const onPointerUp = (event) => {
64
+ const active = drag.current;
65
+ if (!active || active.pointerId !== event.pointerId) return;
66
+ const shouldDismiss = active.offsetY >= Math.min(120, window.innerHeight * .18);
67
+ resetDrag();
68
+ if (shouldDismiss && props.sheetGesturesEnabled !== false) props.onDismissed?.();
69
+ };
70
+ const onCancel = (event) => {
71
+ event.preventDefault();
72
+ if (props.shouldDismissOnBackPress ?? true) props.onDismissed?.();
73
+ };
74
+ const onKeyDown = __hk[2] ?? hookMemoPublishInvariant(__hk, 2, (event) => {
75
+ if (event.key !== "Tab") return;
76
+ const current = dialog.current;
77
+ const active = current?.ownerDocument.activeElement;
78
+ if (!current?.open || active !== current && !panel.current?.contains(active)) return;
79
+ const stops = panel.current ? tabStops(panel.current) : [];
80
+ const index = stops.indexOf(active);
81
+ event.preventDefault();
82
+ if (!stops.length) {
83
+ dialog.current?.focus({ preventScroll: true });
84
+ return;
85
+ }
86
+ stops[event.shiftKey ? index <= 0 ? stops.length - 1 : index - 1 : index < 0 || index === stops.length - 1 ? 0 : index + 1].focus({ preventScroll: true });
87
+ });
88
+ useEffect(() => {
89
+ const current = dialog.current;
90
+ if (!props.open || !current) return;
91
+ current.ownerDocument.addEventListener("keydown", onKeyDown, true);
92
+ return () => current.ownerDocument.removeEventListener("keydown", onKeyDown, true);
93
+ }, [props.open], _hs$ + 4);
94
+ return createScopedElement(Fragment, {}, () => positionalChildren([createScopedValue(() => createScopedElement("dialog", {
95
+ ref: dialog,
96
+ className: "xplat-web-sheet",
97
+ "aria-label": props.label ?? "Bottom sheet",
98
+ "aria-modal": "true",
99
+ style: {
100
+ "--xplat-sheet-scrim": props.scrimColor ?? "rgb(0 0 0 / 0.4)",
101
+ "--xplat-sheet-container": props.containerColor ?? "var(--sheet-bg, Canvas)",
102
+ "--xplat-sheet-content": props.contentColor ?? "var(--sheet-fg, CanvasText)",
103
+ "--xplat-sheet-max-height": props.skipPartiallyExpanded ? "90vh" : "60vh"
104
+ },
105
+ onCancel,
106
+ onClick: (event) => {
107
+ if (event.target === event.currentTarget && (props.shouldDismissOnClickOutside ?? true)) props.onDismissed?.();
108
+ }
109
+ }, () => createScopedValue(() => createScopedElement("div", {
110
+ ref: panel,
111
+ id: props.id,
112
+ className: "xplat-web-sheet-panel " + (props.className ?? ""),
113
+ style: props.style
114
+ }, () => positionalChildren([(props.showDragHandle ?? true) && createScopedValue(() => createElement("div", {
115
+ className: "xplat-web-sheet-handle",
116
+ "aria-hidden": "true",
117
+ onPointerDown,
118
+ onPointerMove,
119
+ onPointerUp,
120
+ onPointerCancel: resetDrag
121
+ }, createElement("div", { className: "xplat-web-sheet-handle-mark" }))), props.content?.()])))))]));
122
+ };
123
+ //#endregion
124
+ export { BottomSheet };
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "buildId": "6220e54f-fce6-443b-8aa6-2f815351b5b7",
4
+ "mode": "production",
5
+ "capabilities": {
6
+ "independentHydration": false
7
+ }
8
+ }
@@ -0,0 +1,58 @@
1
+ /* xplat-web-only:start */
2
+ .xplat-web-sheet {
3
+ position: fixed;
4
+ inset: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ max-width: none;
8
+ max-height: none;
9
+ margin: 0;
10
+ padding: 0;
11
+ border: 0;
12
+ background: transparent;
13
+ color: inherit;
14
+ overflow: visible;
15
+ display: flex;
16
+ align-items: flex-end;
17
+ justify-content: center;
18
+ }
19
+ .xplat-web-sheet::backdrop {
20
+ background: var(--xplat-sheet-scrim, rgb(0 0 0 / 0.4));
21
+ }
22
+
23
+ .xplat-web-sheet-panel {
24
+ box-sizing: border-box;
25
+ width: 100%;
26
+ max-height: var(--xplat-sheet-max-height, 60vh);
27
+ overflow-y: auto;
28
+ overscroll-behavior: contain;
29
+ background: var(--xplat-sheet-container, var(--sheet-bg, Canvas));
30
+ color: var(--xplat-sheet-content, var(--sheet-fg, CanvasText));
31
+ border-radius: 16px 16px 0 0;
32
+ box-shadow: 0 -4px 24px rgb(0 0 0 / 0.2);
33
+ transform: translateY(var(--xplat-sheet-drag-offset, 0px));
34
+ transition: transform 180ms ease-out;
35
+ }
36
+
37
+ .xplat-web-sheet-handle {
38
+ display: flex;
39
+ justify-content: center;
40
+ padding: 8px 0;
41
+ cursor: grab;
42
+ touch-action: none;
43
+ }
44
+
45
+ .xplat-web-sheet-handle-mark {
46
+ width: 36px;
47
+ height: 4px;
48
+ border-radius: 2px;
49
+ background: color-mix(in srgb, CanvasText 30%, transparent);
50
+ }
51
+
52
+ @media (prefers-reduced-motion: reduce) {
53
+ .xplat-web-sheet-panel {
54
+ transition: none;
55
+ }
56
+ }
57
+ /* xplat-web-only:end */
58
+ /*$vite$:1*/
@@ -0,0 +1,3 @@
1
+ /* empty css */
2
+ import { BottomSheet } from "../BottomSheet.web.tsrx.js";
3
+ export { BottomSheet };
package/package.json CHANGED
@@ -1,18 +1,75 @@
1
1
  {
2
2
  "name": "@octane-xplat/sheet",
3
- "version": "0.0.1",
3
+ "version": "0.10.0",
4
4
  "description": "Platform-specific modal bottom sheet controls for Octane xplat",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/octane-xplat/octane-xplat.git",
7
+ "url": "https://github.com/octane-xplat/octane-xplat",
8
8
  "directory": "packages/sheet"
9
9
  },
10
- "homepage": "https://github.com/octane-xplat/octane-xplat/tree/main/packages/sheet",
11
- "main": "./index.js",
12
- "types": "./index.d.ts",
13
10
  "files": [
14
- "README.md",
15
- "index.js",
16
- "index.d.ts"
17
- ]
18
- }
11
+ "dist",
12
+ "types",
13
+ "src",
14
+ "platforms"
15
+ ],
16
+ "type": "module",
17
+ "exports": {
18
+ "./ios": {
19
+ "types": "./types/ios/index.d.ts",
20
+ "native": "./dist/native/ios/index.js"
21
+ },
22
+ "./android": {
23
+ "types": "./types/android/index.d.ts",
24
+ "native": "./dist/native/android/index.js"
25
+ },
26
+ "./web": {
27
+ "types": "./types/web/index.d.ts",
28
+ "web": "./dist/web/web/index.js"
29
+ },
30
+ "./web/styles.css": "./dist/web/sheet.css"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "dependencies": {
36
+ "@nativescript/jetpack-compose": "1.0.0-beta.0",
37
+ "@nativescript/swift-ui": "4.0.2"
38
+ },
39
+ "devDependencies": {
40
+ "@nativescript-community/octane": "0.2.4",
41
+ "@nativescript/core": "9.1.2",
42
+ "@octanejs/vite-plugin": "0.1.60",
43
+ "octane": "0.5.0",
44
+ "tsrx-typegen": "0.2.2",
45
+ "typescript": "5.9.3",
46
+ "vite": "8.3.0"
47
+ },
48
+ "peerDependencies": {
49
+ "@nativescript-community/octane": ">=0.2.1 <1",
50
+ "@nativescript/core": ">=9.1.0 <10",
51
+ "octane": ">=0.1.51 <1"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "@nativescript-community/octane": {
55
+ "optional": true
56
+ },
57
+ "@nativescript/core": {
58
+ "optional": true
59
+ },
60
+ "octane": {
61
+ "optional": true
62
+ }
63
+ },
64
+ "nativescript": {
65
+ "platforms": {
66
+ "android": "9.1.0",
67
+ "ios": "9.1.0"
68
+ }
69
+ },
70
+ "scripts": {
71
+ "build": "vite build && vite build --mode native && tsc -p tsconfig.types.json",
72
+ "test:packed": "node tests/packed-consumer.mjs",
73
+ "pack:check": "tsrx-typegen --pack-check"
74
+ }
75
+ }
@@ -0,0 +1,15 @@
1
+ apply plugin: 'org.jetbrains.kotlin.plugin.compose'
2
+
3
+ android {
4
+ buildFeatures {
5
+ compose true
6
+ }
7
+ kotlinOptions {
8
+ jvmTarget = '17'
9
+ }
10
+ }
11
+
12
+ dependencies {
13
+ implementation platform('androidx.compose:compose-bom:2024.12.01')
14
+ implementation 'androidx.compose.material3:material3'
15
+ }