@surdeddd/bottom-sheet 0.11.0 → 0.12.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 +16 -0
- package/dist/{BottomSheetEngine-DzsIwD28.d.cts → BottomSheetEngine-D6oiEfZ4.d.cts} +1 -0
- package/dist/{BottomSheetEngine-DRjCU73e.d.ts → BottomSheetEngine-Dhy0X_e9.d.ts} +1 -0
- package/dist/element.cjs +27 -17
- package/dist/element.d.cts +1 -1
- package/dist/element.d.ts +1 -1
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +27 -17
- package/dist/index.cjs +26 -16
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -16
- 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 +7 -3
- package/dist/overlay.js +7 -3
- package/dist/preact.d.cts +1 -1
- package/dist/preact.d.ts +1 -1
- package/dist/qwik.cjs +26 -16
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +26 -16
- package/dist/react.cjs +26 -16
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +26 -16
- package/dist/solid.cjs +26 -16
- package/dist/solid.d.cts +1 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +26 -16
- package/dist/solid.source.jsx +26 -16
- package/dist/svelte-core.cjs +26 -16
- package/dist/svelte-core.js +26 -16
- package/dist/svelte.cjs +26 -16
- package/dist/svelte.js +26 -16
- package/dist/vue.cjs +26 -16
- package/dist/vue.js +26 -16
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -317,6 +317,14 @@ engine.depth(); // open sheets above this one
|
|
|
317
317
|
engine.destroy(); // remove listeners + cancel animation
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
+
`initial` starts the sheet **born open** at any snap whose size resolves `> 0`
|
|
321
|
+
(no `open` / `opened` event fires — there is no transition to announce). Calling
|
|
322
|
+
`open()` / `snapTo()` **synchronously in the mount tick is safe** — no
|
|
323
|
+
`requestAnimationFrame` / `nextTick` delay is needed, including `fit` / `content`
|
|
324
|
+
and teleported sheets. A sheet mounted hidden (`display:none` ancestor) heals
|
|
325
|
+
and emits its open sequence once on reveal. See
|
|
326
|
+
[Architecture → Opening at construction](docs/ARCHITECTURE.md).
|
|
327
|
+
|
|
320
328
|
### Scrim runtime API
|
|
321
329
|
|
|
322
330
|
The scrim is the dim layer behind/around the sheet (`screenComponent`). All
|
|
@@ -408,6 +416,14 @@ element — drive any CSS animation from drag without touching JS:
|
|
|
408
416
|
}
|
|
409
417
|
```
|
|
410
418
|
|
|
419
|
+
> **z-index is engine-owned.** The stack controller rewrites inline `z-index` on
|
|
420
|
+
> `.bs-sheet`, `.bs-backdrop` and anchor wrappers on every stack change (base
|
|
421
|
+
> `100`, step `10` per depth), so a value you set is overwritten and races the
|
|
422
|
+
> stack. To position the sheet layer against app UI, move the container
|
|
423
|
+
> (teleport target / `.bs-root` parent) or change the open order — don't style
|
|
424
|
+
> `z-index` on bs-managed elements. See
|
|
425
|
+
> [Architecture → z-index & the sheet stack](docs/ARCHITECTURE.md).
|
|
426
|
+
|
|
411
427
|
### Scrim, blur & high contrast
|
|
412
428
|
|
|
413
429
|
| Token | Default | Region |
|
package/dist/element.cjs
CHANGED
|
@@ -553,7 +553,7 @@ function restore(entry) {
|
|
|
553
553
|
entry.live = true;
|
|
554
554
|
runInternal(() => {
|
|
555
555
|
try {
|
|
556
|
-
history.pushState(entry.surface
|
|
556
|
+
history.pushState(brandMarker(entry.surface), "", entry.surface.url);
|
|
557
557
|
} catch {
|
|
558
558
|
entry.live = false;
|
|
559
559
|
}
|
|
@@ -571,7 +571,7 @@ function pushBackMarker(surface) {
|
|
|
571
571
|
entry.priorUrl = surface.url !== void 0 ? location.href : void 0;
|
|
572
572
|
runInternal(() => {
|
|
573
573
|
try {
|
|
574
|
-
history.pushState(surface
|
|
574
|
+
history.pushState(brandMarker(surface), "", surface.url);
|
|
575
575
|
entry.live = true;
|
|
576
576
|
} catch {
|
|
577
577
|
entry.live = false;
|
|
@@ -597,7 +597,7 @@ function popBackMarker(handle) {
|
|
|
597
597
|
pendingRebrand = () => {
|
|
598
598
|
runInternal(() => {
|
|
599
599
|
history.replaceState(
|
|
600
|
-
rebrandSurface
|
|
600
|
+
brandMarker(rebrandSurface),
|
|
601
601
|
"",
|
|
602
602
|
rebrandUrl !== void 0 ? rebrandUrl : location.href
|
|
603
603
|
);
|
|
@@ -628,7 +628,7 @@ function subscribeRouteChange(fn) {
|
|
|
628
628
|
maybeTeardownListener();
|
|
629
629
|
};
|
|
630
630
|
}
|
|
631
|
-
var entries, subscribers, suppress, internalDepth, pendingRebrand, listenerInstalled, patchInstalled, origPushState, origReplaceState, patchedPushState, patchedReplaceState, hasWindow, hasHistory, runInternal, notifyRouteChange, ensureListener, maybeTeardownListener, installPatch, removePatch;
|
|
631
|
+
var entries, subscribers, suppress, internalDepth, pendingRebrand, listenerInstalled, patchInstalled, origPushState, origReplaceState, patchedPushState, patchedReplaceState, hasWindow, hasHistory, brandMarker, runInternal, notifyRouteChange, ensureListener, maybeTeardownListener, installPatch, removePatch;
|
|
632
632
|
var init_history_coordinator = __esm({
|
|
633
633
|
"src/core/features/history-coordinator.ts"() {
|
|
634
634
|
entries = [];
|
|
@@ -644,6 +644,10 @@ var init_history_coordinator = __esm({
|
|
|
644
644
|
patchedReplaceState = null;
|
|
645
645
|
hasWindow = () => typeof window !== "undefined";
|
|
646
646
|
hasHistory = () => typeof history !== "undefined";
|
|
647
|
+
brandMarker = (surface) => ({
|
|
648
|
+
...surface.markerState(),
|
|
649
|
+
__bs: true
|
|
650
|
+
});
|
|
647
651
|
runInternal = (fn) => {
|
|
648
652
|
internalDepth += 1;
|
|
649
653
|
try {
|
|
@@ -1046,11 +1050,15 @@ var init_fit_measurement = __esm({
|
|
|
1046
1050
|
"src/core/features/fit-measurement.ts"() {
|
|
1047
1051
|
init_transform();
|
|
1048
1052
|
measureSheetNatural = (element, content, vertical) => {
|
|
1049
|
-
if (!content) {
|
|
1050
|
-
return vertical ? element.offsetHeight : element.offsetWidth;
|
|
1051
|
-
}
|
|
1052
1053
|
const axis = vertical ? "height" : "width";
|
|
1053
1054
|
const sheetStyle = element.style;
|
|
1055
|
+
if (!content) {
|
|
1056
|
+
const prev = sheetStyle[axis];
|
|
1057
|
+
sheetStyle[axis] = "auto";
|
|
1058
|
+
const poked2 = vertical ? element.offsetHeight : element.offsetWidth;
|
|
1059
|
+
sheetStyle[axis] = prev;
|
|
1060
|
+
return poked2;
|
|
1061
|
+
}
|
|
1054
1062
|
const cs = content.style;
|
|
1055
1063
|
const prevSheet = sheetStyle[axis];
|
|
1056
1064
|
const prevFlex = cs.flex;
|
|
@@ -3147,12 +3155,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
3147
3155
|
if (!entry.isIntersecting) continue;
|
|
3148
3156
|
if (this.destroyed) return;
|
|
3149
3157
|
this.snaps.recompute();
|
|
3150
|
-
|
|
3151
|
-
if (current) {
|
|
3152
|
-
this.size = current.size;
|
|
3153
|
-
this.applySize(this.size);
|
|
3154
|
-
this.updateAriaSlider();
|
|
3155
|
-
}
|
|
3158
|
+
this.healActiveSnap();
|
|
3156
3159
|
io.disconnect();
|
|
3157
3160
|
return;
|
|
3158
3161
|
}
|
|
@@ -3316,6 +3319,8 @@ var init_BottomSheetEngine = __esm({
|
|
|
3316
3319
|
const vt = document.startViewTransition(() => {
|
|
3317
3320
|
this.applySize(target.size);
|
|
3318
3321
|
});
|
|
3322
|
+
vt.ready?.catch(() => {
|
|
3323
|
+
});
|
|
3319
3324
|
this.currentViewTransition = vt;
|
|
3320
3325
|
try {
|
|
3321
3326
|
await vt.finished;
|
|
@@ -3567,11 +3572,16 @@ var init_BottomSheetEngine = __esm({
|
|
|
3567
3572
|
this.maxHeight.clampTo();
|
|
3568
3573
|
this.scrim.invalidateOpacityCache();
|
|
3569
3574
|
if (this.gesture?.isDragging) return;
|
|
3575
|
+
this.healActiveSnap();
|
|
3576
|
+
}
|
|
3577
|
+
healActiveSnap() {
|
|
3570
3578
|
const current = this.snaps.findById(this.activeId);
|
|
3571
|
-
if (current)
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3579
|
+
if (!current) return;
|
|
3580
|
+
this.size = current.size;
|
|
3581
|
+
this.applySize(this.size);
|
|
3582
|
+
this.updateAriaSlider();
|
|
3583
|
+
if (this.size > 0 && !this.lifecycle.isInstalled && !this.opening && !this.animation.isAnimating) {
|
|
3584
|
+
this.emitOpenSequence(this.activeId);
|
|
3575
3585
|
}
|
|
3576
3586
|
}
|
|
3577
3587
|
destroy() {
|
package/dist/element.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-
|
|
1
|
+
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-D6oiEfZ4.cjs';
|
|
2
2
|
import './transform-jVfAikE9.cjs';
|
|
3
3
|
|
|
4
4
|
declare const BaseHTMLElement: typeof HTMLElement;
|
package/dist/element.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-
|
|
1
|
+
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-Dhy0X_e9.js';
|
|
2
2
|
import './transform-jVfAikE9.js';
|
|
3
3
|
|
|
4
4
|
declare const BaseHTMLElement: typeof HTMLElement;
|