@zag-js/slider 0.1.7 → 0.1.8

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/index.d.ts CHANGED
@@ -2,4 +2,3 @@ export { dom as unstable__dom } from "./slider.dom";
2
2
  export { connect } from "./slider.connect";
3
3
  export { machine } from "./slider.machine";
4
4
  export type { UserDefinedContext as Context } from "./slider.types";
5
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -47,25 +48,6 @@ var __pow = Math.pow;
47
48
  var dataAttr = (guard) => {
48
49
  return guard ? "" : void 0;
49
50
  };
50
- function nextTick(fn) {
51
- const set = /* @__PURE__ */ new Set();
52
- function raf2(fn2) {
53
- const id = globalThis.requestAnimationFrame(fn2);
54
- set.add(() => globalThis.cancelAnimationFrame(id));
55
- }
56
- raf2(() => raf2(fn));
57
- return function cleanup() {
58
- set.forEach(function(fn2) {
59
- fn2();
60
- });
61
- };
62
- }
63
- function raf(fn) {
64
- const id = globalThis.requestAnimationFrame(fn);
65
- return function cleanup() {
66
- globalThis.cancelAnimationFrame(id);
67
- };
68
- }
69
51
  var isDom = () => typeof window !== "undefined";
70
52
  var isArray = (v) => Array.isArray(v);
71
53
  var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
@@ -76,7 +58,7 @@ function getPlatform() {
76
58
  return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
77
59
  }
78
60
  var pt = (v) => isDom() && v.test(getPlatform());
79
- var isTouchDevice = isDom() && !!navigator.maxTouchPoints;
61
+ var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
80
62
  var isMac = () => pt(/^Mac/) && !isTouchDevice;
81
63
  var isApple = () => pt(/mac|iphone|ipad|ipod/i);
82
64
  var isIos = () => isApple() && !isMac();
@@ -93,68 +75,6 @@ var runIfFn = (v, ...a) => {
93
75
  var noop = () => {
94
76
  };
95
77
  var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
96
- function getListenerElements() {
97
- ;
98
- globalThis.__listenerElements__ = globalThis.__listenerElements__ || /* @__PURE__ */ new Map();
99
- return globalThis.__listenerElements__;
100
- }
101
- function getListenerCache() {
102
- ;
103
- globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
104
- return globalThis.__listenerCache__;
105
- }
106
- function addGlobalEventListener(node, type, handler, options) {
107
- var _a;
108
- if (!node)
109
- return noop;
110
- const hash = JSON.stringify({ type, options });
111
- const listenerElements = getListenerElements();
112
- const listenerCache = getListenerCache();
113
- const group = listenerElements.get(node);
114
- if (!listenerElements.has(node)) {
115
- const group2 = /* @__PURE__ */ new Map([[hash, /* @__PURE__ */ new Set([handler])]]);
116
- listenerElements.set(node, group2);
117
- } else if (group == null ? void 0 : group.has(hash)) {
118
- (_a = group == null ? void 0 : group.get(hash)) == null ? void 0 : _a.add(handler);
119
- } else {
120
- group == null ? void 0 : group.set(hash, /* @__PURE__ */ new Set([handler]));
121
- }
122
- function attach(node2) {
123
- var _a2, _b;
124
- function listener(event) {
125
- var _a3;
126
- const group2 = listenerElements.get(node2);
127
- (_a3 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a3.forEach((fn) => fn(event));
128
- }
129
- if (!(listenerCache == null ? void 0 : listenerCache.has(node2))) {
130
- listenerCache.set(node2, /* @__PURE__ */ new Map([[hash, listener]]));
131
- node2.addEventListener(type, listener, options);
132
- return;
133
- }
134
- if (!((_a2 = listenerCache == null ? void 0 : listenerCache.get(node2)) == null ? void 0 : _a2.has(hash))) {
135
- (_b = listenerCache.get(node2)) == null ? void 0 : _b.set(hash, listener);
136
- node2.addEventListener(type, listener, options);
137
- }
138
- }
139
- attach(node);
140
- return function remove() {
141
- var _a2, _b, _c, _d;
142
- if (!listenerElements.has(node))
143
- return;
144
- const group2 = listenerElements.get(node);
145
- (_a2 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a2.delete(handler);
146
- if (((_b = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _b.size) === 0) {
147
- const listener = (_c = listenerCache.get(node)) == null ? void 0 : _c.get(hash);
148
- node.removeEventListener(type, listener, options);
149
- group2 == null ? void 0 : group2.delete(hash);
150
- (_d = listenerCache.get(node)) == null ? void 0 : _d.delete(hash);
151
- if ((group2 == null ? void 0 : group2.size) === 0) {
152
- listenerElements.delete(node);
153
- listenerCache.delete(node);
154
- }
155
- }
156
- };
157
- }
158
78
  var isRef = (v) => hasProp(v, "current");
159
79
  var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
160
80
  function extractInfo(event, type = "page") {
@@ -166,9 +86,12 @@ function extractInfo(event, type = "page") {
166
86
  }
167
87
  };
168
88
  }
169
- function addDomEvent(target, event, listener, options) {
89
+ function addDomEvent(target, eventName, handler, options) {
170
90
  const node = isRef(target) ? target.current : runIfFn(target);
171
- return addGlobalEventListener(node, event, listener, options);
91
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
92
+ return () => {
93
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
94
+ };
172
95
  }
173
96
  function addPointerEvent(target, event, listener, options) {
174
97
  var _a;
@@ -216,6 +139,25 @@ function getEventName(evt) {
216
139
  return mouseEventNames[evt];
217
140
  return evt;
218
141
  }
142
+ function nextTick(fn) {
143
+ const set = /* @__PURE__ */ new Set();
144
+ function raf2(fn2) {
145
+ const id = globalThis.requestAnimationFrame(fn2);
146
+ set.add(() => globalThis.cancelAnimationFrame(id));
147
+ }
148
+ raf2(() => raf2(fn));
149
+ return function cleanup() {
150
+ set.forEach(function(fn2) {
151
+ fn2();
152
+ });
153
+ };
154
+ }
155
+ function raf(fn) {
156
+ const id = globalThis.requestAnimationFrame(fn);
157
+ return function cleanup() {
158
+ globalThis.cancelAnimationFrame(id);
159
+ };
160
+ }
219
161
  function getOwnerWindow(el) {
220
162
  var _a;
221
163
  return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
@@ -319,30 +261,6 @@ function getEventStep(event) {
319
261
  return isSkipKey ? 10 : 1;
320
262
  }
321
263
  }
322
- function itemById(v, id) {
323
- return v.find((node) => node.id === id);
324
- }
325
- function indexOfId(v, id) {
326
- const item = itemById(v, id);
327
- return item ? v.indexOf(item) : -1;
328
- }
329
- var getValueText = (item) => {
330
- var _a, _b;
331
- return (_b = (_a = item.dataset.valuetext) != null ? _a : item.textContent) != null ? _b : "";
332
- };
333
- var match = (valueText, query2) => valueText.toLowerCase().startsWith(query2.toLowerCase());
334
- var wrap = (v, idx) => {
335
- return v.map((_, index) => v[(Math.max(idx, 0) + index) % v.length]);
336
- };
337
- function findByText(v, text, currentId) {
338
- const index = currentId ? indexOfId(v, currentId) : -1;
339
- let items = currentId ? wrap(v, index) : v;
340
- const isSingleKey = text.length === 1;
341
- if (isSingleKey) {
342
- items = items.filter((item) => item.id !== currentId);
343
- }
344
- return items.find((item) => match(getValueText(item), text));
345
- }
346
264
  var state = "default";
347
265
  var savedUserSelect = "";
348
266
  var modifiedElementMap = /* @__PURE__ */ new WeakMap();
@@ -406,34 +324,25 @@ function trackPointerMove(opts) {
406
324
  };
407
325
  return pipe(addPointerEvent(doc, "pointermove", handlePointerMove, false), addPointerEvent(doc, "pointerup", onPointerUp, false), addPointerEvent(doc, "pointercancel", onPointerUp, false), addPointerEvent(doc, "contextmenu", onPointerUp, false), disableTextSelection({ doc }));
408
326
  }
409
- function findByTypeahead(_items, options) {
410
- const { state: state2, activeId, key, timeout = 350 } = options;
411
- const search = state2.keysSoFar + key;
412
- const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
413
- const query2 = isRepeated ? search[0] : search;
414
- let items = _items.slice();
415
- const next = findByText(items, query2, activeId);
416
- function cleanup() {
417
- clearTimeout(state2.timer);
418
- state2.timer = -1;
419
- }
420
- function update(value) {
421
- state2.keysSoFar = value;
422
- cleanup();
423
- if (value !== "") {
424
- state2.timer = +setTimeout(() => {
425
- update("");
426
- cleanup();
427
- }, timeout);
428
- }
429
- }
430
- update(search);
431
- return next;
327
+
328
+ // ../../utilities/rect/dist/index.mjs
329
+ var isArray2 = (v) => Array.isArray(v);
330
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
331
+ var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
332
+ var isTouchEvent2 = (v) => isObject2(v) && hasProp2(v, "touches");
333
+ var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
334
+ function getEventPoint(e, t = "page") {
335
+ const p = isTouchEvent2(e) ? e.touches[0] || e.changedTouches[0] || fallback2 : e;
336
+ return { x: p[`${t}X`], y: p[`${t}Y`] };
337
+ }
338
+ function relativeToNode(p, el) {
339
+ const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft;
340
+ const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop;
341
+ return {
342
+ point: { x: dx, y: dy },
343
+ progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight }
344
+ };
432
345
  }
433
- findByTypeahead.defaultOptions = {
434
- keysSoFar: "",
435
- timer: -1
436
- };
437
346
 
438
347
  // ../../utilities/number/dist/index.mjs
439
348
  var __pow2 = Math.pow;
@@ -495,50 +404,7 @@ var transform = (a, b) => {
495
404
  };
496
405
  };
497
406
 
498
- // ../../utilities/rect/dist/index.mjs
499
- var isDom2 = () => typeof window !== "undefined";
500
- var isArray2 = (v) => Array.isArray(v);
501
- var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
502
- var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
503
- var isTouchDevice2 = isDom2() && !!navigator.maxTouchPoints;
504
- var isTouchEvent2 = (v) => isObject2(v) && hasProp2(v, "touches");
505
- var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
506
- function getEventPoint(e, t = "page") {
507
- const p = isTouchEvent2(e) ? e.touches[0] || e.changedTouches[0] || fallback2 : e;
508
- return { x: p[`${t}X`], y: p[`${t}Y`] };
509
- }
510
- function relativeToNode(p, el) {
511
- const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft;
512
- const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop;
513
- return {
514
- point: { x: dx, y: dy },
515
- progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight }
516
- };
517
- }
518
-
519
- // src/slider.utils.ts
520
- var utils = {
521
- fromPercent(ctx, percent) {
522
- percent = clamp(percent, { min: 0, max: 1 });
523
- return parseFloat(snapToStep(percentToValue(percent, ctx), ctx.step));
524
- },
525
- clamp(ctx, value) {
526
- return clamp(value, ctx);
527
- },
528
- convert(ctx, value) {
529
- return clamp(parseFloat(snapToStep(value, ctx.step)), ctx);
530
- },
531
- decrement(ctx, step) {
532
- let value = decrement(ctx.value, step != null ? step : ctx.step);
533
- return utils.convert(ctx, value);
534
- },
535
- increment(ctx, step) {
536
- let value = increment(ctx.value, step != null ? step : ctx.step);
537
- return utils.convert(ctx, value);
538
- }
539
- };
540
-
541
- // src/slider.dom.ts
407
+ // src/slider.style.ts
542
408
  function getVerticalThumbOffset(ctx) {
543
409
  var _a;
544
410
  const { height = 0 } = (_a = ctx.thumbSize) != null ? _a : {};
@@ -555,54 +421,119 @@ function getHorizontalThumbOffset(ctx) {
555
421
  const getValue = transform([ctx.min, ctx.max], [-width / 2, width / 2]);
556
422
  return parseFloat(getValue(ctx.value).toFixed(2));
557
423
  }
558
- function getThumbStyle(ctx) {
424
+ function getThumbOffset(ctx) {
559
425
  const percent = valueToPercent(ctx.value, ctx);
426
+ if (ctx.thumbAlignment === "center")
427
+ return `${percent}%`;
560
428
  const offset = ctx.isVertical ? getVerticalThumbOffset(ctx) : getHorizontalThumbOffset(ctx);
561
- const style = {
429
+ return `calc(${percent}% - ${offset}px)`;
430
+ }
431
+ function getThumbStyle(ctx) {
432
+ const placementProp = ctx.isVertical ? "bottom" : ctx.isRtl ? "right" : "left";
433
+ return {
562
434
  visibility: ctx.hasMeasuredThumbSize ? "visible" : "hidden",
563
435
  position: "absolute",
564
436
  transform: "var(--slider-thumb-transform)",
565
- "--slider-thumb-placement": `calc(${percent}% - ${offset}px)`
437
+ [placementProp]: "var(--slider-thumb-offset)"
566
438
  };
567
- if (ctx.isVertical) {
568
- style.bottom = "var(--slider-thumb-placement)";
569
- } else {
570
- style[ctx.isRtl ? "right" : "left"] = "var(--slider-thumb-placement)";
571
- }
572
- return style;
573
439
  }
574
- function getRangeStyle(ctx) {
440
+ function getRangeOffsets(ctx) {
575
441
  const percent = valueToPercent(ctx.value, ctx);
576
- const style = {
577
- position: "absolute"
578
- };
579
- let startValue = "0%";
580
- let endValue = `${100 - percent}%`;
442
+ let start = "0%";
443
+ let end = `${100 - percent}%`;
581
444
  if (ctx.origin === "center") {
582
445
  const isNegative = percent < 50;
583
- startValue = isNegative ? `${percent}%` : "50%";
584
- endValue = isNegative ? "50%" : endValue;
446
+ start = isNegative ? `${percent}%` : "50%";
447
+ end = isNegative ? "50%" : end;
585
448
  }
449
+ return { start, end };
450
+ }
451
+ function getRangeStyle(ctx) {
586
452
  if (ctx.isVertical) {
587
- return __spreadProps(__spreadValues({}, style), {
588
- bottom: startValue,
589
- top: endValue
590
- });
453
+ return {
454
+ position: "absolute",
455
+ bottom: "var(--slider-range-start)",
456
+ top: "var(--slider-range-end)"
457
+ };
591
458
  }
592
- return __spreadProps(__spreadValues({}, style), {
593
- [ctx.isRtl ? "right" : "left"]: startValue,
594
- [ctx.isRtl ? "left" : "right"]: endValue
595
- });
459
+ return {
460
+ position: "absolute",
461
+ [ctx.isRtl ? "right" : "left"]: "var(--slider-range-start)",
462
+ [ctx.isRtl ? "left" : "right"]: "var(--slider-range-end)"
463
+ };
596
464
  }
597
- function getControlStyle(ctx) {
465
+ function getControlStyle() {
598
466
  return {
599
467
  touchAction: "none",
600
468
  userSelect: "none",
469
+ position: "relative"
470
+ };
471
+ }
472
+ function getRootStyle(ctx) {
473
+ const range = getRangeOffsets(ctx);
474
+ return {
601
475
  "--slider-thumb-transform": ctx.isVertical ? "translateY(50%)" : "translateX(-50%)",
476
+ "--slider-thumb-offset": getThumbOffset(ctx),
477
+ "--slider-range-start": range.start,
478
+ "--slider-range-end": range.end
479
+ };
480
+ }
481
+ function getMarkerStyle(ctx, percent) {
482
+ return {
483
+ position: "absolute",
484
+ pointerEvents: "none",
485
+ [ctx.isHorizontal ? "left" : "bottom"]: `${ctx.isRtl ? 100 - percent : percent}%`
486
+ };
487
+ }
488
+ function getLabelStyle() {
489
+ return { userSelect: "none" };
490
+ }
491
+ function getTrackStyle() {
492
+ return { position: "relative" };
493
+ }
494
+ function getMarkerGroupStyle() {
495
+ return {
496
+ userSelect: "none",
497
+ pointerEvents: "none",
602
498
  position: "relative"
603
499
  };
604
500
  }
605
- var dom = {
501
+ var styles = {
502
+ getThumbOffset,
503
+ getControlStyle,
504
+ getThumbStyle,
505
+ getRangeStyle,
506
+ getRootStyle,
507
+ getMarkerStyle,
508
+ getLabelStyle,
509
+ getTrackStyle,
510
+ getMarkerGroupStyle
511
+ };
512
+
513
+ // src/slider.utils.ts
514
+ var utils = {
515
+ fromPercent(ctx, percent) {
516
+ percent = clamp(percent, { min: 0, max: 1 });
517
+ return parseFloat(snapToStep(percentToValue(percent, ctx), ctx.step));
518
+ },
519
+ clamp(ctx, value) {
520
+ return clamp(value, ctx);
521
+ },
522
+ convert(ctx, value) {
523
+ return clamp(parseFloat(snapToStep(value, ctx.step)), ctx);
524
+ },
525
+ decrement(ctx, step) {
526
+ let value = decrement(ctx.value, step != null ? step : ctx.step);
527
+ return utils.convert(ctx, value);
528
+ },
529
+ increment(ctx, step) {
530
+ let value = increment(ctx.value, step != null ? step : ctx.step);
531
+ return utils.convert(ctx, value);
532
+ }
533
+ };
534
+
535
+ // src/slider.dom.ts
536
+ var dom = __spreadProps(__spreadValues({}, styles), {
606
537
  getDoc: (ctx) => {
607
538
  var _a;
608
539
  return (_a = ctx.doc) != null ? _a : document;
@@ -630,7 +561,7 @@ var dom = {
630
561
  },
631
562
  getTrackId: (ctx) => {
632
563
  var _a, _b;
633
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.track) != null ? _b : `slider:-${ctx.uid}track`;
564
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.track) != null ? _b : `slider:${ctx.uid}track`;
634
565
  },
635
566
  getRangeId: (ctx) => {
636
567
  var _a, _b;
@@ -645,9 +576,6 @@ var dom = {
645
576
  getThumbEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getThumbId(ctx)),
646
577
  getControlEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getControlId(ctx)),
647
578
  getInputEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getInputId(ctx)),
648
- getControlStyle,
649
- getThumbStyle,
650
- getRangeStyle,
651
579
  getValueFromPoint(ctx, point) {
652
580
  const control = dom.getControlEl(ctx);
653
581
  if (!control)
@@ -666,21 +594,8 @@ var dom = {
666
594
  if (!input)
667
595
  return;
668
596
  dispatchInputValueEvent(input, ctx.value);
669
- },
670
- getMarkerStyle(ctx, percent) {
671
- const style = {
672
- position: "absolute",
673
- pointerEvents: "none"
674
- };
675
- if (ctx.isHorizontal) {
676
- percent = ctx.isRtl ? 100 - percent : percent;
677
- style.left = `${percent}%`;
678
- } else {
679
- style.bottom = `${percent}%`;
680
- }
681
- return style;
682
597
  }
683
- };
598
+ });
684
599
 
685
600
  // ../../types/dist/index.mjs
686
601
  function createNormalizer(fn) {
@@ -693,8 +608,6 @@ function createNormalizer(fn) {
693
608
  var normalizeProp = createNormalizer((v) => v);
694
609
 
695
610
  // ../../utilities/core/dist/index.mjs
696
- var isDom3 = () => typeof window !== "undefined";
697
- var isTouchDevice3 = isDom3() && !!navigator.maxTouchPoints;
698
611
  var isLeftClick2 = (v) => v.button === 0;
699
612
  var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
700
613
 
@@ -733,14 +646,18 @@ function connect(state2, send, normalize = normalizeProp) {
733
646
  rootProps: normalize.element({
734
647
  "data-part": "root",
735
648
  "data-disabled": dataAttr(isDisabled),
649
+ "data-focus": dataAttr(isFocused),
736
650
  "data-orientation": state2.context.orientation,
651
+ "data-invalid": dataAttr(isInvalid),
737
652
  id: dom.getRootId(state2.context),
738
- dir: state2.context.dir
653
+ dir: state2.context.dir,
654
+ style: dom.getRootStyle(state2.context)
739
655
  }),
740
656
  labelProps: normalize.label({
741
657
  "data-part": "label",
742
658
  "data-disabled": dataAttr(isDisabled),
743
659
  "data-invalid": dataAttr(isInvalid),
660
+ "data-focus": dataAttr(isFocused),
744
661
  id: dom.getLabelId(state2.context),
745
662
  htmlFor: dom.getInputId(state2.context),
746
663
  onClick(event) {
@@ -750,9 +667,7 @@ function connect(state2, send, normalize = normalizeProp) {
750
667
  event.preventDefault();
751
668
  (_a2 = dom.getThumbEl(state2.context)) == null ? void 0 : _a2.focus();
752
669
  },
753
- style: {
754
- userSelect: "none"
755
- }
670
+ style: dom.getLabelStyle()
756
671
  }),
757
672
  thumbProps: normalize.element({
758
673
  "data-part": "thumb",
@@ -849,14 +764,15 @@ function connect(state2, send, normalize = normalizeProp) {
849
764
  "data-part": "track",
850
765
  id: dom.getTrackId(state2.context),
851
766
  "data-disabled": dataAttr(isDisabled),
767
+ "data-focus": dataAttr(isFocused),
852
768
  "data-invalid": dataAttr(isInvalid),
853
769
  "data-orientation": state2.context.orientation,
854
- "data-focus": dataAttr(isFocused),
855
- style: { position: "relative" }
770
+ style: dom.getTrackStyle()
856
771
  }),
857
772
  rangeProps: normalize.element({
858
773
  "data-part": "range",
859
774
  id: dom.getRangeId(state2.context),
775
+ "data-focus": dataAttr(isFocused),
860
776
  "data-invalid": dataAttr(isInvalid),
861
777
  "data-disabled": dataAttr(isDisabled),
862
778
  "data-orientation": state2.context.orientation,
@@ -880,18 +796,14 @@ function connect(state2, send, normalize = normalizeProp) {
880
796
  event.preventDefault();
881
797
  event.stopPropagation();
882
798
  },
883
- style: dom.getControlStyle(state2.context)
799
+ style: dom.getControlStyle()
884
800
  }),
885
801
  markerGroupProps: normalize.element({
886
802
  "data-part": "marker-group",
887
803
  role: "presentation",
888
804
  "aria-hidden": true,
889
805
  "data-orientation": state2.context.orientation,
890
- style: {
891
- userSelect: "none",
892
- pointerEvents: "none",
893
- position: "relative"
894
- }
806
+ style: dom.getMarkerGroupStyle()
895
807
  }),
896
808
  getMarkerProps({ value }) {
897
809
  const percent = valueToPercent(value, state2.context);
@@ -899,6 +811,7 @@ function connect(state2, send, normalize = normalizeProp) {
899
811
  const markerState = value > state2.context.value ? "over-value" : value < state2.context.value ? "under-value" : "at-value";
900
812
  return normalize.element({
901
813
  "data-part": "marker",
814
+ role: "presentation",
902
815
  "data-orientation": state2.context.orientation,
903
816
  id: dom.getMarkerId(state2.context, value),
904
817
  "data-value": value,
@@ -918,6 +831,7 @@ function machine(ctx = {}) {
918
831
  initial: "unknown",
919
832
  context: __spreadValues({
920
833
  thumbSize: null,
834
+ thumbAlignment: "contain",
921
835
  uid: "",
922
836
  disabled: false,
923
837
  threshold: 5,
@@ -1032,7 +946,7 @@ function machine(ctx = {}) {
1032
946
  let cleanup;
1033
947
  nextTick(() => {
1034
948
  cleanup = trackFieldsetDisabled(dom.getRootEl(ctx2), (disabled) => {
1035
- if (disabled != ctx2.disabled) {
949
+ if (disabled) {
1036
950
  ctx2.disabled = disabled;
1037
951
  }
1038
952
  });
@@ -1090,6 +1004,8 @@ function machine(ctx = {}) {
1090
1004
  dom.dispatchChangeEvent(ctx2);
1091
1005
  },
1092
1006
  setThumbSize(ctx2) {
1007
+ if (ctx2.thumbAlignment !== "contain")
1008
+ return;
1093
1009
  raf(() => {
1094
1010
  const el = dom.getThumbEl(ctx2);
1095
1011
  if (!el)
@@ -1127,4 +1043,3 @@ function machine(ctx = {}) {
1127
1043
  }
1128
1044
  });
1129
1045
  }
1130
- //# sourceMappingURL=index.js.map