@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/dist/svelte.cjs CHANGED
@@ -476,6 +476,10 @@ var patchedPushState = null;
476
476
  var patchedReplaceState = null;
477
477
  var hasWindow = () => typeof window !== "undefined";
478
478
  var hasHistory = () => typeof history !== "undefined";
479
+ var brandMarker = (surface) => ({
480
+ ...surface.markerState(),
481
+ __bs: true
482
+ });
479
483
  var runInternal = (fn) => {
480
484
  internalDepth += 1;
481
485
  try {
@@ -577,7 +581,7 @@ function restore(entry) {
577
581
  entry.live = true;
578
582
  runInternal(() => {
579
583
  try {
580
- history.pushState(entry.surface.markerState(), "", entry.surface.url);
584
+ history.pushState(brandMarker(entry.surface), "", entry.surface.url);
581
585
  } catch {
582
586
  entry.live = false;
583
587
  }
@@ -595,7 +599,7 @@ function pushBackMarker(surface) {
595
599
  entry.priorUrl = surface.url !== void 0 ? location.href : void 0;
596
600
  runInternal(() => {
597
601
  try {
598
- history.pushState(surface.markerState(), "", surface.url);
602
+ history.pushState(brandMarker(surface), "", surface.url);
599
603
  entry.live = true;
600
604
  } catch {
601
605
  entry.live = false;
@@ -621,7 +625,7 @@ function popBackMarker(handle) {
621
625
  pendingRebrand = () => {
622
626
  runInternal(() => {
623
627
  history.replaceState(
624
- rebrandSurface.markerState(),
628
+ brandMarker(rebrandSurface),
625
629
  "",
626
630
  rebrandUrl !== void 0 ? rebrandUrl : location.href
627
631
  );
@@ -965,11 +969,15 @@ function createMaxHeightController(deps) {
965
969
 
966
970
  // src/core/features/fit-measurement.ts
967
971
  var measureSheetNatural = (element, content, vertical) => {
968
- if (!content) {
969
- return vertical ? element.offsetHeight : element.offsetWidth;
970
- }
971
972
  const axis = vertical ? "height" : "width";
972
973
  const sheetStyle = element.style;
974
+ if (!content) {
975
+ const prev = sheetStyle[axis];
976
+ sheetStyle[axis] = "auto";
977
+ const poked2 = vertical ? element.offsetHeight : element.offsetWidth;
978
+ sheetStyle[axis] = prev;
979
+ return poked2;
980
+ }
973
981
  const cs = content.style;
974
982
  const prevSheet = sheetStyle[axis];
975
983
  const prevFlex = cs.flex;
@@ -2890,12 +2898,7 @@ var BottomSheetEngine = class {
2890
2898
  if (!entry.isIntersecting) continue;
2891
2899
  if (this.destroyed) return;
2892
2900
  this.snaps.recompute();
2893
- const current = this.snaps.findById(this.activeId);
2894
- if (current) {
2895
- this.size = current.size;
2896
- this.applySize(this.size);
2897
- this.updateAriaSlider();
2898
- }
2901
+ this.healActiveSnap();
2899
2902
  io.disconnect();
2900
2903
  return;
2901
2904
  }
@@ -3059,6 +3062,8 @@ var BottomSheetEngine = class {
3059
3062
  const vt = document.startViewTransition(() => {
3060
3063
  this.applySize(target.size);
3061
3064
  });
3065
+ vt.ready?.catch(() => {
3066
+ });
3062
3067
  this.currentViewTransition = vt;
3063
3068
  try {
3064
3069
  await vt.finished;
@@ -3310,11 +3315,16 @@ var BottomSheetEngine = class {
3310
3315
  this.maxHeight.clampTo();
3311
3316
  this.scrim.invalidateOpacityCache();
3312
3317
  if (this.gesture?.isDragging) return;
3318
+ this.healActiveSnap();
3319
+ }
3320
+ healActiveSnap() {
3313
3321
  const current = this.snaps.findById(this.activeId);
3314
- if (current) {
3315
- this.size = current.size;
3316
- this.applySize(this.size);
3317
- this.updateAriaSlider();
3322
+ if (!current) return;
3323
+ this.size = current.size;
3324
+ this.applySize(this.size);
3325
+ this.updateAriaSlider();
3326
+ if (this.size > 0 && !this.lifecycle.isInstalled && !this.opening && !this.animation.isAnimating) {
3327
+ this.emitOpenSequence(this.activeId);
3318
3328
  }
3319
3329
  }
3320
3330
  destroy() {
package/dist/svelte.js CHANGED
@@ -454,6 +454,10 @@ var patchedPushState = null;
454
454
  var patchedReplaceState = null;
455
455
  var hasWindow = () => typeof window !== "undefined";
456
456
  var hasHistory = () => typeof history !== "undefined";
457
+ var brandMarker = (surface) => ({
458
+ ...surface.markerState(),
459
+ __bs: true
460
+ });
457
461
  var runInternal = (fn) => {
458
462
  internalDepth += 1;
459
463
  try {
@@ -555,7 +559,7 @@ function restore(entry) {
555
559
  entry.live = true;
556
560
  runInternal(() => {
557
561
  try {
558
- history.pushState(entry.surface.markerState(), "", entry.surface.url);
562
+ history.pushState(brandMarker(entry.surface), "", entry.surface.url);
559
563
  } catch {
560
564
  entry.live = false;
561
565
  }
@@ -573,7 +577,7 @@ function pushBackMarker(surface) {
573
577
  entry.priorUrl = surface.url !== void 0 ? location.href : void 0;
574
578
  runInternal(() => {
575
579
  try {
576
- history.pushState(surface.markerState(), "", surface.url);
580
+ history.pushState(brandMarker(surface), "", surface.url);
577
581
  entry.live = true;
578
582
  } catch {
579
583
  entry.live = false;
@@ -599,7 +603,7 @@ function popBackMarker(handle) {
599
603
  pendingRebrand = () => {
600
604
  runInternal(() => {
601
605
  history.replaceState(
602
- rebrandSurface.markerState(),
606
+ brandMarker(rebrandSurface),
603
607
  "",
604
608
  rebrandUrl !== void 0 ? rebrandUrl : location.href
605
609
  );
@@ -943,11 +947,15 @@ function createMaxHeightController(deps) {
943
947
 
944
948
  // src/core/features/fit-measurement.ts
945
949
  var measureSheetNatural = (element, content, vertical) => {
946
- if (!content) {
947
- return vertical ? element.offsetHeight : element.offsetWidth;
948
- }
949
950
  const axis = vertical ? "height" : "width";
950
951
  const sheetStyle = element.style;
952
+ if (!content) {
953
+ const prev = sheetStyle[axis];
954
+ sheetStyle[axis] = "auto";
955
+ const poked2 = vertical ? element.offsetHeight : element.offsetWidth;
956
+ sheetStyle[axis] = prev;
957
+ return poked2;
958
+ }
951
959
  const cs = content.style;
952
960
  const prevSheet = sheetStyle[axis];
953
961
  const prevFlex = cs.flex;
@@ -2868,12 +2876,7 @@ var BottomSheetEngine = class {
2868
2876
  if (!entry.isIntersecting) continue;
2869
2877
  if (this.destroyed) return;
2870
2878
  this.snaps.recompute();
2871
- const current = this.snaps.findById(this.activeId);
2872
- if (current) {
2873
- this.size = current.size;
2874
- this.applySize(this.size);
2875
- this.updateAriaSlider();
2876
- }
2879
+ this.healActiveSnap();
2877
2880
  io.disconnect();
2878
2881
  return;
2879
2882
  }
@@ -3037,6 +3040,8 @@ var BottomSheetEngine = class {
3037
3040
  const vt = document.startViewTransition(() => {
3038
3041
  this.applySize(target.size);
3039
3042
  });
3043
+ vt.ready?.catch(() => {
3044
+ });
3040
3045
  this.currentViewTransition = vt;
3041
3046
  try {
3042
3047
  await vt.finished;
@@ -3288,11 +3293,16 @@ var BottomSheetEngine = class {
3288
3293
  this.maxHeight.clampTo();
3289
3294
  this.scrim.invalidateOpacityCache();
3290
3295
  if (this.gesture?.isDragging) return;
3296
+ this.healActiveSnap();
3297
+ }
3298
+ healActiveSnap() {
3291
3299
  const current = this.snaps.findById(this.activeId);
3292
- if (current) {
3293
- this.size = current.size;
3294
- this.applySize(this.size);
3295
- this.updateAriaSlider();
3300
+ if (!current) return;
3301
+ this.size = current.size;
3302
+ this.applySize(this.size);
3303
+ this.updateAriaSlider();
3304
+ if (this.size > 0 && !this.lifecycle.isInstalled && !this.opening && !this.animation.isAnimating) {
3305
+ this.emitOpenSequence(this.activeId);
3296
3306
  }
3297
3307
  }
3298
3308
  destroy() {
package/dist/vue.cjs CHANGED
@@ -454,6 +454,10 @@ var patchedPushState = null;
454
454
  var patchedReplaceState = null;
455
455
  var hasWindow = () => typeof window !== "undefined";
456
456
  var hasHistory = () => typeof history !== "undefined";
457
+ var brandMarker = (surface) => ({
458
+ ...surface.markerState(),
459
+ __bs: true
460
+ });
457
461
  var runInternal = (fn) => {
458
462
  internalDepth += 1;
459
463
  try {
@@ -555,7 +559,7 @@ function restore(entry) {
555
559
  entry.live = true;
556
560
  runInternal(() => {
557
561
  try {
558
- history.pushState(entry.surface.markerState(), "", entry.surface.url);
562
+ history.pushState(brandMarker(entry.surface), "", entry.surface.url);
559
563
  } catch {
560
564
  entry.live = false;
561
565
  }
@@ -573,7 +577,7 @@ function pushBackMarker(surface) {
573
577
  entry.priorUrl = surface.url !== void 0 ? location.href : void 0;
574
578
  runInternal(() => {
575
579
  try {
576
- history.pushState(surface.markerState(), "", surface.url);
580
+ history.pushState(brandMarker(surface), "", surface.url);
577
581
  entry.live = true;
578
582
  } catch {
579
583
  entry.live = false;
@@ -599,7 +603,7 @@ function popBackMarker(handle) {
599
603
  pendingRebrand = () => {
600
604
  runInternal(() => {
601
605
  history.replaceState(
602
- rebrandSurface.markerState(),
606
+ brandMarker(rebrandSurface),
603
607
  "",
604
608
  rebrandUrl !== void 0 ? rebrandUrl : location.href
605
609
  );
@@ -943,11 +947,15 @@ function createMaxHeightController(deps) {
943
947
 
944
948
  // src/core/features/fit-measurement.ts
945
949
  var measureSheetNatural = (element, content, vertical) => {
946
- if (!content) {
947
- return vertical ? element.offsetHeight : element.offsetWidth;
948
- }
949
950
  const axis = vertical ? "height" : "width";
950
951
  const sheetStyle = element.style;
952
+ if (!content) {
953
+ const prev = sheetStyle[axis];
954
+ sheetStyle[axis] = "auto";
955
+ const poked2 = vertical ? element.offsetHeight : element.offsetWidth;
956
+ sheetStyle[axis] = prev;
957
+ return poked2;
958
+ }
951
959
  const cs = content.style;
952
960
  const prevSheet = sheetStyle[axis];
953
961
  const prevFlex = cs.flex;
@@ -2868,12 +2876,7 @@ var BottomSheetEngine = class {
2868
2876
  if (!entry.isIntersecting) continue;
2869
2877
  if (this.destroyed) return;
2870
2878
  this.snaps.recompute();
2871
- const current = this.snaps.findById(this.activeId);
2872
- if (current) {
2873
- this.size = current.size;
2874
- this.applySize(this.size);
2875
- this.updateAriaSlider();
2876
- }
2879
+ this.healActiveSnap();
2877
2880
  io.disconnect();
2878
2881
  return;
2879
2882
  }
@@ -3037,6 +3040,8 @@ var BottomSheetEngine = class {
3037
3040
  const vt = document.startViewTransition(() => {
3038
3041
  this.applySize(target.size);
3039
3042
  });
3043
+ vt.ready?.catch(() => {
3044
+ });
3040
3045
  this.currentViewTransition = vt;
3041
3046
  try {
3042
3047
  await vt.finished;
@@ -3288,11 +3293,16 @@ var BottomSheetEngine = class {
3288
3293
  this.maxHeight.clampTo();
3289
3294
  this.scrim.invalidateOpacityCache();
3290
3295
  if (this.gesture?.isDragging) return;
3296
+ this.healActiveSnap();
3297
+ }
3298
+ healActiveSnap() {
3291
3299
  const current = this.snaps.findById(this.activeId);
3292
- if (current) {
3293
- this.size = current.size;
3294
- this.applySize(this.size);
3295
- this.updateAriaSlider();
3300
+ if (!current) return;
3301
+ this.size = current.size;
3302
+ this.applySize(this.size);
3303
+ this.updateAriaSlider();
3304
+ if (this.size > 0 && !this.lifecycle.isInstalled && !this.opening && !this.animation.isAnimating) {
3305
+ this.emitOpenSequence(this.activeId);
3296
3306
  }
3297
3307
  }
3298
3308
  destroy() {
package/dist/vue.js CHANGED
@@ -452,6 +452,10 @@ var patchedPushState = null;
452
452
  var patchedReplaceState = null;
453
453
  var hasWindow = () => typeof window !== "undefined";
454
454
  var hasHistory = () => typeof history !== "undefined";
455
+ var brandMarker = (surface) => ({
456
+ ...surface.markerState(),
457
+ __bs: true
458
+ });
455
459
  var runInternal = (fn) => {
456
460
  internalDepth += 1;
457
461
  try {
@@ -553,7 +557,7 @@ function restore(entry) {
553
557
  entry.live = true;
554
558
  runInternal(() => {
555
559
  try {
556
- history.pushState(entry.surface.markerState(), "", entry.surface.url);
560
+ history.pushState(brandMarker(entry.surface), "", entry.surface.url);
557
561
  } catch {
558
562
  entry.live = false;
559
563
  }
@@ -571,7 +575,7 @@ function pushBackMarker(surface) {
571
575
  entry.priorUrl = surface.url !== void 0 ? location.href : void 0;
572
576
  runInternal(() => {
573
577
  try {
574
- history.pushState(surface.markerState(), "", surface.url);
578
+ history.pushState(brandMarker(surface), "", surface.url);
575
579
  entry.live = true;
576
580
  } catch {
577
581
  entry.live = false;
@@ -597,7 +601,7 @@ function popBackMarker(handle) {
597
601
  pendingRebrand = () => {
598
602
  runInternal(() => {
599
603
  history.replaceState(
600
- rebrandSurface.markerState(),
604
+ brandMarker(rebrandSurface),
601
605
  "",
602
606
  rebrandUrl !== void 0 ? rebrandUrl : location.href
603
607
  );
@@ -941,11 +945,15 @@ function createMaxHeightController(deps) {
941
945
 
942
946
  // src/core/features/fit-measurement.ts
943
947
  var measureSheetNatural = (element, content, vertical) => {
944
- if (!content) {
945
- return vertical ? element.offsetHeight : element.offsetWidth;
946
- }
947
948
  const axis = vertical ? "height" : "width";
948
949
  const sheetStyle = element.style;
950
+ if (!content) {
951
+ const prev = sheetStyle[axis];
952
+ sheetStyle[axis] = "auto";
953
+ const poked2 = vertical ? element.offsetHeight : element.offsetWidth;
954
+ sheetStyle[axis] = prev;
955
+ return poked2;
956
+ }
949
957
  const cs = content.style;
950
958
  const prevSheet = sheetStyle[axis];
951
959
  const prevFlex = cs.flex;
@@ -2866,12 +2874,7 @@ var BottomSheetEngine = class {
2866
2874
  if (!entry.isIntersecting) continue;
2867
2875
  if (this.destroyed) return;
2868
2876
  this.snaps.recompute();
2869
- const current = this.snaps.findById(this.activeId);
2870
- if (current) {
2871
- this.size = current.size;
2872
- this.applySize(this.size);
2873
- this.updateAriaSlider();
2874
- }
2877
+ this.healActiveSnap();
2875
2878
  io.disconnect();
2876
2879
  return;
2877
2880
  }
@@ -3035,6 +3038,8 @@ var BottomSheetEngine = class {
3035
3038
  const vt = document.startViewTransition(() => {
3036
3039
  this.applySize(target.size);
3037
3040
  });
3041
+ vt.ready?.catch(() => {
3042
+ });
3038
3043
  this.currentViewTransition = vt;
3039
3044
  try {
3040
3045
  await vt.finished;
@@ -3286,11 +3291,16 @@ var BottomSheetEngine = class {
3286
3291
  this.maxHeight.clampTo();
3287
3292
  this.scrim.invalidateOpacityCache();
3288
3293
  if (this.gesture?.isDragging) return;
3294
+ this.healActiveSnap();
3295
+ }
3296
+ healActiveSnap() {
3289
3297
  const current = this.snaps.findById(this.activeId);
3290
- if (current) {
3291
- this.size = current.size;
3292
- this.applySize(this.size);
3293
- this.updateAriaSlider();
3298
+ if (!current) return;
3299
+ this.size = current.size;
3300
+ this.applySize(this.size);
3301
+ this.updateAriaSlider();
3302
+ if (this.size > 0 && !this.lifecycle.isInstalled && !this.opening && !this.animation.isAnimating) {
3303
+ this.emitOpenSequence(this.activeId);
3294
3304
  }
3295
3305
  }
3296
3306
  destroy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surdeddd/bottom-sheet",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
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",
@@ -193,7 +193,7 @@
193
193
  {
194
194
  "name": "svelte adapter",
195
195
  "path": "dist/svelte.js",
196
- "limit": "21.5 KB",
196
+ "limit": "22 KB",
197
197
  "gzip": true
198
198
  },
199
199
  {
@@ -220,7 +220,7 @@
220
220
  {
221
221
  "name": "web component (self-contained)",
222
222
  "path": "dist/element.js",
223
- "limit": "25 KB",
223
+ "limit": "25.5 KB",
224
224
  "gzip": true
225
225
  },
226
226
  {