@sprawlify/primitives 0.0.30 → 0.0.31

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 (86) hide show
  1. package/dist/date-utils.d.cts +5 -5
  2. package/dist/dom-query.d.cts +1 -1
  3. package/dist/dom-query.d.mts +1 -1
  4. package/dist/machines/angle-slider/index.d.cts +1 -1
  5. package/dist/machines/angle-slider/index.d.mts +1 -1
  6. package/dist/machines/bottom-sheet/index.d.cts +1 -1
  7. package/dist/machines/bottom-sheet/index.d.mts +1 -1
  8. package/dist/machines/carousel/index.d.cts +1 -1
  9. package/dist/machines/carousel/index.d.mts +1 -1
  10. package/dist/machines/checkbox/index.d.cts +1 -1
  11. package/dist/machines/checkbox/index.d.mts +1 -1
  12. package/dist/machines/clipboard/index.d.cts +1 -1
  13. package/dist/machines/clipboard/index.d.mts +1 -1
  14. package/dist/machines/collapsible/index.d.cts +1 -1
  15. package/dist/machines/collapsible/index.d.mts +1 -1
  16. package/dist/machines/color-picker/index.d.cts +1 -1
  17. package/dist/machines/color-picker/index.d.mts +1 -1
  18. package/dist/machines/combobox/index.d.cts +1 -1
  19. package/dist/machines/combobox/index.d.mts +1 -1
  20. package/dist/machines/date-picker/index.d.cts +1 -1
  21. package/dist/machines/date-picker/index.d.mts +1 -1
  22. package/dist/machines/dialog/index.d.cts +1 -1
  23. package/dist/machines/dialog/index.d.mts +1 -1
  24. package/dist/machines/editable/index.d.cts +1 -1
  25. package/dist/machines/editable/index.d.mts +1 -1
  26. package/dist/machines/file-upload/index.d.cts +1 -1
  27. package/dist/machines/file-upload/index.d.mts +1 -1
  28. package/dist/machines/floating-panel/index.d.cts +1 -1
  29. package/dist/machines/floating-panel/index.d.mts +1 -1
  30. package/dist/machines/hover-card/index.d.cts +1 -1
  31. package/dist/machines/hover-card/index.d.mts +1 -1
  32. package/dist/machines/image-cropper/index.d.cts +1 -1
  33. package/dist/machines/image-cropper/index.d.mts +1 -1
  34. package/dist/machines/listbox/index.d.cts +1 -1
  35. package/dist/machines/listbox/index.d.mts +1 -1
  36. package/dist/machines/marquee/index.d.cts +3 -3
  37. package/dist/machines/marquee/index.d.mts +3 -3
  38. package/dist/machines/menu/index.d.cts +1 -1
  39. package/dist/machines/menu/index.d.mts +1 -1
  40. package/dist/machines/navigation-menu/index.d.cts +1 -1
  41. package/dist/machines/navigation-menu/index.d.mts +1 -1
  42. package/dist/machines/number-input/index.d.cts +1 -1
  43. package/dist/machines/number-input/index.d.mts +1 -1
  44. package/dist/machines/password-input/index.d.cts +1 -1
  45. package/dist/machines/password-input/index.d.mts +1 -1
  46. package/dist/machines/pin-input/index.d.cts +1 -1
  47. package/dist/machines/pin-input/index.d.mts +1 -1
  48. package/dist/machines/popover/index.d.cts +1 -1
  49. package/dist/machines/popover/index.d.mts +1 -1
  50. package/dist/machines/progress/index.d.cts +1 -1
  51. package/dist/machines/progress/index.d.mts +1 -1
  52. package/dist/machines/qr-code/index.d.cts +1 -1
  53. package/dist/machines/qr-code/index.d.mts +1 -1
  54. package/dist/machines/radio-group/index.d.cts +1 -1
  55. package/dist/machines/radio-group/index.d.mts +1 -1
  56. package/dist/machines/rating-group/index.d.cts +1 -1
  57. package/dist/machines/rating-group/index.d.mts +1 -1
  58. package/dist/machines/scroll-area/index.d.cts +1 -1
  59. package/dist/machines/scroll-area/index.d.mts +1 -1
  60. package/dist/machines/select/index.d.cts +1 -1
  61. package/dist/machines/select/index.d.mts +1 -1
  62. package/dist/machines/signature-pad/index.d.cts +1 -1
  63. package/dist/machines/signature-pad/index.d.mts +1 -1
  64. package/dist/machines/slider/index.cjs +117 -7
  65. package/dist/machines/slider/index.d.cts +5 -2
  66. package/dist/machines/slider/index.d.mts +5 -2
  67. package/dist/machines/slider/index.mjs +117 -7
  68. package/dist/machines/steps/index.d.cts +1 -1
  69. package/dist/machines/steps/index.d.mts +1 -1
  70. package/dist/machines/switch/index.d.cts +1 -1
  71. package/dist/machines/switch/index.d.mts +1 -1
  72. package/dist/machines/tabs/index.d.cts +1 -1
  73. package/dist/machines/tabs/index.d.mts +1 -1
  74. package/dist/machines/tags-input/index.d.cts +1 -1
  75. package/dist/machines/tags-input/index.d.mts +1 -1
  76. package/dist/machines/timer/index.d.cts +1 -1
  77. package/dist/machines/timer/index.d.mts +1 -1
  78. package/dist/machines/toast/index.d.cts +1 -1
  79. package/dist/machines/toast/index.d.mts +1 -1
  80. package/dist/machines/tooltip/index.d.cts +1 -1
  81. package/dist/machines/tooltip/index.d.mts +1 -1
  82. package/dist/machines/tour/index.d.cts +1 -1
  83. package/dist/machines/tour/index.d.mts +1 -1
  84. package/dist/machines/tree-view/index.d.cts +1 -1
  85. package/dist/machines/tree-view/index.d.mts +1 -1
  86. package/package.json +1 -1
@@ -6,7 +6,7 @@ import { r as PersistentElementOptions, t as DismissableElementHandlers } from "
6
6
  import { c as Placement, d as PositioningOptions } from "../../types-TUsgVjZA.cjs";
7
7
 
8
8
  //#region src/machines/popover/popover.anatomy.d.ts
9
- declare const anatomy: AnatomyInstance<"trigger" | "indicator" | "arrow" | "arrowTip" | "positioner" | "content" | "title" | "closeTrigger" | "anchor" | "description">;
9
+ declare const anatomy: AnatomyInstance<"trigger" | "title" | "content" | "indicator" | "arrow" | "arrowTip" | "positioner" | "description" | "closeTrigger" | "anchor">;
10
10
  //#endregion
11
11
  //#region src/machines/popover/popover.types.d.ts
12
12
  interface OpenChangeDetails {
@@ -6,7 +6,7 @@ import { r as PersistentElementOptions, t as DismissableElementHandlers } from "
6
6
  import { p as PositioningOptions, u as Placement } from "../../index-BlM1bSkX.mjs";
7
7
 
8
8
  //#region src/machines/popover/popover.anatomy.d.ts
9
- declare const anatomy: AnatomyInstance<"trigger" | "indicator" | "arrow" | "arrowTip" | "positioner" | "content" | "title" | "closeTrigger" | "anchor" | "description">;
9
+ declare const anatomy: AnatomyInstance<"trigger" | "title" | "content" | "indicator" | "arrow" | "arrowTip" | "positioner" | "description" | "closeTrigger" | "anchor">;
10
10
  //#endregion
11
11
  //#region src/machines/popover/popover.types.d.ts
12
12
  interface OpenChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-BIy26U
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-UNyqrBDu.cjs";
4
4
 
5
5
  //#region src/machines/progress/progress.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "label" | "track" | "circle" | "valueText" | "range" | "view" | "circleTrack" | "circleRange">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "track" | "range" | "circle" | "view" | "circleTrack" | "circleRange">;
7
7
  //#endregion
8
8
  //#region src/machines/progress/progress.types.d.ts
9
9
  type ProgressState = "indeterminate" | "loading" | "complete";
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-jyV564
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-BVcPBg7R.mjs";
4
4
 
5
5
  //#region src/machines/progress/progress.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "label" | "track" | "circle" | "valueText" | "range" | "view" | "circleTrack" | "circleRange">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "track" | "range" | "circle" | "view" | "circleTrack" | "circleRange">;
7
7
  //#endregion
8
8
  //#region src/machines/progress/progress.types.d.ts
9
9
  type ProgressState = "indeterminate" | "loading" | "complete";
@@ -5,7 +5,7 @@ import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as Comm
5
5
  import { QrCodeGenerateOptions, QrCodeGenerateOptions as QrCodeGenerateOptions$1, QrCodeGenerateResult, QrCodeGenerateResult as QrCodeGenerateResult$1 } from "uqr";
6
6
 
7
7
  //#region src/machines/qr-code/qr-code.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"root" | "pattern" | "frame" | "overlay" | "downloadTrigger">;
8
+ declare const anatomy: AnatomyInstance<"pattern" | "root" | "frame" | "overlay" | "downloadTrigger">;
9
9
  //#endregion
10
10
  //#region src/machines/qr-code/qr-code.types.d.ts
11
11
  interface ValueChangeDetails {
@@ -5,7 +5,7 @@ import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as Comm
5
5
  import { QrCodeGenerateOptions, QrCodeGenerateOptions as QrCodeGenerateOptions$1, QrCodeGenerateResult, QrCodeGenerateResult as QrCodeGenerateResult$1 } from "uqr";
6
6
 
7
7
  //#region src/machines/qr-code/qr-code.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"root" | "pattern" | "frame" | "overlay" | "downloadTrigger">;
8
+ declare const anatomy: AnatomyInstance<"pattern" | "root" | "frame" | "overlay" | "downloadTrigger">;
9
9
  //#endregion
10
10
  //#region src/machines/qr-code/qr-code.types.d.ts
11
11
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-BIy26U
3
3
  import { b as NormalizeProps, g as RequiredBy, m as Rect, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-UNyqrBDu.cjs";
4
4
 
5
5
  //#region src/machines/radio-group/radio-group.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "indicator" | "label" | "item" | "itemControl" | "itemText">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "item" | "indicator" | "itemText" | "itemControl">;
7
7
  //#endregion
8
8
  //#region src/machines/radio-group/radio-group.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-jyV564
3
3
  import { b as NormalizeProps, g as RequiredBy, m as Rect, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVcPBg7R.mjs";
4
4
 
5
5
  //#region src/machines/radio-group/radio-group.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "indicator" | "label" | "item" | "itemControl" | "itemText">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "item" | "indicator" | "itemText" | "itemControl">;
7
7
  //#endregion
8
8
  //#region src/machines/radio-group/radio-group.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-BIy26U
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-UNyqrBDu.cjs";
4
4
 
5
5
  //#region src/machines/rating-group/rating-group.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "control" | "label" | "item">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "item">;
7
7
  //#endregion
8
8
  //#region src/machines/rating-group/rating-group.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-jyV564
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVcPBg7R.mjs";
4
4
 
5
5
  //#region src/machines/rating-group/rating-group.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "control" | "label" | "item">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "item">;
7
7
  //#endregion
8
8
  //#region src/machines/rating-group/rating-group.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-BIy26U
3
3
  import { _ as Size, b as NormalizeProps, d as Orientation, p as Point, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-UNyqrBDu.cjs";
4
4
 
5
5
  //#region src/machines/scroll-area/scroll-area.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "content" | "viewport" | "thumb" | "scrollbar" | "corner">;
6
+ declare const anatomy: AnatomyInstance<"root" | "thumb" | "viewport" | "content" | "scrollbar" | "corner">;
7
7
  //#endregion
8
8
  //#region src/machines/scroll-area/utils/timeout.d.ts
9
9
  declare class Timeout {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-jyV564
3
3
  import { _ as Size, b as NormalizeProps, d as Orientation, p as Point, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVcPBg7R.mjs";
4
4
 
5
5
  //#region src/machines/scroll-area/scroll-area.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "content" | "viewport" | "thumb" | "scrollbar" | "corner">;
6
+ declare const anatomy: AnatomyInstance<"root" | "thumb" | "viewport" | "content" | "scrollbar" | "corner">;
7
7
  //#endregion
8
8
  //#region src/machines/scroll-area/utils/timeout.d.ts
9
9
  declare class Timeout {
@@ -8,7 +8,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
8
8
  import { c as Placement, d as PositioningOptions } from "../../types-TUsgVjZA.cjs";
9
9
 
10
10
  //#region src/machines/select/select.anatomy.d.ts
11
- declare const anatomy: AnatomyInstance<"root" | "control" | "trigger" | "indicator" | "label" | "positioner" | "content" | "item" | "valueText" | "itemText" | "itemIndicator" | "clearTrigger" | "itemGroup" | "list" | "itemGroupLabel">;
11
+ declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "control" | "item" | "itemGroup" | "trigger" | "clearTrigger" | "content" | "indicator" | "itemIndicator" | "itemText" | "list" | "positioner" | "itemGroupLabel">;
12
12
  //#endregion
13
13
  //#region src/machines/select/select.collection.d.ts
14
14
  declare const collection: {
@@ -8,7 +8,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
8
8
  import { p as PositioningOptions, u as Placement } from "../../index-BlM1bSkX.mjs";
9
9
 
10
10
  //#region src/machines/select/select.anatomy.d.ts
11
- declare const anatomy: AnatomyInstance<"root" | "control" | "trigger" | "indicator" | "label" | "positioner" | "content" | "item" | "valueText" | "itemText" | "itemIndicator" | "clearTrigger" | "itemGroup" | "list" | "itemGroupLabel">;
11
+ declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "control" | "item" | "itemGroup" | "trigger" | "clearTrigger" | "content" | "indicator" | "itemIndicator" | "itemText" | "list" | "positioner" | "itemGroupLabel">;
12
12
  //#endregion
13
13
  //#region src/machines/select/select.collection.d.ts
14
14
  declare const collection: {
@@ -4,7 +4,7 @@ import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as Comm
4
4
  import { StrokeOptions } from "perfect-freehand";
5
5
 
6
6
  //#region src/machines/signature-pad/signature-pad.anatomy.d.ts
7
- declare const anatomy: AnatomyInstance<"root" | "control" | "label" | "segment" | "segmentPath" | "guide" | "clearTrigger">;
7
+ declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "clearTrigger" | "segment" | "segmentPath" | "guide">;
8
8
  //#endregion
9
9
  //#region src/machines/signature-pad/signature-pad.types.d.ts
10
10
  interface Point {
@@ -4,7 +4,7 @@ import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as Comm
4
4
  import { StrokeOptions } from "perfect-freehand";
5
5
 
6
6
  //#region src/machines/signature-pad/signature-pad.anatomy.d.ts
7
- declare const anatomy: AnatomyInstance<"root" | "control" | "label" | "segment" | "segmentPath" | "guide" | "clearTrigger">;
7
+ declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "clearTrigger" | "segment" | "segmentPath" | "guide">;
8
8
  //#endregion
9
9
  //#region src/machines/signature-pad/signature-pad.types.d.ts
10
10
  interface Point {
@@ -196,6 +196,92 @@ function getMarkerGroupStyle() {
196
196
 
197
197
  //#endregion
198
198
  //#region src/machines/slider/slider.utils.ts
199
+ function getThumbBounds(ctx) {
200
+ const { index, values, min, max, gap } = ctx;
201
+ const prevThumb = values[index - 1];
202
+ const nextThumb = values[index + 1];
203
+ return {
204
+ min: prevThumb != null ? prevThumb + gap : min,
205
+ max: nextThumb != null ? nextThumb - gap : max
206
+ };
207
+ }
208
+ function round(value) {
209
+ return Math.round(value * 1e10) / 1e10;
210
+ }
211
+ function handleNone(ctx) {
212
+ const { index, value, values } = ctx;
213
+ const bounds = getThumbBounds(ctx);
214
+ const nextValues = values.slice();
215
+ nextValues[index] = round(require_utils.clampValue(value, bounds.min, bounds.max));
216
+ return {
217
+ values: nextValues,
218
+ index,
219
+ swapped: false
220
+ };
221
+ }
222
+ function handlePush(ctx) {
223
+ const { index, value, values, min, max, gap } = ctx;
224
+ const nextValues = values.slice();
225
+ nextValues[index] = round(require_utils.clampValue(value, min + index * gap, max - (values.length - 1 - index) * gap));
226
+ for (let i = index + 1; i < values.length; i++) {
227
+ const minAllowed = nextValues[i - 1] + gap;
228
+ if (nextValues[i] < minAllowed) nextValues[i] = round(minAllowed);
229
+ }
230
+ for (let i = index - 1; i >= 0; i--) {
231
+ const maxAllowed = nextValues[i + 1] - gap;
232
+ if (nextValues[i] > maxAllowed) nextValues[i] = round(maxAllowed);
233
+ }
234
+ return {
235
+ values: nextValues,
236
+ index,
237
+ swapped: false
238
+ };
239
+ }
240
+ function handleSwap(ctx, startValue) {
241
+ const { index, value, values, gap } = ctx;
242
+ const prevThumb = values[index - 1];
243
+ const nextThumb = values[index + 1];
244
+ const crossingNext = nextThumb != null && value >= nextThumb && value > startValue;
245
+ const crossingPrev = prevThumb != null && value <= prevThumb && value < startValue;
246
+ if (!crossingNext && !crossingPrev) return handleNone(ctx);
247
+ const swapIndex = crossingNext ? index + 1 : index - 1;
248
+ const nextValues = values.slice();
249
+ const bounds = getThumbBounds({
250
+ ...ctx,
251
+ index: swapIndex
252
+ });
253
+ nextValues[swapIndex] = round(require_utils.clampValue(value, bounds.min, bounds.max));
254
+ nextValues[index] = values[swapIndex];
255
+ if (crossingNext && nextValues[index] > nextValues[swapIndex] - gap) nextValues[index] = round(nextValues[swapIndex] - gap);
256
+ else if (crossingPrev && nextValues[index] < nextValues[swapIndex] + gap) nextValues[index] = round(nextValues[swapIndex] + gap);
257
+ return {
258
+ values: nextValues,
259
+ index: swapIndex,
260
+ swapped: true
261
+ };
262
+ }
263
+ function resolveThumbCollision(behavior, index, value, values, min, max, step, minStepsBetweenThumbs, startValue) {
264
+ if (values.length === 1) return {
265
+ values: [round(require_utils.clampValue(value, min, max))],
266
+ index: 0,
267
+ swapped: false
268
+ };
269
+ const ctx = {
270
+ behavior,
271
+ index,
272
+ value,
273
+ values,
274
+ min,
275
+ max,
276
+ gap: step * minStepsBetweenThumbs
277
+ };
278
+ switch (behavior) {
279
+ case "push": return handlePush(ctx);
280
+ case "swap": return handleSwap(ctx, startValue ?? values[index]);
281
+ case "none":
282
+ default: return handleNone(ctx);
283
+ }
284
+ }
199
285
  function normalizeValues(params, nextValues) {
200
286
  return nextValues.map((value, index) => {
201
287
  return constrainValue(params, value, index);
@@ -644,6 +730,7 @@ const machine = require_core.createMachine({
644
730
  thumbAlignment: "contain",
645
731
  origin: "start",
646
732
  orientation: "horizontal",
733
+ thumbCollisionBehavior: "none",
647
734
  minStepsBetweenThumbs,
648
735
  ...props$1,
649
736
  defaultValue: normalize(defaultValue, min, max, step, minStepsBetweenThumbs),
@@ -684,7 +771,10 @@ const machine = require_core.createMachine({
684
771
  };
685
772
  },
686
773
  refs() {
687
- return { thumbDragOffset: null };
774
+ return {
775
+ thumbDragOffset: null,
776
+ thumbDragStartValue: null
777
+ };
688
778
  },
689
779
  computed: {
690
780
  isHorizontal: ({ prop }) => prop("orientation") === "horizontal",
@@ -722,6 +812,7 @@ const machine = require_core.createMachine({
722
812
  target: "dragging",
723
813
  actions: [
724
814
  "setClosestThumbIndex",
815
+ "setThumbDragStartValue",
725
816
  "setPointerValue",
726
817
  "focusActiveThumb"
727
818
  ]
@@ -735,6 +826,7 @@ const machine = require_core.createMachine({
735
826
  actions: [
736
827
  "setFocusedIndex",
737
828
  "setThumbDragOffset",
829
+ "setThumbDragStartValue",
738
830
  "focusActiveThumb"
739
831
  ]
740
832
  }
@@ -746,6 +838,7 @@ const machine = require_core.createMachine({
746
838
  target: "dragging",
747
839
  actions: [
748
840
  "setClosestThumbIndex",
841
+ "setThumbDragStartValue",
749
842
  "setPointerValue",
750
843
  "focusActiveThumb"
751
844
  ]
@@ -755,6 +848,7 @@ const machine = require_core.createMachine({
755
848
  actions: [
756
849
  "setFocusedIndex",
757
850
  "setThumbDragOffset",
851
+ "setThumbDragStartValue",
758
852
  "focusActiveThumb"
759
853
  ]
760
854
  },
@@ -774,12 +868,20 @@ const machine = require_core.createMachine({
774
868
  on: {
775
869
  POINTER_UP: {
776
870
  target: "focus",
777
- actions: ["invokeOnChangeEnd", "clearThumbDragOffset"]
871
+ actions: [
872
+ "invokeOnChangeEnd",
873
+ "clearThumbDragOffset",
874
+ "clearThumbDragStartValue"
875
+ ]
778
876
  },
779
877
  POINTER_MOVE: { actions: ["setPointerValue"] },
780
878
  POINTER_CANCEL: {
781
879
  target: "idle",
782
- actions: ["clearFocusedIndex", "clearThumbDragOffset"]
880
+ actions: [
881
+ "clearFocusedIndex",
882
+ "clearThumbDragOffset",
883
+ "clearThumbDragStartValue"
884
+ ]
783
885
  }
784
886
  }
785
887
  }
@@ -858,14 +960,22 @@ const machine = require_core.createMachine({
858
960
  clearThumbDragOffset({ refs }) {
859
961
  refs.set("thumbDragOffset", null);
860
962
  },
963
+ setThumbDragStartValue({ refs, context }) {
964
+ refs.set("thumbDragStartValue", context.get("value").slice());
965
+ },
966
+ clearThumbDragStartValue({ refs }) {
967
+ refs.set("thumbDragStartValue", null);
968
+ },
861
969
  setPointerValue(params) {
862
970
  queueMicrotask(() => {
863
- const { context, event } = params;
971
+ const { context, event, prop, refs } = params;
864
972
  const pointValue = getPointValue(params, event.point);
865
973
  if (pointValue == null) return;
866
974
  const focusedIndex = context.get("focusedIndex");
867
- const value = constrainValue(params, pointValue, focusedIndex);
868
- context.set("value", (prev) => require_utils.setValueAtIndex(prev, focusedIndex, value));
975
+ const startValues = refs.get("thumbDragStartValue");
976
+ const result = resolveThumbCollision(prop("thumbCollisionBehavior"), focusedIndex, pointValue, context.get("value"), prop("min"), prop("max"), prop("step"), prop("minStepsBetweenThumbs"), startValues?.[focusedIndex]);
977
+ if (result.swapped) context.set("focusedIndex", result.index);
978
+ context.set("value", result.values);
869
979
  });
870
980
  },
871
981
  focusActiveThumb({ scope, context }) {
@@ -934,7 +1044,7 @@ const props = require_create_props.createProps()([
934
1044
  "readOnly",
935
1045
  "step",
936
1046
  "thumbAlignment",
937
- "thumbAlignment",
1047
+ "thumbCollisionBehavior",
938
1048
  "thumbSize",
939
1049
  "value",
940
1050
  "defaultValue"
@@ -3,9 +3,10 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-BIy26U
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-UNyqrBDu.cjs";
4
4
 
5
5
  //#region src/machines/slider/slider.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "control" | "label" | "track" | "thumb" | "valueText" | "markerGroup" | "marker" | "range" | "draggingIndicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "control" | "track" | "thumb" | "range" | "markerGroup" | "marker" | "draggingIndicator">;
7
7
  //#endregion
8
8
  //#region src/machines/slider/slider.types.d.ts
9
+ type ThumbCollisionBehavior = "none" | "push" | "swap";
9
10
  interface ValueChangeDetails {
10
11
  value: number[];
11
12
  }
@@ -54,8 +55,9 @@ interface SliderProps extends DirectionProperty, CommonProperties {
54
55
  width: number;
55
56
  height: number;
56
57
  } | undefined;
58
+ thumbCollisionBehavior?: ThumbCollisionBehavior | undefined;
57
59
  }
58
- type PropsWithDefault = "dir" | "min" | "max" | "step" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs";
60
+ type PropsWithDefault = "dir" | "min" | "max" | "step" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs" | "thumbCollisionBehavior";
59
61
  type Computed = Readonly<{
60
62
  hasMeasuredThumbSize: boolean;
61
63
  isInteractive: boolean;
@@ -80,6 +82,7 @@ interface SliderSchema {
80
82
  x: number;
81
83
  y: number;
82
84
  } | null;
85
+ thumbDragStartValue: number[] | null;
83
86
  };
84
87
  computed: Computed;
85
88
  event: EventObject;
@@ -3,9 +3,10 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-jyV564
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVcPBg7R.mjs";
4
4
 
5
5
  //#region src/machines/slider/slider.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "control" | "label" | "track" | "thumb" | "valueText" | "markerGroup" | "marker" | "range" | "draggingIndicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "control" | "track" | "thumb" | "range" | "markerGroup" | "marker" | "draggingIndicator">;
7
7
  //#endregion
8
8
  //#region src/machines/slider/slider.types.d.ts
9
+ type ThumbCollisionBehavior = "none" | "push" | "swap";
9
10
  interface ValueChangeDetails {
10
11
  value: number[];
11
12
  }
@@ -54,8 +55,9 @@ interface SliderProps extends DirectionProperty, CommonProperties {
54
55
  width: number;
55
56
  height: number;
56
57
  } | undefined;
58
+ thumbCollisionBehavior?: ThumbCollisionBehavior | undefined;
57
59
  }
58
- type PropsWithDefault = "dir" | "min" | "max" | "step" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs";
60
+ type PropsWithDefault = "dir" | "min" | "max" | "step" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs" | "thumbCollisionBehavior";
59
61
  type Computed = Readonly<{
60
62
  hasMeasuredThumbSize: boolean;
61
63
  isInteractive: boolean;
@@ -80,6 +82,7 @@ interface SliderSchema {
80
82
  x: number;
81
83
  y: number;
82
84
  } | null;
85
+ thumbDragStartValue: number[] | null;
83
86
  };
84
87
  computed: Computed;
85
88
  event: EventObject;
@@ -196,6 +196,92 @@ function getMarkerGroupStyle() {
196
196
 
197
197
  //#endregion
198
198
  //#region src/machines/slider/slider.utils.ts
199
+ function getThumbBounds(ctx) {
200
+ const { index, values, min, max, gap } = ctx;
201
+ const prevThumb = values[index - 1];
202
+ const nextThumb = values[index + 1];
203
+ return {
204
+ min: prevThumb != null ? prevThumb + gap : min,
205
+ max: nextThumb != null ? nextThumb - gap : max
206
+ };
207
+ }
208
+ function round(value) {
209
+ return Math.round(value * 1e10) / 1e10;
210
+ }
211
+ function handleNone(ctx) {
212
+ const { index, value, values } = ctx;
213
+ const bounds = getThumbBounds(ctx);
214
+ const nextValues = values.slice();
215
+ nextValues[index] = round(clampValue(value, bounds.min, bounds.max));
216
+ return {
217
+ values: nextValues,
218
+ index,
219
+ swapped: false
220
+ };
221
+ }
222
+ function handlePush(ctx) {
223
+ const { index, value, values, min, max, gap } = ctx;
224
+ const nextValues = values.slice();
225
+ nextValues[index] = round(clampValue(value, min + index * gap, max - (values.length - 1 - index) * gap));
226
+ for (let i = index + 1; i < values.length; i++) {
227
+ const minAllowed = nextValues[i - 1] + gap;
228
+ if (nextValues[i] < minAllowed) nextValues[i] = round(minAllowed);
229
+ }
230
+ for (let i = index - 1; i >= 0; i--) {
231
+ const maxAllowed = nextValues[i + 1] - gap;
232
+ if (nextValues[i] > maxAllowed) nextValues[i] = round(maxAllowed);
233
+ }
234
+ return {
235
+ values: nextValues,
236
+ index,
237
+ swapped: false
238
+ };
239
+ }
240
+ function handleSwap(ctx, startValue) {
241
+ const { index, value, values, gap } = ctx;
242
+ const prevThumb = values[index - 1];
243
+ const nextThumb = values[index + 1];
244
+ const crossingNext = nextThumb != null && value >= nextThumb && value > startValue;
245
+ const crossingPrev = prevThumb != null && value <= prevThumb && value < startValue;
246
+ if (!crossingNext && !crossingPrev) return handleNone(ctx);
247
+ const swapIndex = crossingNext ? index + 1 : index - 1;
248
+ const nextValues = values.slice();
249
+ const bounds = getThumbBounds({
250
+ ...ctx,
251
+ index: swapIndex
252
+ });
253
+ nextValues[swapIndex] = round(clampValue(value, bounds.min, bounds.max));
254
+ nextValues[index] = values[swapIndex];
255
+ if (crossingNext && nextValues[index] > nextValues[swapIndex] - gap) nextValues[index] = round(nextValues[swapIndex] - gap);
256
+ else if (crossingPrev && nextValues[index] < nextValues[swapIndex] + gap) nextValues[index] = round(nextValues[swapIndex] + gap);
257
+ return {
258
+ values: nextValues,
259
+ index: swapIndex,
260
+ swapped: true
261
+ };
262
+ }
263
+ function resolveThumbCollision(behavior, index, value, values, min, max, step, minStepsBetweenThumbs, startValue) {
264
+ if (values.length === 1) return {
265
+ values: [round(clampValue(value, min, max))],
266
+ index: 0,
267
+ swapped: false
268
+ };
269
+ const ctx = {
270
+ behavior,
271
+ index,
272
+ value,
273
+ values,
274
+ min,
275
+ max,
276
+ gap: step * minStepsBetweenThumbs
277
+ };
278
+ switch (behavior) {
279
+ case "push": return handlePush(ctx);
280
+ case "swap": return handleSwap(ctx, startValue ?? values[index]);
281
+ case "none":
282
+ default: return handleNone(ctx);
283
+ }
284
+ }
199
285
  function normalizeValues(params, nextValues) {
200
286
  return nextValues.map((value, index) => {
201
287
  return constrainValue(params, value, index);
@@ -644,6 +730,7 @@ const machine = createMachine({
644
730
  thumbAlignment: "contain",
645
731
  origin: "start",
646
732
  orientation: "horizontal",
733
+ thumbCollisionBehavior: "none",
647
734
  minStepsBetweenThumbs,
648
735
  ...props$1,
649
736
  defaultValue: normalize(defaultValue, min, max, step, minStepsBetweenThumbs),
@@ -684,7 +771,10 @@ const machine = createMachine({
684
771
  };
685
772
  },
686
773
  refs() {
687
- return { thumbDragOffset: null };
774
+ return {
775
+ thumbDragOffset: null,
776
+ thumbDragStartValue: null
777
+ };
688
778
  },
689
779
  computed: {
690
780
  isHorizontal: ({ prop }) => prop("orientation") === "horizontal",
@@ -722,6 +812,7 @@ const machine = createMachine({
722
812
  target: "dragging",
723
813
  actions: [
724
814
  "setClosestThumbIndex",
815
+ "setThumbDragStartValue",
725
816
  "setPointerValue",
726
817
  "focusActiveThumb"
727
818
  ]
@@ -735,6 +826,7 @@ const machine = createMachine({
735
826
  actions: [
736
827
  "setFocusedIndex",
737
828
  "setThumbDragOffset",
829
+ "setThumbDragStartValue",
738
830
  "focusActiveThumb"
739
831
  ]
740
832
  }
@@ -746,6 +838,7 @@ const machine = createMachine({
746
838
  target: "dragging",
747
839
  actions: [
748
840
  "setClosestThumbIndex",
841
+ "setThumbDragStartValue",
749
842
  "setPointerValue",
750
843
  "focusActiveThumb"
751
844
  ]
@@ -755,6 +848,7 @@ const machine = createMachine({
755
848
  actions: [
756
849
  "setFocusedIndex",
757
850
  "setThumbDragOffset",
851
+ "setThumbDragStartValue",
758
852
  "focusActiveThumb"
759
853
  ]
760
854
  },
@@ -774,12 +868,20 @@ const machine = createMachine({
774
868
  on: {
775
869
  POINTER_UP: {
776
870
  target: "focus",
777
- actions: ["invokeOnChangeEnd", "clearThumbDragOffset"]
871
+ actions: [
872
+ "invokeOnChangeEnd",
873
+ "clearThumbDragOffset",
874
+ "clearThumbDragStartValue"
875
+ ]
778
876
  },
779
877
  POINTER_MOVE: { actions: ["setPointerValue"] },
780
878
  POINTER_CANCEL: {
781
879
  target: "idle",
782
- actions: ["clearFocusedIndex", "clearThumbDragOffset"]
880
+ actions: [
881
+ "clearFocusedIndex",
882
+ "clearThumbDragOffset",
883
+ "clearThumbDragStartValue"
884
+ ]
783
885
  }
784
886
  }
785
887
  }
@@ -858,14 +960,22 @@ const machine = createMachine({
858
960
  clearThumbDragOffset({ refs }) {
859
961
  refs.set("thumbDragOffset", null);
860
962
  },
963
+ setThumbDragStartValue({ refs, context }) {
964
+ refs.set("thumbDragStartValue", context.get("value").slice());
965
+ },
966
+ clearThumbDragStartValue({ refs }) {
967
+ refs.set("thumbDragStartValue", null);
968
+ },
861
969
  setPointerValue(params) {
862
970
  queueMicrotask(() => {
863
- const { context, event } = params;
971
+ const { context, event, prop, refs } = params;
864
972
  const pointValue = getPointValue(params, event.point);
865
973
  if (pointValue == null) return;
866
974
  const focusedIndex = context.get("focusedIndex");
867
- const value = constrainValue(params, pointValue, focusedIndex);
868
- context.set("value", (prev) => setValueAtIndex(prev, focusedIndex, value));
975
+ const startValues = refs.get("thumbDragStartValue");
976
+ const result = resolveThumbCollision(prop("thumbCollisionBehavior"), focusedIndex, pointValue, context.get("value"), prop("min"), prop("max"), prop("step"), prop("minStepsBetweenThumbs"), startValues?.[focusedIndex]);
977
+ if (result.swapped) context.set("focusedIndex", result.index);
978
+ context.set("value", result.values);
869
979
  });
870
980
  },
871
981
  focusActiveThumb({ scope, context }) {
@@ -934,7 +1044,7 @@ const props = createProps()([
934
1044
  "readOnly",
935
1045
  "step",
936
1046
  "thumbAlignment",
937
- "thumbAlignment",
1047
+ "thumbCollisionBehavior",
938
1048
  "thumbSize",
939
1049
  "value",
940
1050
  "defaultValue"
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-BIy26U
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-UNyqrBDu.cjs";
4
4
 
5
5
  //#region src/machines/steps/steps.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "trigger" | "indicator" | "content" | "progress" | "item" | "separator" | "list" | "nextTrigger" | "prevTrigger">;
6
+ declare const anatomy: AnatomyInstance<"root" | "item" | "trigger" | "progress" | "content" | "nextTrigger" | "prevTrigger" | "indicator" | "list" | "separator">;
7
7
  //#endregion
8
8
  //#region src/machines/steps/steps.types.d.ts
9
9
  interface StepChangeDetails {