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