@sprawlify/primitives 0.1.7 → 0.1.9

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.
Files changed (85) hide show
  1. package/dist/machines/accordion/index.d.cts +1 -1
  2. package/dist/machines/accordion/index.d.mts +1 -1
  3. package/dist/machines/angle-slider/index.d.cts +1 -1
  4. package/dist/machines/angle-slider/index.d.mts +1 -1
  5. package/dist/machines/carousel/index.cjs +68 -17
  6. package/dist/machines/carousel/index.d.cts +2 -2
  7. package/dist/machines/carousel/index.d.mts +2 -2
  8. package/dist/machines/carousel/index.mjs +68 -17
  9. package/dist/machines/cascade-select/index.d.cts +2 -2
  10. package/dist/machines/cascade-select/index.d.mts +2 -2
  11. package/dist/machines/clipboard/index.d.cts +1 -1
  12. package/dist/machines/clipboard/index.d.mts +1 -1
  13. package/dist/machines/collapsible/index.d.cts +1 -1
  14. package/dist/machines/collapsible/index.d.mts +1 -1
  15. package/dist/machines/color-picker/index.d.cts +1 -1
  16. package/dist/machines/color-picker/index.d.mts +1 -1
  17. package/dist/machines/combobox/index.d.cts +1 -1
  18. package/dist/machines/combobox/index.d.mts +1 -1
  19. package/dist/machines/date-picker/index.d.cts +1 -1
  20. package/dist/machines/date-picker/index.d.mts +1 -1
  21. package/dist/machines/dialog/index.d.cts +1 -1
  22. package/dist/machines/dialog/index.d.mts +1 -1
  23. package/dist/machines/drawer/index.d.cts +1 -1
  24. package/dist/machines/drawer/index.d.mts +1 -1
  25. package/dist/machines/dropdown-menu/index.d.cts +1 -1
  26. package/dist/machines/dropdown-menu/index.d.mts +1 -1
  27. package/dist/machines/editable/index.d.cts +1 -1
  28. package/dist/machines/editable/index.d.mts +1 -1
  29. package/dist/machines/file-upload/index.d.cts +1 -1
  30. package/dist/machines/file-upload/index.d.mts +1 -1
  31. package/dist/machines/floating-panel/index.d.cts +1 -1
  32. package/dist/machines/floating-panel/index.d.mts +1 -1
  33. package/dist/machines/hover-card/index.d.cts +1 -1
  34. package/dist/machines/hover-card/index.d.mts +1 -1
  35. package/dist/machines/listbox/index.d.cts +1 -1
  36. package/dist/machines/listbox/index.d.mts +1 -1
  37. package/dist/machines/marquee/index.d.cts +3 -3
  38. package/dist/machines/marquee/index.d.mts +3 -3
  39. package/dist/machines/navigation-menu/index.d.cts +1 -1
  40. package/dist/machines/navigation-menu/index.d.mts +1 -1
  41. package/dist/machines/number-input/index.d.cts +1 -1
  42. package/dist/machines/number-input/index.d.mts +1 -1
  43. package/dist/machines/password-input/index.d.cts +1 -1
  44. package/dist/machines/password-input/index.d.mts +1 -1
  45. package/dist/machines/pin-input/index.d.cts +1 -1
  46. package/dist/machines/pin-input/index.d.mts +1 -1
  47. package/dist/machines/popover/index.d.cts +1 -1
  48. package/dist/machines/popover/index.d.mts +1 -1
  49. package/dist/machines/progress/index.d.cts +1 -1
  50. package/dist/machines/progress/index.d.mts +1 -1
  51. package/dist/machines/radio-group/index.d.cts +1 -1
  52. package/dist/machines/radio-group/index.d.mts +1 -1
  53. package/dist/machines/rating-group/index.d.cts +1 -1
  54. package/dist/machines/rating-group/index.d.mts +1 -1
  55. package/dist/machines/scroll-area/index.d.cts +1 -1
  56. package/dist/machines/scroll-area/index.d.mts +1 -1
  57. package/dist/machines/select/index.d.cts +1 -1
  58. package/dist/machines/select/index.d.mts +1 -1
  59. package/dist/machines/signature-pad/index.d.cts +1 -1
  60. package/dist/machines/signature-pad/index.d.mts +1 -1
  61. package/dist/machines/slider/index.d.cts +1 -1
  62. package/dist/machines/slider/index.d.mts +1 -1
  63. package/dist/machines/splitter/index.d.cts +1 -1
  64. package/dist/machines/splitter/index.d.mts +1 -1
  65. package/dist/machines/steps/index.d.cts +1 -1
  66. package/dist/machines/steps/index.d.mts +1 -1
  67. package/dist/machines/switch/index.d.cts +1 -1
  68. package/dist/machines/switch/index.d.mts +1 -1
  69. package/dist/machines/tabs/index.d.cts +1 -1
  70. package/dist/machines/tabs/index.d.mts +1 -1
  71. package/dist/machines/tags-input/index.d.cts +1 -1
  72. package/dist/machines/tags-input/index.d.mts +1 -1
  73. package/dist/machines/timer/index.d.cts +1 -1
  74. package/dist/machines/timer/index.d.mts +1 -1
  75. package/dist/machines/toast/index.d.cts +1 -1
  76. package/dist/machines/toast/index.d.mts +1 -1
  77. package/dist/machines/tooltip/index.d.cts +1 -1
  78. package/dist/machines/tooltip/index.d.mts +1 -1
  79. package/dist/machines/tour/index.cjs +3 -3
  80. package/dist/machines/tour/index.d.cts +1 -1
  81. package/dist/machines/tour/index.d.mts +1 -1
  82. package/dist/machines/tour/index.mjs +3 -3
  83. package/dist/machines/tree-view/index.d.cts +1 -1
  84. package/dist/machines/tree-view/index.d.mts +1 -1
  85. package/package.json +1 -1
@@ -3,7 +3,7 @@ import { b as Service, p as Machine, u as EventObject } from "../../types-u-LWCS
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/accordion/accordion.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "item" | "itemTrigger" | "itemContent" | "itemIndicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "item" | "itemIndicator" | "itemContent" | "itemTrigger">;
7
7
  //#endregion
8
8
  //#region src/machines/accordion/accordion.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { b as Service, p as Machine, u as EventObject } from "../../types-DvUmCW
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/accordion/accordion.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "item" | "itemTrigger" | "itemContent" | "itemIndicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "item" | "itemIndicator" | "itemContent" | "itemTrigger">;
7
7
  //#endregion
8
8
  //#region src/machines/accordion/accordion.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { b as Service, p as Machine, u as EventObject } from "../../types-u-LWCS
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/angle-slider/angle-slider.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "track" | "label" | "thumb" | "valueText" | "control" | "markerGroup" | "marker">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "track" | "marker" | "control" | "thumb" | "valueText" | "markerGroup">;
7
7
  //#endregion
8
8
  //#region src/machines/angle-slider/angle-slider.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { b as Service, p as Machine, u as EventObject } from "../../types-DvUmCW
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/angle-slider/angle-slider.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "track" | "label" | "thumb" | "valueText" | "control" | "markerGroup" | "marker">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "track" | "marker" | "control" | "thumb" | "valueText" | "markerGroup">;
7
7
  //#endregion
8
8
  //#region src/machines/angle-slider/angle-slider.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -38,22 +38,23 @@ function connect(service, normalize) {
38
38
  const autoSize = prop("autoSize");
39
39
  const pageSnapPoints = Array.from(context.get("pageSnapPoints"));
40
40
  const page = context.get("page");
41
+ const activePage = pageSnapPoints.length ? require_utils.clampValue(page, 0, pageSnapPoints.length - 1) : 0;
41
42
  const slidesPerPage = prop("slidesPerPage");
42
43
  const padding = prop("padding");
43
44
  const translations = prop("translations");
44
45
  return {
45
46
  isPlaying,
46
47
  isDragging,
47
- page,
48
+ page: activePage,
48
49
  pageSnapPoints,
49
50
  canScrollNext,
50
51
  canScrollPrev,
51
52
  getProgress() {
52
- return page / pageSnapPoints.length;
53
+ return activePage / pageSnapPoints.length;
53
54
  },
54
55
  getProgressText() {
55
56
  const details = {
56
- page: page + 1,
57
+ page: activePage + 1,
57
58
  totalPages: pageSnapPoints.length
58
59
  };
59
60
  return translations.progressText?.(details) ?? "";
@@ -303,7 +304,7 @@ function connect(service, normalize) {
303
304
  "data-orientation": prop("orientation"),
304
305
  "data-index": props.index,
305
306
  "data-readonly": require_dom_query.dataAttr(props.readOnly),
306
- "data-current": require_dom_query.dataAttr(props.index === page),
307
+ "data-current": require_dom_query.dataAttr(props.index === activePage),
307
308
  "aria-label": translations.indicator(props.index),
308
309
  onClick(event) {
309
310
  if (event.defaultPrevented) return;
@@ -444,7 +445,7 @@ const machine = require_core.createMachine({
444
445
  target: "idle",
445
446
  actions: ["clearScrollEndTimer", "setMatchingPage"]
446
447
  },
447
- "SNAP.REFRESH": { actions: ["setSnapPoints", "clampPage"] },
448
+ "SNAP.REFRESH": { actions: ["setSnapPoints"] },
448
449
  "PAGE.SCROLL": { actions: ["scrollToPage"] }
449
450
  },
450
451
  effects: [
@@ -484,11 +485,36 @@ const machine = require_core.createMachine({
484
485
  on: {
485
486
  DRAGGING: { actions: ["scrollSlides", "invokeDragging"] },
486
487
  "DRAGGING.END": {
487
- target: "idle",
488
- actions: ["endDragging", "invokeDraggingEnd"]
488
+ target: "settling",
489
+ actions: ["endDragging"]
489
490
  }
490
491
  }
491
492
  },
493
+ settling: {
494
+ effects: ["trackSettlingScroll"],
495
+ on: {
496
+ "DRAGGING.START": {
497
+ target: "dragging",
498
+ actions: ["clearScrollEndTimer", "invokeDragStart"]
499
+ },
500
+ "SCROLL.END": [{
501
+ guard: "isFocused",
502
+ target: "focus",
503
+ actions: [
504
+ "clearScrollEndTimer",
505
+ "setClosestPage",
506
+ "invokeDraggingEnd"
507
+ ]
508
+ }, {
509
+ target: "idle",
510
+ actions: [
511
+ "clearScrollEndTimer",
512
+ "setClosestPage",
513
+ "invokeDraggingEnd"
514
+ ]
515
+ }]
516
+ }
517
+ },
492
518
  userScroll: {
493
519
  effects: ["trackScroll"],
494
520
  on: {
@@ -553,7 +579,8 @@ const machine = require_core.createMachine({
553
579
  return () => observer.disconnect();
554
580
  },
555
581
  trackSlideResize({ scope, send }) {
556
- if (!getItemGroupEl(scope)) return;
582
+ const el = getItemGroupEl(scope);
583
+ if (!el) return;
557
584
  const exec = () => {
558
585
  send({
559
586
  type: "SNAP.REFRESH",
@@ -571,7 +598,7 @@ const machine = require_core.createMachine({
571
598
  });
572
599
  const itemEls = getItemEls(scope);
573
600
  itemEls.forEach(exec);
574
- return require_utils.callAll(...itemEls.map((el) => require_dom_query.resizeObserverBorderBox.observe(el, exec)));
601
+ return require_utils.callAll(...[require_dom_query.resizeObserverBorderBox.observe(el, exec), ...itemEls.map((el) => require_dom_query.resizeObserverBorderBox.observe(el, exec))]);
575
602
  },
576
603
  trackSlideIntersections({ scope, prop, context }) {
577
604
  const el = getItemGroupEl(scope);
@@ -602,6 +629,27 @@ const machine = require_core.createMachine({
602
629
  };
603
630
  return require_dom_query.addDomEvent(el, "scroll", onScroll, { passive: true });
604
631
  },
632
+ trackSettlingScroll({ send, refs, scope }) {
633
+ const el = getItemGroupEl(scope);
634
+ if (!el) return;
635
+ const startTimer = () => {
636
+ clearTimeout(refs.get("timeoutRef"));
637
+ refs.set("timeoutRef", void 0);
638
+ refs.set("timeoutRef", setTimeout(() => {
639
+ send({ type: "SCROLL.END" });
640
+ }, 200));
641
+ };
642
+ startTimer();
643
+ const onScroll = () => {
644
+ startTimer();
645
+ };
646
+ const cleanup = require_dom_query.addDomEvent(el, "scroll", onScroll, { passive: true });
647
+ return () => {
648
+ cleanup();
649
+ clearTimeout(refs.get("timeoutRef"));
650
+ refs.set("timeoutRef", void 0);
651
+ };
652
+ },
605
653
  trackDocumentVisibility({ scope, send }) {
606
654
  const doc = scope.getDoc();
607
655
  const onVisibilityChange = () => {
@@ -680,8 +728,11 @@ const machine = require_core.createMachine({
680
728
  const el = getItemGroupEl(scope);
681
729
  if (!el) return;
682
730
  const scrollPosition = computed("isHorizontal") ? el.scrollLeft : el.scrollTop;
683
- const page = context.get("pageSnapPoints").findIndex((point) => Math.abs(point - scrollPosition) < 1);
684
- if (page === -1) return;
731
+ const snapPoints = context.get("pageSnapPoints");
732
+ if (!snapPoints.length) return;
733
+ const page = snapPoints.reduce((closestIndex, snapPoint, index) => {
734
+ return Math.abs(snapPoint - scrollPosition) < Math.abs(snapPoints[closestIndex] - scrollPosition) ? index : closestIndex;
735
+ }, 0);
685
736
  context.set("page", page);
686
737
  },
687
738
  setNextPage({ context, prop, state }) {
@@ -706,15 +757,15 @@ const machine = require_core.createMachine({
706
757
  const page = event.index ?? context.get("page");
707
758
  context.set("page", page);
708
759
  },
709
- clampPage({ context }) {
710
- const index = require_utils.clampValue(context.get("page"), 0, context.get("pageSnapPoints").length - 1);
711
- context.set("page", index);
712
- },
713
760
  setSnapPoints({ context, computed, scope }) {
714
761
  const el = getItemGroupEl(scope);
715
762
  if (!el) return;
716
763
  const scrollSnapPoints = require_scroll_snap.getScrollSnapPositions(el);
717
- context.set("pageSnapPoints", computed("isHorizontal") ? scrollSnapPoints.x : scrollSnapPoints.y);
764
+ const pageSnapPoints = computed("isHorizontal") ? scrollSnapPoints.x : scrollSnapPoints.y;
765
+ context.set("pageSnapPoints", pageSnapPoints);
766
+ if (!pageSnapPoints.length) return;
767
+ const index = require_utils.clampValue(context.get("page"), 0, pageSnapPoints.length - 1);
768
+ context.set("page", index);
718
769
  },
719
770
  disableScrollSnap({ scope }) {
720
771
  const el = getItemGroupEl(scope);
@@ -736,6 +787,7 @@ const machine = require_core.createMachine({
736
787
  const isHorizontal = computed("isHorizontal");
737
788
  const scrollPos = isHorizontal ? el.scrollLeft : el.scrollTop;
738
789
  const snapPoints = context.get("pageSnapPoints");
790
+ if (!snapPoints.length) return;
739
791
  const closest = snapPoints.reduce((closest, curr) => {
740
792
  return Math.abs(curr - scrollPos) < Math.abs(closest - scrollPos) ? curr : closest;
741
793
  }, snapPoints[0]);
@@ -745,7 +797,6 @@ const machine = require_core.createMachine({
745
797
  top: isHorizontal ? el.scrollTop : closest,
746
798
  behavior: "smooth"
747
799
  });
748
- context.set("page", snapPoints.indexOf(closest));
749
800
  const scrollSnapType = el.dataset.scrollSnapType;
750
801
  if (scrollSnapType) {
751
802
  el.style.setProperty("scroll-snap-type", scrollSnapType);
@@ -3,7 +3,7 @@ import { b as Service, p as Machine, u as EventObject } from "../../types-u-LWCS
3
3
  import { b as NormalizeProps, d as Orientation, f as OrientationProperty, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/carousel/carousel.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "indicator" | "control" | "item" | "progressText" | "nextTrigger" | "prevTrigger" | "itemGroup" | "indicatorGroup" | "autoplayTrigger">;
6
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "item" | "control" | "nextTrigger" | "prevTrigger" | "itemGroup" | "indicatorGroup" | "autoplayTrigger" | "progressText">;
7
7
  //#endregion
8
8
  //#region src/machines/carousel/carousel.types.d.ts
9
9
  interface PageChangeDetails {
@@ -86,7 +86,7 @@ interface CarouselSchema {
86
86
  refs: {
87
87
  timeoutRef: any;
88
88
  };
89
- state: "idle" | "dragging" | "autoplay" | "userScroll" | "focus";
89
+ state: "idle" | "dragging" | "settling" | "autoplay" | "userScroll" | "focus";
90
90
  effect: string;
91
91
  action: string;
92
92
  guard: string;
@@ -3,7 +3,7 @@ import { b as Service, p as Machine, u as EventObject } from "../../types-DvUmCW
3
3
  import { b as NormalizeProps, d as Orientation, f as OrientationProperty, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/carousel/carousel.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "indicator" | "control" | "item" | "progressText" | "nextTrigger" | "prevTrigger" | "itemGroup" | "indicatorGroup" | "autoplayTrigger">;
6
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "item" | "control" | "nextTrigger" | "prevTrigger" | "itemGroup" | "indicatorGroup" | "autoplayTrigger" | "progressText">;
7
7
  //#endregion
8
8
  //#region src/machines/carousel/carousel.types.d.ts
9
9
  interface PageChangeDetails {
@@ -86,7 +86,7 @@ interface CarouselSchema {
86
86
  refs: {
87
87
  timeoutRef: any;
88
88
  };
89
- state: "idle" | "dragging" | "autoplay" | "userScroll" | "focus";
89
+ state: "idle" | "dragging" | "settling" | "autoplay" | "userScroll" | "focus";
90
90
  effect: string;
91
91
  action: string;
92
92
  guard: string;
@@ -37,22 +37,23 @@ function connect(service, normalize) {
37
37
  const autoSize = prop("autoSize");
38
38
  const pageSnapPoints = Array.from(context.get("pageSnapPoints"));
39
39
  const page = context.get("page");
40
+ const activePage = pageSnapPoints.length ? clampValue(page, 0, pageSnapPoints.length - 1) : 0;
40
41
  const slidesPerPage = prop("slidesPerPage");
41
42
  const padding = prop("padding");
42
43
  const translations = prop("translations");
43
44
  return {
44
45
  isPlaying,
45
46
  isDragging,
46
- page,
47
+ page: activePage,
47
48
  pageSnapPoints,
48
49
  canScrollNext,
49
50
  canScrollPrev,
50
51
  getProgress() {
51
- return page / pageSnapPoints.length;
52
+ return activePage / pageSnapPoints.length;
52
53
  },
53
54
  getProgressText() {
54
55
  const details = {
55
- page: page + 1,
56
+ page: activePage + 1,
56
57
  totalPages: pageSnapPoints.length
57
58
  };
58
59
  return translations.progressText?.(details) ?? "";
@@ -302,7 +303,7 @@ function connect(service, normalize) {
302
303
  "data-orientation": prop("orientation"),
303
304
  "data-index": props.index,
304
305
  "data-readonly": dataAttr(props.readOnly),
305
- "data-current": dataAttr(props.index === page),
306
+ "data-current": dataAttr(props.index === activePage),
306
307
  "aria-label": translations.indicator(props.index),
307
308
  onClick(event) {
308
309
  if (event.defaultPrevented) return;
@@ -443,7 +444,7 @@ const machine = createMachine({
443
444
  target: "idle",
444
445
  actions: ["clearScrollEndTimer", "setMatchingPage"]
445
446
  },
446
- "SNAP.REFRESH": { actions: ["setSnapPoints", "clampPage"] },
447
+ "SNAP.REFRESH": { actions: ["setSnapPoints"] },
447
448
  "PAGE.SCROLL": { actions: ["scrollToPage"] }
448
449
  },
449
450
  effects: [
@@ -483,11 +484,36 @@ const machine = createMachine({
483
484
  on: {
484
485
  DRAGGING: { actions: ["scrollSlides", "invokeDragging"] },
485
486
  "DRAGGING.END": {
486
- target: "idle",
487
- actions: ["endDragging", "invokeDraggingEnd"]
487
+ target: "settling",
488
+ actions: ["endDragging"]
488
489
  }
489
490
  }
490
491
  },
492
+ settling: {
493
+ effects: ["trackSettlingScroll"],
494
+ on: {
495
+ "DRAGGING.START": {
496
+ target: "dragging",
497
+ actions: ["clearScrollEndTimer", "invokeDragStart"]
498
+ },
499
+ "SCROLL.END": [{
500
+ guard: "isFocused",
501
+ target: "focus",
502
+ actions: [
503
+ "clearScrollEndTimer",
504
+ "setClosestPage",
505
+ "invokeDraggingEnd"
506
+ ]
507
+ }, {
508
+ target: "idle",
509
+ actions: [
510
+ "clearScrollEndTimer",
511
+ "setClosestPage",
512
+ "invokeDraggingEnd"
513
+ ]
514
+ }]
515
+ }
516
+ },
491
517
  userScroll: {
492
518
  effects: ["trackScroll"],
493
519
  on: {
@@ -552,7 +578,8 @@ const machine = createMachine({
552
578
  return () => observer.disconnect();
553
579
  },
554
580
  trackSlideResize({ scope, send }) {
555
- if (!getItemGroupEl(scope)) return;
581
+ const el = getItemGroupEl(scope);
582
+ if (!el) return;
556
583
  const exec = () => {
557
584
  send({
558
585
  type: "SNAP.REFRESH",
@@ -570,7 +597,7 @@ const machine = createMachine({
570
597
  });
571
598
  const itemEls = getItemEls(scope);
572
599
  itemEls.forEach(exec);
573
- return callAll(...itemEls.map((el) => resizeObserverBorderBox.observe(el, exec)));
600
+ return callAll(...[resizeObserverBorderBox.observe(el, exec), ...itemEls.map((el) => resizeObserverBorderBox.observe(el, exec))]);
574
601
  },
575
602
  trackSlideIntersections({ scope, prop, context }) {
576
603
  const el = getItemGroupEl(scope);
@@ -601,6 +628,27 @@ const machine = createMachine({
601
628
  };
602
629
  return addDomEvent(el, "scroll", onScroll, { passive: true });
603
630
  },
631
+ trackSettlingScroll({ send, refs, scope }) {
632
+ const el = getItemGroupEl(scope);
633
+ if (!el) return;
634
+ const startTimer = () => {
635
+ clearTimeout(refs.get("timeoutRef"));
636
+ refs.set("timeoutRef", void 0);
637
+ refs.set("timeoutRef", setTimeout(() => {
638
+ send({ type: "SCROLL.END" });
639
+ }, 200));
640
+ };
641
+ startTimer();
642
+ const onScroll = () => {
643
+ startTimer();
644
+ };
645
+ const cleanup = addDomEvent(el, "scroll", onScroll, { passive: true });
646
+ return () => {
647
+ cleanup();
648
+ clearTimeout(refs.get("timeoutRef"));
649
+ refs.set("timeoutRef", void 0);
650
+ };
651
+ },
604
652
  trackDocumentVisibility({ scope, send }) {
605
653
  const doc = scope.getDoc();
606
654
  const onVisibilityChange = () => {
@@ -679,8 +727,11 @@ const machine = createMachine({
679
727
  const el = getItemGroupEl(scope);
680
728
  if (!el) return;
681
729
  const scrollPosition = computed("isHorizontal") ? el.scrollLeft : el.scrollTop;
682
- const page = context.get("pageSnapPoints").findIndex((point) => Math.abs(point - scrollPosition) < 1);
683
- if (page === -1) return;
730
+ const snapPoints = context.get("pageSnapPoints");
731
+ if (!snapPoints.length) return;
732
+ const page = snapPoints.reduce((closestIndex, snapPoint, index) => {
733
+ return Math.abs(snapPoint - scrollPosition) < Math.abs(snapPoints[closestIndex] - scrollPosition) ? index : closestIndex;
734
+ }, 0);
684
735
  context.set("page", page);
685
736
  },
686
737
  setNextPage({ context, prop, state }) {
@@ -705,15 +756,15 @@ const machine = createMachine({
705
756
  const page = event.index ?? context.get("page");
706
757
  context.set("page", page);
707
758
  },
708
- clampPage({ context }) {
709
- const index = clampValue(context.get("page"), 0, context.get("pageSnapPoints").length - 1);
710
- context.set("page", index);
711
- },
712
759
  setSnapPoints({ context, computed, scope }) {
713
760
  const el = getItemGroupEl(scope);
714
761
  if (!el) return;
715
762
  const scrollSnapPoints = getScrollSnapPositions(el);
716
- context.set("pageSnapPoints", computed("isHorizontal") ? scrollSnapPoints.x : scrollSnapPoints.y);
763
+ const pageSnapPoints = computed("isHorizontal") ? scrollSnapPoints.x : scrollSnapPoints.y;
764
+ context.set("pageSnapPoints", pageSnapPoints);
765
+ if (!pageSnapPoints.length) return;
766
+ const index = clampValue(context.get("page"), 0, pageSnapPoints.length - 1);
767
+ context.set("page", index);
717
768
  },
718
769
  disableScrollSnap({ scope }) {
719
770
  const el = getItemGroupEl(scope);
@@ -735,6 +786,7 @@ const machine = createMachine({
735
786
  const isHorizontal = computed("isHorizontal");
736
787
  const scrollPos = isHorizontal ? el.scrollLeft : el.scrollTop;
737
788
  const snapPoints = context.get("pageSnapPoints");
789
+ if (!snapPoints.length) return;
738
790
  const closest = snapPoints.reduce((closest, curr) => {
739
791
  return Math.abs(curr - scrollPos) < Math.abs(closest - scrollPos) ? curr : closest;
740
792
  }, snapPoints[0]);
@@ -744,7 +796,6 @@ const machine = createMachine({
744
796
  top: isHorizontal ? el.scrollTop : closest,
745
797
  behavior: "smooth"
746
798
  });
747
- context.set("page", snapPoints.indexOf(closest));
748
799
  const scrollSnapType = el.dataset.scrollSnapType;
749
800
  if (scrollSnapType) {
750
801
  el.style.setProperty("scroll-snap-type", scrollSnapType);
@@ -8,8 +8,8 @@ import { c as Placement, d as PositioningOptions } from "../../types-CZAtqGqH.cj
8
8
  import { a as Point } from "../../types-CLXYEgfm.cjs";
9
9
 
10
10
  //#region src/machines/cascade-select/cascade-select.anatomy.d.ts
11
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator" | "label" | "valueText" | "control" | "item" | "itemIndicator" | "positioner" | "list" | "clearTrigger" | "itemText">;
12
- declare const parts: Record<"root" | "trigger" | "content" | "indicator" | "label" | "valueText" | "control" | "item" | "itemIndicator" | "positioner" | "list" | "clearTrigger" | "itemText", AnatomyPart>;
11
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "item" | "label" | "control" | "list" | "trigger" | "content" | "clearTrigger" | "valueText" | "itemText" | "itemIndicator" | "positioner">;
12
+ declare const parts: Record<"root" | "indicator" | "item" | "label" | "control" | "list" | "trigger" | "content" | "clearTrigger" | "valueText" | "itemText" | "itemIndicator" | "positioner", AnatomyPart>;
13
13
  //#endregion
14
14
  //#region src/machines/cascade-select/cascade-select.collection.d.ts
15
15
  declare const collection: {
@@ -8,8 +8,8 @@ import { p as PositioningOptions, u as Placement } from "../../index-fMh0VDkR.mj
8
8
  import { a as Point } from "../../types-DU764tY_.mjs";
9
9
 
10
10
  //#region src/machines/cascade-select/cascade-select.anatomy.d.ts
11
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator" | "label" | "valueText" | "control" | "item" | "itemIndicator" | "positioner" | "list" | "clearTrigger" | "itemText">;
12
- declare const parts: Record<"root" | "trigger" | "content" | "indicator" | "label" | "valueText" | "control" | "item" | "itemIndicator" | "positioner" | "list" | "clearTrigger" | "itemText", AnatomyPart>;
11
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "item" | "label" | "control" | "list" | "trigger" | "content" | "clearTrigger" | "valueText" | "itemText" | "itemIndicator" | "positioner">;
12
+ declare const parts: Record<"root" | "indicator" | "item" | "label" | "control" | "list" | "trigger" | "content" | "clearTrigger" | "valueText" | "itemText" | "itemIndicator" | "positioner", AnatomyPart>;
13
13
  //#endregion
14
14
  //#region src/machines/cascade-select/cascade-select.collection.d.ts
15
15
  declare const collection: {
@@ -3,7 +3,7 @@ import { b as Service, p as Machine } from "../../types-u-LWCSDE.cjs";
3
3
  import { b as NormalizeProps, g as RequiredBy, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/clipboard/clipboard.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "indicator" | "label" | "control" | "input">;
6
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "input" | "label" | "control" | "trigger">;
7
7
  //#endregion
8
8
  //#region src/machines/clipboard/clipboard.types.d.ts
9
9
  interface CopyStatusDetails {
@@ -3,7 +3,7 @@ import { b as Service, p as Machine } from "../../types-DvUmCWsb.mjs";
3
3
  import { b as NormalizeProps, g as RequiredBy, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/clipboard/clipboard.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "indicator" | "label" | "control" | "input">;
6
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "input" | "label" | "control" | "trigger">;
7
7
  //#endregion
8
8
  //#region src/machines/clipboard/clipboard.types.d.ts
9
9
  interface CopyStatusDetails {
@@ -3,7 +3,7 @@ import { b as Service, p as Machine } from "../../types-u-LWCSDE.cjs";
3
3
  import { b as NormalizeProps, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/collapsible/collapsible.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "trigger" | "content">;
7
7
  //#endregion
8
8
  //#region src/machines/collapsible/collapsible.types.d.ts
9
9
  interface OpenChangeDetails {
@@ -3,7 +3,7 @@ import { b as Service, p as Machine } from "../../types-DvUmCWsb.mjs";
3
3
  import { b as NormalizeProps, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/collapsible/collapsible.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "indicator" | "trigger" | "content">;
7
7
  //#endregion
8
8
  //#region src/machines/collapsible/collapsible.types.d.ts
9
9
  interface OpenChangeDetails {
@@ -6,7 +6,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
6
6
  import { d as PositioningOptions } from "../../types-CZAtqGqH.cjs";
7
7
 
8
8
  //#region src/machines/color-picker/color-picker.anatomy.d.ts
9
- declare const anatomy: Anatomy<"root" | "trigger" | "content" | "label" | "valueText" | "control" | "positioner" | "area" | "formatSelect" | "areaThumb" | "channelInput" | "channelSliderTrack" | "channelSliderThumb" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderValueText" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger">;
9
+ declare const anatomy: Anatomy<"root" | "area" | "label" | "control" | "trigger" | "content" | "valueText" | "positioner" | "formatSelect" | "areaThumb" | "channelInput" | "channelSliderTrack" | "channelSliderThumb" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderValueText" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger">;
10
10
  //#endregion
11
11
  //#region src/machines/color-picker/color-picker.types.d.ts
12
12
  type ExtendedColorChannel = ColorChannel | "hex" | "css";
@@ -6,7 +6,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
6
6
  import { p as PositioningOptions } from "../../index-fMh0VDkR.mjs";
7
7
 
8
8
  //#region src/machines/color-picker/color-picker.anatomy.d.ts
9
- declare const anatomy: Anatomy<"root" | "trigger" | "content" | "label" | "valueText" | "control" | "positioner" | "area" | "formatSelect" | "areaThumb" | "channelInput" | "channelSliderTrack" | "channelSliderThumb" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderValueText" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger">;
9
+ declare const anatomy: Anatomy<"root" | "area" | "label" | "control" | "trigger" | "content" | "valueText" | "positioner" | "formatSelect" | "areaThumb" | "channelInput" | "channelSliderTrack" | "channelSliderThumb" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderValueText" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger">;
10
10
  //#endregion
11
11
  //#region src/machines/color-picker/color-picker.types.d.ts
12
12
  type ExtendedColorChannel = ColorChannel | "hex" | "css";
@@ -7,7 +7,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
7
7
  import { c as Placement, d as PositioningOptions } from "../../types-CZAtqGqH.cjs";
8
8
 
9
9
  //#region src/machines/combobox/combobox.anatomy.d.ts
10
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "label" | "control" | "item" | "itemIndicator" | "input" | "positioner" | "list" | "clearTrigger" | "itemText" | "itemGroup" | "itemGroupLabel">;
10
+ declare const anatomy: AnatomyInstance<"root" | "item" | "input" | "label" | "control" | "list" | "trigger" | "content" | "clearTrigger" | "itemText" | "itemIndicator" | "itemGroup" | "positioner" | "itemGroupLabel">;
11
11
  //#endregion
12
12
  //#region src/machines/combobox/combobox.collection.d.ts
13
13
  declare const collection: {
@@ -7,7 +7,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
7
7
  import { p as PositioningOptions, u as Placement } from "../../index-fMh0VDkR.mjs";
8
8
 
9
9
  //#region src/machines/combobox/combobox.anatomy.d.ts
10
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "label" | "control" | "item" | "itemIndicator" | "input" | "positioner" | "list" | "clearTrigger" | "itemText" | "itemGroup" | "itemGroupLabel">;
10
+ declare const anatomy: AnatomyInstance<"root" | "item" | "input" | "label" | "control" | "list" | "trigger" | "content" | "clearTrigger" | "itemText" | "itemIndicator" | "itemGroup" | "positioner" | "itemGroupLabel">;
11
11
  //#endregion
12
12
  //#region src/machines/combobox/combobox.collection.d.ts
13
13
  declare const collection: {
@@ -8,7 +8,7 @@ import { c as Placement, d as PositioningOptions } from "../../types-CZAtqGqH.cj
8
8
  import { Calendar, CalendarDate, CalendarDateTime, CalendarIdentifier, DateDuration, DateFormatter, ZonedDateTime } from "@internationalized/date";
9
9
 
10
10
  //#region src/machines/date-picker/date-picker.anatomy.d.ts
11
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "label" | "control" | "input" | "positioner" | "table" | "view" | "clearTrigger" | "nextTrigger" | "prevTrigger" | "monthSelect" | "presetTrigger" | "rangeText" | "tableBody" | "tableCell" | "tableCellTrigger" | "tableHead" | "tableHeader" | "tableRow" | "viewControl" | "viewTrigger" | "yearSelect">;
11
+ declare const anatomy: AnatomyInstance<"root" | "input" | "label" | "table" | "view" | "control" | "trigger" | "content" | "nextTrigger" | "prevTrigger" | "clearTrigger" | "positioner" | "tableHeader" | "tableBody" | "tableRow" | "viewTrigger" | "monthSelect" | "yearSelect" | "presetTrigger" | "rangeText" | "tableCell" | "tableCellTrigger" | "tableHead" | "viewControl">;
12
12
  //#endregion
13
13
  //#region src/machines/date-picker/date-picker.types.d.ts
14
14
  type DateView = "day" | "month" | "year";
@@ -8,7 +8,7 @@ import { p as PositioningOptions, u as Placement } from "../../index-fMh0VDkR.mj
8
8
  import { Calendar, CalendarDate, CalendarDateTime, CalendarIdentifier, DateDuration, DateFormatter, ZonedDateTime } from "@internationalized/date";
9
9
 
10
10
  //#region src/machines/date-picker/date-picker.anatomy.d.ts
11
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "label" | "control" | "input" | "positioner" | "table" | "view" | "clearTrigger" | "nextTrigger" | "prevTrigger" | "monthSelect" | "presetTrigger" | "rangeText" | "tableBody" | "tableCell" | "tableCellTrigger" | "tableHead" | "tableHeader" | "tableRow" | "viewControl" | "viewTrigger" | "yearSelect">;
11
+ declare const anatomy: AnatomyInstance<"root" | "input" | "label" | "table" | "view" | "control" | "trigger" | "content" | "nextTrigger" | "prevTrigger" | "clearTrigger" | "positioner" | "tableHeader" | "tableBody" | "tableRow" | "viewTrigger" | "monthSelect" | "yearSelect" | "presetTrigger" | "rangeText" | "tableCell" | "tableCellTrigger" | "tableHead" | "viewControl">;
12
12
  //#endregion
13
13
  //#region src/machines/date-picker/date-picker.types.d.ts
14
14
  type DateView = "day" | "month" | "year";
@@ -5,7 +5,7 @@ import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOuts
5
5
  import { r as PersistentElementOptions, t as DismissableElementHandlers } from "../../dismissable-layer-ZgyqN8AD.cjs";
6
6
 
7
7
  //#region src/machines/dialog/dialog.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"trigger" | "content" | "title" | "description" | "positioner" | "backdrop" | "closeTrigger">;
8
+ declare const anatomy: AnatomyInstance<"title" | "description" | "closeTrigger" | "trigger" | "content" | "positioner" | "backdrop">;
9
9
  //#endregion
10
10
  //#region src/machines/dialog/dialog.types.d.ts
11
11
  interface OpenChangeDetails {
@@ -5,7 +5,7 @@ import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOuts
5
5
  import { r as PersistentElementOptions, t as DismissableElementHandlers } from "../../dismissable-layer-h14gHVbJ.mjs";
6
6
 
7
7
  //#region src/machines/dialog/dialog.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"trigger" | "content" | "title" | "description" | "positioner" | "backdrop" | "closeTrigger">;
8
+ declare const anatomy: AnatomyInstance<"title" | "description" | "closeTrigger" | "trigger" | "content" | "positioner" | "backdrop">;
9
9
  //#endregion
10
10
  //#region src/machines/dialog/dialog.types.d.ts
11
11
  interface OpenChangeDetails {
@@ -5,7 +5,7 @@ import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOuts
5
5
  import { t as DismissableElementHandlers } from "../../dismissable-layer-ZgyqN8AD.cjs";
6
6
 
7
7
  //#region src/machines/drawer/drawer.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"trigger" | "content" | "title" | "description" | "positioner" | "backdrop" | "closeTrigger" | "grabber" | "grabberIndicator" | "swipeArea">;
8
+ declare const anatomy: AnatomyInstance<"title" | "description" | "closeTrigger" | "trigger" | "content" | "positioner" | "backdrop" | "grabber" | "grabberIndicator" | "swipeArea">;
9
9
  //#endregion
10
10
  //#region src/machines/drawer/utils/session.d.ts
11
11
  type GestureAxis = "x" | "y";
@@ -5,7 +5,7 @@ import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOuts
5
5
  import { t as DismissableElementHandlers } from "../../dismissable-layer-h14gHVbJ.mjs";
6
6
 
7
7
  //#region src/machines/drawer/drawer.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"trigger" | "content" | "title" | "description" | "positioner" | "backdrop" | "closeTrigger" | "grabber" | "grabberIndicator" | "swipeArea">;
8
+ declare const anatomy: AnatomyInstance<"title" | "description" | "closeTrigger" | "trigger" | "content" | "positioner" | "backdrop" | "grabber" | "grabberIndicator" | "swipeArea">;
9
9
  //#endregion
10
10
  //#region src/machines/drawer/utils/session.d.ts
11
11
  type GestureAxis = "x" | "y";