@zag-js/slider 0.2.8 → 0.2.10
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/{chunk-3Y7IIPR5.mjs → chunk-7YVG4DKQ.mjs} +0 -0
- package/dist/{chunk-SGCWELVB.mjs → chunk-DIZXKUD6.mjs} +0 -0
- package/dist/{chunk-YREEXXZP.mjs → chunk-GVCEKN7A.mjs} +0 -0
- package/dist/{chunk-DRAPR6JV.mjs → chunk-OLKQEDRG.mjs} +0 -0
- package/dist/{chunk-6D4ETNPG.mjs → chunk-OSBGE2HK.mjs} +12 -10
- package/dist/{chunk-J5IGGBVE.mjs → chunk-RQG27JID.mjs} +1 -1
- package/dist/{chunk-A2ZK6G4F.mjs → chunk-WEMXLFK3.mjs} +3 -3
- package/dist/index.js +9 -7
- package/dist/index.mjs +7 -7
- package/dist/slider.anatomy.mjs +1 -1
- package/dist/slider.connect.d.ts +2 -2
- package/dist/slider.connect.js +9 -7
- package/dist/slider.connect.mjs +5 -5
- package/dist/slider.dom.mjs +2 -2
- package/dist/slider.machine.mjs +5 -5
- package/dist/slider.style.mjs +1 -1
- package/dist/slider.utils.mjs +1 -1
- package/package.json +2 -2
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parts
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7YVG4DKQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getNativeEvent,
|
|
6
6
|
isLeftClick,
|
|
7
7
|
isModifiedEvent,
|
|
8
8
|
isTouchEvent
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DIZXKUD6.mjs";
|
|
10
10
|
import {
|
|
11
11
|
dom
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RQG27JID.mjs";
|
|
13
13
|
|
|
14
14
|
// ../../utilities/dom/src/attrs.ts
|
|
15
15
|
var dataAttr = (guard) => {
|
|
@@ -78,6 +78,12 @@ function connect(state, send, normalize) {
|
|
|
78
78
|
const isDisabled = state.context.disabled;
|
|
79
79
|
const isInteractive = state.context.isInteractive;
|
|
80
80
|
const isInvalid = state.context.invalid;
|
|
81
|
+
function getPercentValueFn(percent) {
|
|
82
|
+
return getPercentValue(percent, state.context.min, state.context.max, state.context.step);
|
|
83
|
+
}
|
|
84
|
+
function getValuePercentFn(value) {
|
|
85
|
+
return getValuePercent(value, state.context.min, state.context.max);
|
|
86
|
+
}
|
|
81
87
|
return {
|
|
82
88
|
isFocused,
|
|
83
89
|
isDragging,
|
|
@@ -86,12 +92,8 @@ function connect(state, send, normalize) {
|
|
|
86
92
|
setValue(value) {
|
|
87
93
|
send({ type: "SET_VALUE", value });
|
|
88
94
|
},
|
|
89
|
-
getPercentValue
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
getValuePercent(value) {
|
|
93
|
-
return getValuePercent(value, state.context.min, state.context.max);
|
|
94
|
-
},
|
|
95
|
+
getPercentValue: getPercentValueFn,
|
|
96
|
+
getValuePercent: getValuePercentFn,
|
|
95
97
|
focus() {
|
|
96
98
|
var _a2;
|
|
97
99
|
(_a2 = dom.getThumbEl(state.context)) == null ? void 0 : _a2.focus();
|
|
@@ -266,7 +268,7 @@ function connect(state, send, normalize) {
|
|
|
266
268
|
style: dom.getMarkerGroupStyle()
|
|
267
269
|
}),
|
|
268
270
|
getMarkerProps({ value }) {
|
|
269
|
-
const percent =
|
|
271
|
+
const percent = getValuePercentFn(value);
|
|
270
272
|
const style = dom.getMarkerStyle(state.context, percent);
|
|
271
273
|
const markerState = value > state.context.value ? "over-value" : value < state.context.value ? "under-value" : "at-value";
|
|
272
274
|
return normalize.element({
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
supportsMouseEvent,
|
|
9
9
|
supportsPointerEvent,
|
|
10
10
|
supportsTouchEvent
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-DIZXKUD6.mjs";
|
|
12
12
|
import {
|
|
13
13
|
dom
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RQG27JID.mjs";
|
|
15
15
|
import {
|
|
16
16
|
constrainValue,
|
|
17
17
|
decrement,
|
|
18
18
|
increment
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OLKQEDRG.mjs";
|
|
20
20
|
|
|
21
21
|
// src/slider.machine.ts
|
|
22
22
|
import { createMachine } from "@zag-js/core";
|
package/dist/index.js
CHANGED
|
@@ -650,6 +650,12 @@ function connect(state2, send, normalize) {
|
|
|
650
650
|
const isDisabled = state2.context.disabled;
|
|
651
651
|
const isInteractive = state2.context.isInteractive;
|
|
652
652
|
const isInvalid = state2.context.invalid;
|
|
653
|
+
function getPercentValueFn(percent) {
|
|
654
|
+
return (0, import_numeric_range3.getPercentValue)(percent, state2.context.min, state2.context.max, state2.context.step);
|
|
655
|
+
}
|
|
656
|
+
function getValuePercentFn(value) {
|
|
657
|
+
return (0, import_numeric_range3.getValuePercent)(value, state2.context.min, state2.context.max);
|
|
658
|
+
}
|
|
653
659
|
return {
|
|
654
660
|
isFocused,
|
|
655
661
|
isDragging,
|
|
@@ -658,12 +664,8 @@ function connect(state2, send, normalize) {
|
|
|
658
664
|
setValue(value) {
|
|
659
665
|
send({ type: "SET_VALUE", value });
|
|
660
666
|
},
|
|
661
|
-
getPercentValue
|
|
662
|
-
|
|
663
|
-
},
|
|
664
|
-
getValuePercent(value) {
|
|
665
|
-
return (0, import_numeric_range3.getValuePercent)(value, state2.context.min, state2.context.max);
|
|
666
|
-
},
|
|
667
|
+
getPercentValue: getPercentValueFn,
|
|
668
|
+
getValuePercent: getValuePercentFn,
|
|
667
669
|
focus() {
|
|
668
670
|
var _a2;
|
|
669
671
|
(_a2 = dom.getThumbEl(state2.context)) == null ? void 0 : _a2.focus();
|
|
@@ -838,7 +840,7 @@ function connect(state2, send, normalize) {
|
|
|
838
840
|
style: dom.getMarkerGroupStyle()
|
|
839
841
|
}),
|
|
840
842
|
getMarkerProps({ value }) {
|
|
841
|
-
const percent =
|
|
843
|
+
const percent = getValuePercentFn(value);
|
|
842
844
|
const style = dom.getMarkerStyle(state2.context, percent);
|
|
843
845
|
const markerState = value > state2.context.value ? "over-value" : value < state2.context.value ? "under-value" : "at-value";
|
|
844
846
|
return normalize.element({
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
connect
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OSBGE2HK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
anatomy
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7YVG4DKQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
machine
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-WEMXLFK3.mjs";
|
|
10
|
+
import "./chunk-DIZXKUD6.mjs";
|
|
11
11
|
import {
|
|
12
12
|
dom
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-RQG27JID.mjs";
|
|
14
|
+
import "./chunk-GVCEKN7A.mjs";
|
|
15
|
+
import "./chunk-OLKQEDRG.mjs";
|
|
16
16
|
export {
|
|
17
17
|
anatomy,
|
|
18
18
|
connect,
|
package/dist/slider.anatomy.mjs
CHANGED
package/dist/slider.connect.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
|
|
|
8
8
|
value: number;
|
|
9
9
|
percent: number;
|
|
10
10
|
setValue(value: number): void;
|
|
11
|
-
getPercentValue(percent: number)
|
|
12
|
-
getValuePercent(value: number)
|
|
11
|
+
getPercentValue: (percent: number) => number;
|
|
12
|
+
getValuePercent: (value: number) => number;
|
|
13
13
|
focus(): void;
|
|
14
14
|
increment(): void;
|
|
15
15
|
decrement(): void;
|
package/dist/slider.connect.js
CHANGED
|
@@ -391,6 +391,12 @@ function connect(state, send, normalize) {
|
|
|
391
391
|
const isDisabled = state.context.disabled;
|
|
392
392
|
const isInteractive = state.context.isInteractive;
|
|
393
393
|
const isInvalid = state.context.invalid;
|
|
394
|
+
function getPercentValueFn(percent) {
|
|
395
|
+
return (0, import_numeric_range3.getPercentValue)(percent, state.context.min, state.context.max, state.context.step);
|
|
396
|
+
}
|
|
397
|
+
function getValuePercentFn(value) {
|
|
398
|
+
return (0, import_numeric_range3.getValuePercent)(value, state.context.min, state.context.max);
|
|
399
|
+
}
|
|
394
400
|
return {
|
|
395
401
|
isFocused,
|
|
396
402
|
isDragging,
|
|
@@ -399,12 +405,8 @@ function connect(state, send, normalize) {
|
|
|
399
405
|
setValue(value) {
|
|
400
406
|
send({ type: "SET_VALUE", value });
|
|
401
407
|
},
|
|
402
|
-
getPercentValue
|
|
403
|
-
|
|
404
|
-
},
|
|
405
|
-
getValuePercent(value) {
|
|
406
|
-
return (0, import_numeric_range3.getValuePercent)(value, state.context.min, state.context.max);
|
|
407
|
-
},
|
|
408
|
+
getPercentValue: getPercentValueFn,
|
|
409
|
+
getValuePercent: getValuePercentFn,
|
|
408
410
|
focus() {
|
|
409
411
|
var _a2;
|
|
410
412
|
(_a2 = dom.getThumbEl(state.context)) == null ? void 0 : _a2.focus();
|
|
@@ -579,7 +581,7 @@ function connect(state, send, normalize) {
|
|
|
579
581
|
style: dom.getMarkerGroupStyle()
|
|
580
582
|
}),
|
|
581
583
|
getMarkerProps({ value }) {
|
|
582
|
-
const percent =
|
|
584
|
+
const percent = getValuePercentFn(value);
|
|
583
585
|
const style = dom.getMarkerStyle(state.context, percent);
|
|
584
586
|
const markerState = value > state.context.value ? "over-value" : value < state.context.value ? "under-value" : "at-value";
|
|
585
587
|
return normalize.element({
|
package/dist/slider.connect.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
connect
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-OSBGE2HK.mjs";
|
|
4
|
+
import "./chunk-7YVG4DKQ.mjs";
|
|
5
|
+
import "./chunk-DIZXKUD6.mjs";
|
|
6
|
+
import "./chunk-RQG27JID.mjs";
|
|
7
|
+
import "./chunk-GVCEKN7A.mjs";
|
|
8
8
|
export {
|
|
9
9
|
connect
|
|
10
10
|
};
|
package/dist/slider.dom.mjs
CHANGED
package/dist/slider.machine.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
machine
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-WEMXLFK3.mjs";
|
|
4
|
+
import "./chunk-DIZXKUD6.mjs";
|
|
5
|
+
import "./chunk-RQG27JID.mjs";
|
|
6
|
+
import "./chunk-GVCEKN7A.mjs";
|
|
7
|
+
import "./chunk-OLKQEDRG.mjs";
|
|
8
8
|
export {
|
|
9
9
|
machine
|
|
10
10
|
};
|
package/dist/slider.style.mjs
CHANGED
package/dist/slider.utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/slider",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "Core logic for the slider widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@zag-js/anatomy": "0.1.3",
|
|
30
|
-
"@zag-js/core": "0.2.
|
|
30
|
+
"@zag-js/core": "0.2.6",
|
|
31
31
|
"@zag-js/element-size": "0.3.1",
|
|
32
32
|
"@zag-js/numeric-range": "0.1.0",
|
|
33
33
|
"@zag-js/types": "0.3.3"
|