@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.js
CHANGED
|
@@ -10,10 +10,10 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
12
12
|
|
|
13
|
-
// src/core/lifecycle/
|
|
13
|
+
// src/core/lifecycle/sheet-stack.ts
|
|
14
14
|
var BASE_Z, STEP, SheetStack, sheetStack;
|
|
15
|
-
var
|
|
16
|
-
"src/core/lifecycle/
|
|
15
|
+
var init_sheet_stack = __esm({
|
|
16
|
+
"src/core/lifecycle/sheet-stack.ts"() {
|
|
17
17
|
BASE_Z = 100;
|
|
18
18
|
STEP = 10;
|
|
19
19
|
SheetStack = class {
|
|
@@ -154,10 +154,10 @@ var init_event_bus = __esm({
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
// src/core/primitives/
|
|
157
|
+
// src/core/primitives/css-length.ts
|
|
158
158
|
var probe, PROBE_ATTR, ensureProbe, isViewportAxisVertical, viewportSize, PERCENT, resolveSnap;
|
|
159
|
-
var
|
|
160
|
-
"src/core/primitives/
|
|
159
|
+
var init_css_length = __esm({
|
|
160
|
+
"src/core/primitives/css-length.ts"() {
|
|
161
161
|
probe = null;
|
|
162
162
|
PROBE_ATTR = "data-bs-probe";
|
|
163
163
|
ensureProbe = (axis) => {
|
|
@@ -213,14 +213,14 @@ var init_cssLength = __esm({
|
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
-
// src/core/primitives/
|
|
216
|
+
// src/core/primitives/dev-warn.ts
|
|
217
217
|
function devWarn(...args) {
|
|
218
218
|
if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
219
219
|
console.warn(...args);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
var
|
|
223
|
-
"src/core/primitives/
|
|
222
|
+
var init_dev_warn = __esm({
|
|
223
|
+
"src/core/primitives/dev-warn.ts"() {
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
|
|
@@ -228,8 +228,8 @@ var init_devWarn = __esm({
|
|
|
228
228
|
var resolveSnapList, VH_NOT_DVH, auditVhUsage, findNearest, allowedRange, findById, MOUSE_FLICK_VELOCITY, MOUSE_DRAG_THRESHOLD, DIRECTIONAL_INTENT_VELOCITY, findDragSettleTarget;
|
|
229
229
|
var init_snap_points = __esm({
|
|
230
230
|
"src/core/primitives/snap-points.ts"() {
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
init_css_length();
|
|
232
|
+
init_dev_warn();
|
|
233
233
|
resolveSnapList = (points, mode, measureFit) => points.map((p) => {
|
|
234
234
|
const raw = resolveSnap(p.size, mode, measureFit);
|
|
235
235
|
if (!Number.isFinite(raw) || raw < 0) {
|
|
@@ -322,7 +322,7 @@ function emitCancelable(emit, base, warnLabel) {
|
|
|
322
322
|
}
|
|
323
323
|
var init_cancelable_emit = __esm({
|
|
324
324
|
"src/core/primitives/cancelable-emit.ts"() {
|
|
325
|
-
|
|
325
|
+
init_dev_warn();
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
|
|
@@ -365,6 +365,11 @@ var init_snap_resolver = __esm({
|
|
|
365
365
|
this.raw = raw;
|
|
366
366
|
this.recompute();
|
|
367
367
|
}
|
|
368
|
+
setMode(mode) {
|
|
369
|
+
if (mode === this.mode) return;
|
|
370
|
+
this.mode = mode;
|
|
371
|
+
this.recompute();
|
|
372
|
+
}
|
|
368
373
|
setAllowedIds(ids) {
|
|
369
374
|
this.allowedIds = ids;
|
|
370
375
|
this.rangeCache = null;
|
|
@@ -868,7 +873,7 @@ var init_scrim_controller = __esm({
|
|
|
868
873
|
init_snap_points();
|
|
869
874
|
init_hot_path_thresholds();
|
|
870
875
|
init_opacity_dedup();
|
|
871
|
-
|
|
876
|
+
init_dev_warn();
|
|
872
877
|
init_overlay_position();
|
|
873
878
|
VALID_CSS_LENGTH = /^-?\d+(?:\.\d+)?(?:px|em|rem|%)$/;
|
|
874
879
|
DEFAULT_SCRIM_DIM = "rgba(0, 0, 0, 0.4)";
|
|
@@ -1007,6 +1012,11 @@ var init_scrim_controller = __esm({
|
|
|
1007
1012
|
if (this.isDestroyed()) return;
|
|
1008
1013
|
this.applyScrimStyles({ interactive });
|
|
1009
1014
|
}
|
|
1015
|
+
setSheetMode(mode) {
|
|
1016
|
+
if (this.isDestroyed() || mode === this.mode) return;
|
|
1017
|
+
this.mode = mode;
|
|
1018
|
+
this.invalidateOpacityCache();
|
|
1019
|
+
}
|
|
1010
1020
|
setScrimMode(mode, applySize) {
|
|
1011
1021
|
if (this.isDestroyed()) return;
|
|
1012
1022
|
if (mode === this.scrimMode) return;
|
|
@@ -1658,10 +1668,10 @@ var init_animation_runner = __esm({
|
|
|
1658
1668
|
}
|
|
1659
1669
|
});
|
|
1660
1670
|
|
|
1661
|
-
// src/core/lifecycle/
|
|
1671
|
+
// src/core/lifecycle/focus-trap.ts
|
|
1662
1672
|
var FOCUSABLE, isVisible, collectFocusables, focusables, containsComposed, trapStack, installFocusTrap;
|
|
1663
|
-
var
|
|
1664
|
-
"src/core/lifecycle/
|
|
1673
|
+
var init_focus_trap = __esm({
|
|
1674
|
+
"src/core/lifecycle/focus-trap.ts"() {
|
|
1665
1675
|
FOCUSABLE = [
|
|
1666
1676
|
"a[href]",
|
|
1667
1677
|
"area[href]",
|
|
@@ -1781,10 +1791,10 @@ var init_focusTrap = __esm({
|
|
|
1781
1791
|
}
|
|
1782
1792
|
});
|
|
1783
1793
|
|
|
1784
|
-
// src/core/lifecycle/
|
|
1794
|
+
// src/core/lifecycle/scroll-lock.ts
|
|
1785
1795
|
var lockCount, savedStyles, lockBodyScroll;
|
|
1786
|
-
var
|
|
1787
|
-
"src/core/lifecycle/
|
|
1796
|
+
var init_scroll_lock = __esm({
|
|
1797
|
+
"src/core/lifecycle/scroll-lock.ts"() {
|
|
1788
1798
|
lockCount = 0;
|
|
1789
1799
|
savedStyles = null;
|
|
1790
1800
|
lockBodyScroll = () => {
|
|
@@ -1867,8 +1877,8 @@ var init_inert_siblings = __esm({
|
|
|
1867
1877
|
var LifecycleController;
|
|
1868
1878
|
var init_lifecycle_controller = __esm({
|
|
1869
1879
|
"src/core/controllers/lifecycle-controller.ts"() {
|
|
1870
|
-
|
|
1871
|
-
|
|
1880
|
+
init_focus_trap();
|
|
1881
|
+
init_scroll_lock();
|
|
1872
1882
|
init_inert_siblings();
|
|
1873
1883
|
LifecycleController = class {
|
|
1874
1884
|
constructor(deps, opts) {
|
|
@@ -1983,30 +1993,47 @@ var init_gestures = __esm({
|
|
|
1983
1993
|
this.size = 0;
|
|
1984
1994
|
}
|
|
1985
1995
|
};
|
|
1986
|
-
installGestures = (handle, mode, callbacks) => {
|
|
1996
|
+
installGestures = (handle, mode, callbacks, options = {}) => {
|
|
1987
1997
|
let activePointerId = null;
|
|
1988
1998
|
let activePointerType = "touch";
|
|
1989
1999
|
let startCoord = 0;
|
|
2000
|
+
let startCross = 0;
|
|
1990
2001
|
let lastCoord = 0;
|
|
2002
|
+
let pendingStart = false;
|
|
1991
2003
|
const VELOCITY_WINDOW_MS = (kind) => kind === "mouse" ? 160 : 120;
|
|
1992
2004
|
const MAX_SAMPLES = 32;
|
|
1993
2005
|
const samples = new SampleRing(MAX_SAMPLES);
|
|
1994
2006
|
const axis = isAxisVertical(mode) ? "Y" : "X";
|
|
1995
2007
|
const sign = mode === "bottom" || mode === "right" ? -1 : 1;
|
|
1996
2008
|
const coordOf = (e) => axis === "Y" ? e.clientY : e.clientX;
|
|
2009
|
+
const crossOf = (e) => axis === "Y" ? e.clientX : e.clientY;
|
|
2010
|
+
const capture = (pointerId) => {
|
|
2011
|
+
try {
|
|
2012
|
+
handle.setPointerCapture(pointerId);
|
|
2013
|
+
} catch {
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
const releaseTracking = () => {
|
|
2017
|
+
activePointerId = null;
|
|
2018
|
+
pendingStart = false;
|
|
2019
|
+
samples.reset();
|
|
2020
|
+
};
|
|
1997
2021
|
const onPointerDown = (e) => {
|
|
1998
2022
|
if (activePointerId !== null) return;
|
|
1999
2023
|
if (e.button !== void 0 && e.button !== 0) return;
|
|
2024
|
+
if (options.shouldStart && !options.shouldStart(e)) return;
|
|
2000
2025
|
activePointerId = e.pointerId;
|
|
2001
2026
|
activePointerType = e.pointerType || "touch";
|
|
2002
2027
|
startCoord = coordOf(e);
|
|
2028
|
+
startCross = crossOf(e);
|
|
2003
2029
|
lastCoord = startCoord;
|
|
2004
2030
|
samples.reset();
|
|
2005
2031
|
samples.push(e.timeStamp, startCoord);
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2032
|
+
if (options.deferStart) {
|
|
2033
|
+
pendingStart = true;
|
|
2034
|
+
return;
|
|
2009
2035
|
}
|
|
2036
|
+
capture(e.pointerId);
|
|
2010
2037
|
callbacks.onStart(startCoord, activePointerType);
|
|
2011
2038
|
};
|
|
2012
2039
|
const onPointerMove = (e) => {
|
|
@@ -2014,6 +2041,22 @@ var init_gestures = __esm({
|
|
|
2014
2041
|
const coord = coordOf(e);
|
|
2015
2042
|
const rawDelta = coord - startCoord;
|
|
2016
2043
|
const delta = rawDelta * sign;
|
|
2044
|
+
if (pendingStart) {
|
|
2045
|
+
const verdict = options.deferStart(e, delta, crossOf(e) - startCross);
|
|
2046
|
+
if (verdict === false) {
|
|
2047
|
+
releaseTracking();
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
if (verdict !== true) return;
|
|
2051
|
+
pendingStart = false;
|
|
2052
|
+
startCoord = coord;
|
|
2053
|
+
lastCoord = coord;
|
|
2054
|
+
samples.reset();
|
|
2055
|
+
samples.push(e.timeStamp, coord);
|
|
2056
|
+
capture(e.pointerId);
|
|
2057
|
+
callbacks.onStart(startCoord, activePointerType);
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2017
2060
|
lastCoord = coord;
|
|
2018
2061
|
samples.push(e.timeStamp, coord);
|
|
2019
2062
|
const cutoff = e.timeStamp - VELOCITY_WINDOW_MS(activePointerType);
|
|
@@ -2022,6 +2065,10 @@ var init_gestures = __esm({
|
|
|
2022
2065
|
};
|
|
2023
2066
|
const finishGesture = (e) => {
|
|
2024
2067
|
if (e.pointerId !== activePointerId) return;
|
|
2068
|
+
if (pendingStart) {
|
|
2069
|
+
releaseTracking();
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2025
2072
|
const rawDelta = lastCoord - startCoord;
|
|
2026
2073
|
const delta = rawDelta * sign;
|
|
2027
2074
|
let velocity = 0;
|
|
@@ -2044,22 +2091,26 @@ var init_gestures = __esm({
|
|
|
2044
2091
|
};
|
|
2045
2092
|
const onPointerCancel = (e) => {
|
|
2046
2093
|
if (e.pointerId !== activePointerId) return;
|
|
2047
|
-
|
|
2048
|
-
|
|
2094
|
+
const wasPending = pendingStart;
|
|
2095
|
+
releaseTracking();
|
|
2096
|
+
if (wasPending) return;
|
|
2049
2097
|
callbacks.onCancel?.();
|
|
2050
2098
|
};
|
|
2051
2099
|
handle.addEventListener("pointerdown", onPointerDown);
|
|
2052
2100
|
handle.addEventListener("pointermove", onPointerMove);
|
|
2053
2101
|
handle.addEventListener("pointerup", finishGesture);
|
|
2054
2102
|
handle.addEventListener("pointercancel", onPointerCancel);
|
|
2103
|
+
const managesTouchAction = options.manageTouchAction !== false;
|
|
2055
2104
|
const prevTouchAction = handle.style.touchAction;
|
|
2056
|
-
|
|
2105
|
+
if (managesTouchAction) {
|
|
2106
|
+
handle.style.touchAction = isAxisVertical(mode) ? "pan-x" : "pan-y";
|
|
2107
|
+
}
|
|
2057
2108
|
return () => {
|
|
2058
2109
|
handle.removeEventListener("pointerdown", onPointerDown);
|
|
2059
2110
|
handle.removeEventListener("pointermove", onPointerMove);
|
|
2060
2111
|
handle.removeEventListener("pointerup", finishGesture);
|
|
2061
2112
|
handle.removeEventListener("pointercancel", onPointerCancel);
|
|
2062
|
-
handle.style.touchAction = prevTouchAction;
|
|
2113
|
+
if (managesTouchAction) handle.style.touchAction = prevTouchAction;
|
|
2063
2114
|
if (activePointerId !== null && handle.hasPointerCapture(activePointerId)) {
|
|
2064
2115
|
handle.releasePointerCapture(activePointerId);
|
|
2065
2116
|
}
|
|
@@ -2194,7 +2245,7 @@ var init_gesture_controller = __esm({
|
|
|
2194
2245
|
const restoreTo = this.dragStartSize;
|
|
2195
2246
|
void this.deps.animateTo(restoreTo, 0);
|
|
2196
2247
|
}
|
|
2197
|
-
});
|
|
2248
|
+
}, this.deps.gestureOptions);
|
|
2198
2249
|
return this.detach;
|
|
2199
2250
|
}
|
|
2200
2251
|
forceClearDragState() {
|
|
@@ -2208,6 +2259,93 @@ var init_gesture_controller = __esm({
|
|
|
2208
2259
|
}
|
|
2209
2260
|
});
|
|
2210
2261
|
|
|
2262
|
+
// src/core/primitives/drag-zones.ts
|
|
2263
|
+
function isDragAllowedFrom(target, mode) {
|
|
2264
|
+
const el = asElement(target);
|
|
2265
|
+
if (!el) return mode !== "zones";
|
|
2266
|
+
if (el.closest(NO_DRAG_SELECTOR)) return false;
|
|
2267
|
+
if (mode === "zones") return el.closest(DRAG_ZONE_SELECTOR) !== null;
|
|
2268
|
+
return true;
|
|
2269
|
+
}
|
|
2270
|
+
var DRAG_ZONE_SELECTOR, NO_DRAG_SELECTOR, asElement;
|
|
2271
|
+
var init_drag_zones = __esm({
|
|
2272
|
+
"src/core/primitives/drag-zones.ts"() {
|
|
2273
|
+
DRAG_ZONE_SELECTOR = "[data-bs-drag]";
|
|
2274
|
+
NO_DRAG_SELECTOR = "[data-bs-no-drag]";
|
|
2275
|
+
asElement = (target) => {
|
|
2276
|
+
const candidate = target;
|
|
2277
|
+
return candidate && typeof candidate.closest === "function" ? candidate : null;
|
|
2278
|
+
};
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2281
|
+
|
|
2282
|
+
// src/core/primitives/content-gesture.ts
|
|
2283
|
+
function decideContentGesture(input) {
|
|
2284
|
+
const slop = input.slop ?? CONTENT_DRAG_SLOP;
|
|
2285
|
+
const cross = input.crossDelta ?? 0;
|
|
2286
|
+
const sharesScrollAxis = input.sharesScrollAxis ?? true;
|
|
2287
|
+
if (!sharesScrollAxis) {
|
|
2288
|
+
if (Math.abs(input.delta) < slop && Math.abs(cross) < slop) return "pending";
|
|
2289
|
+
if (Math.abs(input.delta) <= Math.abs(cross)) return "scroll";
|
|
2290
|
+
return "drag";
|
|
2291
|
+
}
|
|
2292
|
+
if (Math.abs(input.delta) < slop) return "pending";
|
|
2293
|
+
if (input.scrollTop > 0) return "scroll";
|
|
2294
|
+
if (input.delta > 0 && input.atMaxSnap) return "scroll";
|
|
2295
|
+
return "drag";
|
|
2296
|
+
}
|
|
2297
|
+
var CONTENT_DRAG_SLOP;
|
|
2298
|
+
var init_content_gesture = __esm({
|
|
2299
|
+
"src/core/primitives/content-gesture.ts"() {
|
|
2300
|
+
CONTENT_DRAG_SLOP = 6;
|
|
2301
|
+
}
|
|
2302
|
+
});
|
|
2303
|
+
|
|
2304
|
+
// src/core/primitives/logical-mode.ts
|
|
2305
|
+
var isLogicalMode, readDirection, resolveMode;
|
|
2306
|
+
var init_logical_mode = __esm({
|
|
2307
|
+
"src/core/primitives/logical-mode.ts"() {
|
|
2308
|
+
isLogicalMode = (mode) => mode === "start" || mode === "end";
|
|
2309
|
+
readDirection = (el) => {
|
|
2310
|
+
if (!el) return "ltr";
|
|
2311
|
+
if (typeof getComputedStyle === "function") {
|
|
2312
|
+
try {
|
|
2313
|
+
if (getComputedStyle(el).direction === "rtl") return "rtl";
|
|
2314
|
+
} catch {
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
try {
|
|
2318
|
+
const marked = el.closest?.("[dir]");
|
|
2319
|
+
if (marked) {
|
|
2320
|
+
return marked.getAttribute("dir")?.toLowerCase() === "rtl" ? "rtl" : "ltr";
|
|
2321
|
+
}
|
|
2322
|
+
} catch {
|
|
2323
|
+
}
|
|
2324
|
+
return "ltr";
|
|
2325
|
+
};
|
|
2326
|
+
resolveMode = (mode, el) => {
|
|
2327
|
+
if (!isLogicalMode(mode)) return mode;
|
|
2328
|
+
const rtl = readDirection(el) === "rtl";
|
|
2329
|
+
if (mode === "start") return rtl ? "right" : "left";
|
|
2330
|
+
return rtl ? "left" : "right";
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
|
|
2335
|
+
// src/core/primitives/touch-scroll-guard.ts
|
|
2336
|
+
function installTouchScrollGuard(surface, isDragging) {
|
|
2337
|
+
const onTouchMove = (e) => {
|
|
2338
|
+
if (!isDragging()) return;
|
|
2339
|
+
if (e.cancelable) e.preventDefault();
|
|
2340
|
+
};
|
|
2341
|
+
surface.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
2342
|
+
return () => surface.removeEventListener("touchmove", onTouchMove);
|
|
2343
|
+
}
|
|
2344
|
+
var init_touch_scroll_guard = __esm({
|
|
2345
|
+
"src/core/primitives/touch-scroll-guard.ts"() {
|
|
2346
|
+
}
|
|
2347
|
+
});
|
|
2348
|
+
|
|
2211
2349
|
// src/core/primitives/aria-slider-writer.ts
|
|
2212
2350
|
var AriaSliderWriter;
|
|
2213
2351
|
var init_aria_slider_writer = __esm({
|
|
@@ -2586,9 +2724,11 @@ function resolveEngineOptions(opts, extras) {
|
|
|
2586
2724
|
}
|
|
2587
2725
|
}
|
|
2588
2726
|
return {
|
|
2589
|
-
mode: opts.mode ?? "bottom",
|
|
2727
|
+
mode: resolveMode(opts.mode ?? "bottom", opts.element),
|
|
2590
2728
|
flickVelocity: opts.flickVelocity ?? DEFAULT_FLICK_VELOCITY,
|
|
2591
2729
|
dragThreshold: opts.dragThreshold ?? DEFAULT_DRAG_THRESHOLD,
|
|
2730
|
+
dragFrom: opts.dragFrom ?? (opts.handle ? "handle" : "sheet"),
|
|
2731
|
+
dragFromContent: opts.dragFromContent ?? true,
|
|
2592
2732
|
rubberBandEnabled: opts.rubberBand ?? true,
|
|
2593
2733
|
closeOnBack: opts.closeOnBack ?? false,
|
|
2594
2734
|
persistent: opts.persistent ?? false,
|
|
@@ -2632,6 +2772,7 @@ function resolveEngineOptions(opts, extras) {
|
|
|
2632
2772
|
var DEFAULT_FLICK_VELOCITY, DEFAULT_DRAG_THRESHOLD, readPersistedIdSafe;
|
|
2633
2773
|
var init_engine_options = __esm({
|
|
2634
2774
|
"src/core/primitives/engine-options.ts"() {
|
|
2775
|
+
init_logical_mode();
|
|
2635
2776
|
DEFAULT_FLICK_VELOCITY = 0.65;
|
|
2636
2777
|
DEFAULT_DRAG_THRESHOLD = 18;
|
|
2637
2778
|
readPersistedIdSafe = (key) => {
|
|
@@ -2676,13 +2817,13 @@ var init_teardown_stack = __esm({
|
|
|
2676
2817
|
var HAPTIC_DURATION_MS, BottomSheetCore;
|
|
2677
2818
|
var init_BottomSheetCore = __esm({
|
|
2678
2819
|
"src/core/BottomSheetCore.ts"() {
|
|
2679
|
-
|
|
2820
|
+
init_sheet_stack();
|
|
2680
2821
|
init_transform();
|
|
2681
2822
|
init_instance_id();
|
|
2682
2823
|
init_event_bus();
|
|
2683
2824
|
init_snap_points();
|
|
2684
2825
|
init_cancelable_emit();
|
|
2685
|
-
|
|
2826
|
+
init_dev_warn();
|
|
2686
2827
|
init_snap_resolver();
|
|
2687
2828
|
init_linked_sheets();
|
|
2688
2829
|
init_resize_observer();
|
|
@@ -2694,6 +2835,10 @@ var init_BottomSheetCore = __esm({
|
|
|
2694
2835
|
init_animation_runner();
|
|
2695
2836
|
init_lifecycle_controller();
|
|
2696
2837
|
init_gesture_controller();
|
|
2838
|
+
init_drag_zones();
|
|
2839
|
+
init_content_gesture();
|
|
2840
|
+
init_logical_mode();
|
|
2841
|
+
init_touch_scroll_guard();
|
|
2697
2842
|
init_aria_slider_writer();
|
|
2698
2843
|
init_hot_path_thresholds();
|
|
2699
2844
|
init_scroll_cache();
|
|
@@ -2715,6 +2860,8 @@ var init_BottomSheetCore = __esm({
|
|
|
2715
2860
|
__publicField(this, "mode");
|
|
2716
2861
|
__publicField(this, "flickVelocity");
|
|
2717
2862
|
__publicField(this, "dragThreshold");
|
|
2863
|
+
__publicField(this, "dragFromMode");
|
|
2864
|
+
__publicField(this, "dragFromContentDefault");
|
|
2718
2865
|
__publicField(this, "rubberBandEnabled");
|
|
2719
2866
|
__publicField(this, "scrim");
|
|
2720
2867
|
__publicField(this, "aria");
|
|
@@ -2727,13 +2874,18 @@ var init_BottomSheetCore = __esm({
|
|
|
2727
2874
|
__publicField(this, "disableDragFlag");
|
|
2728
2875
|
__publicField(this, "closeOnRouteChange");
|
|
2729
2876
|
__publicField(this, "maxHeight");
|
|
2877
|
+
__publicField(this, "maxHeightDeps");
|
|
2730
2878
|
__publicField(this, "snapPointsRaw");
|
|
2731
2879
|
__publicField(this, "snaps");
|
|
2732
2880
|
__publicField(this, "activeId");
|
|
2733
2881
|
__publicField(this, "size", 0);
|
|
2734
2882
|
__publicField(this, "gesture");
|
|
2883
|
+
__publicField(this, "contentGesture");
|
|
2884
|
+
__publicField(this, "detachSheetGesture", null);
|
|
2885
|
+
__publicField(this, "detachSliderKeyboard", null);
|
|
2735
2886
|
__publicField(this, "rootEl", null);
|
|
2736
2887
|
__publicField(this, "destroyed", false);
|
|
2888
|
+
__publicField(this, "restClosed", false);
|
|
2737
2889
|
__publicField(this, "currentViewTransition", null);
|
|
2738
2890
|
__publicField(this, "currentAbort", new AbortController());
|
|
2739
2891
|
__publicField(this, "sizeWriteSentinel", new WriteSentinel());
|
|
@@ -2782,10 +2934,13 @@ var init_BottomSheetCore = __esm({
|
|
|
2782
2934
|
this.screenComponent = opts.scrim ?? opts.screenComponent;
|
|
2783
2935
|
this.scrimParent = this.screenComponent?.parentElement ?? null;
|
|
2784
2936
|
this.mode = resolved.mode;
|
|
2937
|
+
this.element.dataset.mode = this.mode;
|
|
2785
2938
|
this.transformTemplate = buildTransformTemplate(this.mode);
|
|
2786
2939
|
this.aria = new AriaSliderWriter(this.handle, this.mode);
|
|
2787
2940
|
this.flickVelocity = resolved.flickVelocity;
|
|
2788
2941
|
this.dragThreshold = resolved.dragThreshold;
|
|
2942
|
+
this.dragFromMode = resolved.dragFrom;
|
|
2943
|
+
this.dragFromContentDefault = resolved.dragFromContent;
|
|
2789
2944
|
this.rubberBandEnabled = resolved.rubberBandEnabled;
|
|
2790
2945
|
this.scrim = new ScrimController(
|
|
2791
2946
|
{
|
|
@@ -2812,7 +2967,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2812
2967
|
getRootEl: () => this.rootEl,
|
|
2813
2968
|
applySize: (size) => this.applySize(size),
|
|
2814
2969
|
getSize: () => this.size,
|
|
2815
|
-
isDragging: () => this.
|
|
2970
|
+
isDragging: () => this.isDraggingAny(),
|
|
2816
2971
|
applyAux: (size) => this.applySize(size, true),
|
|
2817
2972
|
getTransformFor: (size) => this.transformTemplate(this.snaps.getMaxAxisSize() - size)
|
|
2818
2973
|
},
|
|
@@ -2846,7 +3001,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2846
3001
|
auditVhUsage(this.snapPointsRaw);
|
|
2847
3002
|
this.auditDuplicateSnapIds(this.snapPointsRaw);
|
|
2848
3003
|
this.rootEl = this.element.closest(".bs-root");
|
|
2849
|
-
this.
|
|
3004
|
+
this.maxHeightDeps = {
|
|
2850
3005
|
element: this.element,
|
|
2851
3006
|
mode: this.mode,
|
|
2852
3007
|
getMaxAxisSize: () => this.snaps.getMaxAxisSize(),
|
|
@@ -2854,7 +3009,8 @@ var init_BottomSheetCore = __esm({
|
|
|
2854
3009
|
this.snaps.setMaxAxisSize(size);
|
|
2855
3010
|
},
|
|
2856
3011
|
recompute: () => this.recompute()
|
|
2857
|
-
}
|
|
3012
|
+
};
|
|
3013
|
+
this.maxHeight = createMaxHeightController(this.maxHeightDeps);
|
|
2858
3014
|
this.fitDeps = {
|
|
2859
3015
|
element: this.element,
|
|
2860
3016
|
scrollContainer: this.scrollContainer,
|
|
@@ -2873,6 +3029,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2873
3029
|
const initial = this.snaps.findById(this.activeId);
|
|
2874
3030
|
if (initial) this.size = initial.size;
|
|
2875
3031
|
this.applySize(this.size);
|
|
3032
|
+
this.setRestClosed(this.size === 0);
|
|
2876
3033
|
this.updateAriaSlider();
|
|
2877
3034
|
this.scrollCache = createScrollCache({
|
|
2878
3035
|
scrollContainer: this.scrollContainer,
|
|
@@ -2903,7 +3060,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2903
3060
|
(p) => p.size === "fit" || p.size === "content"
|
|
2904
3061
|
),
|
|
2905
3062
|
isDestroyed: () => this.destroyed,
|
|
2906
|
-
isDragging: () => this.
|
|
3063
|
+
isDragging: () => this.isDraggingAny(),
|
|
2907
3064
|
recompute: () => this.recompute()
|
|
2908
3065
|
})
|
|
2909
3066
|
);
|
|
@@ -2929,7 +3086,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2929
3086
|
autoCollapseAfter
|
|
2930
3087
|
},
|
|
2931
3088
|
isDestroyed: () => this.destroyed,
|
|
2932
|
-
isDragging: () => this.
|
|
3089
|
+
isDragging: () => this.isDraggingAny(),
|
|
2933
3090
|
isAnimating: () => this.animation.isAnimating,
|
|
2934
3091
|
isTopSheet: () => this.isTopSheet,
|
|
2935
3092
|
isVerticalAxis: () => this.mode === "bottom" || this.mode === "top",
|
|
@@ -2959,6 +3116,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2959
3116
|
void this.snapTo(id);
|
|
2960
3117
|
},
|
|
2961
3118
|
close: (reason) => this.close(reason),
|
|
3119
|
+
attachDragSurface: (surface, kind) => this.attachDragSurface(surface, kind),
|
|
2962
3120
|
on: (event, fn) => this.on(event, fn),
|
|
2963
3121
|
addTeardown: (fn) => this.teardowns.add(fn)
|
|
2964
3122
|
};
|
|
@@ -2987,7 +3145,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2987
3145
|
return {
|
|
2988
3146
|
size: this.size,
|
|
2989
3147
|
activeId: this.activeId,
|
|
2990
|
-
isDragging: this.
|
|
3148
|
+
isDragging: this.isDraggingAny(),
|
|
2991
3149
|
isAnimating: this.animation.isAnimating,
|
|
2992
3150
|
progress: this.computeProgress(this.size)
|
|
2993
3151
|
};
|
|
@@ -3107,9 +3265,16 @@ var init_BottomSheetCore = __esm({
|
|
|
3107
3265
|
progress: this.computeProgress(this.size)
|
|
3108
3266
|
});
|
|
3109
3267
|
if (withHaptic) this.haptic();
|
|
3268
|
+
this.setRestClosed(targetSize === 0);
|
|
3110
3269
|
if (wasClosed && targetSize > 0) this.emitOpenSequence(id);
|
|
3111
3270
|
if (targetSize === 0) this.emitCloseSequence();
|
|
3112
3271
|
}
|
|
3272
|
+
setRestClosed(closed) {
|
|
3273
|
+
if (closed === this.restClosed) return;
|
|
3274
|
+
this.restClosed = closed;
|
|
3275
|
+
if (closed) this.element.setAttribute("data-bs-rest", "closed");
|
|
3276
|
+
else this.element.removeAttribute("data-bs-rest");
|
|
3277
|
+
}
|
|
3113
3278
|
emitOpenSequence(id) {
|
|
3114
3279
|
this.emit("open", { id });
|
|
3115
3280
|
this.handleOpen();
|
|
@@ -3165,6 +3330,51 @@ var init_BottomSheetCore = __esm({
|
|
|
3165
3330
|
if (this.destroyed) return;
|
|
3166
3331
|
this.disableDragFlag = value;
|
|
3167
3332
|
}
|
|
3333
|
+
setDragFromContent(value) {
|
|
3334
|
+
if (this.destroyed) return;
|
|
3335
|
+
this.dragFromContentDefault = value;
|
|
3336
|
+
}
|
|
3337
|
+
setDragFrom(mode) {
|
|
3338
|
+
if (this.destroyed || mode === this.dragFromMode) return;
|
|
3339
|
+
this.gesture?.forceClearDragState();
|
|
3340
|
+
this.detachSheetGesture?.();
|
|
3341
|
+
this.dragFromMode = mode;
|
|
3342
|
+
this.mountSheetGesture();
|
|
3343
|
+
}
|
|
3344
|
+
getDragFrom() {
|
|
3345
|
+
return this.dragFromMode;
|
|
3346
|
+
}
|
|
3347
|
+
setMode(mode) {
|
|
3348
|
+
if (this.destroyed) return;
|
|
3349
|
+
const next = resolveMode(mode, this.element);
|
|
3350
|
+
if (next === this.mode) return;
|
|
3351
|
+
const wasVertical = this.mode === "bottom" || this.mode === "top";
|
|
3352
|
+
const nowVertical = next === "bottom" || next === "top";
|
|
3353
|
+
this.gesture?.forceClearDragState();
|
|
3354
|
+
this.detachSheetGesture?.();
|
|
3355
|
+
this.animation.cancel();
|
|
3356
|
+
this.element.style.removeProperty(layoutAxis(this.mode));
|
|
3357
|
+
this.mode = next;
|
|
3358
|
+
this.element.dataset.mode = next;
|
|
3359
|
+
this.transformTemplate = buildTransformTemplate(next);
|
|
3360
|
+
this.maxHeightDeps.mode = next;
|
|
3361
|
+
this.fitDeps.mode = next;
|
|
3362
|
+
this.snaps.setMode(next);
|
|
3363
|
+
this.scrim.setSheetMode(next);
|
|
3364
|
+
if (wasVertical !== nowVertical) {
|
|
3365
|
+
this.aria = new AriaSliderWriter(this.handle, next);
|
|
3366
|
+
}
|
|
3367
|
+
this.detachSliderKeyboard?.();
|
|
3368
|
+
this.mountSliderKeyboard();
|
|
3369
|
+
this.mountSheetGesture();
|
|
3370
|
+
this.recompute();
|
|
3371
|
+
const active = this.snaps.findById(this.activeId);
|
|
3372
|
+
if (active) this.applySize(active.size);
|
|
3373
|
+
this.updateAriaSlider();
|
|
3374
|
+
}
|
|
3375
|
+
getMode() {
|
|
3376
|
+
return this.mode;
|
|
3377
|
+
}
|
|
3168
3378
|
isTop() {
|
|
3169
3379
|
return this.isTopSheet;
|
|
3170
3380
|
}
|
|
@@ -3319,12 +3529,24 @@ var init_BottomSheetCore = __esm({
|
|
|
3319
3529
|
auditVhUsage(points);
|
|
3320
3530
|
this.auditDuplicateSnapIds(points);
|
|
3321
3531
|
this.snaps.setRaw(points);
|
|
3322
|
-
if (allowed)
|
|
3532
|
+
if (allowed) {
|
|
3533
|
+
this.snaps.setAllowedIds(allowed);
|
|
3534
|
+
} else {
|
|
3535
|
+
const present = this.snaps.getResolvedSnaps().map((s) => s.id);
|
|
3536
|
+
const kept = this.snaps.getAllowedIds().filter((id) => present.includes(id));
|
|
3537
|
+
this.snaps.setAllowedIds(kept.length ? kept : present);
|
|
3538
|
+
}
|
|
3323
3539
|
this.scrollCache.clear();
|
|
3324
3540
|
this.scrim.invalidateOpacityCache();
|
|
3325
3541
|
const current = this.snaps.findById(this.activeId);
|
|
3326
3542
|
if (current) {
|
|
3327
3543
|
this.applySize(current.size);
|
|
3544
|
+
} else {
|
|
3545
|
+
const fallback = this.snaps.getResolvedSnaps().find((s) => this.snaps.getAllowedIds().includes(s.id)) ?? this.snaps.getResolvedSnaps()[0];
|
|
3546
|
+
if (fallback) {
|
|
3547
|
+
this.activeId = fallback.id;
|
|
3548
|
+
this.applySize(fallback.size);
|
|
3549
|
+
}
|
|
3328
3550
|
}
|
|
3329
3551
|
this.updateAriaSlider();
|
|
3330
3552
|
}
|
|
@@ -3334,7 +3556,7 @@ var init_BottomSheetCore = __esm({
|
|
|
3334
3556
|
this.snaps.recompute();
|
|
3335
3557
|
this.maxHeight.clampTo();
|
|
3336
3558
|
this.scrim.invalidateOpacityCache();
|
|
3337
|
-
if (this.
|
|
3559
|
+
if (this.isDraggingAny()) return;
|
|
3338
3560
|
this.healActiveSnap();
|
|
3339
3561
|
}
|
|
3340
3562
|
healActiveSnap() {
|
|
@@ -3356,6 +3578,8 @@ var init_BottomSheetCore = __esm({
|
|
|
3356
3578
|
this.bus.clear();
|
|
3357
3579
|
this.animation.cancel();
|
|
3358
3580
|
this.gesture?.forceClearDragState();
|
|
3581
|
+
this.contentGesture?.forceClearDragState();
|
|
3582
|
+
this.setRestClosed(false);
|
|
3359
3583
|
this.teardowns.drain();
|
|
3360
3584
|
this.scrim.destroy();
|
|
3361
3585
|
this.animation.destroy();
|
|
@@ -3468,11 +3692,12 @@ var init_BottomSheetCore = __esm({
|
|
|
3468
3692
|
const scale = Math.max(1 - depth * 0.04, 0.86);
|
|
3469
3693
|
this.element.style.scale = scale === 1 ? "" : String(scale);
|
|
3470
3694
|
}
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
handle:
|
|
3695
|
+
buildGestureDeps(surface, gestureOptions) {
|
|
3696
|
+
return {
|
|
3697
|
+
handle: surface,
|
|
3474
3698
|
element: this.element,
|
|
3475
3699
|
mode: this.mode,
|
|
3700
|
+
gestureOptions,
|
|
3476
3701
|
getRoot: () => this.rootEl,
|
|
3477
3702
|
getDragContext: () => {
|
|
3478
3703
|
const buf = this.dragContextBuf;
|
|
@@ -3491,8 +3716,90 @@ var init_BottomSheetCore = __esm({
|
|
|
3491
3716
|
settleAfterDrag: (delta, velocity, kind) => this.settleAfterDrag(delta, velocity, kind),
|
|
3492
3717
|
emit: (event, payload) => this.emit(event, payload),
|
|
3493
3718
|
listenerCount: (event) => this.bus.listenerCount(event)
|
|
3719
|
+
};
|
|
3720
|
+
}
|
|
3721
|
+
isContentDragAllowed() {
|
|
3722
|
+
if (this.disableDragFlag) return false;
|
|
3723
|
+
const point = this.snapPointsRaw.find((p) => p.id === this.activeId);
|
|
3724
|
+
return point?.dragFromContent ?? this.dragFromContentDefault;
|
|
3725
|
+
}
|
|
3726
|
+
decideContentDrag(surface, e, delta, crossDelta) {
|
|
3727
|
+
if (this.destroyed) return false;
|
|
3728
|
+
if (e.pointerType === "mouse") return false;
|
|
3729
|
+
if (this.gesture?.isDragging) return false;
|
|
3730
|
+
if (!this.isContentDragAllowed()) return false;
|
|
3731
|
+
if (!isDragAllowedFrom(e.target, "sheet")) return false;
|
|
3732
|
+
const decision = decideContentGesture({
|
|
3733
|
+
delta,
|
|
3734
|
+
crossDelta,
|
|
3735
|
+
sharesScrollAxis: this.mode === "bottom" || this.mode === "top",
|
|
3736
|
+
scrollTop: surface.scrollTop,
|
|
3737
|
+
atMaxSnap: this.size >= this.getAllowedRange().max - 0.5
|
|
3738
|
+
});
|
|
3739
|
+
if (decision === "pending") return null;
|
|
3740
|
+
return decision === "drag";
|
|
3741
|
+
}
|
|
3742
|
+
attachDragSurface(surface, kind) {
|
|
3743
|
+
if (this.destroyed || kind !== "content") return;
|
|
3744
|
+
if (this.contentGesture) return;
|
|
3745
|
+
const controller = new GestureController(
|
|
3746
|
+
this.buildGestureDeps(surface, {
|
|
3747
|
+
manageTouchAction: false,
|
|
3748
|
+
deferStart: (e, delta, crossDelta) => this.decideContentDrag(surface, e, delta, crossDelta)
|
|
3749
|
+
})
|
|
3750
|
+
);
|
|
3751
|
+
this.contentGesture = controller;
|
|
3752
|
+
const detachGestures = controller.install();
|
|
3753
|
+
const detachGuard = installTouchScrollGuard(
|
|
3754
|
+
surface,
|
|
3755
|
+
() => controller.isDragging
|
|
3756
|
+
);
|
|
3757
|
+
return () => {
|
|
3758
|
+
detachGuard();
|
|
3759
|
+
detachGestures();
|
|
3760
|
+
if (this.contentGesture === controller) this.contentGesture = void 0;
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
sheetDragSurface() {
|
|
3764
|
+
return this.dragFromMode === "handle" ? this.handle : this.element;
|
|
3765
|
+
}
|
|
3766
|
+
canStartSheetDrag(e) {
|
|
3767
|
+
if (this.contentGesture?.isDragging) return false;
|
|
3768
|
+
const target = e.target;
|
|
3769
|
+
const scoped = typeof target?.closest === "function";
|
|
3770
|
+
if (scoped && target.closest(NO_DRAG_SELECTOR)) return false;
|
|
3771
|
+
if (this.handle !== this.element && scoped && this.handle.contains(target)) {
|
|
3772
|
+
return true;
|
|
3773
|
+
}
|
|
3774
|
+
if (!isDragAllowedFrom(e.target, this.dragFromMode)) return false;
|
|
3775
|
+
if (this.dragFromMode === "handle") return true;
|
|
3776
|
+
if (this.scrollContainer && scoped && this.scrollContainer.contains(target) && !target.closest(DRAG_ZONE_SELECTOR)) {
|
|
3777
|
+
return false;
|
|
3778
|
+
}
|
|
3779
|
+
return true;
|
|
3780
|
+
}
|
|
3781
|
+
mountSheetGesture() {
|
|
3782
|
+
const surface = this.sheetDragSurface();
|
|
3783
|
+
const controller = new GestureController(
|
|
3784
|
+
this.buildGestureDeps(surface, {
|
|
3785
|
+
shouldStart: (e) => this.canStartSheetDrag(e),
|
|
3786
|
+
manageTouchAction: this.dragFromMode === "handle"
|
|
3787
|
+
})
|
|
3788
|
+
);
|
|
3789
|
+
this.gesture = controller;
|
|
3790
|
+
const detachGestures = controller.install();
|
|
3791
|
+
const detachGuard = this.dragFromMode === "handle" ? null : installTouchScrollGuard(surface, () => controller.isDragging);
|
|
3792
|
+
this.detachSheetGesture = () => {
|
|
3793
|
+
detachGuard?.();
|
|
3794
|
+
detachGestures();
|
|
3795
|
+
};
|
|
3796
|
+
}
|
|
3797
|
+
attach() {
|
|
3798
|
+
this.mountSheetGesture();
|
|
3799
|
+
this.teardowns.add(() => {
|
|
3800
|
+
this.detachSheetGesture?.();
|
|
3801
|
+
this.detachSheetGesture = null;
|
|
3494
3802
|
});
|
|
3495
|
-
this.teardowns.add(this.gesture.install());
|
|
3496
3803
|
try {
|
|
3497
3804
|
this.attachFeatures();
|
|
3498
3805
|
} catch (err) {
|
|
@@ -3529,7 +3836,7 @@ var init_BottomSheetCore = __esm({
|
|
|
3529
3836
|
element: this.element,
|
|
3530
3837
|
getMode: () => this.mode,
|
|
3531
3838
|
isDestroyed: () => this.destroyed,
|
|
3532
|
-
isDragging: () => this.
|
|
3839
|
+
isDragging: () => this.isDraggingAny(),
|
|
3533
3840
|
resolveActiveSnap: () => this.snaps.findById(this.activeId),
|
|
3534
3841
|
getMaxAxisSize: () => this.snaps.getMaxAxisSize(),
|
|
3535
3842
|
getSize: () => this.size,
|
|
@@ -3564,7 +3871,11 @@ var init_BottomSheetCore = __esm({
|
|
|
3564
3871
|
);
|
|
3565
3872
|
}
|
|
3566
3873
|
}
|
|
3567
|
-
this.
|
|
3874
|
+
this.mountSliderKeyboard();
|
|
3875
|
+
this.scrim.attach();
|
|
3876
|
+
}
|
|
3877
|
+
mountSliderKeyboard() {
|
|
3878
|
+
const detach = installSliderKeyboard({
|
|
3568
3879
|
handle: this.handle,
|
|
3569
3880
|
mode: this.mode,
|
|
3570
3881
|
isDestroyed: () => this.destroyed,
|
|
@@ -3573,8 +3884,12 @@ var init_BottomSheetCore = __esm({
|
|
|
3573
3884
|
snapTo: (id) => {
|
|
3574
3885
|
void this.snapTo(id);
|
|
3575
3886
|
}
|
|
3576
|
-
})
|
|
3577
|
-
this.
|
|
3887
|
+
});
|
|
3888
|
+
this.detachSliderKeyboard = detach;
|
|
3889
|
+
this.teardowns.add(() => {
|
|
3890
|
+
this.detachSliderKeyboard?.();
|
|
3891
|
+
this.detachSliderKeyboard = null;
|
|
3892
|
+
});
|
|
3578
3893
|
}
|
|
3579
3894
|
settleAfterDrag(delta, velocity, kind = "touch") {
|
|
3580
3895
|
const signal = this.newCycle();
|
|
@@ -3627,8 +3942,11 @@ var init_BottomSheetCore = __esm({
|
|
|
3627
3942
|
);
|
|
3628
3943
|
});
|
|
3629
3944
|
}
|
|
3945
|
+
isDraggingAny() {
|
|
3946
|
+
return (this.gesture?.isDragging ?? false) || (this.contentGesture?.isDragging ?? false);
|
|
3947
|
+
}
|
|
3630
3948
|
clearWillChangeIfIdle() {
|
|
3631
|
-
if (this.animation.isAnimating || this.
|
|
3949
|
+
if (this.animation.isAnimating || this.isDraggingAny()) return;
|
|
3632
3950
|
this.element.style.willChange = "";
|
|
3633
3951
|
}
|
|
3634
3952
|
haptic() {
|
|
@@ -3641,8 +3959,9 @@ var init_BottomSheetCore = __esm({
|
|
|
3641
3959
|
}
|
|
3642
3960
|
applySize(size, skipTransform = false) {
|
|
3643
3961
|
const cap = this.snaps.getMaxAxisSize();
|
|
3644
|
-
const clamped = cap > 0 && size > cap && !this.
|
|
3962
|
+
const clamped = cap > 0 && size > cap && !this.isDraggingAny() && !this.allowOvershoot ? cap : size;
|
|
3645
3963
|
this.size = clamped;
|
|
3964
|
+
if (clamped > 0) this.setRestClosed(false);
|
|
3646
3965
|
const offset = cap - clamped;
|
|
3647
3966
|
const style = this.element.style;
|
|
3648
3967
|
if (!skipTransform) style.transform = this.transformTemplate(offset);
|
|
@@ -4042,54 +4361,13 @@ var init_auto_collapse = __esm({
|
|
|
4042
4361
|
}
|
|
4043
4362
|
});
|
|
4044
4363
|
|
|
4045
|
-
// src/core/features/content-
|
|
4046
|
-
function
|
|
4047
|
-
const
|
|
4048
|
-
|
|
4049
|
-
let startScrollTop = 0;
|
|
4050
|
-
let moved = false;
|
|
4051
|
-
const onTouchStart = (e) => {
|
|
4052
|
-
const t = e.touches[0];
|
|
4053
|
-
if (!t) return;
|
|
4054
|
-
startY = t.clientY;
|
|
4055
|
-
startScrollTop = container.scrollTop;
|
|
4056
|
-
moved = false;
|
|
4057
|
-
};
|
|
4058
|
-
const onTouchMove = (e) => {
|
|
4059
|
-
const t = e.touches[0];
|
|
4060
|
-
if (!t) return;
|
|
4061
|
-
if (Math.abs(t.clientY - startY) > CONTENT_PULL_THRESHOLD) moved = true;
|
|
4062
|
-
};
|
|
4063
|
-
const onTouchEnd = (e) => {
|
|
4064
|
-
if (!moved) return;
|
|
4065
|
-
if (deps.isDragging() || deps.isAnimating()) return;
|
|
4066
|
-
if (container.scrollTop !== startScrollTop) return;
|
|
4067
|
-
const t = e.changedTouches[0];
|
|
4068
|
-
if (!t) return;
|
|
4069
|
-
const deltaY = t.clientY - startY;
|
|
4070
|
-
const atTop = container.scrollTop <= 0;
|
|
4071
|
-
const allowed = deps.getAllowedIds();
|
|
4072
|
-
const idx = allowed.indexOf(deps.getActiveId());
|
|
4073
|
-
if (idx === -1) return;
|
|
4074
|
-
if (atTop && deltaY > CONTENT_PULL_THRESHOLD && idx > 0) {
|
|
4075
|
-
deps.snapTo(allowed[idx - 1]);
|
|
4076
|
-
} else if (deltaY < -CONTENT_PULL_THRESHOLD && idx < allowed.length - 1) {
|
|
4077
|
-
deps.snapTo(allowed[idx + 1]);
|
|
4078
|
-
}
|
|
4079
|
-
};
|
|
4080
|
-
container.addEventListener("touchstart", onTouchStart, { passive: true });
|
|
4081
|
-
container.addEventListener("touchmove", onTouchMove, { passive: true });
|
|
4082
|
-
container.addEventListener("touchend", onTouchEnd, { passive: true });
|
|
4083
|
-
return () => {
|
|
4084
|
-
container.removeEventListener("touchstart", onTouchStart);
|
|
4085
|
-
container.removeEventListener("touchmove", onTouchMove);
|
|
4086
|
-
container.removeEventListener("touchend", onTouchEnd);
|
|
4087
|
-
};
|
|
4364
|
+
// src/core/features/content-drag.ts
|
|
4365
|
+
function installContentDrag(deps) {
|
|
4366
|
+
const detach = deps.attachDragSurface(deps.container, "content");
|
|
4367
|
+
return () => detach?.();
|
|
4088
4368
|
}
|
|
4089
|
-
var
|
|
4090
|
-
|
|
4091
|
-
"src/core/features/content-swipe.ts"() {
|
|
4092
|
-
CONTENT_PULL_THRESHOLD = 60;
|
|
4369
|
+
var init_content_drag = __esm({
|
|
4370
|
+
"src/core/features/content-drag.ts"() {
|
|
4093
4371
|
}
|
|
4094
4372
|
});
|
|
4095
4373
|
|
|
@@ -4203,13 +4481,9 @@ function contentSwipeFeature() {
|
|
|
4203
4481
|
stage: "attach",
|
|
4204
4482
|
install: (ctx) => {
|
|
4205
4483
|
if (!ctx.scrollContainer) return;
|
|
4206
|
-
return
|
|
4484
|
+
return installContentDrag({
|
|
4207
4485
|
container: ctx.scrollContainer,
|
|
4208
|
-
|
|
4209
|
-
isAnimating: ctx.isAnimating,
|
|
4210
|
-
getAllowedIds: ctx.allowedIdsBySize,
|
|
4211
|
-
getActiveId: ctx.getActiveId,
|
|
4212
|
-
snapTo: ctx.snapTo
|
|
4486
|
+
attachDragSurface: ctx.attachDragSurface
|
|
4213
4487
|
});
|
|
4214
4488
|
}
|
|
4215
4489
|
};
|
|
@@ -4244,7 +4518,7 @@ var init_engine_features = __esm({
|
|
|
4244
4518
|
init_route();
|
|
4245
4519
|
init_persist();
|
|
4246
4520
|
init_auto_collapse();
|
|
4247
|
-
|
|
4521
|
+
init_content_drag();
|
|
4248
4522
|
init_visual_viewport();
|
|
4249
4523
|
init_teardown_stack();
|
|
4250
4524
|
}
|
|
@@ -4287,7 +4561,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
4287
4561
|
var baseStyles;
|
|
4288
4562
|
var init_baseStyles = __esm({
|
|
4289
4563
|
"src/web-component/baseStyles.ts"() {
|
|
4290
|
-
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}}`;
|
|
4564
|
+
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}}`;
|
|
4291
4565
|
}
|
|
4292
4566
|
});
|
|
4293
4567
|
|
|
@@ -4384,7 +4658,7 @@ var init_shadow_tree = __esm({
|
|
|
4384
4658
|
});
|
|
4385
4659
|
|
|
4386
4660
|
// src/web-component/attributes.ts
|
|
4387
|
-
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;
|
|
4661
|
+
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;
|
|
4388
4662
|
var init_attributes = __esm({
|
|
4389
4663
|
"src/web-component/attributes.ts"() {
|
|
4390
4664
|
ATTR_SNAP_POINTS = "snap-points";
|
|
@@ -4402,6 +4676,8 @@ var init_attributes = __esm({
|
|
|
4402
4676
|
ATTR_PERSISTENT = "persistent";
|
|
4403
4677
|
ATTR_DISABLE_CLOSE = "disable-close";
|
|
4404
4678
|
ATTR_DISABLE_DRAG = "disable-drag";
|
|
4679
|
+
ATTR_DRAG_FROM = "drag-from";
|
|
4680
|
+
ATTR_DRAG_FROM_CONTENT = "drag-from-content";
|
|
4405
4681
|
ATTR_CLOSE_ON_ROUTE_CHANGE = "close-on-route-change";
|
|
4406
4682
|
ATTR_RADIUS = "radius";
|
|
4407
4683
|
ATTR_MAX_HEIGHT = "max-height";
|
|
@@ -4417,7 +4693,9 @@ var init_attributes = __esm({
|
|
|
4417
4693
|
ATTR_SNAP,
|
|
4418
4694
|
ATTR_PERSISTENT,
|
|
4419
4695
|
ATTR_DISABLE_CLOSE,
|
|
4420
|
-
ATTR_DISABLE_DRAG
|
|
4696
|
+
ATTR_DISABLE_DRAG,
|
|
4697
|
+
ATTR_DRAG_FROM,
|
|
4698
|
+
ATTR_DRAG_FROM_CONTENT
|
|
4421
4699
|
]);
|
|
4422
4700
|
OBSERVED_ATTRS = [
|
|
4423
4701
|
ATTR_SNAP_POINTS,
|
|
@@ -4434,6 +4712,8 @@ var init_attributes = __esm({
|
|
|
4434
4712
|
ATTR_PERSISTENT,
|
|
4435
4713
|
ATTR_DISABLE_CLOSE,
|
|
4436
4714
|
ATTR_DISABLE_DRAG,
|
|
4715
|
+
ATTR_DRAG_FROM,
|
|
4716
|
+
ATTR_DRAG_FROM_CONTENT,
|
|
4437
4717
|
ATTR_CLOSE_ON_ROUTE_CHANGE,
|
|
4438
4718
|
ATTR_RADIUS,
|
|
4439
4719
|
ATTR_MAX_HEIGHT,
|
|
@@ -4470,6 +4750,12 @@ var init_attributes = __esm({
|
|
|
4470
4750
|
VALID_ANIMATIONS = ["spring", "tween", "ios-spring", "material-bounce", "linear", "snappy"];
|
|
4471
4751
|
parseMode = (raw) => raw && VALID_MODES.includes(raw) ? raw : "bottom";
|
|
4472
4752
|
parseAnimation = (raw) => raw && VALID_ANIMATIONS.includes(raw) ? raw : void 0;
|
|
4753
|
+
VALID_DRAG_FROM = [
|
|
4754
|
+
"handle",
|
|
4755
|
+
"sheet",
|
|
4756
|
+
"zones"
|
|
4757
|
+
];
|
|
4758
|
+
parseDragFrom = (raw) => raw && VALID_DRAG_FROM.includes(raw) ? raw : void 0;
|
|
4473
4759
|
parseList = (raw) => raw ? raw.split(",").map((s) => s.trim()).filter(Boolean) : void 0;
|
|
4474
4760
|
parseDimension = (raw) => {
|
|
4475
4761
|
if (raw === null) return void 0;
|
|
@@ -4618,6 +4904,14 @@ var init_BottomSheetElement = __esm({
|
|
|
4618
4904
|
case ATTR_DISABLE_DRAG:
|
|
4619
4905
|
this.engine.setDisableDrag(value === "true");
|
|
4620
4906
|
break;
|
|
4907
|
+
case ATTR_DRAG_FROM_CONTENT:
|
|
4908
|
+
this.engine.setDragFromContent(value !== "false");
|
|
4909
|
+
break;
|
|
4910
|
+
case ATTR_DRAG_FROM: {
|
|
4911
|
+
const mode = parseDragFrom(value);
|
|
4912
|
+
if (mode) this.engine.setDragFrom(mode);
|
|
4913
|
+
break;
|
|
4914
|
+
}
|
|
4621
4915
|
case ATTR_SNAP:
|
|
4622
4916
|
if (value && value !== this.engine.state.activeId) {
|
|
4623
4917
|
void this.engine.snapTo(value);
|
|
@@ -4688,6 +4982,8 @@ var init_BottomSheetElement = __esm({
|
|
|
4688
4982
|
persistent: this.getAttribute(ATTR_PERSISTENT) === "true",
|
|
4689
4983
|
disableClose: this.getAttribute(ATTR_DISABLE_CLOSE) === "true",
|
|
4690
4984
|
disableDrag: this.getAttribute(ATTR_DISABLE_DRAG) === "true",
|
|
4985
|
+
dragFrom: parseDragFrom(this.getAttribute(ATTR_DRAG_FROM)),
|
|
4986
|
+
dragFromContent: this.getAttribute(ATTR_DRAG_FROM_CONTENT) === null ? void 0 : this.getAttribute(ATTR_DRAG_FROM_CONTENT) !== "false",
|
|
4691
4987
|
closeOnRouteChange: this.getAttribute(ATTR_CLOSE_ON_ROUTE_CHANGE) === "true",
|
|
4692
4988
|
radius: parseDimension(this.getAttribute(ATTR_RADIUS)),
|
|
4693
4989
|
maxHeight: parseDimension(this.getAttribute(ATTR_MAX_HEIGHT)),
|