@surdeddd/bottom-sheet 0.21.1 → 0.21.2

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/core.cjs CHANGED
@@ -375,14 +375,26 @@ function notifyLinkedSheets(sheets, self) {
375
375
  }
376
376
  }
377
377
 
378
+ // src/core/primitives/hot-path-thresholds.ts
379
+ var SIZE_WRITE_EPSILON = 0.5;
380
+ var OPACITY_WRITE_EPSILON = 5e-3;
381
+ var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
382
+ var RANGE_DIVISION_EPSILON = 1e-4;
383
+
378
384
  // src/core/features/resize-observer.ts
379
385
  function installResizeObserver(deps) {
380
386
  if (typeof window === "undefined") {
381
387
  return () => {
382
388
  };
383
389
  }
390
+ const seatFor = () => {
391
+ const snap = deps.resolveActiveSnap();
392
+ const max = deps.getMaxAxisSize();
393
+ return { target: snap ? Math.min(snap.size, max) : null, max };
394
+ };
384
395
  const onResize = () => {
385
396
  if (deps.isDestroyed()) return;
397
+ const before = seatFor();
386
398
  deps.recomputeSnaps();
387
399
  const mode = deps.getMode();
388
400
  const isVerticalAxis = mode === "bottom" || mode === "top";
@@ -391,6 +403,10 @@ function installResizeObserver(deps) {
391
403
  if (viewportSize2 > 0 && viewportSize2 < max) {
392
404
  deps.setMaxAxisSize(viewportSize2);
393
405
  }
406
+ const after = seatFor();
407
+ if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
408
+ return;
409
+ }
394
410
  const wasAnimating = deps.isAnimating?.() ?? false;
395
411
  deps.cancelInFlight();
396
412
  deps.newCycle();
@@ -659,12 +675,6 @@ var SCRIM_PRESETS = Object.freeze({
659
675
  }
660
676
  });
661
677
 
662
- // src/core/primitives/hot-path-thresholds.ts
663
- var SIZE_WRITE_EPSILON = 0.5;
664
- var OPACITY_WRITE_EPSILON = 5e-3;
665
- var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
666
- var RANGE_DIVISION_EPSILON = 1e-4;
667
-
668
678
  // src/core/primitives/opacity-dedup.ts
669
679
  var WriteSentinel = class {
670
680
  constructor() {
package/dist/core.js CHANGED
@@ -373,14 +373,26 @@ function notifyLinkedSheets(sheets, self) {
373
373
  }
374
374
  }
375
375
 
376
+ // src/core/primitives/hot-path-thresholds.ts
377
+ var SIZE_WRITE_EPSILON = 0.5;
378
+ var OPACITY_WRITE_EPSILON = 5e-3;
379
+ var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
380
+ var RANGE_DIVISION_EPSILON = 1e-4;
381
+
376
382
  // src/core/features/resize-observer.ts
377
383
  function installResizeObserver(deps) {
378
384
  if (typeof window === "undefined") {
379
385
  return () => {
380
386
  };
381
387
  }
388
+ const seatFor = () => {
389
+ const snap = deps.resolveActiveSnap();
390
+ const max = deps.getMaxAxisSize();
391
+ return { target: snap ? Math.min(snap.size, max) : null, max };
392
+ };
382
393
  const onResize = () => {
383
394
  if (deps.isDestroyed()) return;
395
+ const before = seatFor();
384
396
  deps.recomputeSnaps();
385
397
  const mode = deps.getMode();
386
398
  const isVerticalAxis = mode === "bottom" || mode === "top";
@@ -389,6 +401,10 @@ function installResizeObserver(deps) {
389
401
  if (viewportSize2 > 0 && viewportSize2 < max) {
390
402
  deps.setMaxAxisSize(viewportSize2);
391
403
  }
404
+ const after = seatFor();
405
+ if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
406
+ return;
407
+ }
392
408
  const wasAnimating = deps.isAnimating?.() ?? false;
393
409
  deps.cancelInFlight();
394
410
  deps.newCycle();
@@ -657,12 +673,6 @@ var SCRIM_PRESETS = Object.freeze({
657
673
  }
658
674
  });
659
675
 
660
- // src/core/primitives/hot-path-thresholds.ts
661
- var SIZE_WRITE_EPSILON = 0.5;
662
- var OPACITY_WRITE_EPSILON = 5e-3;
663
- var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
664
- var RANGE_DIVISION_EPSILON = 1e-4;
665
-
666
676
  // src/core/primitives/opacity-dedup.ts
667
677
  var WriteSentinel = class {
668
678
  constructor() {
package/dist/element.cjs CHANGED
@@ -433,14 +433,31 @@ var init_linked_sheets = __esm({
433
433
  }
434
434
  });
435
435
 
436
+ // src/core/primitives/hot-path-thresholds.ts
437
+ var SIZE_WRITE_EPSILON, OPACITY_WRITE_EPSILON, POINTER_EVENTS_OPACITY_THRESHOLD, RANGE_DIVISION_EPSILON;
438
+ var init_hot_path_thresholds = __esm({
439
+ "src/core/primitives/hot-path-thresholds.ts"() {
440
+ SIZE_WRITE_EPSILON = 0.5;
441
+ OPACITY_WRITE_EPSILON = 5e-3;
442
+ POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
443
+ RANGE_DIVISION_EPSILON = 1e-4;
444
+ }
445
+ });
446
+
436
447
  // src/core/features/resize-observer.ts
437
448
  function installResizeObserver(deps) {
438
449
  if (typeof window === "undefined") {
439
450
  return () => {
440
451
  };
441
452
  }
453
+ const seatFor = () => {
454
+ const snap = deps.resolveActiveSnap();
455
+ const max = deps.getMaxAxisSize();
456
+ return { target: snap ? Math.min(snap.size, max) : null, max };
457
+ };
442
458
  const onResize = () => {
443
459
  if (deps.isDestroyed()) return;
460
+ const before = seatFor();
444
461
  deps.recomputeSnaps();
445
462
  const mode = deps.getMode();
446
463
  const isVerticalAxis = mode === "bottom" || mode === "top";
@@ -449,6 +466,10 @@ function installResizeObserver(deps) {
449
466
  if (viewportSize2 > 0 && viewportSize2 < max) {
450
467
  deps.setMaxAxisSize(viewportSize2);
451
468
  }
469
+ const after = seatFor();
470
+ if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
471
+ return;
472
+ }
452
473
  const wasAnimating = deps.isAnimating?.() ?? false;
453
474
  deps.cancelInFlight();
454
475
  deps.newCycle();
@@ -483,6 +504,7 @@ function installResizeObserver(deps) {
483
504
  }
484
505
  var init_resize_observer = __esm({
485
506
  "src/core/features/resize-observer.ts"() {
507
+ init_hot_path_thresholds();
486
508
  }
487
509
  });
488
510
 
@@ -747,17 +769,6 @@ var init_types = __esm({
747
769
  }
748
770
  });
749
771
 
750
- // src/core/primitives/hot-path-thresholds.ts
751
- var SIZE_WRITE_EPSILON, OPACITY_WRITE_EPSILON, POINTER_EVENTS_OPACITY_THRESHOLD, RANGE_DIVISION_EPSILON;
752
- var init_hot_path_thresholds = __esm({
753
- "src/core/primitives/hot-path-thresholds.ts"() {
754
- SIZE_WRITE_EPSILON = 0.5;
755
- OPACITY_WRITE_EPSILON = 5e-3;
756
- POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
757
- RANGE_DIVISION_EPSILON = 1e-4;
758
- }
759
- });
760
-
761
772
  // src/core/primitives/opacity-dedup.ts
762
773
  var WriteSentinel;
763
774
  var init_opacity_dedup = __esm({