@zag-js/slider 0.10.4 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,657 @@
1
- export { anatomy } from './slider.anatomy.mjs';
2
- export { connect } from './slider.connect.mjs';
3
- export { dom as unstable__dom } from './slider.dom.mjs';
4
- export { machine } from './slider.machine.mjs';
1
+ // src/slider.anatomy.ts
2
+ import { createAnatomy } from "@zag-js/anatomy";
3
+ var anatomy = createAnatomy("slider").parts(
4
+ "root",
5
+ "label",
6
+ "thumb",
7
+ "hiddenInput",
8
+ "output",
9
+ "track",
10
+ "range",
11
+ "control",
12
+ "markerGroup",
13
+ "marker"
14
+ );
15
+ var parts = anatomy.build();
16
+
17
+ // src/slider.connect.ts
18
+ import {
19
+ getEventKey,
20
+ getEventPoint,
21
+ getEventStep,
22
+ getNativeEvent,
23
+ isLeftClick,
24
+ isModifiedEvent
25
+ } from "@zag-js/dom-event";
26
+ import { ariaAttr, dataAttr } from "@zag-js/dom-query";
27
+ import { getPercentValue as getPercentValue2, getValuePercent as getValuePercent2 } from "@zag-js/numeric-range";
28
+
29
+ // src/slider.dom.ts
30
+ import { getRelativePoint } from "@zag-js/dom-event";
31
+ import { createScope } from "@zag-js/dom-query";
32
+ import { dispatchInputValueEvent } from "@zag-js/form-utils";
33
+ import { getPercentValue } from "@zag-js/numeric-range";
34
+
35
+ // src/slider.style.ts
36
+ import { getValuePercent, getValueTransformer } from "@zag-js/numeric-range";
37
+ function getVerticalThumbOffset(ctx) {
38
+ const { height = 0 } = ctx.thumbSize ?? {};
39
+ const getValue = getValueTransformer([ctx.min, ctx.max], [-height / 2, height / 2]);
40
+ return parseFloat(getValue(ctx.value).toFixed(2));
41
+ }
42
+ function getHorizontalThumbOffset(ctx) {
43
+ const { width = 0 } = ctx.thumbSize ?? {};
44
+ if (ctx.isRtl) {
45
+ const getValue2 = getValueTransformer([ctx.max, ctx.min], [-width * 1.5, -width / 2]);
46
+ return -1 * parseFloat(getValue2(ctx.value).toFixed(2));
47
+ }
48
+ const getValue = getValueTransformer([ctx.min, ctx.max], [-width / 2, width / 2]);
49
+ return parseFloat(getValue(ctx.value).toFixed(2));
50
+ }
51
+ function getThumbOffset(ctx) {
52
+ const percent = getValuePercent(ctx.value, ctx.min, ctx.max) * 100;
53
+ if (ctx.thumbAlignment === "center") {
54
+ return `${percent}%`;
55
+ }
56
+ const offset = ctx.isVertical ? getVerticalThumbOffset(ctx) : getHorizontalThumbOffset(ctx);
57
+ return `calc(${percent}% - ${offset}px)`;
58
+ }
59
+ function getVisibility(ctx) {
60
+ let visibility = "visible";
61
+ if (ctx.thumbAlignment === "contain" && !ctx.hasMeasuredThumbSize) {
62
+ visibility = "hidden";
63
+ }
64
+ return visibility;
65
+ }
66
+ function getThumbStyle(ctx) {
67
+ const placementProp = ctx.isVertical ? "bottom" : ctx.isRtl ? "right" : "left";
68
+ return {
69
+ visibility: getVisibility(ctx),
70
+ position: "absolute",
71
+ transform: "var(--slider-thumb-transform)",
72
+ [placementProp]: "var(--slider-thumb-offset)"
73
+ };
74
+ }
75
+ function getRangeOffsets(ctx) {
76
+ let start = "0%";
77
+ let end = `${100 - ctx.valuePercent}%`;
78
+ if (ctx.origin === "center") {
79
+ const isNegative = ctx.valuePercent < 50;
80
+ start = isNegative ? `${ctx.valuePercent}%` : "50%";
81
+ end = isNegative ? "50%" : end;
82
+ }
83
+ return { start, end };
84
+ }
85
+ function getRangeStyle(ctx) {
86
+ if (ctx.isVertical) {
87
+ return {
88
+ position: "absolute",
89
+ bottom: "var(--slider-range-start)",
90
+ top: "var(--slider-range-end)"
91
+ };
92
+ }
93
+ return {
94
+ position: "absolute",
95
+ [ctx.isRtl ? "right" : "left"]: "var(--slider-range-start)",
96
+ [ctx.isRtl ? "left" : "right"]: "var(--slider-range-end)"
97
+ };
98
+ }
99
+ function getControlStyle() {
100
+ return {
101
+ touchAction: "none",
102
+ userSelect: "none",
103
+ position: "relative"
104
+ };
105
+ }
106
+ function getRootStyle(ctx) {
107
+ const range = getRangeOffsets(ctx);
108
+ return {
109
+ "--slider-thumb-transform": ctx.isVertical ? "translateY(50%)" : "translateX(-50%)",
110
+ "--slider-thumb-offset": getThumbOffset(ctx),
111
+ "--slider-range-start": range.start,
112
+ "--slider-range-end": range.end
113
+ };
114
+ }
115
+ function getMarkerStyle(ctx, percent) {
116
+ return {
117
+ position: "absolute",
118
+ pointerEvents: "none",
119
+ [ctx.isHorizontal ? "left" : "bottom"]: `${(ctx.isRtl ? 1 - percent : percent) * 100}%`
120
+ };
121
+ }
122
+ function getLabelStyle() {
123
+ return { userSelect: "none" };
124
+ }
125
+ function getTrackStyle() {
126
+ return { position: "relative" };
127
+ }
128
+ function getMarkerGroupStyle() {
129
+ return {
130
+ userSelect: "none",
131
+ pointerEvents: "none",
132
+ position: "relative"
133
+ };
134
+ }
135
+ var styles = {
136
+ getThumbOffset,
137
+ getControlStyle,
138
+ getThumbStyle,
139
+ getRangeStyle,
140
+ getRootStyle,
141
+ getMarkerStyle,
142
+ getLabelStyle,
143
+ getTrackStyle,
144
+ getMarkerGroupStyle
145
+ };
146
+
147
+ // src/slider.dom.ts
148
+ var dom = createScope({
149
+ ...styles,
150
+ getRootId: (ctx) => ctx.ids?.root ?? `slider:${ctx.id}`,
151
+ getThumbId: (ctx) => ctx.ids?.thumb ?? `slider:${ctx.id}:thumb`,
152
+ getControlId: (ctx) => ctx.ids?.control ?? `slider:${ctx.id}:control`,
153
+ getHiddenInputId: (ctx) => ctx.ids?.hiddenInput ?? `slider:${ctx.id}:input`,
154
+ getOutputId: (ctx) => ctx.ids?.output ?? `slider:${ctx.id}:output`,
155
+ getTrackId: (ctx) => ctx.ids?.track ?? `slider:${ctx.id}track`,
156
+ getRangeId: (ctx) => ctx.ids?.track ?? `slider:${ctx.id}:range`,
157
+ getLabelId: (ctx) => ctx.ids?.label ?? `slider:${ctx.id}:label`,
158
+ getMarkerId: (ctx, value) => `slider:${ctx.id}:marker:${value}`,
159
+ getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
160
+ getThumbEl: (ctx) => dom.getById(ctx, dom.getThumbId(ctx)),
161
+ getControlEl: (ctx) => dom.queryById(ctx, dom.getControlId(ctx)),
162
+ getHiddenInputEl: (ctx) => dom.getById(ctx, dom.getHiddenInputId(ctx)),
163
+ getValueFromPoint(ctx, point) {
164
+ const relativePoint = getRelativePoint(point, dom.getControlEl(ctx));
165
+ const percent = relativePoint.getPercentValue({
166
+ orientation: ctx.orientation,
167
+ dir: ctx.dir,
168
+ inverted: { y: true }
169
+ });
170
+ return getPercentValue(percent, ctx.min, ctx.max, ctx.step);
171
+ },
172
+ dispatchChangeEvent(ctx) {
173
+ const input = dom.getHiddenInputEl(ctx);
174
+ if (!input)
175
+ return;
176
+ dispatchInputValueEvent(input, { value: ctx.value });
177
+ }
178
+ });
179
+
180
+ // src/slider.connect.ts
181
+ function connect(state, send, normalize) {
182
+ const ariaLabel = state.context["aria-label"];
183
+ const ariaLabelledBy = state.context["aria-labelledby"];
184
+ const ariaValueText = state.context.getAriaValueText?.(state.context.value);
185
+ const isFocused = state.matches("focus");
186
+ const isDragging = state.matches("dragging");
187
+ const isDisabled = state.context.disabled;
188
+ const isInteractive = state.context.isInteractive;
189
+ const isInvalid = state.context.invalid;
190
+ function getPercentValueFn(percent) {
191
+ return getPercentValue2(percent, state.context.min, state.context.max, state.context.step);
192
+ }
193
+ function getValuePercentFn(value) {
194
+ return getValuePercent2(value, state.context.min, state.context.max);
195
+ }
196
+ return {
197
+ /**
198
+ * Whether the slider is focused.
199
+ */
200
+ isFocused,
201
+ /**
202
+ * Whether the slider is being dragged.
203
+ */
204
+ isDragging,
205
+ /**
206
+ * The value of the slider.
207
+ */
208
+ value: state.context.value,
209
+ /**
210
+ * The value of the slider as a percent.
211
+ */
212
+ percent: getValuePercent2(state.context.value, state.context.min, state.context.max),
213
+ /**
214
+ * Function to set the value of the slider.
215
+ */
216
+ setValue(value) {
217
+ send({ type: "SET_VALUE", value });
218
+ },
219
+ /**
220
+ * Returns the value of the slider at the given percent.
221
+ */
222
+ getPercentValue: getPercentValueFn,
223
+ /**
224
+ * Returns the percent of the slider at the given value.
225
+ */
226
+ getValuePercent: getValuePercentFn,
227
+ /**
228
+ * Function to focus the slider.
229
+ */
230
+ focus() {
231
+ dom.getThumbEl(state.context)?.focus();
232
+ },
233
+ /**
234
+ * Function to increment the value of the slider by the step.
235
+ */
236
+ increment() {
237
+ send("INCREMENT");
238
+ },
239
+ /**
240
+ * Function to decrement the value of the slider by the step.
241
+ */
242
+ decrement() {
243
+ send("DECREMENT");
244
+ },
245
+ rootProps: normalize.element({
246
+ ...parts.root.attrs,
247
+ "data-disabled": dataAttr(isDisabled),
248
+ "data-focus": dataAttr(isFocused),
249
+ "data-orientation": state.context.orientation,
250
+ "data-invalid": dataAttr(isInvalid),
251
+ id: dom.getRootId(state.context),
252
+ dir: state.context.dir,
253
+ style: dom.getRootStyle(state.context)
254
+ }),
255
+ labelProps: normalize.label({
256
+ ...parts.label.attrs,
257
+ "data-disabled": dataAttr(isDisabled),
258
+ "data-invalid": dataAttr(isInvalid),
259
+ "data-focus": dataAttr(isFocused),
260
+ id: dom.getLabelId(state.context),
261
+ htmlFor: dom.getHiddenInputId(state.context),
262
+ onClick(event) {
263
+ if (!isInteractive)
264
+ return;
265
+ event.preventDefault();
266
+ dom.getThumbEl(state.context)?.focus();
267
+ },
268
+ style: dom.getLabelStyle()
269
+ }),
270
+ thumbProps: normalize.element({
271
+ ...parts.thumb.attrs,
272
+ id: dom.getThumbId(state.context),
273
+ "data-disabled": dataAttr(isDisabled),
274
+ "data-orientation": state.context.orientation,
275
+ "data-focus": dataAttr(isFocused),
276
+ draggable: false,
277
+ "aria-invalid": ariaAttr(isInvalid),
278
+ "data-invalid": dataAttr(isInvalid),
279
+ "aria-disabled": ariaAttr(isDisabled),
280
+ "aria-label": ariaLabel,
281
+ "aria-labelledby": ariaLabel ? void 0 : ariaLabelledBy ?? dom.getLabelId(state.context),
282
+ "aria-orientation": state.context.orientation,
283
+ "aria-valuemax": state.context.max,
284
+ "aria-valuemin": state.context.min,
285
+ "aria-valuenow": state.context.value,
286
+ "aria-valuetext": ariaValueText,
287
+ role: "slider",
288
+ tabIndex: isDisabled ? void 0 : 0,
289
+ onBlur() {
290
+ if (!isInteractive)
291
+ return;
292
+ send("BLUR");
293
+ },
294
+ onFocus() {
295
+ if (!isInteractive)
296
+ return;
297
+ send("FOCUS");
298
+ },
299
+ onKeyDown(event) {
300
+ if (!isInteractive)
301
+ return;
302
+ const step = getEventStep(event) * state.context.step;
303
+ let prevent = true;
304
+ const keyMap = {
305
+ ArrowUp() {
306
+ send({ type: "ARROW_UP", step });
307
+ prevent = state.context.isVertical;
308
+ },
309
+ ArrowDown() {
310
+ send({ type: "ARROW_DOWN", step });
311
+ prevent = state.context.isVertical;
312
+ },
313
+ ArrowLeft() {
314
+ send({ type: "ARROW_LEFT", step });
315
+ prevent = state.context.isHorizontal;
316
+ },
317
+ ArrowRight() {
318
+ send({ type: "ARROW_RIGHT", step });
319
+ prevent = state.context.isHorizontal;
320
+ },
321
+ PageUp() {
322
+ send({ type: "PAGE_UP", step });
323
+ },
324
+ PageDown() {
325
+ send({ type: "PAGE_DOWN", step });
326
+ },
327
+ Home() {
328
+ send("HOME");
329
+ },
330
+ End() {
331
+ send("END");
332
+ }
333
+ };
334
+ const key = getEventKey(event, state.context);
335
+ const exec = keyMap[key];
336
+ if (!exec)
337
+ return;
338
+ exec(event);
339
+ if (prevent) {
340
+ event.preventDefault();
341
+ }
342
+ },
343
+ style: dom.getThumbStyle(state.context)
344
+ }),
345
+ hiddenInputProps: normalize.input({
346
+ ...parts.hiddenInput.attrs,
347
+ type: "text",
348
+ defaultValue: state.context.value,
349
+ name: state.context.name,
350
+ form: state.context.form,
351
+ id: dom.getHiddenInputId(state.context),
352
+ hidden: true
353
+ }),
354
+ outputProps: normalize.output({
355
+ ...parts.output.attrs,
356
+ "data-disabled": dataAttr(isDisabled),
357
+ "data-invalid": dataAttr(isInvalid),
358
+ id: dom.getOutputId(state.context),
359
+ htmlFor: dom.getHiddenInputId(state.context),
360
+ "aria-live": "off"
361
+ }),
362
+ trackProps: normalize.element({
363
+ ...parts.track.attrs,
364
+ id: dom.getTrackId(state.context),
365
+ "data-disabled": dataAttr(isDisabled),
366
+ "data-focus": dataAttr(isFocused),
367
+ "data-invalid": dataAttr(isInvalid),
368
+ "data-orientation": state.context.orientation,
369
+ style: dom.getTrackStyle()
370
+ }),
371
+ rangeProps: normalize.element({
372
+ ...parts.range.attrs,
373
+ id: dom.getRangeId(state.context),
374
+ "data-focus": dataAttr(isFocused),
375
+ "data-invalid": dataAttr(isInvalid),
376
+ "data-disabled": dataAttr(isDisabled),
377
+ "data-orientation": state.context.orientation,
378
+ style: dom.getRangeStyle(state.context)
379
+ }),
380
+ controlProps: normalize.element({
381
+ ...parts.control.attrs,
382
+ id: dom.getControlId(state.context),
383
+ "data-disabled": dataAttr(isDisabled),
384
+ "data-invalid": dataAttr(isInvalid),
385
+ "data-orientation": state.context.orientation,
386
+ "data-focus": dataAttr(isFocused),
387
+ onPointerDown(event) {
388
+ if (!isInteractive)
389
+ return;
390
+ const evt = getNativeEvent(event);
391
+ if (!isLeftClick(evt) || isModifiedEvent(evt))
392
+ return;
393
+ const point = getEventPoint(evt);
394
+ send({ type: "POINTER_DOWN", point });
395
+ event.preventDefault();
396
+ event.stopPropagation();
397
+ },
398
+ style: dom.getControlStyle()
399
+ }),
400
+ markerGroupProps: normalize.element({
401
+ ...parts.markerGroup.attrs,
402
+ role: "presentation",
403
+ "aria-hidden": true,
404
+ "data-orientation": state.context.orientation,
405
+ style: dom.getMarkerGroupStyle()
406
+ }),
407
+ getMarkerProps({ value }) {
408
+ const percent = getValuePercentFn(value);
409
+ const style = dom.getMarkerStyle(state.context, percent);
410
+ const markerState = value > state.context.value ? "over-value" : value < state.context.value ? "under-value" : "at-value";
411
+ return normalize.element({
412
+ ...parts.marker.attrs,
413
+ id: dom.getMarkerId(state.context, value),
414
+ role: "presentation",
415
+ "data-orientation": state.context.orientation,
416
+ "data-value": value,
417
+ "data-disabled": dataAttr(isDisabled),
418
+ "data-state": markerState,
419
+ style
420
+ });
421
+ }
422
+ };
423
+ }
424
+
425
+ // src/slider.machine.ts
426
+ import { createMachine } from "@zag-js/core";
427
+ import { trackPointerMove } from "@zag-js/dom-event";
428
+ import { raf } from "@zag-js/dom-query";
429
+ import { trackElementSize } from "@zag-js/element-size";
430
+ import { trackFormControl } from "@zag-js/form-utils";
431
+ import { clampValue as clampValue2, getValuePercent as getValuePercent3 } from "@zag-js/numeric-range";
432
+ import { compact } from "@zag-js/utils";
433
+
434
+ // src/slider.utils.ts
435
+ import { clampValue, getNextStepValue, getPreviousStepValue, snapValueToStep } from "@zag-js/numeric-range";
436
+ function constrainValue(ctx, value) {
437
+ const snapValue = snapValueToStep(value, ctx.min, ctx.max, ctx.step);
438
+ return clampValue(snapValue, ctx.min, ctx.max);
439
+ }
440
+ function decrement(ctx, step) {
441
+ const index = 0;
442
+ const values = getPreviousStepValue(index, {
443
+ ...ctx,
444
+ step: step ?? ctx.step,
445
+ values: [ctx.value]
446
+ });
447
+ return values[index];
448
+ }
449
+ function increment(ctx, step) {
450
+ const index = 0;
451
+ const values = getNextStepValue(index, {
452
+ ...ctx,
453
+ step: step ?? ctx.step,
454
+ values: [ctx.value]
455
+ });
456
+ return values[index];
457
+ }
458
+
459
+ // src/slider.machine.ts
460
+ function machine(userContext) {
461
+ const ctx = compact(userContext);
462
+ return createMachine(
463
+ {
464
+ id: "slider",
465
+ initial: "idle",
466
+ context: {
467
+ thumbSize: null,
468
+ thumbAlignment: "contain",
469
+ disabled: false,
470
+ threshold: 5,
471
+ dir: "ltr",
472
+ origin: "start",
473
+ orientation: "horizontal",
474
+ initialValue: null,
475
+ value: 0,
476
+ step: 1,
477
+ min: 0,
478
+ max: 100,
479
+ ...ctx
480
+ },
481
+ computed: {
482
+ isHorizontal: (ctx2) => ctx2.orientation === "horizontal",
483
+ isVertical: (ctx2) => ctx2.orientation === "vertical",
484
+ isRtl: (ctx2) => ctx2.orientation === "horizontal" && ctx2.dir === "rtl",
485
+ isInteractive: (ctx2) => !(ctx2.disabled || ctx2.readOnly),
486
+ hasMeasuredThumbSize: (ctx2) => ctx2.thumbSize !== null,
487
+ valuePercent: (ctx2) => 100 * getValuePercent3(ctx2.value, ctx2.min, ctx2.max)
488
+ },
489
+ watch: {
490
+ value: ["invokeOnChange", "dispatchChangeEvent"]
491
+ },
492
+ activities: ["trackFormControlState", "trackThumbSize"],
493
+ on: {
494
+ SET_VALUE: {
495
+ actions: "setValue"
496
+ },
497
+ INCREMENT: {
498
+ actions: "increment"
499
+ },
500
+ DECREMENT: {
501
+ actions: "decrement"
502
+ }
503
+ },
504
+ entry: ["checkValue"],
505
+ states: {
506
+ idle: {
507
+ on: {
508
+ POINTER_DOWN: {
509
+ target: "dragging",
510
+ actions: ["setPointerValue", "invokeOnChangeStart", "focusThumb"]
511
+ },
512
+ FOCUS: "focus"
513
+ }
514
+ },
515
+ focus: {
516
+ entry: "focusThumb",
517
+ on: {
518
+ POINTER_DOWN: {
519
+ target: "dragging",
520
+ actions: ["setPointerValue", "invokeOnChangeStart", "focusThumb"]
521
+ },
522
+ ARROW_LEFT: {
523
+ guard: "isHorizontal",
524
+ actions: "decrement"
525
+ },
526
+ ARROW_RIGHT: {
527
+ guard: "isHorizontal",
528
+ actions: "increment"
529
+ },
530
+ ARROW_UP: {
531
+ guard: "isVertical",
532
+ actions: "increment"
533
+ },
534
+ ARROW_DOWN: {
535
+ guard: "isVertical",
536
+ actions: "decrement"
537
+ },
538
+ PAGE_UP: {
539
+ actions: "increment"
540
+ },
541
+ PAGE_DOWN: {
542
+ actions: "decrement"
543
+ },
544
+ HOME: {
545
+ actions: "setToMin"
546
+ },
547
+ END: {
548
+ actions: "setToMax"
549
+ },
550
+ BLUR: "idle"
551
+ }
552
+ },
553
+ dragging: {
554
+ entry: "focusThumb",
555
+ activities: "trackPointerMove",
556
+ on: {
557
+ POINTER_UP: {
558
+ target: "focus",
559
+ actions: "invokeOnChangeEnd"
560
+ },
561
+ POINTER_MOVE: {
562
+ actions: "setPointerValue"
563
+ }
564
+ }
565
+ }
566
+ }
567
+ },
568
+ {
569
+ guards: {
570
+ isHorizontal: (ctx2) => ctx2.isHorizontal,
571
+ isVertical: (ctx2) => ctx2.isVertical
572
+ },
573
+ activities: {
574
+ trackFormControlState(ctx2) {
575
+ return trackFormControl(dom.getHiddenInputEl(ctx2), {
576
+ onFieldsetDisabled() {
577
+ ctx2.disabled = true;
578
+ },
579
+ onFormReset() {
580
+ if (ctx2.initialValue != null) {
581
+ ctx2.value = ctx2.initialValue;
582
+ }
583
+ }
584
+ });
585
+ },
586
+ trackPointerMove(ctx2, _evt, { send }) {
587
+ return trackPointerMove(dom.getDoc(ctx2), {
588
+ onPointerMove(info) {
589
+ send({ type: "POINTER_MOVE", point: info.point });
590
+ },
591
+ onPointerUp() {
592
+ send("POINTER_UP");
593
+ }
594
+ });
595
+ },
596
+ trackThumbSize(ctx2, _evt) {
597
+ if (ctx2.thumbAlignment !== "contain")
598
+ return;
599
+ return trackElementSize(dom.getThumbEl(ctx2), (size) => {
600
+ if (size)
601
+ ctx2.thumbSize = size;
602
+ });
603
+ }
604
+ },
605
+ actions: {
606
+ checkValue(ctx2) {
607
+ const value = constrainValue(ctx2, ctx2.value);
608
+ ctx2.value = value;
609
+ ctx2.initialValue = value;
610
+ },
611
+ invokeOnChangeStart(ctx2) {
612
+ ctx2.onChangeStart?.({ value: ctx2.value });
613
+ },
614
+ invokeOnChangeEnd(ctx2) {
615
+ ctx2.onChangeEnd?.({ value: ctx2.value });
616
+ },
617
+ invokeOnChange(ctx2) {
618
+ ctx2.onChange?.({ value: ctx2.value });
619
+ },
620
+ dispatchChangeEvent(ctx2) {
621
+ dom.dispatchChangeEvent(ctx2);
622
+ },
623
+ setPointerValue(ctx2, evt) {
624
+ const value = dom.getValueFromPoint(ctx2, evt.point);
625
+ if (value == null)
626
+ return;
627
+ ctx2.value = clampValue2(value, ctx2.min, ctx2.max);
628
+ },
629
+ focusThumb(ctx2) {
630
+ raf(() => dom.getThumbEl(ctx2)?.focus());
631
+ },
632
+ decrement(ctx2, evt) {
633
+ ctx2.value = decrement(ctx2, evt.step);
634
+ },
635
+ increment(ctx2, evt) {
636
+ ctx2.value = increment(ctx2, evt.step);
637
+ },
638
+ setToMin(ctx2) {
639
+ ctx2.value = ctx2.min;
640
+ },
641
+ setToMax(ctx2) {
642
+ ctx2.value = ctx2.max;
643
+ },
644
+ setValue(ctx2, evt) {
645
+ ctx2.value = constrainValue(ctx2, evt.value);
646
+ }
647
+ }
648
+ }
649
+ );
650
+ }
651
+ export {
652
+ anatomy,
653
+ connect,
654
+ machine,
655
+ dom as unstable__dom
656
+ };
657
+ //# sourceMappingURL=index.mjs.map