@capgo/capacitor-sheets 8.0.11 → 8.0.12
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 +29 -1
- package/dist/angular/index.d.mts +18 -2
- package/dist/angular/index.d.ts +18 -2
- package/dist/angular/index.js +157 -16
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/index.mjs +157 -16
- package/dist/angular/index.mjs.map +1 -1
- package/dist/{chunk-LY2DKBXN.mjs → chunk-7DYTSFX3.mjs} +27 -10
- package/dist/chunk-7DYTSFX3.mjs.map +1 -0
- package/dist/{chunk-FHGK4I6L.mjs → chunk-AXGC7BLW.mjs} +133 -9
- package/dist/chunk-AXGC7BLW.mjs.map +1 -0
- package/dist/{components-YSGBN2YD.mjs → components-STHKYCFN.mjs} +3 -3
- package/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +158 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +23 -2
- package/dist/react/index.d.ts +23 -2
- package/dist/react/index.js +157 -16
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +157 -16
- package/dist/react/index.mjs.map +1 -1
- package/dist/solid/index.d.mts +23 -2
- package/dist/solid/index.d.ts +23 -2
- package/dist/solid/index.js +157 -16
- package/dist/solid/index.js.map +1 -1
- package/dist/solid/index.mjs +157 -16
- package/dist/solid/index.mjs.map +1 -1
- package/dist/{styles-VAFNQKVC.mjs → styles-P4J3AKBN.mjs} +2 -2
- package/dist/svelte/index.d.mts +18 -2
- package/dist/svelte/index.d.ts +18 -2
- package/dist/svelte/index.js +157 -16
- package/dist/svelte/index.js.map +1 -1
- package/dist/svelte/index.mjs +157 -16
- package/dist/svelte/index.mjs.map +1 -1
- package/dist/vue/index.d.mts +18 -2
- package/dist/vue/index.d.ts +18 -2
- package/dist/vue/index.js +157 -16
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/index.mjs +157 -16
- package/dist/vue/index.mjs.map +1 -1
- package/docs/demos/ios-fullscreen-real-demo.webp +0 -0
- package/package.json +1 -1
- package/dist/chunk-FHGK4I6L.mjs.map +0 -1
- package/dist/chunk-LY2DKBXN.mjs.map +0 -1
- /package/dist/{components-YSGBN2YD.mjs.map → components-STHKYCFN.mjs.map} +0 -0
- /package/dist/{styles-VAFNQKVC.mjs.map → styles-P4J3AKBN.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -24,17 +24,17 @@ import {
|
|
|
24
24
|
applySheetOptions,
|
|
25
25
|
getSheetFromElement,
|
|
26
26
|
updateThemeColor
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-AXGC7BLW.mjs";
|
|
28
28
|
import {
|
|
29
29
|
CSS,
|
|
30
30
|
injectCapSheetStyles
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-7DYTSFX3.mjs";
|
|
32
32
|
|
|
33
33
|
// src/index.ts
|
|
34
34
|
function initCapSheets() {
|
|
35
|
-
import("./components-
|
|
35
|
+
import("./components-STHKYCFN.mjs");
|
|
36
36
|
if (typeof document !== "undefined") {
|
|
37
|
-
import("./styles-
|
|
37
|
+
import("./styles-P4J3AKBN.mjs").then(({ injectCapSheetStyles: injectCapSheetStyles2 }) => injectCapSheetStyles2(document));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
export {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @capgo/capacitor-sheets\n *\n * Framework-agnostic sheet, drawer, dialog, and scroll primitives for Capacitor apps.\n * The package is implemented with standards-based custom elements so the same API\n * works in React, Vue, Angular, Svelte, Solid, or plain TypeScript.\n */\n\nimport './components';\n\nimport type {\n CapAutoFocusTarget,\n CapExternalOverlay,\n CapFixed,\n CapIsland,\n CapScroll,\n CapScrollContent,\n CapSheet,\n CapSheetBackdrop,\n CapSheetBleedingBackground,\n CapSheetContent,\n CapSheetDescription,\n CapSheetHandle,\n CapSheetOutlet,\n CapSheetPortal,\n CapSheetSpecialWrapper,\n CapSheetSpecialWrapperContent,\n CapSheetStack,\n CapSheetTitle,\n CapSheetTrigger,\n CapSheetView,\n CapVisuallyHidden,\n} from './components';\n\nexport { injectCapSheetStyles, CAP_SHEETS_CSS } from './core/styles';\nexport { updateThemeColor } from './core/theme-color';\nexport { SheetController } from './core/sheet-controller';\nexport { applySheetOptions, getSheetFromElement } from './components/cap-sheet';\nexport {\n CapAutoFocusTarget,\n CapExternalOverlay,\n CapFixed,\n CapIsland,\n CapScroll,\n CapScrollContent,\n CapSheet,\n CapSheetBackdrop,\n CapSheetBleedingBackground,\n CapSheetContent,\n CapSheetDescription,\n CapSheetHandle,\n CapSheetOutlet,\n CapSheetPortal,\n CapSheetSpecialWrapper,\n CapSheetSpecialWrapperContent,\n CapSheetStack,\n CapSheetTitle,\n CapSheetTrigger,\n CapSheetView,\n CapVisuallyHidden,\n} from './components';\nexport type {\n ScrollByTravelOptions,\n ScrollController,\n ScrollToTravelOptions,\n SheetActiveDetentChangeEvent,\n SheetAnimationPreset,\n SheetAnimationSettings,\n SheetEasing,\n SheetOptions,\n SheetPlacement,\n SheetProgressAnimation,\n SheetSafeAreaEdge,\n SheetSafeAreaMode,\n SheetTrack,\n SheetTravelEvent,\n SheetTravelRangeChangeEvent,\n SheetTravelStatus,\n SheetTravelStatusChangeEvent,\n SheetTriggerAction,\n} from './core/types';\n\n/** Initialize all custom elements and structural styles. */\nexport function initCapSheets(): void {\n import('./components');\n if (typeof document !== 'undefined') {\n import('./core/styles').then(({ injectCapSheetStyles }) => injectCapSheetStyles(document));\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cap-sheet': CapSheet;\n 'cap-sheet-trigger': CapSheetTrigger;\n 'cap-sheet-portal': CapSheetPortal;\n 'cap-sheet-view': CapSheetView;\n 'cap-sheet-backdrop': CapSheetBackdrop;\n 'cap-sheet-content': CapSheetContent;\n 'cap-sheet-bleeding-background': CapSheetBleedingBackground;\n 'cap-sheet-handle': CapSheetHandle;\n 'cap-sheet-title': CapSheetTitle;\n 'cap-sheet-description': CapSheetDescription;\n 'cap-sheet-special-wrapper': CapSheetSpecialWrapper;\n 'cap-sheet-special-wrapper-content': CapSheetSpecialWrapperContent;\n 'cap-sheet-stack': CapSheetStack;\n 'cap-sheet-outlet': CapSheetOutlet;\n 'cap-scroll': CapScroll;\n 'cap-scroll-content': CapScrollContent;\n 'cap-fixed': CapFixed;\n 'cap-island': CapIsland;\n 'cap-external-overlay': CapExternalOverlay;\n 'cap-visually-hidden': CapVisuallyHidden;\n 'cap-auto-focus-target': CapAutoFocusTarget;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @capgo/capacitor-sheets\n *\n * Framework-agnostic sheet, drawer, dialog, and scroll primitives for Capacitor apps.\n * The package is implemented with standards-based custom elements so the same API\n * works in React, Vue, Angular, Svelte, Solid, or plain TypeScript.\n */\n\nimport './components';\n\nimport type {\n CapAutoFocusTarget,\n CapExternalOverlay,\n CapFixed,\n CapIsland,\n CapScroll,\n CapScrollContent,\n CapSheet,\n CapSheetBackdrop,\n CapSheetBleedingBackground,\n CapSheetContent,\n CapSheetDescription,\n CapSheetHandle,\n CapSheetOutlet,\n CapSheetPortal,\n CapSheetSpecialWrapper,\n CapSheetSpecialWrapperContent,\n CapSheetStack,\n CapSheetTitle,\n CapSheetTrigger,\n CapSheetView,\n CapVisuallyHidden,\n} from './components';\n\nexport { injectCapSheetStyles, CAP_SHEETS_CSS } from './core/styles';\nexport { updateThemeColor } from './core/theme-color';\nexport { SheetController } from './core/sheet-controller';\nexport { applySheetOptions, getSheetFromElement } from './components/cap-sheet';\nexport {\n CapAutoFocusTarget,\n CapExternalOverlay,\n CapFixed,\n CapIsland,\n CapScroll,\n CapScrollContent,\n CapSheet,\n CapSheetBackdrop,\n CapSheetBleedingBackground,\n CapSheetContent,\n CapSheetDescription,\n CapSheetHandle,\n CapSheetOutlet,\n CapSheetPortal,\n CapSheetSpecialWrapper,\n CapSheetSpecialWrapperContent,\n CapSheetStack,\n CapSheetTitle,\n CapSheetTrigger,\n CapSheetView,\n CapVisuallyHidden,\n} from './components';\nexport type {\n ScrollByTravelOptions,\n ScrollController,\n ScrollToTravelOptions,\n SheetActiveDetentChangeEvent,\n SheetAnimationPreset,\n SheetAnimationSettings,\n SheetContainerOffset,\n SheetInsetValue,\n SheetEasing,\n SheetOptions,\n SheetPlacement,\n SheetProgressAnimation,\n SheetSafeAreaEdge,\n SheetSafeAreaMode,\n SheetTrack,\n SheetTravelEvent,\n SheetTravelRangeChangeEvent,\n SheetTravelStatus,\n SheetTravelStatusChangeEvent,\n SheetTriggerAction,\n} from './core/types';\n\n/** Initialize all custom elements and structural styles. */\nexport function initCapSheets(): void {\n import('./components');\n if (typeof document !== 'undefined') {\n import('./core/styles').then(({ injectCapSheetStyles }) => injectCapSheetStyles(document));\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cap-sheet': CapSheet;\n 'cap-sheet-trigger': CapSheetTrigger;\n 'cap-sheet-portal': CapSheetPortal;\n 'cap-sheet-view': CapSheetView;\n 'cap-sheet-backdrop': CapSheetBackdrop;\n 'cap-sheet-content': CapSheetContent;\n 'cap-sheet-bleeding-background': CapSheetBleedingBackground;\n 'cap-sheet-handle': CapSheetHandle;\n 'cap-sheet-title': CapSheetTitle;\n 'cap-sheet-description': CapSheetDescription;\n 'cap-sheet-special-wrapper': CapSheetSpecialWrapper;\n 'cap-sheet-special-wrapper-content': CapSheetSpecialWrapperContent;\n 'cap-sheet-stack': CapSheetStack;\n 'cap-sheet-outlet': CapSheetOutlet;\n 'cap-scroll': CapScroll;\n 'cap-scroll-content': CapScrollContent;\n 'cap-fixed': CapFixed;\n 'cap-island': CapIsland;\n 'cap-external-overlay': CapExternalOverlay;\n 'cap-visually-hidden': CapVisuallyHidden;\n 'cap-auto-focus-target': CapAutoFocusTarget;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFO,SAAS,gBAAsB;AACpC,SAAO,2BAAc;AACrB,MAAI,OAAO,aAAa,aAAa;AACnC,WAAO,uBAAe,EAAE,KAAK,CAAC,EAAE,sBAAAA,sBAAqB,MAAMA,sBAAqB,QAAQ,CAAC;AAAA,EAC3F;AACF;","names":["injectCapSheetStyles"]}
|
package/dist/react/index.d.mts
CHANGED
|
@@ -5,7 +5,11 @@ type SheetTrack = Exclude<SheetPlacement, 'center'>;
|
|
|
5
5
|
/** Viewport edges protected by safe-area insets. */
|
|
6
6
|
type SheetSafeAreaEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
7
7
|
/** Safe-area behavior for Capacitor WebViews and mobile browsers. */
|
|
8
|
-
type SheetSafeAreaMode = boolean | 'auto' | 'none' | SheetSafeAreaEdge[];
|
|
8
|
+
type SheetSafeAreaMode = boolean | 'auto' | 'all' | 'none' | SheetSafeAreaEdge[];
|
|
9
|
+
/** CSS length or pixel number used for sheet container insets. */
|
|
10
|
+
type SheetInsetValue = string | number;
|
|
11
|
+
/** Extra container offsets applied around the sheet viewport. */
|
|
12
|
+
type SheetContainerOffset = Partial<Record<SheetSafeAreaEdge, SheetInsetValue>>;
|
|
9
13
|
/** Runtime travel state emitted by sheet lifecycle events. */
|
|
10
14
|
type SheetTravelStatus = 'idle' | 'entering' | 'exiting' | 'dragging' | 'settling';
|
|
11
15
|
/** Built-in animation presets tuned for mobile WebViews. */
|
|
@@ -49,6 +53,18 @@ interface SheetOptions {
|
|
|
49
53
|
contentPlacement?: SheetPlacement;
|
|
50
54
|
/** Safe-area edges protected by the sheet viewport. Defaults to `auto`. */
|
|
51
55
|
safeArea?: SheetSafeAreaMode;
|
|
56
|
+
/** Render as a floating sheet with detached edge rounding. */
|
|
57
|
+
detached?: boolean;
|
|
58
|
+
/** Extra top inset added to the sheet viewport, equivalent to Gorhom `topInset`. */
|
|
59
|
+
topInset?: SheetInsetValue;
|
|
60
|
+
/** Extra bottom inset added to the sheet viewport, equivalent to Gorhom `bottomInset`. */
|
|
61
|
+
bottomInset?: SheetInsetValue;
|
|
62
|
+
/** Extra left inset added to the sheet viewport. */
|
|
63
|
+
leftInset?: SheetInsetValue;
|
|
64
|
+
/** Extra right inset added to the sheet viewport. */
|
|
65
|
+
rightInset?: SheetInsetValue;
|
|
66
|
+
/** Extra per-edge container offsets, equivalent to Gorhom `containerOffset`. */
|
|
67
|
+
containerOffset?: SheetContainerOffset;
|
|
52
68
|
/** Edge tracks that can dismiss the sheet. */
|
|
53
69
|
tracks?: SheetTrack | SheetTrack[];
|
|
54
70
|
/** Enables pointer, touch, trackpad, and wheel travel gestures. */
|
|
@@ -145,6 +161,11 @@ interface CapSheetsIntrinsicElements {
|
|
|
145
161
|
detents?: string;
|
|
146
162
|
'content-placement'?: Placement;
|
|
147
163
|
'safe-area'?: SafeArea;
|
|
164
|
+
detached?: Booleanish;
|
|
165
|
+
'top-inset'?: number | string;
|
|
166
|
+
'bottom-inset'?: number | string;
|
|
167
|
+
'left-inset'?: number | string;
|
|
168
|
+
'right-inset'?: number | string;
|
|
148
169
|
tracks?: string;
|
|
149
170
|
'sheet-role'?: string;
|
|
150
171
|
swipe?: Booleanish;
|
|
@@ -237,4 +258,4 @@ declare module 'react/jsx-runtime' {
|
|
|
237
258
|
}
|
|
238
259
|
}
|
|
239
260
|
|
|
240
|
-
export { type Placement, type SheetActiveDetentChangeEvent, type SheetOptions, type SheetPresentedChangeEvent, type SheetSafeAreaEdge, type SheetSafeAreaMode, type SheetTravelEvent, type Track, dismissSheet, presentSheet, setupSheet };
|
|
261
|
+
export { type Placement, type SheetActiveDetentChangeEvent, type SheetContainerOffset, type SheetInsetValue, type SheetOptions, type SheetPresentedChangeEvent, type SheetSafeAreaEdge, type SheetSafeAreaMode, type SheetTravelEvent, type Track, dismissSheet, presentSheet, setupSheet };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ type SheetTrack = Exclude<SheetPlacement, 'center'>;
|
|
|
5
5
|
/** Viewport edges protected by safe-area insets. */
|
|
6
6
|
type SheetSafeAreaEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
7
7
|
/** Safe-area behavior for Capacitor WebViews and mobile browsers. */
|
|
8
|
-
type SheetSafeAreaMode = boolean | 'auto' | 'none' | SheetSafeAreaEdge[];
|
|
8
|
+
type SheetSafeAreaMode = boolean | 'auto' | 'all' | 'none' | SheetSafeAreaEdge[];
|
|
9
|
+
/** CSS length or pixel number used for sheet container insets. */
|
|
10
|
+
type SheetInsetValue = string | number;
|
|
11
|
+
/** Extra container offsets applied around the sheet viewport. */
|
|
12
|
+
type SheetContainerOffset = Partial<Record<SheetSafeAreaEdge, SheetInsetValue>>;
|
|
9
13
|
/** Runtime travel state emitted by sheet lifecycle events. */
|
|
10
14
|
type SheetTravelStatus = 'idle' | 'entering' | 'exiting' | 'dragging' | 'settling';
|
|
11
15
|
/** Built-in animation presets tuned for mobile WebViews. */
|
|
@@ -49,6 +53,18 @@ interface SheetOptions {
|
|
|
49
53
|
contentPlacement?: SheetPlacement;
|
|
50
54
|
/** Safe-area edges protected by the sheet viewport. Defaults to `auto`. */
|
|
51
55
|
safeArea?: SheetSafeAreaMode;
|
|
56
|
+
/** Render as a floating sheet with detached edge rounding. */
|
|
57
|
+
detached?: boolean;
|
|
58
|
+
/** Extra top inset added to the sheet viewport, equivalent to Gorhom `topInset`. */
|
|
59
|
+
topInset?: SheetInsetValue;
|
|
60
|
+
/** Extra bottom inset added to the sheet viewport, equivalent to Gorhom `bottomInset`. */
|
|
61
|
+
bottomInset?: SheetInsetValue;
|
|
62
|
+
/** Extra left inset added to the sheet viewport. */
|
|
63
|
+
leftInset?: SheetInsetValue;
|
|
64
|
+
/** Extra right inset added to the sheet viewport. */
|
|
65
|
+
rightInset?: SheetInsetValue;
|
|
66
|
+
/** Extra per-edge container offsets, equivalent to Gorhom `containerOffset`. */
|
|
67
|
+
containerOffset?: SheetContainerOffset;
|
|
52
68
|
/** Edge tracks that can dismiss the sheet. */
|
|
53
69
|
tracks?: SheetTrack | SheetTrack[];
|
|
54
70
|
/** Enables pointer, touch, trackpad, and wheel travel gestures. */
|
|
@@ -145,6 +161,11 @@ interface CapSheetsIntrinsicElements {
|
|
|
145
161
|
detents?: string;
|
|
146
162
|
'content-placement'?: Placement;
|
|
147
163
|
'safe-area'?: SafeArea;
|
|
164
|
+
detached?: Booleanish;
|
|
165
|
+
'top-inset'?: number | string;
|
|
166
|
+
'bottom-inset'?: number | string;
|
|
167
|
+
'left-inset'?: number | string;
|
|
168
|
+
'right-inset'?: number | string;
|
|
148
169
|
tracks?: string;
|
|
149
170
|
'sheet-role'?: string;
|
|
150
171
|
swipe?: Booleanish;
|
|
@@ -237,4 +258,4 @@ declare module 'react/jsx-runtime' {
|
|
|
237
258
|
}
|
|
238
259
|
}
|
|
239
260
|
|
|
240
|
-
export { type Placement, type SheetActiveDetentChangeEvent, type SheetOptions, type SheetPresentedChangeEvent, type SheetSafeAreaEdge, type SheetSafeAreaMode, type SheetTravelEvent, type Track, dismissSheet, presentSheet, setupSheet };
|
|
261
|
+
export { type Placement, type SheetActiveDetentChangeEvent, type SheetContainerOffset, type SheetInsetValue, type SheetOptions, type SheetPresentedChangeEvent, type SheetSafeAreaEdge, type SheetSafeAreaMode, type SheetTravelEvent, type Track, dismissSheet, presentSheet, setupSheet };
|
package/dist/react/index.js
CHANGED
|
@@ -149,6 +149,11 @@ var CSS = `
|
|
|
149
149
|
--cap-sheet-applied-safe-area-bottom: var(--cap-sheet-safe-area-bottom);
|
|
150
150
|
--cap-sheet-applied-safe-area-left: var(--cap-sheet-safe-area-left);
|
|
151
151
|
--cap-sheet-applied-safe-area-right: var(--cap-sheet-safe-area-right);
|
|
152
|
+
--cap-sheet-container-offset-top: 0em;
|
|
153
|
+
--cap-sheet-container-offset-bottom: 0em;
|
|
154
|
+
--cap-sheet-container-offset-left: 0em;
|
|
155
|
+
--cap-sheet-container-offset-right: 0em;
|
|
156
|
+
--cap-sheet-keyboard-offset: 0em;
|
|
152
157
|
}
|
|
153
158
|
|
|
154
159
|
@supports (height: 1dvh) {
|
|
@@ -177,10 +182,13 @@ cap-sheet-view {
|
|
|
177
182
|
overscroll-behavior: none;
|
|
178
183
|
contain: layout style;
|
|
179
184
|
box-sizing: border-box;
|
|
180
|
-
padding-
|
|
181
|
-
padding-
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
padding-top: calc(var(--cap-sheet-applied-safe-area-top, 0em) + var(--cap-sheet-container-offset-top, 0em));
|
|
186
|
+
padding-bottom: calc(
|
|
187
|
+
var(--cap-sheet-applied-safe-area-bottom, 0em) + var(--cap-sheet-container-offset-bottom, 0em) +
|
|
188
|
+
var(--cap-sheet-keyboard-offset, 0em)
|
|
189
|
+
);
|
|
190
|
+
padding-left: calc(var(--cap-sheet-applied-safe-area-left, 0em) + var(--cap-sheet-container-offset-left, 0em));
|
|
191
|
+
padding-right: calc(var(--cap-sheet-applied-safe-area-right, 0em) + var(--cap-sheet-container-offset-right, 0em));
|
|
184
192
|
}
|
|
185
193
|
|
|
186
194
|
cap-sheet-view[hidden] {
|
|
@@ -225,6 +233,7 @@ cap-sheet-backdrop {
|
|
|
225
233
|
}
|
|
226
234
|
|
|
227
235
|
cap-sheet-content {
|
|
236
|
+
--cap-sheet-content-border-radius: var(--cap-sheet-radius) var(--cap-sheet-radius) 0 0;
|
|
228
237
|
box-sizing: border-box;
|
|
229
238
|
position: relative;
|
|
230
239
|
display: block;
|
|
@@ -232,7 +241,7 @@ cap-sheet-content {
|
|
|
232
241
|
max-height: 100%;
|
|
233
242
|
color: CanvasText;
|
|
234
243
|
background: var(--cap-sheet-surface);
|
|
235
|
-
border-radius: var(--cap-sheet-
|
|
244
|
+
border-radius: var(--cap-sheet-content-border-radius);
|
|
236
245
|
box-shadow: var(--cap-sheet-shadow), var(--cap-sheet-edge-bleed-shadow, 0 0 0 0 transparent);
|
|
237
246
|
overflow: auto;
|
|
238
247
|
overscroll-behavior: contain;
|
|
@@ -243,27 +252,35 @@ cap-sheet-content {
|
|
|
243
252
|
}
|
|
244
253
|
|
|
245
254
|
cap-sheet-view[content-placement="top"] cap-sheet-content {
|
|
246
|
-
border-radius: 0 0 var(--cap-sheet-radius) var(--cap-sheet-radius);
|
|
255
|
+
--cap-sheet-content-border-radius: 0 0 var(--cap-sheet-radius) var(--cap-sheet-radius);
|
|
247
256
|
}
|
|
248
257
|
|
|
249
258
|
cap-sheet-view[content-placement="left"] cap-sheet-content {
|
|
250
259
|
width: min(88%, 28em);
|
|
251
260
|
height: 100%;
|
|
252
261
|
max-height: 100%;
|
|
253
|
-
border-radius: 0 var(--cap-sheet-radius) var(--cap-sheet-radius) 0;
|
|
262
|
+
--cap-sheet-content-border-radius: 0 var(--cap-sheet-radius) var(--cap-sheet-radius) 0;
|
|
254
263
|
}
|
|
255
264
|
|
|
256
265
|
cap-sheet-view[content-placement="right"] cap-sheet-content {
|
|
257
266
|
width: min(88%, 28em);
|
|
258
267
|
height: 100%;
|
|
259
268
|
max-height: 100%;
|
|
260
|
-
border-radius: var(--cap-sheet-radius) 0 0 var(--cap-sheet-radius);
|
|
269
|
+
--cap-sheet-content-border-radius: var(--cap-sheet-radius) 0 0 var(--cap-sheet-radius);
|
|
261
270
|
}
|
|
262
271
|
|
|
263
272
|
cap-sheet-view[content-placement="center"] cap-sheet-content {
|
|
264
273
|
width: min(90%, 30em);
|
|
265
274
|
max-height: min(90%, 42em);
|
|
266
|
-
border-radius: var(--cap-sheet-radius);
|
|
275
|
+
--cap-sheet-content-border-radius: var(--cap-sheet-radius);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
cap-sheet-view[data-detached="true"] cap-sheet-content {
|
|
279
|
+
--cap-sheet-content-border-radius: var(--cap-sheet-detached-radius, var(--cap-sheet-radius));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
cap-sheet-view[data-detached="true"] cap-sheet-content[data-cap-sheet-bleeds] {
|
|
283
|
+
--cap-sheet-edge-bleed-shadow: 0 0 0 0 transparent;
|
|
267
284
|
}
|
|
268
285
|
|
|
269
286
|
cap-sheet-bleeding-background {
|
|
@@ -517,6 +534,7 @@ function releaseThemeColorDimmer(documentRef) {
|
|
|
517
534
|
var defaultOptions = {
|
|
518
535
|
contentPlacement: "bottom",
|
|
519
536
|
sheetRole: "dialog",
|
|
537
|
+
detached: false,
|
|
520
538
|
safeArea: "auto",
|
|
521
539
|
swipe: true,
|
|
522
540
|
swipeDismissal: true,
|
|
@@ -547,21 +565,74 @@ function normalizeDetents(value) {
|
|
|
547
565
|
if (Array.isArray(value)) return value.filter(Boolean);
|
|
548
566
|
return parseList(value || null);
|
|
549
567
|
}
|
|
568
|
+
var unitlessInsetPattern = /^-?(?:\d+(?:\.\d+)?|\.\d+)$/;
|
|
569
|
+
function normalizeInsetValue(value) {
|
|
570
|
+
return unitlessInsetPattern.test(value) ? `${value}px` : value;
|
|
571
|
+
}
|
|
572
|
+
function parseInset(value) {
|
|
573
|
+
const normalized = value?.trim();
|
|
574
|
+
return normalized ? normalizeInsetValue(normalized) : void 0;
|
|
575
|
+
}
|
|
576
|
+
function formatInsetValue(value) {
|
|
577
|
+
if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : "0em";
|
|
578
|
+
const normalized = value?.trim();
|
|
579
|
+
return normalized ? normalizeInsetValue(normalized) : "0em";
|
|
580
|
+
}
|
|
581
|
+
function explicitInsetForEdge(options, edge) {
|
|
582
|
+
switch (edge) {
|
|
583
|
+
case "top":
|
|
584
|
+
return options.topInset;
|
|
585
|
+
case "bottom":
|
|
586
|
+
return options.bottomInset;
|
|
587
|
+
case "left":
|
|
588
|
+
return options.leftInset;
|
|
589
|
+
case "right":
|
|
590
|
+
return options.rightInset;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function containerInsetForEdge(options, edge) {
|
|
594
|
+
const values = [options.containerOffset?.[edge], explicitInsetForEdge(options, edge)].map(formatInsetValue).filter((value) => value !== "0em");
|
|
595
|
+
if (values.length === 0) return "0em";
|
|
596
|
+
if (values.length === 1) return values[0];
|
|
597
|
+
return `calc(${values.join(" + ")})`;
|
|
598
|
+
}
|
|
599
|
+
function hasOwnOption(options, key) {
|
|
600
|
+
return Object.prototype.hasOwnProperty.call(options, key);
|
|
601
|
+
}
|
|
602
|
+
function affectsDismissedOffset(options) {
|
|
603
|
+
return hasOwnOption(options, "contentPlacement") || hasOwnOption(options, "tracks") || hasOwnOption(options, "detents") || hasOwnOption(options, "safeArea") || hasOwnOption(options, "topInset") || hasOwnOption(options, "bottomInset") || hasOwnOption(options, "leftInset") || hasOwnOption(options, "rightInset") || hasOwnOption(options, "containerOffset");
|
|
604
|
+
}
|
|
550
605
|
var safeAreaEdges = ["top", "bottom", "left", "right"];
|
|
551
606
|
function parseSafeArea(value) {
|
|
552
607
|
if (value === null) return void 0;
|
|
553
608
|
const normalized = value.trim().toLowerCase();
|
|
554
|
-
if (!normalized || normalized === "
|
|
609
|
+
if (!normalized || normalized === "auto") return "auto";
|
|
610
|
+
if (normalized === "true" || normalized === "all") return "all";
|
|
555
611
|
if (normalized === "false" || normalized === "none" || normalized === "off") return "none";
|
|
556
612
|
const edges = parseList(normalized).filter(
|
|
557
613
|
(edge) => safeAreaEdges.includes(edge)
|
|
558
614
|
);
|
|
559
615
|
return edges.length > 0 ? edges : "auto";
|
|
560
616
|
}
|
|
561
|
-
function
|
|
617
|
+
function resolveAutoSafeAreaEdges(placement) {
|
|
618
|
+
switch (placement) {
|
|
619
|
+
case "bottom":
|
|
620
|
+
return ["bottom", "left", "right"];
|
|
621
|
+
case "top":
|
|
622
|
+
return ["top", "left", "right"];
|
|
623
|
+
case "left":
|
|
624
|
+
return ["top", "bottom", "left"];
|
|
625
|
+
case "right":
|
|
626
|
+
return ["top", "bottom", "right"];
|
|
627
|
+
case "center":
|
|
628
|
+
return safeAreaEdges;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function resolveSafeAreaEdges(value, placement) {
|
|
562
632
|
if (value === false || value === "none") return [];
|
|
633
|
+
if (value === true || value === "all") return safeAreaEdges;
|
|
563
634
|
if (Array.isArray(value)) return value.filter((edge) => safeAreaEdges.includes(edge));
|
|
564
|
-
return
|
|
635
|
+
return resolveAutoSafeAreaEdges(placement);
|
|
565
636
|
}
|
|
566
637
|
function readOptionsFromElement(root) {
|
|
567
638
|
const placement = parsePlacement(root.getAttribute("content-placement"));
|
|
@@ -578,6 +649,11 @@ function readOptionsFromElement(root) {
|
|
|
578
649
|
sheetRole: root.getAttribute("sheet-role") || defaultOptions.sheetRole,
|
|
579
650
|
contentPlacement: placement,
|
|
580
651
|
safeArea: parseSafeArea(root.getAttribute("safe-area")),
|
|
652
|
+
detached: parseBoolean(root.getAttribute("detached"), defaultOptions.detached),
|
|
653
|
+
topInset: parseInset(root.getAttribute("top-inset")),
|
|
654
|
+
bottomInset: parseInset(root.getAttribute("bottom-inset")),
|
|
655
|
+
leftInset: parseInset(root.getAttribute("left-inset")),
|
|
656
|
+
rightInset: parseInset(root.getAttribute("right-inset")),
|
|
581
657
|
tracks: parseTracks(root.getAttribute("tracks"), placement === "center" ? "bottom" : placement),
|
|
582
658
|
swipe: parseBoolean(root.getAttribute("swipe"), defaultOptions.swipe),
|
|
583
659
|
swipeDismissal: parseBoolean(root.getAttribute("swipe-dismissal"), defaultOptions.swipeDismissal),
|
|
@@ -814,6 +890,11 @@ var SheetController = class {
|
|
|
814
890
|
this.parts.content.setAttribute("aria-modal", attributeBoolean(this.options.inertOutside !== false));
|
|
815
891
|
}
|
|
816
892
|
this.linkAccessibleNames();
|
|
893
|
+
if (this.connected && !this.presented && this.parts.content && affectsDismissedOffset(options)) {
|
|
894
|
+
this.remeasure();
|
|
895
|
+
this.applyOffset(this.detentOffsetsPx[0] || this.hiddenOffsetPx, this.status);
|
|
896
|
+
this.updateDomState(false);
|
|
897
|
+
}
|
|
817
898
|
this.registerStack();
|
|
818
899
|
}
|
|
819
900
|
/** Register a view, backdrop, content, or semantic part. */
|
|
@@ -968,12 +1049,29 @@ var SheetController = class {
|
|
|
968
1049
|
const sign = trackSign(track);
|
|
969
1050
|
const axis = isVerticalTrack(track) ? "y" : "x";
|
|
970
1051
|
const rect = content.getBoundingClientRect();
|
|
1052
|
+
const viewRect = view?.getBoundingClientRect();
|
|
971
1053
|
const size = axis === "y" ? rect.height : rect.width;
|
|
972
|
-
|
|
1054
|
+
const transformedX = axis === "x" ? this.currentOffsetPx : 0;
|
|
1055
|
+
const transformedY = axis === "y" ? this.currentOffsetPx : 0;
|
|
1056
|
+
const contentRect = {
|
|
1057
|
+
top: rect.top - transformedY,
|
|
1058
|
+
right: rect.right - transformedX,
|
|
1059
|
+
bottom: rect.bottom - transformedY,
|
|
1060
|
+
left: rect.left - transformedX
|
|
1061
|
+
};
|
|
1062
|
+
let hiddenOffsetPx = Math.max(size, 1) * sign;
|
|
1063
|
+
if (viewRect) {
|
|
1064
|
+
if (track === "top") hiddenOffsetPx = viewRect.top - contentRect.bottom;
|
|
1065
|
+
if (track === "bottom") hiddenOffsetPx = viewRect.bottom - contentRect.top;
|
|
1066
|
+
if (track === "left") hiddenOffsetPx = viewRect.left - contentRect.right;
|
|
1067
|
+
if (track === "right") hiddenOffsetPx = viewRect.right - contentRect.left;
|
|
1068
|
+
}
|
|
1069
|
+
this.hiddenOffsetPx = Math.abs(hiddenOffsetPx) > 1 ? hiddenOffsetPx : sign;
|
|
973
1070
|
const detents = normalizeDetents(this.options.detents);
|
|
974
1071
|
const offsets = [this.hiddenOffsetPx];
|
|
1072
|
+
const measureContext = content;
|
|
975
1073
|
for (const detent of detents) {
|
|
976
|
-
const visible = measureCssLength(detent,
|
|
1074
|
+
const visible = measureCssLength(detent, measureContext, axis);
|
|
977
1075
|
const offset = Math.max(Math.abs(this.hiddenOffsetPx) - visible, 0) * sign;
|
|
978
1076
|
offsets.push(offset);
|
|
979
1077
|
}
|
|
@@ -1143,13 +1241,17 @@ var SheetController = class {
|
|
|
1143
1241
|
applySafeArea() {
|
|
1144
1242
|
const view = this.parts.view;
|
|
1145
1243
|
if (!view) return;
|
|
1146
|
-
const edges = new Set(
|
|
1244
|
+
const edges = new Set(
|
|
1245
|
+
resolveSafeAreaEdges(this.options.safeArea, this.options.contentPlacement || defaultOptions.contentPlacement)
|
|
1246
|
+
);
|
|
1147
1247
|
view.dataset.safeArea = edges.size > 0 ? Array.from(edges).join(" ") : "none";
|
|
1248
|
+
view.dataset.detached = this.options.detached ? "true" : "false";
|
|
1148
1249
|
for (const edge of safeAreaEdges) {
|
|
1149
1250
|
view.style.setProperty(
|
|
1150
1251
|
`--cap-sheet-applied-safe-area-${edge}`,
|
|
1151
1252
|
edges.has(edge) ? `var(--cap-sheet-safe-area-${edge})` : "0em"
|
|
1152
1253
|
);
|
|
1254
|
+
view.style.setProperty(`--cap-sheet-container-offset-${edge}`, containerInsetForEdge(this.options, edge));
|
|
1153
1255
|
}
|
|
1154
1256
|
}
|
|
1155
1257
|
addGlobalListeners() {
|
|
@@ -1447,12 +1549,17 @@ var observed = [
|
|
|
1447
1549
|
"default-active-detent",
|
|
1448
1550
|
"default-presented",
|
|
1449
1551
|
"detents",
|
|
1552
|
+
"detached",
|
|
1450
1553
|
"focus-trap",
|
|
1451
1554
|
"inert-outside",
|
|
1452
1555
|
"native-edge-swipe-prevention",
|
|
1453
1556
|
"native-focus-scroll-prevention",
|
|
1454
1557
|
"presented",
|
|
1455
1558
|
"restore-focus",
|
|
1559
|
+
"top-inset",
|
|
1560
|
+
"bottom-inset",
|
|
1561
|
+
"left-inset",
|
|
1562
|
+
"right-inset",
|
|
1456
1563
|
"safe-area",
|
|
1457
1564
|
"sheet-role",
|
|
1458
1565
|
"stack",
|
|
@@ -1567,12 +1674,17 @@ function readChangedOptionsFromElement(element, name) {
|
|
|
1567
1674
|
"default-active-detent": ["defaultActiveDetent"],
|
|
1568
1675
|
"default-presented": ["defaultPresented"],
|
|
1569
1676
|
detents: ["detents"],
|
|
1677
|
+
detached: ["detached"],
|
|
1570
1678
|
"focus-trap": ["focusTrap"],
|
|
1571
1679
|
"inert-outside": ["inertOutside"],
|
|
1572
1680
|
"native-edge-swipe-prevention": ["nativeEdgeSwipePrevention"],
|
|
1573
1681
|
"native-focus-scroll-prevention": ["nativeFocusScrollPrevention"],
|
|
1574
1682
|
presented: ["presented"],
|
|
1575
1683
|
"restore-focus": ["restoreFocus"],
|
|
1684
|
+
"top-inset": ["topInset"],
|
|
1685
|
+
"bottom-inset": ["bottomInset"],
|
|
1686
|
+
"left-inset": ["leftInset"],
|
|
1687
|
+
"right-inset": ["rightInset"],
|
|
1576
1688
|
"safe-area": ["safeArea"],
|
|
1577
1689
|
"sheet-role": ["sheetRole"],
|
|
1578
1690
|
stack: ["stack"],
|
|
@@ -1589,6 +1701,19 @@ function readChangedOptionsFromElement(element, name) {
|
|
|
1589
1701
|
}
|
|
1590
1702
|
return changed;
|
|
1591
1703
|
}
|
|
1704
|
+
function formatInsetAttribute(value) {
|
|
1705
|
+
if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : void 0;
|
|
1706
|
+
const normalized = value.trim();
|
|
1707
|
+
return normalized || void 0;
|
|
1708
|
+
}
|
|
1709
|
+
function combineInsetAttributes(...values) {
|
|
1710
|
+
const parts = values.flatMap((value) => {
|
|
1711
|
+
const attributeValue = value === void 0 ? void 0 : formatInsetAttribute(value);
|
|
1712
|
+
return attributeValue ? [attributeValue] : [];
|
|
1713
|
+
});
|
|
1714
|
+
if (parts.length === 0) return void 0;
|
|
1715
|
+
return parts.length === 1 ? parts[0] : `calc(${parts.join(" + ")})`;
|
|
1716
|
+
}
|
|
1592
1717
|
function applySheetOptions(element, options) {
|
|
1593
1718
|
if (options.contentPlacement) element.setAttribute("content-placement", options.contentPlacement);
|
|
1594
1719
|
if (options.detents !== void 0) {
|
|
@@ -1600,7 +1725,6 @@ function applySheetOptions(element, options) {
|
|
|
1600
1725
|
}
|
|
1601
1726
|
if (options.defaultPresented !== void 0)
|
|
1602
1727
|
element.setAttribute("default-presented", String(options.defaultPresented));
|
|
1603
|
-
if (options.presented !== void 0) element.toggleAttribute("presented", options.presented);
|
|
1604
1728
|
if (options.sheetRole) element.setAttribute("sheet-role", options.sheetRole);
|
|
1605
1729
|
if (options.safeArea !== void 0) {
|
|
1606
1730
|
element.setAttribute(
|
|
@@ -1611,7 +1735,23 @@ function applySheetOptions(element, options) {
|
|
|
1611
1735
|
if (options.stack) element.setAttribute("stack", options.stack);
|
|
1612
1736
|
if (options.tracks)
|
|
1613
1737
|
element.setAttribute("tracks", Array.isArray(options.tracks) ? options.tracks.join(" ") : options.tracks);
|
|
1738
|
+
for (const [key, attr, edge] of [
|
|
1739
|
+
["topInset", "top-inset", "top"],
|
|
1740
|
+
["bottomInset", "bottom-inset", "bottom"],
|
|
1741
|
+
["leftInset", "left-inset", "left"],
|
|
1742
|
+
["rightInset", "right-inset", "right"]
|
|
1743
|
+
]) {
|
|
1744
|
+
const hasEdgeInset = Object.prototype.hasOwnProperty.call(options, key);
|
|
1745
|
+
const hasContainerOffset = Object.prototype.hasOwnProperty.call(options, "containerOffset");
|
|
1746
|
+
const attributeValue = combineInsetAttributes(options[key], options.containerOffset?.[edge]);
|
|
1747
|
+
if (attributeValue !== void 0) {
|
|
1748
|
+
element.setAttribute(attr, attributeValue);
|
|
1749
|
+
} else if (hasEdgeInset || hasContainerOffset) {
|
|
1750
|
+
element.removeAttribute(attr);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1614
1753
|
for (const [key, attr] of [
|
|
1754
|
+
["detached", "detached"],
|
|
1615
1755
|
["swipe", "swipe"],
|
|
1616
1756
|
["swipeDismissal", "swipe-dismissal"],
|
|
1617
1757
|
["swipeOvershoot", "swipe-overshoot"],
|
|
@@ -1630,6 +1770,7 @@ function applySheetOptions(element, options) {
|
|
|
1630
1770
|
if (options.themeColorDimming !== void 0) {
|
|
1631
1771
|
element.setAttribute("theme-color-dimming", options.themeColorDimming === false ? "false" : "auto");
|
|
1632
1772
|
}
|
|
1773
|
+
if (options.presented !== void 0) element.toggleAttribute("presented", options.presented);
|
|
1633
1774
|
}
|
|
1634
1775
|
|
|
1635
1776
|
// src/components/sheet-actions.ts
|