@zag-js/slider 1.27.1 → 1.28.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.js CHANGED
@@ -785,18 +785,16 @@ var machine = core.createMachine({
785
785
  },
786
786
  trackThumbSize({ context, scope, prop }) {
787
787
  if (prop("thumbAlignment") !== "contain" || prop("thumbSize")) return;
788
- return domQuery.trackElementRect(getThumbEls(scope), {
789
- box: "border-box",
790
- measure(el) {
791
- return getOffsetRect(el);
792
- },
793
- onEntry({ rects }) {
794
- if (rects.length === 0) return;
795
- const size = utils.pick(rects[0], ["width", "height"]);
796
- if (isEqualSize(context.get("thumbSize"), size)) return;
797
- context.set("thumbSize", size);
798
- }
799
- });
788
+ const exec = (el) => {
789
+ const rect = getOffsetRect(el);
790
+ const size = utils.pick(rect, ["width", "height"]);
791
+ if (isEqualSize(context.get("thumbSize"), size)) return;
792
+ context.set("thumbSize", size);
793
+ };
794
+ const thumbEls = getThumbEls(scope);
795
+ thumbEls.forEach(exec);
796
+ const cleanups = thumbEls.map((el) => domQuery.resizeObserverBorderBox.observe(el, () => exec(el)));
797
+ return utils.callAll(...cleanups);
800
798
  }
801
799
  },
802
800
  actions: {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createAnatomy } from '@zag-js/anatomy';
2
- import { raf, setElementValue, trackElementRect, queryAll, trackPointerMove, trackFormControl, getRelativePoint, dispatchInputValueEvent, dataAttr, isLeftClick, isModifierKey, getEventPoint, ariaAttr, getEventStep, getEventKey } from '@zag-js/dom-query';
3
- import { setValueAtIndex, pick, getValuePercent, isEqual, createSplitProps, snapValueToStep, clampValue, getValueRanges, getNextStepValue, getPreviousStepValue, getPercentValue, isValueWithinRange, first, last, toPx, getValueTransformer } from '@zag-js/utils';
2
+ import { raf, setElementValue, queryAll, resizeObserverBorderBox, trackPointerMove, trackFormControl, getRelativePoint, dispatchInputValueEvent, dataAttr, isLeftClick, isModifierKey, getEventPoint, ariaAttr, getEventStep, getEventKey } from '@zag-js/dom-query';
3
+ import { setValueAtIndex, callAll, getValuePercent, isEqual, createSplitProps, snapValueToStep, clampValue, getValueRanges, getNextStepValue, getPreviousStepValue, getPercentValue, pick, isValueWithinRange, first, last, toPx, getValueTransformer } from '@zag-js/utils';
4
4
  import { createMachine, memo } from '@zag-js/core';
5
5
  import { createProps } from '@zag-js/types';
6
6
 
@@ -783,18 +783,16 @@ var machine = createMachine({
783
783
  },
784
784
  trackThumbSize({ context, scope, prop }) {
785
785
  if (prop("thumbAlignment") !== "contain" || prop("thumbSize")) return;
786
- return trackElementRect(getThumbEls(scope), {
787
- box: "border-box",
788
- measure(el) {
789
- return getOffsetRect(el);
790
- },
791
- onEntry({ rects }) {
792
- if (rects.length === 0) return;
793
- const size = pick(rects[0], ["width", "height"]);
794
- if (isEqualSize(context.get("thumbSize"), size)) return;
795
- context.set("thumbSize", size);
796
- }
797
- });
786
+ const exec = (el) => {
787
+ const rect = getOffsetRect(el);
788
+ const size = pick(rect, ["width", "height"]);
789
+ if (isEqualSize(context.get("thumbSize"), size)) return;
790
+ context.set("thumbSize", size);
791
+ };
792
+ const thumbEls = getThumbEls(scope);
793
+ thumbEls.forEach(exec);
794
+ const cleanups = thumbEls.map((el) => resizeObserverBorderBox.observe(el, () => exec(el)));
795
+ return callAll(...cleanups);
798
796
  }
799
797
  },
800
798
  actions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/slider",
3
- "version": "1.27.1",
3
+ "version": "1.28.0",
4
4
  "description": "Core logic for the slider widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,11 +27,11 @@
27
27
  "url": "https://github.com/chakra-ui/zag/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@zag-js/anatomy": "1.27.1",
31
- "@zag-js/core": "1.27.1",
32
- "@zag-js/dom-query": "1.27.1",
33
- "@zag-js/utils": "1.27.1",
34
- "@zag-js/types": "1.27.1"
30
+ "@zag-js/anatomy": "1.28.0",
31
+ "@zag-js/core": "1.28.0",
32
+ "@zag-js/dom-query": "1.28.0",
33
+ "@zag-js/types": "1.28.0",
34
+ "@zag-js/utils": "1.28.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "clean-package": "2.2.0"