@zag-js/slider 0.2.9 → 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.
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-3Y7IIPR5.mjs";
3
+ } from "./chunk-7YVG4DKQ.mjs";
4
4
  import {
5
5
  getNativeEvent,
6
6
  isLeftClick,
7
7
  isModifiedEvent,
8
8
  isTouchEvent
9
- } from "./chunk-SGCWELVB.mjs";
9
+ } from "./chunk-DIZXKUD6.mjs";
10
10
  import {
11
11
  dom
12
- } from "./chunk-J5IGGBVE.mjs";
12
+ } from "./chunk-RQG27JID.mjs";
13
13
 
14
14
  // ../../utilities/dom/src/attrs.ts
15
15
  var dataAttr = (guard) => {
@@ -78,7 +78,13 @@ 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
- const api = {
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
+ }
87
+ return {
82
88
  isFocused,
83
89
  isDragging,
84
90
  value: state.context.value,
@@ -86,12 +92,8 @@ function connect(state, send, normalize) {
86
92
  setValue(value) {
87
93
  send({ type: "SET_VALUE", value });
88
94
  },
89
- getPercentValue(percent) {
90
- return getPercentValue(percent, state.context.min, state.context.max, state.context.step);
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 = api.getValuePercent(value);
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({
@@ -281,7 +283,6 @@ function connect(state, send, normalize) {
281
283
  });
282
284
  }
283
285
  };
284
- return api;
285
286
  }
286
287
 
287
288
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  styles
3
- } from "./chunk-YREEXXZP.mjs";
3
+ } from "./chunk-GVCEKN7A.mjs";
4
4
 
5
5
  // ../../utilities/dom/src/query.ts
6
6
  function isDocument(el) {
@@ -8,15 +8,15 @@ import {
8
8
  supportsMouseEvent,
9
9
  supportsPointerEvent,
10
10
  supportsTouchEvent
11
- } from "./chunk-SGCWELVB.mjs";
11
+ } from "./chunk-DIZXKUD6.mjs";
12
12
  import {
13
13
  dom
14
- } from "./chunk-J5IGGBVE.mjs";
14
+ } from "./chunk-RQG27JID.mjs";
15
15
  import {
16
16
  constrainValue,
17
17
  decrement,
18
18
  increment
19
- } from "./chunk-DRAPR6JV.mjs";
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,7 +650,13 @@ 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
- const api = {
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
+ }
659
+ return {
654
660
  isFocused,
655
661
  isDragging,
656
662
  value: state2.context.value,
@@ -658,12 +664,8 @@ function connect(state2, send, normalize) {
658
664
  setValue(value) {
659
665
  send({ type: "SET_VALUE", value });
660
666
  },
661
- getPercentValue(percent) {
662
- return (0, import_numeric_range3.getPercentValue)(percent, state2.context.min, state2.context.max, state2.context.step);
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 = api.getValuePercent(value);
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({
@@ -853,7 +855,6 @@ function connect(state2, send, normalize) {
853
855
  });
854
856
  }
855
857
  };
856
- return api;
857
858
  }
858
859
 
859
860
  // src/slider.machine.ts
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-WMQQQRK5.mjs";
3
+ } from "./chunk-OSBGE2HK.mjs";
4
4
  import {
5
5
  anatomy
6
- } from "./chunk-3Y7IIPR5.mjs";
6
+ } from "./chunk-7YVG4DKQ.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-A2ZK6G4F.mjs";
10
- import "./chunk-SGCWELVB.mjs";
9
+ } from "./chunk-WEMXLFK3.mjs";
10
+ import "./chunk-DIZXKUD6.mjs";
11
11
  import {
12
12
  dom
13
- } from "./chunk-J5IGGBVE.mjs";
14
- import "./chunk-YREEXXZP.mjs";
15
- import "./chunk-DRAPR6JV.mjs";
13
+ } from "./chunk-RQG27JID.mjs";
14
+ import "./chunk-GVCEKN7A.mjs";
15
+ import "./chunk-OLKQEDRG.mjs";
16
16
  export {
17
17
  anatomy,
18
18
  connect,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  anatomy,
3
3
  parts
4
- } from "./chunk-3Y7IIPR5.mjs";
4
+ } from "./chunk-7YVG4DKQ.mjs";
5
5
  export {
6
6
  anatomy,
7
7
  parts
@@ -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): number;
12
- getValuePercent(value: number): number;
11
+ getPercentValue: (percent: number) => number;
12
+ getValuePercent: (value: number) => number;
13
13
  focus(): void;
14
14
  increment(): void;
15
15
  decrement(): void;
@@ -391,7 +391,13 @@ 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
- const api = {
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
+ }
400
+ return {
395
401
  isFocused,
396
402
  isDragging,
397
403
  value: state.context.value,
@@ -399,12 +405,8 @@ function connect(state, send, normalize) {
399
405
  setValue(value) {
400
406
  send({ type: "SET_VALUE", value });
401
407
  },
402
- getPercentValue(percent) {
403
- return (0, import_numeric_range3.getPercentValue)(percent, state.context.min, state.context.max, state.context.step);
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 = api.getValuePercent(value);
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({
@@ -594,7 +596,6 @@ function connect(state, send, normalize) {
594
596
  });
595
597
  }
596
598
  };
597
- return api;
598
599
  }
599
600
  // Annotate the CommonJS export names for ESM import in node:
600
601
  0 && (module.exports = {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-WMQQQRK5.mjs";
4
- import "./chunk-3Y7IIPR5.mjs";
5
- import "./chunk-SGCWELVB.mjs";
6
- import "./chunk-J5IGGBVE.mjs";
7
- import "./chunk-YREEXXZP.mjs";
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
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-J5IGGBVE.mjs";
4
- import "./chunk-YREEXXZP.mjs";
3
+ } from "./chunk-RQG27JID.mjs";
4
+ import "./chunk-GVCEKN7A.mjs";
5
5
  export {
6
6
  dom
7
7
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-A2ZK6G4F.mjs";
4
- import "./chunk-SGCWELVB.mjs";
5
- import "./chunk-J5IGGBVE.mjs";
6
- import "./chunk-YREEXXZP.mjs";
7
- import "./chunk-DRAPR6JV.mjs";
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
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  styles
3
- } from "./chunk-YREEXXZP.mjs";
3
+ } from "./chunk-GVCEKN7A.mjs";
4
4
  export {
5
5
  styles
6
6
  };
@@ -3,7 +3,7 @@ import {
3
3
  constrainValue,
4
4
  decrement,
5
5
  increment
6
- } from "./chunk-DRAPR6JV.mjs";
6
+ } from "./chunk-OLKQEDRG.mjs";
7
7
  export {
8
8
  clampPercent,
9
9
  constrainValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/slider",
3
- "version": "0.2.9",
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.5",
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"