@surdeddd/bottom-sheet 0.11.0 → 0.13.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 +68 -1
- package/dist/{BottomSheetEngine-DzsIwD28.d.cts → BottomSheetCore-CsIjyq7C.d.cts} +61 -5
- package/dist/{BottomSheetEngine-DRjCU73e.d.ts → BottomSheetCore-D16lsa6g.d.ts} +61 -5
- package/dist/BottomSheetEngine-BYjAVrmd.d.cts +7 -0
- package/dist/BottomSheetEngine-YuCNugZn.d.ts +7 -0
- package/dist/core.cjs +3476 -0
- package/dist/core.d.cts +3 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.js +3474 -0
- package/dist/debug.cjs +109 -0
- package/dist/debug.d.cts +22 -0
- package/dist/debug.d.ts +22 -0
- package/dist/debug.js +107 -0
- package/dist/element.cjs +994 -697
- package/dist/element.d.cts +2 -1
- package/dist/element.d.ts +2 -1
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +994 -697
- package/dist/features.cjs +533 -0
- package/dist/features.d.cts +13 -0
- package/dist/features.d.ts +13 -0
- package/dist/features.js +526 -0
- package/dist/index-DdYLOIIT.d.ts +15 -0
- package/dist/index-dfrzw-lI.d.cts +15 -0
- package/dist/index.cjs +823 -542
- package/dist/index.d.cts +6 -15
- package/dist/index.d.ts +6 -15
- package/dist/index.js +817 -543
- 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 +13 -8
- package/dist/overlay.js +13 -8
- package/dist/preact.d.cts +2 -1
- package/dist/preact.d.ts +2 -1
- package/dist/qwik-lib/index.qwik.cjs +4267 -0
- package/dist/qwik-lib/index.qwik.mjs +4267 -0
- package/dist/qwik.cjs +816 -542
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +816 -542
- package/dist/react.cjs +816 -542
- package/dist/react.d.cts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.js +816 -542
- package/dist/solid.cjs +816 -542
- package/dist/solid.d.cts +64 -4
- package/dist/solid.d.ts +64 -4
- package/dist/solid.js +816 -542
- package/dist/solid.source.jsx +816 -542
- package/dist/svelte-core.cjs +816 -542
- package/dist/svelte-core.js +816 -542
- package/dist/svelte.cjs +816 -542
- package/dist/svelte.js +816 -542
- package/dist/vue.cjs +927 -645
- package/dist/vue.js +927 -645
- package/package.json +63 -11
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
6
|
+
|
|
7
|
+
// src/core/features/history-coordinator.ts
|
|
8
|
+
var entries = [];
|
|
9
|
+
var subscribers = /* @__PURE__ */ new Set();
|
|
10
|
+
var suppress = 0;
|
|
11
|
+
var internalDepth = 0;
|
|
12
|
+
var pendingRebrands = [];
|
|
13
|
+
var listenerInstalled = false;
|
|
14
|
+
var patchInstalled = false;
|
|
15
|
+
var origPushState = null;
|
|
16
|
+
var origReplaceState = null;
|
|
17
|
+
var patchedPushState = null;
|
|
18
|
+
var patchedReplaceState = null;
|
|
19
|
+
var hasWindow = () => typeof window !== "undefined";
|
|
20
|
+
var hasHistory = () => typeof history !== "undefined";
|
|
21
|
+
var brandMarker = (surface) => ({
|
|
22
|
+
...surface.markerState(),
|
|
23
|
+
__bs: true
|
|
24
|
+
});
|
|
25
|
+
var runInternal = (fn) => {
|
|
26
|
+
internalDepth += 1;
|
|
27
|
+
try {
|
|
28
|
+
fn();
|
|
29
|
+
} finally {
|
|
30
|
+
internalDepth -= 1;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var notifyRouteChange = () => {
|
|
34
|
+
const snapshot = Array.from(subscribers);
|
|
35
|
+
for (const fn of snapshot) fn();
|
|
36
|
+
};
|
|
37
|
+
var ensureListener = () => {
|
|
38
|
+
if (listenerInstalled || !hasWindow()) return;
|
|
39
|
+
window.addEventListener("popstate", onPopState);
|
|
40
|
+
listenerInstalled = true;
|
|
41
|
+
};
|
|
42
|
+
var maybeTeardownListener = () => {
|
|
43
|
+
if (!listenerInstalled) return;
|
|
44
|
+
if (entries.length > 0 || subscribers.size > 0 || suppress > 0) return;
|
|
45
|
+
if (hasWindow()) window.removeEventListener("popstate", onPopState);
|
|
46
|
+
listenerInstalled = false;
|
|
47
|
+
};
|
|
48
|
+
var installPatch = () => {
|
|
49
|
+
if (patchInstalled || !hasHistory()) return;
|
|
50
|
+
origPushState = history.pushState;
|
|
51
|
+
origReplaceState = history.replaceState;
|
|
52
|
+
patchedPushState = function(...args) {
|
|
53
|
+
origPushState.apply(this, args);
|
|
54
|
+
if (internalDepth === 0) notifyRouteChange();
|
|
55
|
+
};
|
|
56
|
+
patchedReplaceState = function(...args) {
|
|
57
|
+
origReplaceState.apply(this, args);
|
|
58
|
+
if (internalDepth === 0) notifyRouteChange();
|
|
59
|
+
};
|
|
60
|
+
history.pushState = patchedPushState;
|
|
61
|
+
history.replaceState = patchedReplaceState;
|
|
62
|
+
patchInstalled = true;
|
|
63
|
+
};
|
|
64
|
+
var removePatch = () => {
|
|
65
|
+
if (!patchInstalled) return;
|
|
66
|
+
if (history.pushState === patchedPushState && origPushState) {
|
|
67
|
+
history.pushState = origPushState;
|
|
68
|
+
}
|
|
69
|
+
if (history.replaceState === patchedReplaceState && origReplaceState) {
|
|
70
|
+
history.replaceState = origReplaceState;
|
|
71
|
+
}
|
|
72
|
+
origPushState = null;
|
|
73
|
+
origReplaceState = null;
|
|
74
|
+
patchedPushState = null;
|
|
75
|
+
patchedReplaceState = null;
|
|
76
|
+
patchInstalled = false;
|
|
77
|
+
};
|
|
78
|
+
function onPopState() {
|
|
79
|
+
if (suppress > 0) {
|
|
80
|
+
suppress -= 1;
|
|
81
|
+
const rebrand = pendingRebrands.shift();
|
|
82
|
+
if (rebrand) rebrand();
|
|
83
|
+
maybeTeardownListener();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (entries.length === 0) {
|
|
87
|
+
notifyRouteChange();
|
|
88
|
+
maybeTeardownListener();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
let target = null;
|
|
92
|
+
let targetIdx = -1;
|
|
93
|
+
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
94
|
+
const entry = entries[i];
|
|
95
|
+
if (!entry.surface.isOpen()) continue;
|
|
96
|
+
if (!target) {
|
|
97
|
+
target = entry;
|
|
98
|
+
targetIdx = i;
|
|
99
|
+
}
|
|
100
|
+
if (entry.surface.isTop()) {
|
|
101
|
+
target = entry;
|
|
102
|
+
targetIdx = i;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (!target) {
|
|
107
|
+
const removed = entries.pop();
|
|
108
|
+
if (removed) removed.live = false;
|
|
109
|
+
maybeTeardownListener();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
target.live = false;
|
|
113
|
+
entries.splice(targetIdx, 1);
|
|
114
|
+
const settled = target;
|
|
115
|
+
void Promise.resolve(settled.surface.close()).then(() => {
|
|
116
|
+
if (settled.surface.isOpen()) restore(settled);
|
|
117
|
+
});
|
|
118
|
+
maybeTeardownListener();
|
|
119
|
+
}
|
|
120
|
+
function restore(entry) {
|
|
121
|
+
if (!hasWindow() || !hasHistory()) return;
|
|
122
|
+
entry.live = true;
|
|
123
|
+
runInternal(() => {
|
|
124
|
+
try {
|
|
125
|
+
history.pushState(brandMarker(entry.surface), "", entry.surface.url);
|
|
126
|
+
} catch {
|
|
127
|
+
entry.live = false;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (entry.live) {
|
|
131
|
+
entries.push(entry);
|
|
132
|
+
ensureListener();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function pushBackMarker(surface) {
|
|
136
|
+
const entry = { surface, priorUrl: void 0, live: false };
|
|
137
|
+
if (!hasWindow() || !hasHistory()) {
|
|
138
|
+
return entry;
|
|
139
|
+
}
|
|
140
|
+
entry.priorUrl = surface.url !== void 0 ? location.href : void 0;
|
|
141
|
+
runInternal(() => {
|
|
142
|
+
try {
|
|
143
|
+
history.pushState(brandMarker(surface), "", surface.url);
|
|
144
|
+
entry.live = true;
|
|
145
|
+
} catch {
|
|
146
|
+
entry.live = false;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
if (entry.live) {
|
|
150
|
+
entries.push(entry);
|
|
151
|
+
ensureListener();
|
|
152
|
+
}
|
|
153
|
+
return entry;
|
|
154
|
+
}
|
|
155
|
+
function popBackMarker(handle) {
|
|
156
|
+
if (!hasWindow() || !hasHistory()) return;
|
|
157
|
+
const entry = handle;
|
|
158
|
+
const idx = entries.indexOf(entry);
|
|
159
|
+
if (idx === -1 || !entry.live) return;
|
|
160
|
+
const last = entries.length - 1;
|
|
161
|
+
entry.live = false;
|
|
162
|
+
entries.splice(idx, 1);
|
|
163
|
+
let rebrand = null;
|
|
164
|
+
if (idx !== last) {
|
|
165
|
+
const rebrandSurface = entries[entries.length - 1].surface;
|
|
166
|
+
const rebrandUrl = entry.priorUrl;
|
|
167
|
+
rebrand = () => {
|
|
168
|
+
runInternal(() => {
|
|
169
|
+
history.replaceState(
|
|
170
|
+
brandMarker(rebrandSurface),
|
|
171
|
+
"",
|
|
172
|
+
rebrandUrl !== void 0 ? rebrandUrl : location.href
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
pendingRebrands.push(rebrand);
|
|
178
|
+
suppress += 1;
|
|
179
|
+
runInternal(() => {
|
|
180
|
+
try {
|
|
181
|
+
history.back();
|
|
182
|
+
} catch {
|
|
183
|
+
suppress = Math.max(0, suppress - 1);
|
|
184
|
+
pendingRebrands.pop();
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
maybeTeardownListener();
|
|
188
|
+
}
|
|
189
|
+
function subscribeRouteChange(fn) {
|
|
190
|
+
if (!hasWindow() || !hasHistory()) return () => {
|
|
191
|
+
};
|
|
192
|
+
subscribers.add(fn);
|
|
193
|
+
if (subscribers.size === 1) installPatch();
|
|
194
|
+
ensureListener();
|
|
195
|
+
return () => {
|
|
196
|
+
if (!subscribers.has(fn)) return;
|
|
197
|
+
subscribers.delete(fn);
|
|
198
|
+
if (subscribers.size === 0) removePatch();
|
|
199
|
+
maybeTeardownListener();
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// src/core/features/route.ts
|
|
204
|
+
function installRoute(deps) {
|
|
205
|
+
if (typeof window === "undefined") {
|
|
206
|
+
return () => {
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (!deps.routedTo && !deps.closeOnBack) {
|
|
210
|
+
return () => {
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
let handle = null;
|
|
214
|
+
const onOpen = () => {
|
|
215
|
+
if (handle) return;
|
|
216
|
+
handle = pushBackMarker({
|
|
217
|
+
isOpen: () => !deps.isDestroyed() && deps.getSize() > 0,
|
|
218
|
+
isTop: deps.isTopSheet,
|
|
219
|
+
close: deps.close,
|
|
220
|
+
markerState: () => deps.routedTo !== void 0 ? { __bsRouted: deps.sheetId } : { __bsSheet: deps.sheetId },
|
|
221
|
+
url: deps.routedTo
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
const onClose = () => {
|
|
225
|
+
if (!handle) return;
|
|
226
|
+
popBackMarker(handle);
|
|
227
|
+
handle = null;
|
|
228
|
+
};
|
|
229
|
+
const unsubscribeOpen = deps.on("open", onOpen);
|
|
230
|
+
const unsubscribeClose = deps.on("close", onClose);
|
|
231
|
+
if (deps.getSize() > 0) onOpen();
|
|
232
|
+
return () => {
|
|
233
|
+
unsubscribeOpen();
|
|
234
|
+
unsubscribeClose();
|
|
235
|
+
if (handle) {
|
|
236
|
+
popBackMarker(handle);
|
|
237
|
+
handle = null;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function installRouteChange(deps) {
|
|
242
|
+
return subscribeRouteChange(() => {
|
|
243
|
+
if (deps.isDestroyed() || deps.getSize() <= 0) return;
|
|
244
|
+
void deps.close();
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/core/features/persist.ts
|
|
249
|
+
function installPersist(engine, key) {
|
|
250
|
+
const unsubscribe = engine.on("snap", ({ id }) => {
|
|
251
|
+
if (typeof window === "undefined") return;
|
|
252
|
+
if (typeof localStorage === "undefined") return;
|
|
253
|
+
try {
|
|
254
|
+
localStorage.setItem(key, id);
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
return unsubscribe;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/core/features/auto-collapse.ts
|
|
262
|
+
function installAutoCollapse(deps) {
|
|
263
|
+
const { ms } = deps;
|
|
264
|
+
if (ms === void 0 || ms <= 0) {
|
|
265
|
+
return () => {
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
let timer = null;
|
|
269
|
+
const clearTimer = () => {
|
|
270
|
+
if (timer !== null) {
|
|
271
|
+
clearTimeout(timer);
|
|
272
|
+
timer = null;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
const fire = () => {
|
|
276
|
+
if (deps.isDestroyed()) return;
|
|
277
|
+
if (deps.isDragging()) return;
|
|
278
|
+
const active = deps.resolveSnap(deps.getActiveId());
|
|
279
|
+
if (!active || active.size === 0) return;
|
|
280
|
+
let target = null;
|
|
281
|
+
for (const id of deps.getAllowedIds()) {
|
|
282
|
+
const snap = deps.resolveSnap(id);
|
|
283
|
+
if (!snap || snap.size <= 0) continue;
|
|
284
|
+
if (!target || snap.size < target.size) target = snap;
|
|
285
|
+
}
|
|
286
|
+
if (!target) return;
|
|
287
|
+
if (target.id === active.id || target.size >= active.size) return;
|
|
288
|
+
deps.snapTo(target.id);
|
|
289
|
+
};
|
|
290
|
+
const reset = () => {
|
|
291
|
+
clearTimer();
|
|
292
|
+
if (deps.isDestroyed()) return;
|
|
293
|
+
timer = setTimeout(() => {
|
|
294
|
+
timer = null;
|
|
295
|
+
fire();
|
|
296
|
+
}, ms);
|
|
297
|
+
};
|
|
298
|
+
const unsubscribe = deps.on("snap", () => reset());
|
|
299
|
+
if ((deps.resolveSnap(deps.getActiveId())?.size ?? 0) > 0) reset();
|
|
300
|
+
return () => {
|
|
301
|
+
clearTimer();
|
|
302
|
+
unsubscribe();
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// src/core/features/content-swipe.ts
|
|
307
|
+
var CONTENT_PULL_THRESHOLD = 60;
|
|
308
|
+
function installContentSwipe(deps) {
|
|
309
|
+
const { container } = deps;
|
|
310
|
+
let startY = 0;
|
|
311
|
+
let startScrollTop = 0;
|
|
312
|
+
let moved = false;
|
|
313
|
+
const onTouchStart = (e) => {
|
|
314
|
+
const t = e.touches[0];
|
|
315
|
+
if (!t) return;
|
|
316
|
+
startY = t.clientY;
|
|
317
|
+
startScrollTop = container.scrollTop;
|
|
318
|
+
moved = false;
|
|
319
|
+
};
|
|
320
|
+
const onTouchMove = (e) => {
|
|
321
|
+
const t = e.touches[0];
|
|
322
|
+
if (!t) return;
|
|
323
|
+
if (Math.abs(t.clientY - startY) > CONTENT_PULL_THRESHOLD) moved = true;
|
|
324
|
+
};
|
|
325
|
+
const onTouchEnd = (e) => {
|
|
326
|
+
if (!moved) return;
|
|
327
|
+
if (deps.isDragging() || deps.isAnimating()) return;
|
|
328
|
+
if (container.scrollTop !== startScrollTop) return;
|
|
329
|
+
const t = e.changedTouches[0];
|
|
330
|
+
if (!t) return;
|
|
331
|
+
const deltaY = t.clientY - startY;
|
|
332
|
+
const atTop = container.scrollTop <= 0;
|
|
333
|
+
const allowed = deps.getAllowedIds();
|
|
334
|
+
const idx = allowed.indexOf(deps.getActiveId());
|
|
335
|
+
if (idx === -1) return;
|
|
336
|
+
if (atTop && deltaY > CONTENT_PULL_THRESHOLD && idx > 0) {
|
|
337
|
+
deps.snapTo(allowed[idx - 1]);
|
|
338
|
+
} else if (deltaY < -CONTENT_PULL_THRESHOLD && idx < allowed.length - 1) {
|
|
339
|
+
deps.snapTo(allowed[idx + 1]);
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
container.addEventListener("touchstart", onTouchStart, { passive: true });
|
|
343
|
+
container.addEventListener("touchmove", onTouchMove, { passive: true });
|
|
344
|
+
container.addEventListener("touchend", onTouchEnd, { passive: true });
|
|
345
|
+
return () => {
|
|
346
|
+
container.removeEventListener("touchstart", onTouchStart);
|
|
347
|
+
container.removeEventListener("touchmove", onTouchMove);
|
|
348
|
+
container.removeEventListener("touchend", onTouchEnd);
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// src/core/features/visual-viewport.ts
|
|
353
|
+
var SAFETY_PAD = 8;
|
|
354
|
+
function installVisualViewport(deps) {
|
|
355
|
+
if (typeof window === "undefined" || !window.visualViewport) {
|
|
356
|
+
return () => {
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
const vv = window.visualViewport;
|
|
360
|
+
let rafId = null;
|
|
361
|
+
const onResize = () => {
|
|
362
|
+
if (rafId !== null) return;
|
|
363
|
+
rafId = requestAnimationFrame(() => {
|
|
364
|
+
rafId = null;
|
|
365
|
+
if (deps.isDestroyed()) return;
|
|
366
|
+
deps.recomputeSnaps();
|
|
367
|
+
const isVertical = deps.isVerticalAxis();
|
|
368
|
+
const visible = isVertical ? vv.height : vv.width;
|
|
369
|
+
const windowSize = isVertical ? window.innerHeight : window.innerWidth;
|
|
370
|
+
const clamp = Math.max(0, Math.min(windowSize, visible) - SAFETY_PAD);
|
|
371
|
+
if (clamp < deps.getMaxAxisSize()) {
|
|
372
|
+
deps.setMaxAxisSize(clamp);
|
|
373
|
+
}
|
|
374
|
+
const wasAnimating = deps.isAnimating?.() ?? false;
|
|
375
|
+
deps.cancelInFlight();
|
|
376
|
+
deps.newCycle();
|
|
377
|
+
const max = deps.getMaxAxisSize();
|
|
378
|
+
deps.setSize(Math.min(deps.getSize(), max));
|
|
379
|
+
const current = deps.resolveActiveSnap();
|
|
380
|
+
if (current && !deps.isDragging()) {
|
|
381
|
+
deps.applySize(Math.min(current.size, max));
|
|
382
|
+
if (wasAnimating) deps.resyncAfterCancel?.();
|
|
383
|
+
} else {
|
|
384
|
+
deps.applySize(deps.getSize());
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
vv.addEventListener("resize", onResize);
|
|
389
|
+
return () => {
|
|
390
|
+
vv.removeEventListener("resize", onResize);
|
|
391
|
+
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// src/core/primitives/teardown-stack.ts
|
|
396
|
+
var TeardownStack = class {
|
|
397
|
+
constructor() {
|
|
398
|
+
__publicField(this, "fns", []);
|
|
399
|
+
}
|
|
400
|
+
add(fn) {
|
|
401
|
+
if (fn) this.fns.push(fn);
|
|
402
|
+
}
|
|
403
|
+
drain() {
|
|
404
|
+
while (this.fns.length) {
|
|
405
|
+
try {
|
|
406
|
+
this.fns.pop()();
|
|
407
|
+
} catch (err) {
|
|
408
|
+
queueMicrotask(() => {
|
|
409
|
+
throw err;
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
// src/core/features/engine-features.ts
|
|
417
|
+
function routeFeature() {
|
|
418
|
+
return {
|
|
419
|
+
name: "route",
|
|
420
|
+
install: (ctx) => {
|
|
421
|
+
const teardowns = new TeardownStack();
|
|
422
|
+
if (ctx.options.closeOnRouteChange) {
|
|
423
|
+
teardowns.add(
|
|
424
|
+
installRouteChange({
|
|
425
|
+
isDestroyed: ctx.isDestroyed,
|
|
426
|
+
getSize: ctx.getSize,
|
|
427
|
+
close: () => ctx.close()
|
|
428
|
+
})
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
teardowns.add(
|
|
432
|
+
installRoute({
|
|
433
|
+
routedTo: ctx.options.routedTo,
|
|
434
|
+
closeOnBack: ctx.options.closeOnBack,
|
|
435
|
+
isTopSheet: ctx.isTopSheet,
|
|
436
|
+
getSize: ctx.getSize,
|
|
437
|
+
isDestroyed: ctx.isDestroyed,
|
|
438
|
+
close: () => ctx.close("back"),
|
|
439
|
+
on: ctx.on,
|
|
440
|
+
sheetId: ctx.sheetId
|
|
441
|
+
})
|
|
442
|
+
);
|
|
443
|
+
return () => teardowns.drain();
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function persistFeature() {
|
|
448
|
+
return {
|
|
449
|
+
name: "persist",
|
|
450
|
+
install: (ctx) => {
|
|
451
|
+
const key = ctx.options.persistKey;
|
|
452
|
+
if (!key) return;
|
|
453
|
+
return installPersist({ on: ctx.on }, key);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
function autoCollapseFeature() {
|
|
458
|
+
return {
|
|
459
|
+
name: "auto-collapse",
|
|
460
|
+
install: (ctx) => installAutoCollapse({
|
|
461
|
+
ms: ctx.options.autoCollapseAfter,
|
|
462
|
+
isDestroyed: ctx.isDestroyed,
|
|
463
|
+
isDragging: ctx.isDragging,
|
|
464
|
+
getAllowedIds: ctx.getAllowedIds,
|
|
465
|
+
getActiveId: ctx.getActiveId,
|
|
466
|
+
resolveSnap: ctx.resolveSnap,
|
|
467
|
+
snapTo: ctx.snapTo,
|
|
468
|
+
on: ctx.on
|
|
469
|
+
})
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
function contentSwipeFeature() {
|
|
473
|
+
return {
|
|
474
|
+
name: "content-swipe",
|
|
475
|
+
stage: "attach",
|
|
476
|
+
install: (ctx) => {
|
|
477
|
+
if (!ctx.scrollContainer) return;
|
|
478
|
+
return installContentSwipe({
|
|
479
|
+
container: ctx.scrollContainer,
|
|
480
|
+
isDragging: ctx.isDragging,
|
|
481
|
+
isAnimating: ctx.isAnimating,
|
|
482
|
+
getAllowedIds: ctx.allowedIdsBySize,
|
|
483
|
+
getActiveId: ctx.getActiveId,
|
|
484
|
+
snapTo: ctx.snapTo
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function visualViewportFeature() {
|
|
490
|
+
return {
|
|
491
|
+
name: "visual-viewport",
|
|
492
|
+
install: (ctx) => {
|
|
493
|
+
if (typeof window === "undefined") return;
|
|
494
|
+
return installVisualViewport({
|
|
495
|
+
element: ctx.element,
|
|
496
|
+
isVerticalAxis: ctx.isVerticalAxis,
|
|
497
|
+
isDestroyed: ctx.isDestroyed,
|
|
498
|
+
isDragging: ctx.isDragging,
|
|
499
|
+
recomputeSnaps: ctx.recomputeSnaps,
|
|
500
|
+
resolveActiveSnap: ctx.resolveActiveSnap,
|
|
501
|
+
getMaxAxisSize: ctx.getMaxAxisSize,
|
|
502
|
+
getSize: ctx.getSize,
|
|
503
|
+
setMaxAxisSize: ctx.setMaxAxisSize,
|
|
504
|
+
setSize: ctx.setSize,
|
|
505
|
+
applySize: ctx.applySize,
|
|
506
|
+
cancelInFlight: ctx.cancelInFlight,
|
|
507
|
+
newCycle: ctx.newCycle,
|
|
508
|
+
isAnimating: ctx.isAnimating,
|
|
509
|
+
resyncAfterCancel: ctx.resyncAfterResize
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// src/core/default-features.ts
|
|
516
|
+
function defaultEngineFeatures() {
|
|
517
|
+
return [
|
|
518
|
+
contentSwipeFeature(),
|
|
519
|
+
visualViewportFeature(),
|
|
520
|
+
persistFeature(),
|
|
521
|
+
autoCollapseFeature(),
|
|
522
|
+
routeFeature()
|
|
523
|
+
];
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
exports.autoCollapseFeature = autoCollapseFeature;
|
|
527
|
+
exports.contentSwipeFeature = contentSwipeFeature;
|
|
528
|
+
exports.defaultEngineFeatures = defaultEngineFeatures;
|
|
529
|
+
exports.persistFeature = persistFeature;
|
|
530
|
+
exports.routeFeature = routeFeature;
|
|
531
|
+
exports.visualViewportFeature = visualViewportFeature;
|
|
532
|
+
//# sourceMappingURL=features.cjs.map
|
|
533
|
+
//# sourceMappingURL=features.cjs.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { l as EngineFeature } from './BottomSheetCore-CsIjyq7C.cjs';
|
|
2
|
+
export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-CsIjyq7C.cjs';
|
|
3
|
+
import './transform-jVfAikE9.cjs';
|
|
4
|
+
|
|
5
|
+
declare function defaultEngineFeatures(): EngineFeature[];
|
|
6
|
+
|
|
7
|
+
declare function routeFeature(): EngineFeature;
|
|
8
|
+
declare function persistFeature(): EngineFeature;
|
|
9
|
+
declare function autoCollapseFeature(): EngineFeature;
|
|
10
|
+
declare function contentSwipeFeature(): EngineFeature;
|
|
11
|
+
declare function visualViewportFeature(): EngineFeature;
|
|
12
|
+
|
|
13
|
+
export { EngineFeature, autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { l as EngineFeature } from './BottomSheetCore-D16lsa6g.js';
|
|
2
|
+
export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-D16lsa6g.js';
|
|
3
|
+
import './transform-jVfAikE9.js';
|
|
4
|
+
|
|
5
|
+
declare function defaultEngineFeatures(): EngineFeature[];
|
|
6
|
+
|
|
7
|
+
declare function routeFeature(): EngineFeature;
|
|
8
|
+
declare function persistFeature(): EngineFeature;
|
|
9
|
+
declare function autoCollapseFeature(): EngineFeature;
|
|
10
|
+
declare function contentSwipeFeature(): EngineFeature;
|
|
11
|
+
declare function visualViewportFeature(): EngineFeature;
|
|
12
|
+
|
|
13
|
+
export { EngineFeature, autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature };
|