@surdeddd/bottom-sheet 0.13.0 → 0.20.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 +46 -0
- package/dist/{BottomSheetCore-D16lsa6g.d.ts → BottomSheetCore-Cgn8b_6A.d.ts} +36 -2
- package/dist/{BottomSheetCore-CsIjyq7C.d.cts → BottomSheetCore-VPJZcKcg.d.cts} +36 -2
- package/dist/{BottomSheetEngine-BYjAVrmd.d.cts → BottomSheetEngine-B8C2CwF9.d.cts} +1 -1
- package/dist/{BottomSheetEngine-YuCNugZn.d.ts → BottomSheetEngine-DwYR_ygJ.d.ts} +1 -1
- package/dist/core.cjs +328 -33
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +328 -33
- package/dist/debug.d.cts +1 -1
- package/dist/debug.d.ts +1 -1
- package/dist/element.cjs +404 -108
- package/dist/element.d.cts +2 -2
- package/dist/element.d.ts +2 -2
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +404 -108
- package/dist/features.cjs +6 -50
- package/dist/features.d.cts +4 -4
- package/dist/features.d.ts +4 -4
- package/dist/features.js +6 -50
- package/dist/index-CnfbOKx0.d.cts +9 -0
- package/dist/index-DcMkhXAy.d.ts +9 -0
- package/dist/index.cjs +335 -829
- package/dist/index.d.cts +44 -47
- package/dist/index.d.ts +44 -47
- package/dist/index.js +336 -816
- package/dist/integrations/formik.d.cts +1 -1
- package/dist/integrations/formik.d.ts +1 -1
- package/dist/integrations/react-hook-form.d.cts +1 -1
- package/dist/integrations/react-hook-form.d.ts +1 -1
- package/dist/overlay.cjs +5 -5
- package/dist/overlay.js +5 -5
- package/dist/preact.d.cts +2 -2
- package/dist/preact.d.ts +2 -2
- package/dist/qwik-lib/index.qwik.cjs +323 -83
- package/dist/qwik-lib/index.qwik.mjs +323 -83
- package/dist/qwik.cjs +342 -83
- package/dist/qwik.d.cts +4 -2
- package/dist/qwik.d.ts +4 -2
- package/dist/qwik.js +342 -83
- package/dist/react.cjs +347 -85
- package/dist/react.d.cts +3 -4
- package/dist/react.d.ts +3 -4
- package/dist/react.js +347 -85
- package/dist/solid.cjs +348 -83
- package/dist/solid.d.cts +37 -1
- package/dist/solid.d.ts +37 -1
- package/dist/solid.js +348 -83
- package/dist/solid.source.jsx +356 -83
- package/dist/styles.css +24 -4
- package/dist/svelte-core.cjs +334 -83
- package/dist/svelte-core.js +334 -83
- package/dist/svelte-src/BottomSheet.svelte +14 -0
- package/dist/svelte.cjs +344 -83
- package/dist/svelte.d.cts +2 -0
- package/dist/svelte.d.ts +2 -0
- package/dist/svelte.js +344 -83
- package/dist/vue.cjs +350 -83
- package/dist/vue.js +350 -83
- package/dist/webgl.cjs +673 -0
- package/dist/webgl.d.cts +17 -0
- package/dist/webgl.d.ts +17 -0
- package/dist/webgl.js +671 -0
- package/package.json +64 -40
- package/dist/index-DdYLOIIT.d.ts +0 -15
- package/dist/index-dfrzw-lI.d.cts +0 -15
package/dist/element.cjs
CHANGED
|
@@ -12,10 +12,10 @@ var __export = (target, all) => {
|
|
|
12
12
|
};
|
|
13
13
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14
14
|
|
|
15
|
-
// src/core/lifecycle/
|
|
15
|
+
// src/core/lifecycle/sheet-stack.ts
|
|
16
16
|
var BASE_Z, STEP, SheetStack, sheetStack;
|
|
17
|
-
var
|
|
18
|
-
"src/core/lifecycle/
|
|
17
|
+
var init_sheet_stack = __esm({
|
|
18
|
+
"src/core/lifecycle/sheet-stack.ts"() {
|
|
19
19
|
BASE_Z = 100;
|
|
20
20
|
STEP = 10;
|
|
21
21
|
SheetStack = class {
|
|
@@ -156,10 +156,10 @@ var init_event_bus = __esm({
|
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
// src/core/primitives/
|
|
159
|
+
// src/core/primitives/css-length.ts
|
|
160
160
|
var probe, PROBE_ATTR, ensureProbe, isViewportAxisVertical, viewportSize, PERCENT, resolveSnap;
|
|
161
|
-
var
|
|
162
|
-
"src/core/primitives/
|
|
161
|
+
var init_css_length = __esm({
|
|
162
|
+
"src/core/primitives/css-length.ts"() {
|
|
163
163
|
probe = null;
|
|
164
164
|
PROBE_ATTR = "data-bs-probe";
|
|
165
165
|
ensureProbe = (axis) => {
|
|
@@ -215,14 +215,14 @@ var init_cssLength = __esm({
|
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
217
|
|
|
218
|
-
// src/core/primitives/
|
|
218
|
+
// src/core/primitives/dev-warn.ts
|
|
219
219
|
function devWarn(...args) {
|
|
220
220
|
if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
221
221
|
console.warn(...args);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
var
|
|
225
|
-
"src/core/primitives/
|
|
224
|
+
var init_dev_warn = __esm({
|
|
225
|
+
"src/core/primitives/dev-warn.ts"() {
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
|
|
@@ -230,8 +230,8 @@ var init_devWarn = __esm({
|
|
|
230
230
|
var resolveSnapList, VH_NOT_DVH, auditVhUsage, findNearest, allowedRange, findById, MOUSE_FLICK_VELOCITY, MOUSE_DRAG_THRESHOLD, DIRECTIONAL_INTENT_VELOCITY, findDragSettleTarget;
|
|
231
231
|
var init_snap_points = __esm({
|
|
232
232
|
"src/core/primitives/snap-points.ts"() {
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
init_css_length();
|
|
234
|
+
init_dev_warn();
|
|
235
235
|
resolveSnapList = (points, mode, measureFit) => points.map((p) => {
|
|
236
236
|
const raw = resolveSnap(p.size, mode, measureFit);
|
|
237
237
|
if (!Number.isFinite(raw) || raw < 0) {
|
|
@@ -324,7 +324,7 @@ function emitCancelable(emit, base, warnLabel) {
|
|
|
324
324
|
}
|
|
325
325
|
var init_cancelable_emit = __esm({
|
|
326
326
|
"src/core/primitives/cancelable-emit.ts"() {
|
|
327
|
-
|
|
327
|
+
init_dev_warn();
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
|
|
@@ -367,6 +367,11 @@ var init_snap_resolver = __esm({
|
|
|
367
367
|
this.raw = raw;
|
|
368
368
|
this.recompute();
|
|
369
369
|
}
|
|
370
|
+
setMode(mode) {
|
|
371
|
+
if (mode === this.mode) return;
|
|
372
|
+
this.mode = mode;
|
|
373
|
+
this.recompute();
|
|
374
|
+
}
|
|
370
375
|
setAllowedIds(ids) {
|
|
371
376
|
this.allowedIds = ids;
|
|
372
377
|
this.rangeCache = null;
|
|
@@ -870,7 +875,7 @@ var init_scrim_controller = __esm({
|
|
|
870
875
|
init_snap_points();
|
|
871
876
|
init_hot_path_thresholds();
|
|
872
877
|
init_opacity_dedup();
|
|
873
|
-
|
|
878
|
+
init_dev_warn();
|
|
874
879
|
init_overlay_position();
|
|
875
880
|
VALID_CSS_LENGTH = /^-?\d+(?:\.\d+)?(?:px|em|rem|%)$/;
|
|
876
881
|
DEFAULT_SCRIM_DIM = "rgba(0, 0, 0, 0.4)";
|
|
@@ -1009,6 +1014,11 @@ var init_scrim_controller = __esm({
|
|
|
1009
1014
|
if (this.isDestroyed()) return;
|
|
1010
1015
|
this.applyScrimStyles({ interactive });
|
|
1011
1016
|
}
|
|
1017
|
+
setSheetMode(mode) {
|
|
1018
|
+
if (this.isDestroyed() || mode === this.mode) return;
|
|
1019
|
+
this.mode = mode;
|
|
1020
|
+
this.invalidateOpacityCache();
|
|
1021
|
+
}
|
|
1012
1022
|
setScrimMode(mode, applySize) {
|
|
1013
1023
|
if (this.isDestroyed()) return;
|
|
1014
1024
|
if (mode === this.scrimMode) return;
|
|
@@ -1660,10 +1670,10 @@ var init_animation_runner = __esm({
|
|
|
1660
1670
|
}
|
|
1661
1671
|
});
|
|
1662
1672
|
|
|
1663
|
-
// src/core/lifecycle/
|
|
1673
|
+
// src/core/lifecycle/focus-trap.ts
|
|
1664
1674
|
var FOCUSABLE, isVisible, collectFocusables, focusables, containsComposed, trapStack, installFocusTrap;
|
|
1665
|
-
var
|
|
1666
|
-
"src/core/lifecycle/
|
|
1675
|
+
var init_focus_trap = __esm({
|
|
1676
|
+
"src/core/lifecycle/focus-trap.ts"() {
|
|
1667
1677
|
FOCUSABLE = [
|
|
1668
1678
|
"a[href]",
|
|
1669
1679
|
"area[href]",
|
|
@@ -1783,10 +1793,10 @@ var init_focusTrap = __esm({
|
|
|
1783
1793
|
}
|
|
1784
1794
|
});
|
|
1785
1795
|
|
|
1786
|
-
// src/core/lifecycle/
|
|
1796
|
+
// src/core/lifecycle/scroll-lock.ts
|
|
1787
1797
|
var lockCount, savedStyles, lockBodyScroll;
|
|
1788
|
-
var
|
|
1789
|
-
"src/core/lifecycle/
|
|
1798
|
+
var init_scroll_lock = __esm({
|
|
1799
|
+
"src/core/lifecycle/scroll-lock.ts"() {
|
|
1790
1800
|
lockCount = 0;
|
|
1791
1801
|
savedStyles = null;
|
|
1792
1802
|
lockBodyScroll = () => {
|
|
@@ -1869,8 +1879,8 @@ var init_inert_siblings = __esm({
|
|
|
1869
1879
|
var LifecycleController;
|
|
1870
1880
|
var init_lifecycle_controller = __esm({
|
|
1871
1881
|
"src/core/controllers/lifecycle-controller.ts"() {
|
|
1872
|
-
|
|
1873
|
-
|
|
1882
|
+
init_focus_trap();
|
|
1883
|
+
init_scroll_lock();
|
|
1874
1884
|
init_inert_siblings();
|
|
1875
1885
|
LifecycleController = class {
|
|
1876
1886
|
constructor(deps, opts) {
|
|
@@ -1985,30 +1995,47 @@ var init_gestures = __esm({
|
|
|
1985
1995
|
this.size = 0;
|
|
1986
1996
|
}
|
|
1987
1997
|
};
|
|
1988
|
-
installGestures = (handle, mode, callbacks) => {
|
|
1998
|
+
installGestures = (handle, mode, callbacks, options = {}) => {
|
|
1989
1999
|
let activePointerId = null;
|
|
1990
2000
|
let activePointerType = "touch";
|
|
1991
2001
|
let startCoord = 0;
|
|
2002
|
+
let startCross = 0;
|
|
1992
2003
|
let lastCoord = 0;
|
|
2004
|
+
let pendingStart = false;
|
|
1993
2005
|
const VELOCITY_WINDOW_MS = (kind) => kind === "mouse" ? 160 : 120;
|
|
1994
2006
|
const MAX_SAMPLES = 32;
|
|
1995
2007
|
const samples = new SampleRing(MAX_SAMPLES);
|
|
1996
2008
|
const axis = isAxisVertical(mode) ? "Y" : "X";
|
|
1997
2009
|
const sign = mode === "bottom" || mode === "right" ? -1 : 1;
|
|
1998
2010
|
const coordOf = (e) => axis === "Y" ? e.clientY : e.clientX;
|
|
2011
|
+
const crossOf = (e) => axis === "Y" ? e.clientX : e.clientY;
|
|
2012
|
+
const capture = (pointerId) => {
|
|
2013
|
+
try {
|
|
2014
|
+
handle.setPointerCapture(pointerId);
|
|
2015
|
+
} catch {
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
const releaseTracking = () => {
|
|
2019
|
+
activePointerId = null;
|
|
2020
|
+
pendingStart = false;
|
|
2021
|
+
samples.reset();
|
|
2022
|
+
};
|
|
1999
2023
|
const onPointerDown = (e) => {
|
|
2000
2024
|
if (activePointerId !== null) return;
|
|
2001
2025
|
if (e.button !== void 0 && e.button !== 0) return;
|
|
2026
|
+
if (options.shouldStart && !options.shouldStart(e)) return;
|
|
2002
2027
|
activePointerId = e.pointerId;
|
|
2003
2028
|
activePointerType = e.pointerType || "touch";
|
|
2004
2029
|
startCoord = coordOf(e);
|
|
2030
|
+
startCross = crossOf(e);
|
|
2005
2031
|
lastCoord = startCoord;
|
|
2006
2032
|
samples.reset();
|
|
2007
2033
|
samples.push(e.timeStamp, startCoord);
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2034
|
+
if (options.deferStart) {
|
|
2035
|
+
pendingStart = true;
|
|
2036
|
+
return;
|
|
2011
2037
|
}
|
|
2038
|
+
capture(e.pointerId);
|
|
2012
2039
|
callbacks.onStart(startCoord, activePointerType);
|
|
2013
2040
|
};
|
|
2014
2041
|
const onPointerMove = (e) => {
|
|
@@ -2016,6 +2043,22 @@ var init_gestures = __esm({
|
|
|
2016
2043
|
const coord = coordOf(e);
|
|
2017
2044
|
const rawDelta = coord - startCoord;
|
|
2018
2045
|
const delta = rawDelta * sign;
|
|
2046
|
+
if (pendingStart) {
|
|
2047
|
+
const verdict = options.deferStart(e, delta, crossOf(e) - startCross);
|
|
2048
|
+
if (verdict === false) {
|
|
2049
|
+
releaseTracking();
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
2052
|
+
if (verdict !== true) return;
|
|
2053
|
+
pendingStart = false;
|
|
2054
|
+
startCoord = coord;
|
|
2055
|
+
lastCoord = coord;
|
|
2056
|
+
samples.reset();
|
|
2057
|
+
samples.push(e.timeStamp, coord);
|
|
2058
|
+
capture(e.pointerId);
|
|
2059
|
+
callbacks.onStart(startCoord, activePointerType);
|
|
2060
|
+
return;
|
|
2061
|
+
}
|
|
2019
2062
|
lastCoord = coord;
|
|
2020
2063
|
samples.push(e.timeStamp, coord);
|
|
2021
2064
|
const cutoff = e.timeStamp - VELOCITY_WINDOW_MS(activePointerType);
|
|
@@ -2024,6 +2067,10 @@ var init_gestures = __esm({
|
|
|
2024
2067
|
};
|
|
2025
2068
|
const finishGesture = (e) => {
|
|
2026
2069
|
if (e.pointerId !== activePointerId) return;
|
|
2070
|
+
if (pendingStart) {
|
|
2071
|
+
releaseTracking();
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2027
2074
|
const rawDelta = lastCoord - startCoord;
|
|
2028
2075
|
const delta = rawDelta * sign;
|
|
2029
2076
|
let velocity = 0;
|
|
@@ -2046,22 +2093,26 @@ var init_gestures = __esm({
|
|
|
2046
2093
|
};
|
|
2047
2094
|
const onPointerCancel = (e) => {
|
|
2048
2095
|
if (e.pointerId !== activePointerId) return;
|
|
2049
|
-
|
|
2050
|
-
|
|
2096
|
+
const wasPending = pendingStart;
|
|
2097
|
+
releaseTracking();
|
|
2098
|
+
if (wasPending) return;
|
|
2051
2099
|
callbacks.onCancel?.();
|
|
2052
2100
|
};
|
|
2053
2101
|
handle.addEventListener("pointerdown", onPointerDown);
|
|
2054
2102
|
handle.addEventListener("pointermove", onPointerMove);
|
|
2055
2103
|
handle.addEventListener("pointerup", finishGesture);
|
|
2056
2104
|
handle.addEventListener("pointercancel", onPointerCancel);
|
|
2105
|
+
const managesTouchAction = options.manageTouchAction !== false;
|
|
2057
2106
|
const prevTouchAction = handle.style.touchAction;
|
|
2058
|
-
|
|
2107
|
+
if (managesTouchAction) {
|
|
2108
|
+
handle.style.touchAction = isAxisVertical(mode) ? "pan-x" : "pan-y";
|
|
2109
|
+
}
|
|
2059
2110
|
return () => {
|
|
2060
2111
|
handle.removeEventListener("pointerdown", onPointerDown);
|
|
2061
2112
|
handle.removeEventListener("pointermove", onPointerMove);
|
|
2062
2113
|
handle.removeEventListener("pointerup", finishGesture);
|
|
2063
2114
|
handle.removeEventListener("pointercancel", onPointerCancel);
|
|
2064
|
-
handle.style.touchAction = prevTouchAction;
|
|
2115
|
+
if (managesTouchAction) handle.style.touchAction = prevTouchAction;
|
|
2065
2116
|
if (activePointerId !== null && handle.hasPointerCapture(activePointerId)) {
|
|
2066
2117
|
handle.releasePointerCapture(activePointerId);
|
|
2067
2118
|
}
|
|
@@ -2196,7 +2247,7 @@ var init_gesture_controller = __esm({
|
|
|
2196
2247
|
const restoreTo = this.dragStartSize;
|
|
2197
2248
|
void this.deps.animateTo(restoreTo, 0);
|
|
2198
2249
|
}
|
|
2199
|
-
});
|
|
2250
|
+
}, this.deps.gestureOptions);
|
|
2200
2251
|
return this.detach;
|
|
2201
2252
|
}
|
|
2202
2253
|
forceClearDragState() {
|
|
@@ -2210,6 +2261,93 @@ var init_gesture_controller = __esm({
|
|
|
2210
2261
|
}
|
|
2211
2262
|
});
|
|
2212
2263
|
|
|
2264
|
+
// src/core/primitives/drag-zones.ts
|
|
2265
|
+
function isDragAllowedFrom(target, mode) {
|
|
2266
|
+
const el = asElement(target);
|
|
2267
|
+
if (!el) return mode !== "zones";
|
|
2268
|
+
if (el.closest(NO_DRAG_SELECTOR)) return false;
|
|
2269
|
+
if (mode === "zones") return el.closest(DRAG_ZONE_SELECTOR) !== null;
|
|
2270
|
+
return true;
|
|
2271
|
+
}
|
|
2272
|
+
var DRAG_ZONE_SELECTOR, NO_DRAG_SELECTOR, asElement;
|
|
2273
|
+
var init_drag_zones = __esm({
|
|
2274
|
+
"src/core/primitives/drag-zones.ts"() {
|
|
2275
|
+
DRAG_ZONE_SELECTOR = "[data-bs-drag]";
|
|
2276
|
+
NO_DRAG_SELECTOR = "[data-bs-no-drag]";
|
|
2277
|
+
asElement = (target) => {
|
|
2278
|
+
const candidate = target;
|
|
2279
|
+
return candidate && typeof candidate.closest === "function" ? candidate : null;
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
|
|
2284
|
+
// src/core/primitives/content-gesture.ts
|
|
2285
|
+
function decideContentGesture(input) {
|
|
2286
|
+
const slop = input.slop ?? CONTENT_DRAG_SLOP;
|
|
2287
|
+
const cross = input.crossDelta ?? 0;
|
|
2288
|
+
const sharesScrollAxis = input.sharesScrollAxis ?? true;
|
|
2289
|
+
if (!sharesScrollAxis) {
|
|
2290
|
+
if (Math.abs(input.delta) < slop && Math.abs(cross) < slop) return "pending";
|
|
2291
|
+
if (Math.abs(input.delta) <= Math.abs(cross)) return "scroll";
|
|
2292
|
+
return "drag";
|
|
2293
|
+
}
|
|
2294
|
+
if (Math.abs(input.delta) < slop) return "pending";
|
|
2295
|
+
if (input.scrollTop > 0) return "scroll";
|
|
2296
|
+
if (input.delta > 0 && input.atMaxSnap) return "scroll";
|
|
2297
|
+
return "drag";
|
|
2298
|
+
}
|
|
2299
|
+
var CONTENT_DRAG_SLOP;
|
|
2300
|
+
var init_content_gesture = __esm({
|
|
2301
|
+
"src/core/primitives/content-gesture.ts"() {
|
|
2302
|
+
CONTENT_DRAG_SLOP = 6;
|
|
2303
|
+
}
|
|
2304
|
+
});
|
|
2305
|
+
|
|
2306
|
+
// src/core/primitives/logical-mode.ts
|
|
2307
|
+
var isLogicalMode, readDirection, resolveMode;
|
|
2308
|
+
var init_logical_mode = __esm({
|
|
2309
|
+
"src/core/primitives/logical-mode.ts"() {
|
|
2310
|
+
isLogicalMode = (mode) => mode === "start" || mode === "end";
|
|
2311
|
+
readDirection = (el) => {
|
|
2312
|
+
if (!el) return "ltr";
|
|
2313
|
+
if (typeof getComputedStyle === "function") {
|
|
2314
|
+
try {
|
|
2315
|
+
if (getComputedStyle(el).direction === "rtl") return "rtl";
|
|
2316
|
+
} catch {
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
try {
|
|
2320
|
+
const marked = el.closest?.("[dir]");
|
|
2321
|
+
if (marked) {
|
|
2322
|
+
return marked.getAttribute("dir")?.toLowerCase() === "rtl" ? "rtl" : "ltr";
|
|
2323
|
+
}
|
|
2324
|
+
} catch {
|
|
2325
|
+
}
|
|
2326
|
+
return "ltr";
|
|
2327
|
+
};
|
|
2328
|
+
resolveMode = (mode, el) => {
|
|
2329
|
+
if (!isLogicalMode(mode)) return mode;
|
|
2330
|
+
const rtl = readDirection(el) === "rtl";
|
|
2331
|
+
if (mode === "start") return rtl ? "right" : "left";
|
|
2332
|
+
return rtl ? "left" : "right";
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
});
|
|
2336
|
+
|
|
2337
|
+
// src/core/primitives/touch-scroll-guard.ts
|
|
2338
|
+
function installTouchScrollGuard(surface, isDragging) {
|
|
2339
|
+
const onTouchMove = (e) => {
|
|
2340
|
+
if (!isDragging()) return;
|
|
2341
|
+
if (e.cancelable) e.preventDefault();
|
|
2342
|
+
};
|
|
2343
|
+
surface.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
2344
|
+
return () => surface.removeEventListener("touchmove", onTouchMove);
|
|
2345
|
+
}
|
|
2346
|
+
var init_touch_scroll_guard = __esm({
|
|
2347
|
+
"src/core/primitives/touch-scroll-guard.ts"() {
|
|
2348
|
+
}
|
|
2349
|
+
});
|
|
2350
|
+
|
|
2213
2351
|
// src/core/primitives/aria-slider-writer.ts
|
|
2214
2352
|
var AriaSliderWriter;
|
|
2215
2353
|
var init_aria_slider_writer = __esm({
|
|
@@ -2588,9 +2726,11 @@ function resolveEngineOptions(opts, extras) {
|
|
|
2588
2726
|
}
|
|
2589
2727
|
}
|
|
2590
2728
|
return {
|
|
2591
|
-
mode: opts.mode ?? "bottom",
|
|
2729
|
+
mode: resolveMode(opts.mode ?? "bottom", opts.element),
|
|
2592
2730
|
flickVelocity: opts.flickVelocity ?? DEFAULT_FLICK_VELOCITY,
|
|
2593
2731
|
dragThreshold: opts.dragThreshold ?? DEFAULT_DRAG_THRESHOLD,
|
|
2732
|
+
dragFrom: opts.dragFrom ?? (opts.handle ? "handle" : "sheet"),
|
|
2733
|
+
dragFromContent: opts.dragFromContent ?? true,
|
|
2594
2734
|
rubberBandEnabled: opts.rubberBand ?? true,
|
|
2595
2735
|
closeOnBack: opts.closeOnBack ?? false,
|
|
2596
2736
|
persistent: opts.persistent ?? false,
|
|
@@ -2634,6 +2774,7 @@ function resolveEngineOptions(opts, extras) {
|
|
|
2634
2774
|
var DEFAULT_FLICK_VELOCITY, DEFAULT_DRAG_THRESHOLD, readPersistedIdSafe;
|
|
2635
2775
|
var init_engine_options = __esm({
|
|
2636
2776
|
"src/core/primitives/engine-options.ts"() {
|
|
2777
|
+
init_logical_mode();
|
|
2637
2778
|
DEFAULT_FLICK_VELOCITY = 0.65;
|
|
2638
2779
|
DEFAULT_DRAG_THRESHOLD = 18;
|
|
2639
2780
|
readPersistedIdSafe = (key) => {
|
|
@@ -2678,13 +2819,13 @@ var init_teardown_stack = __esm({
|
|
|
2678
2819
|
var HAPTIC_DURATION_MS, BottomSheetCore;
|
|
2679
2820
|
var init_BottomSheetCore = __esm({
|
|
2680
2821
|
"src/core/BottomSheetCore.ts"() {
|
|
2681
|
-
|
|
2822
|
+
init_sheet_stack();
|
|
2682
2823
|
init_transform();
|
|
2683
2824
|
init_instance_id();
|
|
2684
2825
|
init_event_bus();
|
|
2685
2826
|
init_snap_points();
|
|
2686
2827
|
init_cancelable_emit();
|
|
2687
|
-
|
|
2828
|
+
init_dev_warn();
|
|
2688
2829
|
init_snap_resolver();
|
|
2689
2830
|
init_linked_sheets();
|
|
2690
2831
|
init_resize_observer();
|
|
@@ -2696,6 +2837,10 @@ var init_BottomSheetCore = __esm({
|
|
|
2696
2837
|
init_animation_runner();
|
|
2697
2838
|
init_lifecycle_controller();
|
|
2698
2839
|
init_gesture_controller();
|
|
2840
|
+
init_drag_zones();
|
|
2841
|
+
init_content_gesture();
|
|
2842
|
+
init_logical_mode();
|
|
2843
|
+
init_touch_scroll_guard();
|
|
2699
2844
|
init_aria_slider_writer();
|
|
2700
2845
|
init_hot_path_thresholds();
|
|
2701
2846
|
init_scroll_cache();
|
|
@@ -2717,6 +2862,8 @@ var init_BottomSheetCore = __esm({
|
|
|
2717
2862
|
__publicField(this, "mode");
|
|
2718
2863
|
__publicField(this, "flickVelocity");
|
|
2719
2864
|
__publicField(this, "dragThreshold");
|
|
2865
|
+
__publicField(this, "dragFromMode");
|
|
2866
|
+
__publicField(this, "dragFromContentDefault");
|
|
2720
2867
|
__publicField(this, "rubberBandEnabled");
|
|
2721
2868
|
__publicField(this, "scrim");
|
|
2722
2869
|
__publicField(this, "aria");
|
|
@@ -2729,13 +2876,18 @@ var init_BottomSheetCore = __esm({
|
|
|
2729
2876
|
__publicField(this, "disableDragFlag");
|
|
2730
2877
|
__publicField(this, "closeOnRouteChange");
|
|
2731
2878
|
__publicField(this, "maxHeight");
|
|
2879
|
+
__publicField(this, "maxHeightDeps");
|
|
2732
2880
|
__publicField(this, "snapPointsRaw");
|
|
2733
2881
|
__publicField(this, "snaps");
|
|
2734
2882
|
__publicField(this, "activeId");
|
|
2735
2883
|
__publicField(this, "size", 0);
|
|
2736
2884
|
__publicField(this, "gesture");
|
|
2885
|
+
__publicField(this, "contentGesture");
|
|
2886
|
+
__publicField(this, "detachSheetGesture", null);
|
|
2887
|
+
__publicField(this, "detachSliderKeyboard", null);
|
|
2737
2888
|
__publicField(this, "rootEl", null);
|
|
2738
2889
|
__publicField(this, "destroyed", false);
|
|
2890
|
+
__publicField(this, "restClosed", false);
|
|
2739
2891
|
__publicField(this, "currentViewTransition", null);
|
|
2740
2892
|
__publicField(this, "currentAbort", new AbortController());
|
|
2741
2893
|
__publicField(this, "sizeWriteSentinel", new WriteSentinel());
|
|
@@ -2784,10 +2936,13 @@ var init_BottomSheetCore = __esm({
|
|
|
2784
2936
|
this.screenComponent = opts.scrim ?? opts.screenComponent;
|
|
2785
2937
|
this.scrimParent = this.screenComponent?.parentElement ?? null;
|
|
2786
2938
|
this.mode = resolved.mode;
|
|
2939
|
+
this.element.dataset.mode = this.mode;
|
|
2787
2940
|
this.transformTemplate = buildTransformTemplate(this.mode);
|
|
2788
2941
|
this.aria = new AriaSliderWriter(this.handle, this.mode);
|
|
2789
2942
|
this.flickVelocity = resolved.flickVelocity;
|
|
2790
2943
|
this.dragThreshold = resolved.dragThreshold;
|
|
2944
|
+
this.dragFromMode = resolved.dragFrom;
|
|
2945
|
+
this.dragFromContentDefault = resolved.dragFromContent;
|
|
2791
2946
|
this.rubberBandEnabled = resolved.rubberBandEnabled;
|
|
2792
2947
|
this.scrim = new ScrimController(
|
|
2793
2948
|
{
|
|
@@ -2814,7 +2969,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2814
2969
|
getRootEl: () => this.rootEl,
|
|
2815
2970
|
applySize: (size) => this.applySize(size),
|
|
2816
2971
|
getSize: () => this.size,
|
|
2817
|
-
isDragging: () => this.
|
|
2972
|
+
isDragging: () => this.isDraggingAny(),
|
|
2818
2973
|
applyAux: (size) => this.applySize(size, true),
|
|
2819
2974
|
getTransformFor: (size) => this.transformTemplate(this.snaps.getMaxAxisSize() - size)
|
|
2820
2975
|
},
|
|
@@ -2848,7 +3003,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2848
3003
|
auditVhUsage(this.snapPointsRaw);
|
|
2849
3004
|
this.auditDuplicateSnapIds(this.snapPointsRaw);
|
|
2850
3005
|
this.rootEl = this.element.closest(".bs-root");
|
|
2851
|
-
this.
|
|
3006
|
+
this.maxHeightDeps = {
|
|
2852
3007
|
element: this.element,
|
|
2853
3008
|
mode: this.mode,
|
|
2854
3009
|
getMaxAxisSize: () => this.snaps.getMaxAxisSize(),
|
|
@@ -2856,7 +3011,8 @@ var init_BottomSheetCore = __esm({
|
|
|
2856
3011
|
this.snaps.setMaxAxisSize(size);
|
|
2857
3012
|
},
|
|
2858
3013
|
recompute: () => this.recompute()
|
|
2859
|
-
}
|
|
3014
|
+
};
|
|
3015
|
+
this.maxHeight = createMaxHeightController(this.maxHeightDeps);
|
|
2860
3016
|
this.fitDeps = {
|
|
2861
3017
|
element: this.element,
|
|
2862
3018
|
scrollContainer: this.scrollContainer,
|
|
@@ -2875,6 +3031,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2875
3031
|
const initial = this.snaps.findById(this.activeId);
|
|
2876
3032
|
if (initial) this.size = initial.size;
|
|
2877
3033
|
this.applySize(this.size);
|
|
3034
|
+
this.setRestClosed(this.size === 0);
|
|
2878
3035
|
this.updateAriaSlider();
|
|
2879
3036
|
this.scrollCache = createScrollCache({
|
|
2880
3037
|
scrollContainer: this.scrollContainer,
|
|
@@ -2905,7 +3062,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2905
3062
|
(p) => p.size === "fit" || p.size === "content"
|
|
2906
3063
|
),
|
|
2907
3064
|
isDestroyed: () => this.destroyed,
|
|
2908
|
-
isDragging: () => this.
|
|
3065
|
+
isDragging: () => this.isDraggingAny(),
|
|
2909
3066
|
recompute: () => this.recompute()
|
|
2910
3067
|
})
|
|
2911
3068
|
);
|
|
@@ -2931,7 +3088,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2931
3088
|
autoCollapseAfter
|
|
2932
3089
|
},
|
|
2933
3090
|
isDestroyed: () => this.destroyed,
|
|
2934
|
-
isDragging: () => this.
|
|
3091
|
+
isDragging: () => this.isDraggingAny(),
|
|
2935
3092
|
isAnimating: () => this.animation.isAnimating,
|
|
2936
3093
|
isTopSheet: () => this.isTopSheet,
|
|
2937
3094
|
isVerticalAxis: () => this.mode === "bottom" || this.mode === "top",
|
|
@@ -2961,6 +3118,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2961
3118
|
void this.snapTo(id);
|
|
2962
3119
|
},
|
|
2963
3120
|
close: (reason) => this.close(reason),
|
|
3121
|
+
attachDragSurface: (surface, kind) => this.attachDragSurface(surface, kind),
|
|
2964
3122
|
on: (event, fn) => this.on(event, fn),
|
|
2965
3123
|
addTeardown: (fn) => this.teardowns.add(fn)
|
|
2966
3124
|
};
|
|
@@ -2989,7 +3147,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2989
3147
|
return {
|
|
2990
3148
|
size: this.size,
|
|
2991
3149
|
activeId: this.activeId,
|
|
2992
|
-
isDragging: this.
|
|
3150
|
+
isDragging: this.isDraggingAny(),
|
|
2993
3151
|
isAnimating: this.animation.isAnimating,
|
|
2994
3152
|
progress: this.computeProgress(this.size)
|
|
2995
3153
|
};
|
|
@@ -3109,9 +3267,16 @@ var init_BottomSheetCore = __esm({
|
|
|
3109
3267
|
progress: this.computeProgress(this.size)
|
|
3110
3268
|
});
|
|
3111
3269
|
if (withHaptic) this.haptic();
|
|
3270
|
+
this.setRestClosed(targetSize === 0);
|
|
3112
3271
|
if (wasClosed && targetSize > 0) this.emitOpenSequence(id);
|
|
3113
3272
|
if (targetSize === 0) this.emitCloseSequence();
|
|
3114
3273
|
}
|
|
3274
|
+
setRestClosed(closed) {
|
|
3275
|
+
if (closed === this.restClosed) return;
|
|
3276
|
+
this.restClosed = closed;
|
|
3277
|
+
if (closed) this.element.setAttribute("data-bs-rest", "closed");
|
|
3278
|
+
else this.element.removeAttribute("data-bs-rest");
|
|
3279
|
+
}
|
|
3115
3280
|
emitOpenSequence(id) {
|
|
3116
3281
|
this.emit("open", { id });
|
|
3117
3282
|
this.handleOpen();
|
|
@@ -3167,6 +3332,51 @@ var init_BottomSheetCore = __esm({
|
|
|
3167
3332
|
if (this.destroyed) return;
|
|
3168
3333
|
this.disableDragFlag = value;
|
|
3169
3334
|
}
|
|
3335
|
+
setDragFromContent(value) {
|
|
3336
|
+
if (this.destroyed) return;
|
|
3337
|
+
this.dragFromContentDefault = value;
|
|
3338
|
+
}
|
|
3339
|
+
setDragFrom(mode) {
|
|
3340
|
+
if (this.destroyed || mode === this.dragFromMode) return;
|
|
3341
|
+
this.gesture?.forceClearDragState();
|
|
3342
|
+
this.detachSheetGesture?.();
|
|
3343
|
+
this.dragFromMode = mode;
|
|
3344
|
+
this.mountSheetGesture();
|
|
3345
|
+
}
|
|
3346
|
+
getDragFrom() {
|
|
3347
|
+
return this.dragFromMode;
|
|
3348
|
+
}
|
|
3349
|
+
setMode(mode) {
|
|
3350
|
+
if (this.destroyed) return;
|
|
3351
|
+
const next = resolveMode(mode, this.element);
|
|
3352
|
+
if (next === this.mode) return;
|
|
3353
|
+
const wasVertical = this.mode === "bottom" || this.mode === "top";
|
|
3354
|
+
const nowVertical = next === "bottom" || next === "top";
|
|
3355
|
+
this.gesture?.forceClearDragState();
|
|
3356
|
+
this.detachSheetGesture?.();
|
|
3357
|
+
this.animation.cancel();
|
|
3358
|
+
this.element.style.removeProperty(layoutAxis(this.mode));
|
|
3359
|
+
this.mode = next;
|
|
3360
|
+
this.element.dataset.mode = next;
|
|
3361
|
+
this.transformTemplate = buildTransformTemplate(next);
|
|
3362
|
+
this.maxHeightDeps.mode = next;
|
|
3363
|
+
this.fitDeps.mode = next;
|
|
3364
|
+
this.snaps.setMode(next);
|
|
3365
|
+
this.scrim.setSheetMode(next);
|
|
3366
|
+
if (wasVertical !== nowVertical) {
|
|
3367
|
+
this.aria = new AriaSliderWriter(this.handle, next);
|
|
3368
|
+
}
|
|
3369
|
+
this.detachSliderKeyboard?.();
|
|
3370
|
+
this.mountSliderKeyboard();
|
|
3371
|
+
this.mountSheetGesture();
|
|
3372
|
+
this.recompute();
|
|
3373
|
+
const active = this.snaps.findById(this.activeId);
|
|
3374
|
+
if (active) this.applySize(active.size);
|
|
3375
|
+
this.updateAriaSlider();
|
|
3376
|
+
}
|
|
3377
|
+
getMode() {
|
|
3378
|
+
return this.mode;
|
|
3379
|
+
}
|
|
3170
3380
|
isTop() {
|
|
3171
3381
|
return this.isTopSheet;
|
|
3172
3382
|
}
|
|
@@ -3321,12 +3531,24 @@ var init_BottomSheetCore = __esm({
|
|
|
3321
3531
|
auditVhUsage(points);
|
|
3322
3532
|
this.auditDuplicateSnapIds(points);
|
|
3323
3533
|
this.snaps.setRaw(points);
|
|
3324
|
-
if (allowed)
|
|
3534
|
+
if (allowed) {
|
|
3535
|
+
this.snaps.setAllowedIds(allowed);
|
|
3536
|
+
} else {
|
|
3537
|
+
const present = this.snaps.getResolvedSnaps().map((s) => s.id);
|
|
3538
|
+
const kept = this.snaps.getAllowedIds().filter((id) => present.includes(id));
|
|
3539
|
+
this.snaps.setAllowedIds(kept.length ? kept : present);
|
|
3540
|
+
}
|
|
3325
3541
|
this.scrollCache.clear();
|
|
3326
3542
|
this.scrim.invalidateOpacityCache();
|
|
3327
3543
|
const current = this.snaps.findById(this.activeId);
|
|
3328
3544
|
if (current) {
|
|
3329
3545
|
this.applySize(current.size);
|
|
3546
|
+
} else {
|
|
3547
|
+
const fallback = this.snaps.getResolvedSnaps().find((s) => this.snaps.getAllowedIds().includes(s.id)) ?? this.snaps.getResolvedSnaps()[0];
|
|
3548
|
+
if (fallback) {
|
|
3549
|
+
this.activeId = fallback.id;
|
|
3550
|
+
this.applySize(fallback.size);
|
|
3551
|
+
}
|
|
3330
3552
|
}
|
|
3331
3553
|
this.updateAriaSlider();
|
|
3332
3554
|
}
|
|
@@ -3336,7 +3558,7 @@ var init_BottomSheetCore = __esm({
|
|
|
3336
3558
|
this.snaps.recompute();
|
|
3337
3559
|
this.maxHeight.clampTo();
|
|
3338
3560
|
this.scrim.invalidateOpacityCache();
|
|
3339
|
-
if (this.
|
|
3561
|
+
if (this.isDraggingAny()) return;
|
|
3340
3562
|
this.healActiveSnap();
|
|
3341
3563
|
}
|
|
3342
3564
|
healActiveSnap() {
|
|
@@ -3358,6 +3580,8 @@ var init_BottomSheetCore = __esm({
|
|
|
3358
3580
|
this.bus.clear();
|
|
3359
3581
|
this.animation.cancel();
|
|
3360
3582
|
this.gesture?.forceClearDragState();
|
|
3583
|
+
this.contentGesture?.forceClearDragState();
|
|
3584
|
+
this.setRestClosed(false);
|
|
3361
3585
|
this.teardowns.drain();
|
|
3362
3586
|
this.scrim.destroy();
|
|
3363
3587
|
this.animation.destroy();
|
|
@@ -3470,11 +3694,12 @@ var init_BottomSheetCore = __esm({
|
|
|
3470
3694
|
const scale = Math.max(1 - depth * 0.04, 0.86);
|
|
3471
3695
|
this.element.style.scale = scale === 1 ? "" : String(scale);
|
|
3472
3696
|
}
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
handle:
|
|
3697
|
+
buildGestureDeps(surface, gestureOptions) {
|
|
3698
|
+
return {
|
|
3699
|
+
handle: surface,
|
|
3476
3700
|
element: this.element,
|
|
3477
3701
|
mode: this.mode,
|
|
3702
|
+
gestureOptions,
|
|
3478
3703
|
getRoot: () => this.rootEl,
|
|
3479
3704
|
getDragContext: () => {
|
|
3480
3705
|
const buf = this.dragContextBuf;
|
|
@@ -3493,8 +3718,90 @@ var init_BottomSheetCore = __esm({
|
|
|
3493
3718
|
settleAfterDrag: (delta, velocity, kind) => this.settleAfterDrag(delta, velocity, kind),
|
|
3494
3719
|
emit: (event, payload) => this.emit(event, payload),
|
|
3495
3720
|
listenerCount: (event) => this.bus.listenerCount(event)
|
|
3721
|
+
};
|
|
3722
|
+
}
|
|
3723
|
+
isContentDragAllowed() {
|
|
3724
|
+
if (this.disableDragFlag) return false;
|
|
3725
|
+
const point = this.snapPointsRaw.find((p) => p.id === this.activeId);
|
|
3726
|
+
return point?.dragFromContent ?? this.dragFromContentDefault;
|
|
3727
|
+
}
|
|
3728
|
+
decideContentDrag(surface, e, delta, crossDelta) {
|
|
3729
|
+
if (this.destroyed) return false;
|
|
3730
|
+
if (e.pointerType === "mouse") return false;
|
|
3731
|
+
if (this.gesture?.isDragging) return false;
|
|
3732
|
+
if (!this.isContentDragAllowed()) return false;
|
|
3733
|
+
if (!isDragAllowedFrom(e.target, "sheet")) return false;
|
|
3734
|
+
const decision = decideContentGesture({
|
|
3735
|
+
delta,
|
|
3736
|
+
crossDelta,
|
|
3737
|
+
sharesScrollAxis: this.mode === "bottom" || this.mode === "top",
|
|
3738
|
+
scrollTop: surface.scrollTop,
|
|
3739
|
+
atMaxSnap: this.size >= this.getAllowedRange().max - 0.5
|
|
3740
|
+
});
|
|
3741
|
+
if (decision === "pending") return null;
|
|
3742
|
+
return decision === "drag";
|
|
3743
|
+
}
|
|
3744
|
+
attachDragSurface(surface, kind) {
|
|
3745
|
+
if (this.destroyed || kind !== "content") return;
|
|
3746
|
+
if (this.contentGesture) return;
|
|
3747
|
+
const controller = new GestureController(
|
|
3748
|
+
this.buildGestureDeps(surface, {
|
|
3749
|
+
manageTouchAction: false,
|
|
3750
|
+
deferStart: (e, delta, crossDelta) => this.decideContentDrag(surface, e, delta, crossDelta)
|
|
3751
|
+
})
|
|
3752
|
+
);
|
|
3753
|
+
this.contentGesture = controller;
|
|
3754
|
+
const detachGestures = controller.install();
|
|
3755
|
+
const detachGuard = installTouchScrollGuard(
|
|
3756
|
+
surface,
|
|
3757
|
+
() => controller.isDragging
|
|
3758
|
+
);
|
|
3759
|
+
return () => {
|
|
3760
|
+
detachGuard();
|
|
3761
|
+
detachGestures();
|
|
3762
|
+
if (this.contentGesture === controller) this.contentGesture = void 0;
|
|
3763
|
+
};
|
|
3764
|
+
}
|
|
3765
|
+
sheetDragSurface() {
|
|
3766
|
+
return this.dragFromMode === "handle" ? this.handle : this.element;
|
|
3767
|
+
}
|
|
3768
|
+
canStartSheetDrag(e) {
|
|
3769
|
+
if (this.contentGesture?.isDragging) return false;
|
|
3770
|
+
const target = e.target;
|
|
3771
|
+
const scoped = typeof target?.closest === "function";
|
|
3772
|
+
if (scoped && target.closest(NO_DRAG_SELECTOR)) return false;
|
|
3773
|
+
if (this.handle !== this.element && scoped && this.handle.contains(target)) {
|
|
3774
|
+
return true;
|
|
3775
|
+
}
|
|
3776
|
+
if (!isDragAllowedFrom(e.target, this.dragFromMode)) return false;
|
|
3777
|
+
if (this.dragFromMode === "handle") return true;
|
|
3778
|
+
if (this.scrollContainer && scoped && this.scrollContainer.contains(target) && !target.closest(DRAG_ZONE_SELECTOR)) {
|
|
3779
|
+
return false;
|
|
3780
|
+
}
|
|
3781
|
+
return true;
|
|
3782
|
+
}
|
|
3783
|
+
mountSheetGesture() {
|
|
3784
|
+
const surface = this.sheetDragSurface();
|
|
3785
|
+
const controller = new GestureController(
|
|
3786
|
+
this.buildGestureDeps(surface, {
|
|
3787
|
+
shouldStart: (e) => this.canStartSheetDrag(e),
|
|
3788
|
+
manageTouchAction: this.dragFromMode === "handle"
|
|
3789
|
+
})
|
|
3790
|
+
);
|
|
3791
|
+
this.gesture = controller;
|
|
3792
|
+
const detachGestures = controller.install();
|
|
3793
|
+
const detachGuard = this.dragFromMode === "handle" ? null : installTouchScrollGuard(surface, () => controller.isDragging);
|
|
3794
|
+
this.detachSheetGesture = () => {
|
|
3795
|
+
detachGuard?.();
|
|
3796
|
+
detachGestures();
|
|
3797
|
+
};
|
|
3798
|
+
}
|
|
3799
|
+
attach() {
|
|
3800
|
+
this.mountSheetGesture();
|
|
3801
|
+
this.teardowns.add(() => {
|
|
3802
|
+
this.detachSheetGesture?.();
|
|
3803
|
+
this.detachSheetGesture = null;
|
|
3496
3804
|
});
|
|
3497
|
-
this.teardowns.add(this.gesture.install());
|
|
3498
3805
|
try {
|
|
3499
3806
|
this.attachFeatures();
|
|
3500
3807
|
} catch (err) {
|
|
@@ -3531,7 +3838,7 @@ var init_BottomSheetCore = __esm({
|
|
|
3531
3838
|
element: this.element,
|
|
3532
3839
|
getMode: () => this.mode,
|
|
3533
3840
|
isDestroyed: () => this.destroyed,
|
|
3534
|
-
isDragging: () => this.
|
|
3841
|
+
isDragging: () => this.isDraggingAny(),
|
|
3535
3842
|
resolveActiveSnap: () => this.snaps.findById(this.activeId),
|
|
3536
3843
|
getMaxAxisSize: () => this.snaps.getMaxAxisSize(),
|
|
3537
3844
|
getSize: () => this.size,
|
|
@@ -3566,7 +3873,11 @@ var init_BottomSheetCore = __esm({
|
|
|
3566
3873
|
);
|
|
3567
3874
|
}
|
|
3568
3875
|
}
|
|
3569
|
-
this.
|
|
3876
|
+
this.mountSliderKeyboard();
|
|
3877
|
+
this.scrim.attach();
|
|
3878
|
+
}
|
|
3879
|
+
mountSliderKeyboard() {
|
|
3880
|
+
const detach = installSliderKeyboard({
|
|
3570
3881
|
handle: this.handle,
|
|
3571
3882
|
mode: this.mode,
|
|
3572
3883
|
isDestroyed: () => this.destroyed,
|
|
@@ -3575,8 +3886,12 @@ var init_BottomSheetCore = __esm({
|
|
|
3575
3886
|
snapTo: (id) => {
|
|
3576
3887
|
void this.snapTo(id);
|
|
3577
3888
|
}
|
|
3578
|
-
})
|
|
3579
|
-
this.
|
|
3889
|
+
});
|
|
3890
|
+
this.detachSliderKeyboard = detach;
|
|
3891
|
+
this.teardowns.add(() => {
|
|
3892
|
+
this.detachSliderKeyboard?.();
|
|
3893
|
+
this.detachSliderKeyboard = null;
|
|
3894
|
+
});
|
|
3580
3895
|
}
|
|
3581
3896
|
settleAfterDrag(delta, velocity, kind = "touch") {
|
|
3582
3897
|
const signal = this.newCycle();
|
|
@@ -3629,8 +3944,11 @@ var init_BottomSheetCore = __esm({
|
|
|
3629
3944
|
);
|
|
3630
3945
|
});
|
|
3631
3946
|
}
|
|
3947
|
+
isDraggingAny() {
|
|
3948
|
+
return (this.gesture?.isDragging ?? false) || (this.contentGesture?.isDragging ?? false);
|
|
3949
|
+
}
|
|
3632
3950
|
clearWillChangeIfIdle() {
|
|
3633
|
-
if (this.animation.isAnimating || this.
|
|
3951
|
+
if (this.animation.isAnimating || this.isDraggingAny()) return;
|
|
3634
3952
|
this.element.style.willChange = "";
|
|
3635
3953
|
}
|
|
3636
3954
|
haptic() {
|
|
@@ -3643,8 +3961,9 @@ var init_BottomSheetCore = __esm({
|
|
|
3643
3961
|
}
|
|
3644
3962
|
applySize(size, skipTransform = false) {
|
|
3645
3963
|
const cap = this.snaps.getMaxAxisSize();
|
|
3646
|
-
const clamped = cap > 0 && size > cap && !this.
|
|
3964
|
+
const clamped = cap > 0 && size > cap && !this.isDraggingAny() && !this.allowOvershoot ? cap : size;
|
|
3647
3965
|
this.size = clamped;
|
|
3966
|
+
if (clamped > 0) this.setRestClosed(false);
|
|
3648
3967
|
const offset = cap - clamped;
|
|
3649
3968
|
const style = this.element.style;
|
|
3650
3969
|
if (!skipTransform) style.transform = this.transformTemplate(offset);
|
|
@@ -4044,54 +4363,13 @@ var init_auto_collapse = __esm({
|
|
|
4044
4363
|
}
|
|
4045
4364
|
});
|
|
4046
4365
|
|
|
4047
|
-
// src/core/features/content-
|
|
4048
|
-
function
|
|
4049
|
-
const
|
|
4050
|
-
|
|
4051
|
-
let startScrollTop = 0;
|
|
4052
|
-
let moved = false;
|
|
4053
|
-
const onTouchStart = (e) => {
|
|
4054
|
-
const t = e.touches[0];
|
|
4055
|
-
if (!t) return;
|
|
4056
|
-
startY = t.clientY;
|
|
4057
|
-
startScrollTop = container.scrollTop;
|
|
4058
|
-
moved = false;
|
|
4059
|
-
};
|
|
4060
|
-
const onTouchMove = (e) => {
|
|
4061
|
-
const t = e.touches[0];
|
|
4062
|
-
if (!t) return;
|
|
4063
|
-
if (Math.abs(t.clientY - startY) > CONTENT_PULL_THRESHOLD) moved = true;
|
|
4064
|
-
};
|
|
4065
|
-
const onTouchEnd = (e) => {
|
|
4066
|
-
if (!moved) return;
|
|
4067
|
-
if (deps.isDragging() || deps.isAnimating()) return;
|
|
4068
|
-
if (container.scrollTop !== startScrollTop) return;
|
|
4069
|
-
const t = e.changedTouches[0];
|
|
4070
|
-
if (!t) return;
|
|
4071
|
-
const deltaY = t.clientY - startY;
|
|
4072
|
-
const atTop = container.scrollTop <= 0;
|
|
4073
|
-
const allowed = deps.getAllowedIds();
|
|
4074
|
-
const idx = allowed.indexOf(deps.getActiveId());
|
|
4075
|
-
if (idx === -1) return;
|
|
4076
|
-
if (atTop && deltaY > CONTENT_PULL_THRESHOLD && idx > 0) {
|
|
4077
|
-
deps.snapTo(allowed[idx - 1]);
|
|
4078
|
-
} else if (deltaY < -CONTENT_PULL_THRESHOLD && idx < allowed.length - 1) {
|
|
4079
|
-
deps.snapTo(allowed[idx + 1]);
|
|
4080
|
-
}
|
|
4081
|
-
};
|
|
4082
|
-
container.addEventListener("touchstart", onTouchStart, { passive: true });
|
|
4083
|
-
container.addEventListener("touchmove", onTouchMove, { passive: true });
|
|
4084
|
-
container.addEventListener("touchend", onTouchEnd, { passive: true });
|
|
4085
|
-
return () => {
|
|
4086
|
-
container.removeEventListener("touchstart", onTouchStart);
|
|
4087
|
-
container.removeEventListener("touchmove", onTouchMove);
|
|
4088
|
-
container.removeEventListener("touchend", onTouchEnd);
|
|
4089
|
-
};
|
|
4366
|
+
// src/core/features/content-drag.ts
|
|
4367
|
+
function installContentDrag(deps) {
|
|
4368
|
+
const detach = deps.attachDragSurface(deps.container, "content");
|
|
4369
|
+
return () => detach?.();
|
|
4090
4370
|
}
|
|
4091
|
-
var
|
|
4092
|
-
|
|
4093
|
-
"src/core/features/content-swipe.ts"() {
|
|
4094
|
-
CONTENT_PULL_THRESHOLD = 60;
|
|
4371
|
+
var init_content_drag = __esm({
|
|
4372
|
+
"src/core/features/content-drag.ts"() {
|
|
4095
4373
|
}
|
|
4096
4374
|
});
|
|
4097
4375
|
|
|
@@ -4205,13 +4483,9 @@ function contentSwipeFeature() {
|
|
|
4205
4483
|
stage: "attach",
|
|
4206
4484
|
install: (ctx) => {
|
|
4207
4485
|
if (!ctx.scrollContainer) return;
|
|
4208
|
-
return
|
|
4486
|
+
return installContentDrag({
|
|
4209
4487
|
container: ctx.scrollContainer,
|
|
4210
|
-
|
|
4211
|
-
isAnimating: ctx.isAnimating,
|
|
4212
|
-
getAllowedIds: ctx.allowedIdsBySize,
|
|
4213
|
-
getActiveId: ctx.getActiveId,
|
|
4214
|
-
snapTo: ctx.snapTo
|
|
4488
|
+
attachDragSurface: ctx.attachDragSurface
|
|
4215
4489
|
});
|
|
4216
4490
|
}
|
|
4217
4491
|
};
|
|
@@ -4246,7 +4520,7 @@ var init_engine_features = __esm({
|
|
|
4246
4520
|
init_route();
|
|
4247
4521
|
init_persist();
|
|
4248
4522
|
init_auto_collapse();
|
|
4249
|
-
|
|
4523
|
+
init_content_drag();
|
|
4250
4524
|
init_visual_viewport();
|
|
4251
4525
|
init_teardown_stack();
|
|
4252
4526
|
}
|
|
@@ -4289,7 +4563,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
4289
4563
|
var baseStyles;
|
|
4290
4564
|
var init_baseStyles = __esm({
|
|
4291
4565
|
"src/web-component/baseStyles.ts"() {
|
|
4292
|
-
baseStyles = `:where(.bs-root){--bs-surface-d:#ffffff;--bs-surface-border-d:rgba(225,227,237,1);--bs-radius-d:20px;--bs-handle-color-d:rgba(26,22,20,0.3);--bs-handle-width:40px;--bs-handle-height:5px;--bs-z-backdrop:90;--bs-z-sheet:100;--bs-backdrop-color-d:rgba(0,0,0,0.5);--bs-scrim-color-d:transparent;--bs-scrim-blur:0px;--bs-z-scrim:calc(var(--bs-z-sheet) - 1);--bs-size:0px;--bs-progress:0}.bs-backdrop{position:fixed;inset:0;background:var(--bs-backdrop-color,var(--bs-backdrop-color-d));opacity:0;pointer-events:none;z-index:var(--bs-z-backdrop);transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-backdrop,.bs-root[data-animating="true"] .bs-backdrop{transition:none}.bs-sheet{position:fixed;background:var(--bs-surface,var(--bs-surface-d));box-shadow:var(--bs-shadow,var(--bs-shadow-auto,none));z-index:var(--bs-z-sheet);pointer-events:auto;overflow:hidden;display:flex;flex-direction:column;-webkit-tap-highlight-color:transparent;user-select:none;overscroll-behavior:contain}.bs-sheet[data-mode="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));padding-bottom:env(safe-area-inset-bottom);--bs-shadow-auto:0 calc(var(--bs-progress,0) * -2px - 3px) calc(var(--bs-progress,0) * 18px + 12px) rgba(0,0,0,calc(var(--bs-progress,0) * 0.15 + 0.12))}.bs-sheet[data-mode="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom:1px solid var(--bs-surface-border,var(--bs-surface-border-d));flex-direction:column-reverse;--bs-shadow-auto:0 3px 12px rgba(0,0,0,0.12);padding-top:env(safe-area-inset-top)}.bs-sheet[data-mode="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:3px 0 12px rgba(0,0,0,0.12)}.bs-sheet[data-mode="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:-3px 0 12px rgba(0,0,0,0.12)}.bs-sheet[data-mode="left"] .bs-content{padding-right:36px}.bs-sheet[data-mode="right"] .bs-content{padding-left:36px}.bs-handle{flex-shrink:0;min-height:44px;display:flex;flex-direction:column;justify-content:center;padding:var(--bs-handle-padding,8px 16px 4px);cursor:grab;touch-action:none;user-select:none;background:var(--bs-surface,var(--bs-surface-d));-webkit-tap-highlight-color:transparent;outline:none;position:relative}.bs-handle:active{cursor:grabbing}.bs-handle:focus-visible{outline:2px solid currentColor;outline-offset:-2px;border-radius:var(--bs-radius,var(--bs-radius-d))}.bs-handle::before{content:"";display:block;width:var(--bs-handle-width);height:var(--bs-handle-height);background:var(--bs-handle-color,var(--bs-handle-color-d));border-radius:calc(var(--bs-handle-height) / 2);margin:0 auto 8px;transition:width 0.15s ease,background 0.15s ease,transform 0.15s ease;pointer-events:none}.bs-sheet[data-mode="left"] .bs-handle,.bs-sheet[data-mode="right"] .bs-handle{position:absolute;top:0;bottom:0;width:28px;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0;background:var(--bs-surface,var(--bs-surface-d));z-index:1;overflow:hidden}.bs-sheet[data-mode="left"] .bs-handle>*,.bs-sheet[data-mode="right"] .bs-handle>*{display:none}.bs-sheet[data-mode="left"] .bs-handle{right:0;border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="right"] .bs-handle{left:0;border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="left"] .bs-handle::before,.bs-sheet[data-mode="right"] .bs-handle::before{width:var(--bs-handle-height);height:var(--bs-handle-width);margin:0}.bs-sheet:hover .bs-handle::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 15%)}.bs-handle:active::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 35%);transform:scaleX(1.15)}.bs-handle.bs-handle--ticks::after{content:"";display:block;position:absolute;left:50%;bottom:6px;transform:translateX(-50%);width:calc(var(--bs-handle-width) * 2);height:3px;background-image:radial-gradient( circle,var(--bs-handle-color,var(--bs-handle-color-d)) 0 1.5px,transparent 1.6px );background-size:8px 3px;background-repeat:repeat-x;background-position:center;opacity:0;transition:opacity 0.18s ease-out;pointer-events:none}.bs-root[data-dragging="true"] .bs-handle.bs-handle--ticks::after{opacity:0.4}.bs-sheet[data-mode="top"] .bs-handle.bs-handle--ticks::after{bottom:auto;top:6px}.bs-sheet[data-mode="left"] .bs-handle.bs-handle--ticks::after,.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{left:50%;top:50%;bottom:auto;transform:translate(-50%,-50%);width:3px;height:calc(var(--bs-handle-width) * 2);background-size:3px 8px;background-repeat:repeat-y;margin-left:calc(var(--bs-handle-height) + 6px)}.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{margin-left:calc(-1 * (var(--bs-handle-height) + 6px))}.bs-header{flex:0 0 auto;min-height:var(--bs-header-min-height,0px);padding:var(--bs-header-padding,0 16px 8px);background:var(--bs-surface,var(--bs-surface-d))}.bs-content{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;user-select:text;padding:var(--bs-content-padding,0 16px 16px)}.bs-footer{flex:0 0 auto;padding:var(--bs-footer-padding,12px 16px calc(12px + env(safe-area-inset-bottom)));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));background:var(--bs-surface,var(--bs-surface-d))}.bs-sheet[data-mode="bottom"]:has(.bs-footer:not([hidden]):has(*)){padding-bottom:0}.bs-header:not(:has(*)),.bs-footer:not(:has(*)),.bs-header[hidden],.bs-footer[hidden]{display:none}.bs-screen{position:absolute;inset:0;pointer-events:none;z-index:var(--bs-z-scrim);background:var(--bs-scrim-color,var(--bs-scrim-color-d));backdrop-filter:blur(var(--bs-scrim-blur,0px));-webkit-backdrop-filter:blur(var(--bs-scrim-blur,0px));transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-screen,.bs-root[data-animating="true"] .bs-screen{transition:none}.bs-scrim-overlay{z-index:calc(var(--bs-z-sheet) + 1);pointer-events:none}.bs-button-slot{position:fixed;z-index:calc(var(--bs-z-sheet) + 1);pointer-events:auto}.bs-button-slot[data-side="left"]{left:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-side="right"]{right:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="top"]{bottom:auto;top:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="left"]{left:calc(var(--bs-size,0px) + 12px);right:auto;bottom:auto;top:16px}.bs-button-slot[data-mode="right"]{right:calc(var(--bs-size,0px) + 12px);left:auto;bottom:auto;top:16px}@media (prefers-reduced-motion:reduce){.bs-backdrop,.bs-handle::before,.bs-button-slot[data-side="left"],.bs-button-slot[data-side="right"]{transition:none !important}}@media (prefers-color-scheme:dark){:where(.bs-root){--bs-surface-d:#1a1a1d;--bs-surface-border-d:rgba(255,255,255,0.08);--bs-handle-color-d:rgba(255,255,255,0.45);--bs-shadow-auto:0 -3px 16px rgba(0,0,0,0.5)}}@media (forced-colors:active){.bs-sheet{border:1px solid CanvasText}.bs-handle::before{background:CanvasText;forced-color-adjust:none}.bs-backdrop,.bs-screen{forced-color-adjust:none}}.bs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}:where(.ovl-root){--ovl-surface:var(--bs-surface,var(--bs-surface-d,#ffffff));--ovl-surface-border:var(--bs-surface-border,var(--bs-surface-border-d,rgba(0,0,0,0.08)));--ovl-shadow:0 -8px 40px rgba(0,0,0,0.35);--ovl-radius:var(--bs-radius,var(--bs-radius-d,20px));--ovl-backdrop-color:rgba(0,0,0,0.5);--ovl-z-backdrop:200;--ovl-z-panel:201}.ovl-backdrop{position:fixed;inset:0;background:var(--ovl-backdrop-color);opacity:0;pointer-events:none;z-index:var(--ovl-z-backdrop)}.ovl-panel{position:fixed;background:var(--ovl-surface);box-shadow:var(--ovl-shadow);z-index:var(--ovl-z-panel);-webkit-tap-highlight-color:transparent;outline:none;transition:transform 0.32s cubic-bezier(0.29,1.24,0.84,0.99),opacity 0.32s ease-out}.ovl-panel[data-state="open"]{transform:translate3d(0,0,0);opacity:1}@starting-style{.ovl-panel[data-edge="bottom"][data-state="open"]{transform:translate3d(0,100%,0);opacity:0}.ovl-panel[data-edge="top"][data-state="open"]{transform:translate3d(0,-100%,0);opacity:0}.ovl-panel[data-edge="left"][data-state="open"]{transform:translate3d(-100%,0,0);opacity:0}.ovl-panel[data-edge="right"][data-state="open"]{transform:translate3d(100%,0,0);opacity:0}}.ovl-panel[data-edge="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--ovl-radius);border-top-right-radius:var(--ovl-radius);border-top:1px solid var(--ovl-surface-border);padding-bottom:env(safe-area-inset-bottom)}.ovl-panel[data-edge="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-bottom:1px solid var(--ovl-surface-border);padding-top:env(safe-area-inset-top)}.ovl-panel[data-edge="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-right:1px solid var(--ovl-surface-border)}.ovl-panel[data-edge="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--ovl-radius);border-bottom-left-radius:var(--ovl-radius);border-left:1px solid var(--ovl-surface-border)}@media (prefers-reduced-motion:reduce){.ovl-panel,.ovl-backdrop{transition:none !important}}`;
|
|
4566
|
+
baseStyles = `:where(.bs-root){--bs-surface-d:#ffffff;--bs-surface-border-d:rgba(225,227,237,1);--bs-radius-d:20px;--bs-handle-color-d:rgba(26,22,20,0.3);--bs-handle-width:40px;--bs-handle-height:5px;--bs-z-backdrop:90;--bs-z-sheet:100;--bs-backdrop-color-d:rgba(0,0,0,0.5);--bs-scrim-color-d:transparent;--bs-scrim-blur:0px;--bs-z-scrim:calc(var(--bs-z-sheet) - 1);--bs-size:0px;--bs-progress:0}.bs-backdrop{position:fixed;inset:0;background:var(--bs-backdrop-color,var(--bs-backdrop-color-d));opacity:0;pointer-events:none;z-index:var(--bs-z-backdrop);transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-backdrop,.bs-root[data-animating="true"] .bs-backdrop{transition:none}.bs-sheet{position:fixed;background:var(--bs-surface,var(--bs-surface-d));box-shadow:var(--bs-shadow,var(--bs-shadow-auto,none));--bs-shadow-fade:clamp(0,calc(var(--bs-progress,0) * 8),1);z-index:var(--bs-z-sheet);pointer-events:auto;overflow:hidden;display:flex;flex-direction:column;-webkit-tap-highlight-color:transparent;user-select:none;overscroll-behavior:contain}.bs-sheet[data-mode="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));padding-bottom:env(safe-area-inset-bottom);--bs-shadow-auto:0 calc(var(--bs-progress,0) * -2px - 3px) calc(var(--bs-progress,0) * 18px + 12px) rgba( 0,0,0,calc(var(--bs-shadow-fade) * (var(--bs-progress,0) * 0.15 + 0.12)) )}.bs-sheet[data-mode="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom:1px solid var(--bs-surface-border,var(--bs-surface-border-d));flex-direction:column-reverse;--bs-shadow-auto:0 3px 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12));padding-top:env(safe-area-inset-top)}.bs-sheet[data-mode="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:3px 0 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12))}.bs-sheet[data-mode="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:-3px 0 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12))}.bs-sheet[data-bs-rest="closed"]{box-shadow:none;visibility:hidden}.bs-sheet[data-bs-webgl="on"],.bs-sheet[data-bs-webgl="on"] .bs-handle,.bs-sheet[data-bs-webgl="on"] .bs-header,.bs-sheet[data-bs-webgl="on"] .bs-footer{background:transparent;box-shadow:none}.bs-sheet[data-mode="left"] .bs-content{padding-right:36px}.bs-sheet[data-mode="right"] .bs-content{padding-left:36px}.bs-handle{flex-shrink:0;min-height:44px;display:flex;flex-direction:column;justify-content:center;padding:var(--bs-handle-padding,8px 16px 4px);cursor:grab;touch-action:none;user-select:none;background:var(--bs-surface,var(--bs-surface-d));-webkit-tap-highlight-color:transparent;outline:none;position:relative}.bs-handle:active{cursor:grabbing}.bs-handle:focus-visible{outline:2px solid currentColor;outline-offset:-2px;border-radius:var(--bs-radius,var(--bs-radius-d))}.bs-handle::before{content:"";display:block;width:var(--bs-handle-width);height:var(--bs-handle-height);background:var(--bs-handle-color,var(--bs-handle-color-d));border-radius:calc(var(--bs-handle-height) / 2);margin:0 auto 8px;transition:width 0.15s ease,background 0.15s ease,transform 0.15s ease;pointer-events:none}.bs-sheet[data-mode="left"] .bs-handle,.bs-sheet[data-mode="right"] .bs-handle{position:absolute;top:0;bottom:0;width:28px;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0;background:var(--bs-surface,var(--bs-surface-d));z-index:1;overflow:hidden}.bs-sheet[data-mode="left"] .bs-handle>*,.bs-sheet[data-mode="right"] .bs-handle>*{display:none}.bs-sheet[data-mode="left"] .bs-handle{right:0;border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="right"] .bs-handle{left:0;border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="left"] .bs-handle::before,.bs-sheet[data-mode="right"] .bs-handle::before{width:var(--bs-handle-height);height:var(--bs-handle-width);margin:0}.bs-sheet:hover .bs-handle::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 15%)}.bs-handle:active::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 35%);transform:scaleX(1.15)}.bs-handle.bs-handle--ticks::after{content:"";display:block;position:absolute;left:50%;bottom:6px;transform:translateX(-50%);width:calc(var(--bs-handle-width) * 2);height:3px;background-image:radial-gradient( circle,var(--bs-handle-color,var(--bs-handle-color-d)) 0 1.5px,transparent 1.6px );background-size:8px 3px;background-repeat:repeat-x;background-position:center;opacity:0;transition:opacity 0.18s ease-out;pointer-events:none}.bs-root[data-dragging="true"] .bs-handle.bs-handle--ticks::after{opacity:0.4}.bs-sheet[data-mode="top"] .bs-handle.bs-handle--ticks::after{bottom:auto;top:6px}.bs-sheet[data-mode="left"] .bs-handle.bs-handle--ticks::after,.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{left:50%;top:50%;bottom:auto;transform:translate(-50%,-50%);width:3px;height:calc(var(--bs-handle-width) * 2);background-size:3px 8px;background-repeat:repeat-y;margin-left:calc(var(--bs-handle-height) + 6px)}.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{margin-left:calc(-1 * (var(--bs-handle-height) + 6px))}.bs-header{flex:0 0 auto;min-height:var(--bs-header-min-height,0px);padding:var(--bs-header-padding,0 16px 8px);background:var(--bs-surface,var(--bs-surface-d))}.bs-content{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;user-select:text;padding:var(--bs-content-padding,0 16px 16px)}.bs-footer{flex:0 0 auto;padding:var(--bs-footer-padding,12px 16px calc(12px + env(safe-area-inset-bottom)));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));background:var(--bs-surface,var(--bs-surface-d))}.bs-sheet[data-mode="bottom"]:has(.bs-footer:not([hidden]):has(*)){padding-bottom:0}.bs-header:not(:has(*)),.bs-footer:not(:has(*)),.bs-header[hidden],.bs-footer[hidden]{display:none}.bs-screen{position:absolute;inset:0;pointer-events:none;z-index:var(--bs-z-scrim);background:var(--bs-scrim-color,var(--bs-scrim-color-d));backdrop-filter:blur(var(--bs-scrim-blur,0px));-webkit-backdrop-filter:blur(var(--bs-scrim-blur,0px));transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-screen,.bs-root[data-animating="true"] .bs-screen{transition:none}.bs-scrim-overlay{z-index:calc(var(--bs-z-sheet) + 1);pointer-events:none}.bs-button-slot{position:fixed;z-index:calc(var(--bs-z-sheet) + 1);pointer-events:auto}.bs-button-slot[data-side="left"]{left:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-side="right"]{right:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="top"]{bottom:auto;top:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="left"]{left:calc(var(--bs-size,0px) + 12px);right:auto;bottom:auto;top:16px}.bs-button-slot[data-mode="right"]{right:calc(var(--bs-size,0px) + 12px);left:auto;bottom:auto;top:16px}@media (prefers-reduced-motion:reduce){.bs-backdrop,.bs-handle::before,.bs-button-slot[data-side="left"],.bs-button-slot[data-side="right"]{transition:none !important}}@media (prefers-color-scheme:dark){:where(.bs-root){--bs-surface-d:#1a1a1d;--bs-surface-border-d:rgba(255,255,255,0.08);--bs-handle-color-d:rgba(255,255,255,0.45);--bs-shadow-auto:0 -3px 16px rgba(0,0,0,0.5)}}@media (forced-colors:active){.bs-sheet{border:1px solid CanvasText}.bs-handle::before{background:CanvasText;forced-color-adjust:none}.bs-backdrop,.bs-screen{forced-color-adjust:none}}.bs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}:where(.ovl-root){--ovl-surface:var(--bs-surface,var(--bs-surface-d,#ffffff));--ovl-surface-border:var(--bs-surface-border,var(--bs-surface-border-d,rgba(0,0,0,0.08)));--ovl-shadow:0 -8px 40px rgba(0,0,0,0.35);--ovl-radius:var(--bs-radius,var(--bs-radius-d,20px));--ovl-backdrop-color:rgba(0,0,0,0.5);--ovl-z-backdrop:200;--ovl-z-panel:201}.ovl-backdrop{position:fixed;inset:0;background:var(--ovl-backdrop-color);opacity:0;pointer-events:none;z-index:var(--ovl-z-backdrop)}.ovl-panel{position:fixed;background:var(--ovl-surface);box-shadow:var(--ovl-shadow);z-index:var(--ovl-z-panel);-webkit-tap-highlight-color:transparent;outline:none;transition:transform 0.32s cubic-bezier(0.29,1.24,0.84,0.99),opacity 0.32s ease-out}.ovl-panel[data-state="open"]{transform:translate3d(0,0,0);opacity:1}@starting-style{.ovl-panel[data-edge="bottom"][data-state="open"]{transform:translate3d(0,100%,0);opacity:0}.ovl-panel[data-edge="top"][data-state="open"]{transform:translate3d(0,-100%,0);opacity:0}.ovl-panel[data-edge="left"][data-state="open"]{transform:translate3d(-100%,0,0);opacity:0}.ovl-panel[data-edge="right"][data-state="open"]{transform:translate3d(100%,0,0);opacity:0}}.ovl-panel[data-edge="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--ovl-radius);border-top-right-radius:var(--ovl-radius);border-top:1px solid var(--ovl-surface-border);padding-bottom:env(safe-area-inset-bottom)}.ovl-panel[data-edge="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-bottom:1px solid var(--ovl-surface-border);padding-top:env(safe-area-inset-top)}.ovl-panel[data-edge="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-right:1px solid var(--ovl-surface-border)}.ovl-panel[data-edge="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--ovl-radius);border-bottom-left-radius:var(--ovl-radius);border-left:1px solid var(--ovl-surface-border)}@media (prefers-reduced-motion:reduce){.ovl-panel,.ovl-backdrop{transition:none !important}}`;
|
|
4293
4567
|
}
|
|
4294
4568
|
});
|
|
4295
4569
|
|
|
@@ -4386,7 +4660,7 @@ var init_shadow_tree = __esm({
|
|
|
4386
4660
|
});
|
|
4387
4661
|
|
|
4388
4662
|
// src/web-component/attributes.ts
|
|
4389
|
-
var ATTR_SNAP_POINTS, ATTR_ALLOWED, ATTR_INITIAL, ATTR_MODE, ATTR_BACKDROP, ATTR_STYLESHEET, ATTR_ANIMATION, ATTR_FOCUS_TRAP, ATTR_CLOSE_ON_ESCAPE, ATTR_LOCK_BODY_SCROLL, ATTR_SHEET_LABEL, ATTR_STACK_EFFECT, ATTR_PERSISTENT, ATTR_DISABLE_CLOSE, ATTR_DISABLE_DRAG, ATTR_CLOSE_ON_ROUTE_CHANGE, ATTR_RADIUS, ATTR_MAX_HEIGHT, ATTR_RETURN_FOCUS_TO, ATTR_BACKDROP_COLOR, ATTR_SCRIM_COLOR, ATTR_SNAP, LIVE_ATTRS, OBSERVED_ATTRS, isValidSnapPoint, DEFAULT_SNAP_POINTS, parseSnapPoints, VALID_MODES, VALID_ANIMATIONS, parseMode, parseAnimation, parseList, parseDimension, ANCHOR_POSITIONS, ANCHOR_ANIMATIONS, parseAnchorOptions;
|
|
4663
|
+
var ATTR_SNAP_POINTS, ATTR_ALLOWED, ATTR_INITIAL, ATTR_MODE, ATTR_BACKDROP, ATTR_STYLESHEET, ATTR_ANIMATION, ATTR_FOCUS_TRAP, ATTR_CLOSE_ON_ESCAPE, ATTR_LOCK_BODY_SCROLL, ATTR_SHEET_LABEL, ATTR_STACK_EFFECT, ATTR_PERSISTENT, ATTR_DISABLE_CLOSE, ATTR_DISABLE_DRAG, ATTR_DRAG_FROM, ATTR_DRAG_FROM_CONTENT, ATTR_CLOSE_ON_ROUTE_CHANGE, ATTR_RADIUS, ATTR_MAX_HEIGHT, ATTR_RETURN_FOCUS_TO, ATTR_BACKDROP_COLOR, ATTR_SCRIM_COLOR, ATTR_SNAP, LIVE_ATTRS, OBSERVED_ATTRS, isValidSnapPoint, DEFAULT_SNAP_POINTS, parseSnapPoints, VALID_MODES, VALID_ANIMATIONS, parseMode, parseAnimation, VALID_DRAG_FROM, parseDragFrom, parseList, parseDimension, ANCHOR_POSITIONS, ANCHOR_ANIMATIONS, parseAnchorOptions;
|
|
4390
4664
|
var init_attributes = __esm({
|
|
4391
4665
|
"src/web-component/attributes.ts"() {
|
|
4392
4666
|
ATTR_SNAP_POINTS = "snap-points";
|
|
@@ -4404,6 +4678,8 @@ var init_attributes = __esm({
|
|
|
4404
4678
|
ATTR_PERSISTENT = "persistent";
|
|
4405
4679
|
ATTR_DISABLE_CLOSE = "disable-close";
|
|
4406
4680
|
ATTR_DISABLE_DRAG = "disable-drag";
|
|
4681
|
+
ATTR_DRAG_FROM = "drag-from";
|
|
4682
|
+
ATTR_DRAG_FROM_CONTENT = "drag-from-content";
|
|
4407
4683
|
ATTR_CLOSE_ON_ROUTE_CHANGE = "close-on-route-change";
|
|
4408
4684
|
ATTR_RADIUS = "radius";
|
|
4409
4685
|
ATTR_MAX_HEIGHT = "max-height";
|
|
@@ -4419,7 +4695,9 @@ var init_attributes = __esm({
|
|
|
4419
4695
|
ATTR_SNAP,
|
|
4420
4696
|
ATTR_PERSISTENT,
|
|
4421
4697
|
ATTR_DISABLE_CLOSE,
|
|
4422
|
-
ATTR_DISABLE_DRAG
|
|
4698
|
+
ATTR_DISABLE_DRAG,
|
|
4699
|
+
ATTR_DRAG_FROM,
|
|
4700
|
+
ATTR_DRAG_FROM_CONTENT
|
|
4423
4701
|
]);
|
|
4424
4702
|
OBSERVED_ATTRS = [
|
|
4425
4703
|
ATTR_SNAP_POINTS,
|
|
@@ -4436,6 +4714,8 @@ var init_attributes = __esm({
|
|
|
4436
4714
|
ATTR_PERSISTENT,
|
|
4437
4715
|
ATTR_DISABLE_CLOSE,
|
|
4438
4716
|
ATTR_DISABLE_DRAG,
|
|
4717
|
+
ATTR_DRAG_FROM,
|
|
4718
|
+
ATTR_DRAG_FROM_CONTENT,
|
|
4439
4719
|
ATTR_CLOSE_ON_ROUTE_CHANGE,
|
|
4440
4720
|
ATTR_RADIUS,
|
|
4441
4721
|
ATTR_MAX_HEIGHT,
|
|
@@ -4472,6 +4752,12 @@ var init_attributes = __esm({
|
|
|
4472
4752
|
VALID_ANIMATIONS = ["spring", "tween", "ios-spring", "material-bounce", "linear", "snappy"];
|
|
4473
4753
|
parseMode = (raw) => raw && VALID_MODES.includes(raw) ? raw : "bottom";
|
|
4474
4754
|
parseAnimation = (raw) => raw && VALID_ANIMATIONS.includes(raw) ? raw : void 0;
|
|
4755
|
+
VALID_DRAG_FROM = [
|
|
4756
|
+
"handle",
|
|
4757
|
+
"sheet",
|
|
4758
|
+
"zones"
|
|
4759
|
+
];
|
|
4760
|
+
parseDragFrom = (raw) => raw && VALID_DRAG_FROM.includes(raw) ? raw : void 0;
|
|
4475
4761
|
parseList = (raw) => raw ? raw.split(",").map((s) => s.trim()).filter(Boolean) : void 0;
|
|
4476
4762
|
parseDimension = (raw) => {
|
|
4477
4763
|
if (raw === null) return void 0;
|
|
@@ -4620,6 +4906,14 @@ var init_BottomSheetElement = __esm({
|
|
|
4620
4906
|
case ATTR_DISABLE_DRAG:
|
|
4621
4907
|
this.engine.setDisableDrag(value === "true");
|
|
4622
4908
|
break;
|
|
4909
|
+
case ATTR_DRAG_FROM_CONTENT:
|
|
4910
|
+
this.engine.setDragFromContent(value !== "false");
|
|
4911
|
+
break;
|
|
4912
|
+
case ATTR_DRAG_FROM: {
|
|
4913
|
+
const mode = parseDragFrom(value);
|
|
4914
|
+
if (mode) this.engine.setDragFrom(mode);
|
|
4915
|
+
break;
|
|
4916
|
+
}
|
|
4623
4917
|
case ATTR_SNAP:
|
|
4624
4918
|
if (value && value !== this.engine.state.activeId) {
|
|
4625
4919
|
void this.engine.snapTo(value);
|
|
@@ -4690,6 +4984,8 @@ var init_BottomSheetElement = __esm({
|
|
|
4690
4984
|
persistent: this.getAttribute(ATTR_PERSISTENT) === "true",
|
|
4691
4985
|
disableClose: this.getAttribute(ATTR_DISABLE_CLOSE) === "true",
|
|
4692
4986
|
disableDrag: this.getAttribute(ATTR_DISABLE_DRAG) === "true",
|
|
4987
|
+
dragFrom: parseDragFrom(this.getAttribute(ATTR_DRAG_FROM)),
|
|
4988
|
+
dragFromContent: this.getAttribute(ATTR_DRAG_FROM_CONTENT) === null ? void 0 : this.getAttribute(ATTR_DRAG_FROM_CONTENT) !== "false",
|
|
4693
4989
|
closeOnRouteChange: this.getAttribute(ATTR_CLOSE_ON_ROUTE_CHANGE) === "true",
|
|
4694
4990
|
radius: parseDimension(this.getAttribute(ATTR_RADIUS)),
|
|
4695
4991
|
maxHeight: parseDimension(this.getAttribute(ATTR_MAX_HEIGHT)),
|