@surdeddd/bottom-sheet 0.22.1 → 0.23.1
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 +58 -14
- package/dist/core.cjs +13 -5
- package/dist/core.js +13 -5
- package/dist/element.cjs +43 -13
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +43 -13
- package/dist/features.cjs +28 -6
- package/dist/features.js +28 -6
- package/dist/index.cjs +41 -11
- package/dist/index.js +41 -11
- package/dist/qwik-lib/index.qwik.cjs +42 -11
- package/dist/qwik-lib/index.qwik.mjs +42 -11
- package/dist/qwik.cjs +41 -11
- package/dist/qwik.js +41 -11
- package/dist/react.cjs +41 -11
- package/dist/react.js +41 -11
- package/dist/solid.cjs +41 -11
- package/dist/solid.js +41 -11
- package/dist/solid.source.jsx +41 -11
- package/dist/styles.css +19 -2
- package/dist/svelte-core.cjs +41 -11
- package/dist/svelte-core.js +41 -11
- package/dist/svelte.cjs +41 -11
- package/dist/svelte.js +41 -11
- package/dist/vue.cjs +41 -11
- package/dist/vue.js +41 -11
- package/package.json +11 -11
package/dist/vue.cjs
CHANGED
|
@@ -1489,13 +1489,17 @@ var AnimationRunner = class {
|
|
|
1489
1489
|
});
|
|
1490
1490
|
let stopped = false;
|
|
1491
1491
|
let auxRaf = 0;
|
|
1492
|
-
const start = performance.now();
|
|
1493
1492
|
const lastIdx = samples.values.length - 1;
|
|
1494
1493
|
const auxTick = () => {
|
|
1495
1494
|
if (stopped) return;
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1495
|
+
const at = Math.min(
|
|
1496
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1497
|
+
lastIdx
|
|
1498
|
+
);
|
|
1499
|
+
const idx = Math.floor(at);
|
|
1500
|
+
const from = samples.values[idx];
|
|
1501
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1502
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1499
1503
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1500
1504
|
};
|
|
1501
1505
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2707,7 +2711,11 @@ var BottomSheetCore = class {
|
|
|
2707
2711
|
getSize: () => this.size,
|
|
2708
2712
|
isDragging: () => this.isDraggingAny(),
|
|
2709
2713
|
applyAux: (size) => this.applySize(size, true),
|
|
2710
|
-
getTransformFor: (size) =>
|
|
2714
|
+
getTransformFor: (size) => {
|
|
2715
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2716
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2717
|
+
return this.transformTemplate(cap - shown);
|
|
2718
|
+
}
|
|
2711
2719
|
},
|
|
2712
2720
|
resolved.animation
|
|
2713
2721
|
);
|
|
@@ -4239,6 +4247,9 @@ function visualViewportFeature() {
|
|
|
4239
4247
|
|
|
4240
4248
|
// src/core/features/content-fit.ts
|
|
4241
4249
|
var INSET_VAR = "--bs-content-inset";
|
|
4250
|
+
var SIZE_VAR = "--bs-size";
|
|
4251
|
+
var CAP_VAR = "--bs-max-size";
|
|
4252
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4242
4253
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4243
4254
|
function contentFitFeature() {
|
|
4244
4255
|
return {
|
|
@@ -4252,6 +4263,8 @@ function contentFitFeature() {
|
|
|
4252
4263
|
let inset = 0;
|
|
4253
4264
|
let unpaddedMax = -1;
|
|
4254
4265
|
let top = 0;
|
|
4266
|
+
let resting = false;
|
|
4267
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4255
4268
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4256
4269
|
const follow = (size) => {
|
|
4257
4270
|
if (unpaddedMax < 0) {
|
|
@@ -4267,21 +4280,36 @@ function contentFitFeature() {
|
|
|
4267
4280
|
const settle = () => {
|
|
4268
4281
|
if (ctx.isDestroyed()) return;
|
|
4269
4282
|
const size = ctx.getSize();
|
|
4270
|
-
|
|
4271
|
-
|
|
4283
|
+
if (!resting) {
|
|
4284
|
+
unpaddedMax = -1;
|
|
4285
|
+
follow(size);
|
|
4286
|
+
}
|
|
4272
4287
|
inset = hiddenAt(size);
|
|
4273
|
-
|
|
4288
|
+
put(INSET_VAR, inset);
|
|
4289
|
+
put(SIZE_VAR, size);
|
|
4290
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4291
|
+
if (!resting) {
|
|
4292
|
+
resting = true;
|
|
4293
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4294
|
+
}
|
|
4274
4295
|
unpaddedMax = -1;
|
|
4275
4296
|
};
|
|
4297
|
+
const move = (size) => {
|
|
4298
|
+
if (resting) {
|
|
4299
|
+
resting = false;
|
|
4300
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4301
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4302
|
+
}
|
|
4303
|
+
follow(size);
|
|
4304
|
+
};
|
|
4276
4305
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4277
4306
|
const whenIdle = () => {
|
|
4278
4307
|
if (!moving()) settle();
|
|
4279
4308
|
};
|
|
4280
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4281
4309
|
settle();
|
|
4282
4310
|
const offProgress = ctx.on(
|
|
4283
4311
|
"progress",
|
|
4284
|
-
(p) => moving() ?
|
|
4312
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4285
4313
|
);
|
|
4286
4314
|
const offSnap = ctx.on("snap", settle);
|
|
4287
4315
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4293,7 +4321,9 @@ function contentFitFeature() {
|
|
|
4293
4321
|
observer?.disconnect();
|
|
4294
4322
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4295
4323
|
sheet.removeAttribute(FIT_ATTR);
|
|
4296
|
-
|
|
4324
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4325
|
+
sheet.style.removeProperty(name);
|
|
4326
|
+
}
|
|
4297
4327
|
};
|
|
4298
4328
|
}
|
|
4299
4329
|
};
|
package/dist/vue.js
CHANGED
|
@@ -1487,13 +1487,17 @@ var AnimationRunner = class {
|
|
|
1487
1487
|
});
|
|
1488
1488
|
let stopped = false;
|
|
1489
1489
|
let auxRaf = 0;
|
|
1490
|
-
const start = performance.now();
|
|
1491
1490
|
const lastIdx = samples.values.length - 1;
|
|
1492
1491
|
const auxTick = () => {
|
|
1493
1492
|
if (stopped) return;
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1493
|
+
const at = Math.min(
|
|
1494
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1495
|
+
lastIdx
|
|
1496
|
+
);
|
|
1497
|
+
const idx = Math.floor(at);
|
|
1498
|
+
const from = samples.values[idx];
|
|
1499
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1500
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1497
1501
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1498
1502
|
};
|
|
1499
1503
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2705,7 +2709,11 @@ var BottomSheetCore = class {
|
|
|
2705
2709
|
getSize: () => this.size,
|
|
2706
2710
|
isDragging: () => this.isDraggingAny(),
|
|
2707
2711
|
applyAux: (size) => this.applySize(size, true),
|
|
2708
|
-
getTransformFor: (size) =>
|
|
2712
|
+
getTransformFor: (size) => {
|
|
2713
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2714
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2715
|
+
return this.transformTemplate(cap - shown);
|
|
2716
|
+
}
|
|
2709
2717
|
},
|
|
2710
2718
|
resolved.animation
|
|
2711
2719
|
);
|
|
@@ -4237,6 +4245,9 @@ function visualViewportFeature() {
|
|
|
4237
4245
|
|
|
4238
4246
|
// src/core/features/content-fit.ts
|
|
4239
4247
|
var INSET_VAR = "--bs-content-inset";
|
|
4248
|
+
var SIZE_VAR = "--bs-size";
|
|
4249
|
+
var CAP_VAR = "--bs-max-size";
|
|
4250
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4240
4251
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4241
4252
|
function contentFitFeature() {
|
|
4242
4253
|
return {
|
|
@@ -4250,6 +4261,8 @@ function contentFitFeature() {
|
|
|
4250
4261
|
let inset = 0;
|
|
4251
4262
|
let unpaddedMax = -1;
|
|
4252
4263
|
let top = 0;
|
|
4264
|
+
let resting = false;
|
|
4265
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4253
4266
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4254
4267
|
const follow = (size) => {
|
|
4255
4268
|
if (unpaddedMax < 0) {
|
|
@@ -4265,21 +4278,36 @@ function contentFitFeature() {
|
|
|
4265
4278
|
const settle = () => {
|
|
4266
4279
|
if (ctx.isDestroyed()) return;
|
|
4267
4280
|
const size = ctx.getSize();
|
|
4268
|
-
|
|
4269
|
-
|
|
4281
|
+
if (!resting) {
|
|
4282
|
+
unpaddedMax = -1;
|
|
4283
|
+
follow(size);
|
|
4284
|
+
}
|
|
4270
4285
|
inset = hiddenAt(size);
|
|
4271
|
-
|
|
4286
|
+
put(INSET_VAR, inset);
|
|
4287
|
+
put(SIZE_VAR, size);
|
|
4288
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4289
|
+
if (!resting) {
|
|
4290
|
+
resting = true;
|
|
4291
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4292
|
+
}
|
|
4272
4293
|
unpaddedMax = -1;
|
|
4273
4294
|
};
|
|
4295
|
+
const move = (size) => {
|
|
4296
|
+
if (resting) {
|
|
4297
|
+
resting = false;
|
|
4298
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4299
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4300
|
+
}
|
|
4301
|
+
follow(size);
|
|
4302
|
+
};
|
|
4274
4303
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4275
4304
|
const whenIdle = () => {
|
|
4276
4305
|
if (!moving()) settle();
|
|
4277
4306
|
};
|
|
4278
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4279
4307
|
settle();
|
|
4280
4308
|
const offProgress = ctx.on(
|
|
4281
4309
|
"progress",
|
|
4282
|
-
(p) => moving() ?
|
|
4310
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4283
4311
|
);
|
|
4284
4312
|
const offSnap = ctx.on("snap", settle);
|
|
4285
4313
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4291,7 +4319,9 @@ function contentFitFeature() {
|
|
|
4291
4319
|
observer?.disconnect();
|
|
4292
4320
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4293
4321
|
sheet.removeAttribute(FIT_ATTR);
|
|
4294
|
-
|
|
4322
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4323
|
+
sheet.style.removeProperty(name);
|
|
4324
|
+
}
|
|
4295
4325
|
};
|
|
4296
4326
|
}
|
|
4297
4327
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surdeddd/bottom-sheet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"description": "Universal, headless bottom sheet — framework-agnostic core with React, Vue 3, Svelte, Solid, Qwik, Preact, Lit and Custom Element adapters. Pointer Events, snap points, momentum, a11y, SSR-safe.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -240,37 +240,37 @@
|
|
|
240
240
|
{
|
|
241
241
|
"name": "core (engine + types)",
|
|
242
242
|
"path": "dist/index.js",
|
|
243
|
-
"limit": "22.
|
|
243
|
+
"limit": "22.22 KB",
|
|
244
244
|
"gzip": true
|
|
245
245
|
},
|
|
246
246
|
{
|
|
247
247
|
"name": "react adapter",
|
|
248
248
|
"path": "dist/react.js",
|
|
249
|
-
"limit": "29.
|
|
249
|
+
"limit": "29.71 KB",
|
|
250
250
|
"gzip": true
|
|
251
251
|
},
|
|
252
252
|
{
|
|
253
253
|
"name": "vue adapter",
|
|
254
254
|
"path": "dist/vue.js",
|
|
255
|
-
"limit": "25.
|
|
255
|
+
"limit": "25.43 KB",
|
|
256
256
|
"gzip": true
|
|
257
257
|
},
|
|
258
258
|
{
|
|
259
259
|
"name": "svelte adapter",
|
|
260
260
|
"path": "dist/svelte.js",
|
|
261
|
-
"limit": "
|
|
261
|
+
"limit": "25.11 KB",
|
|
262
262
|
"gzip": true
|
|
263
263
|
},
|
|
264
264
|
{
|
|
265
265
|
"name": "solid adapter",
|
|
266
266
|
"path": "dist/solid.js",
|
|
267
|
-
"limit": "23.
|
|
267
|
+
"limit": "23.74 KB",
|
|
268
268
|
"gzip": true
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
271
|
"name": "qwik adapter",
|
|
272
272
|
"path": "dist/qwik.js",
|
|
273
|
-
"limit": "23.
|
|
273
|
+
"limit": "23.78 KB",
|
|
274
274
|
"gzip": true
|
|
275
275
|
},
|
|
276
276
|
{
|
|
@@ -285,13 +285,13 @@
|
|
|
285
285
|
{
|
|
286
286
|
"name": "web component (self-contained)",
|
|
287
287
|
"path": "dist/element.js",
|
|
288
|
-
"limit": "
|
|
288
|
+
"limit": "29 KB",
|
|
289
289
|
"gzip": true
|
|
290
290
|
},
|
|
291
291
|
{
|
|
292
292
|
"name": "web component (IIFE / CDN)",
|
|
293
293
|
"path": "dist/element.iife.global.js",
|
|
294
|
-
"limit": "28.
|
|
294
|
+
"limit": "28.57 KB",
|
|
295
295
|
"gzip": true
|
|
296
296
|
},
|
|
297
297
|
{
|
|
@@ -309,13 +309,13 @@
|
|
|
309
309
|
{
|
|
310
310
|
"name": "slim core (subpath, no optional features)",
|
|
311
311
|
"path": "dist/core.js",
|
|
312
|
-
"limit": "19.
|
|
312
|
+
"limit": "19.89 KB",
|
|
313
313
|
"gzip": true
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
"name": "features (subpath)",
|
|
317
317
|
"path": "dist/features.js",
|
|
318
|
-
"limit": "2.
|
|
318
|
+
"limit": "2.72 KB",
|
|
319
319
|
"gzip": true
|
|
320
320
|
},
|
|
321
321
|
{
|