@zag-js/slider 0.2.0 → 0.2.2

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
@@ -227,6 +227,6 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
227
227
  }): T["element"];
228
228
  };
229
229
 
230
- declare function machine(ctx: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
230
+ declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
231
231
 
232
232
  export { UserDefinedContext as Context, connect, machine, dom as unstable__dom };
package/dist/index.js CHANGED
@@ -364,7 +364,7 @@ function observeAttributes(node, attributes, fn) {
364
364
  }
365
365
  function getDescriptor(el, options) {
366
366
  var _a;
367
- const { type, property } = options;
367
+ const { type, property = "value" } = options;
368
368
  const proto = getWindow(el)[type].prototype;
369
369
  return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
370
370
  }
@@ -868,7 +868,21 @@ function connect(state2, send, normalize) {
868
868
  // src/slider.machine.ts
869
869
  var import_core = require("@zag-js/core");
870
870
  var import_element_size = require("@zag-js/element-size");
871
- function machine(ctx) {
871
+
872
+ // ../../utilities/core/dist/index.mjs
873
+ var isArray2 = (v) => Array.isArray(v);
874
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
875
+ function compact(obj) {
876
+ if (obj === void 0)
877
+ return obj;
878
+ return Object.fromEntries(
879
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
880
+ );
881
+ }
882
+
883
+ // src/slider.machine.ts
884
+ function machine(userContext) {
885
+ const ctx = compact(userContext);
872
886
  return (0, import_core.createMachine)(
873
887
  {
874
888
  id: "slider",
package/dist/index.mjs CHANGED
@@ -336,7 +336,7 @@ function observeAttributes(node, attributes, fn) {
336
336
  }
337
337
  function getDescriptor(el, options) {
338
338
  var _a;
339
- const { type, property } = options;
339
+ const { type, property = "value" } = options;
340
340
  const proto = getWindow(el)[type].prototype;
341
341
  return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
342
342
  }
@@ -840,7 +840,21 @@ function connect(state2, send, normalize) {
840
840
  // src/slider.machine.ts
841
841
  import { createMachine } from "@zag-js/core";
842
842
  import { trackElementSize } from "@zag-js/element-size";
843
- function machine(ctx) {
843
+
844
+ // ../../utilities/core/dist/index.mjs
845
+ var isArray2 = (v) => Array.isArray(v);
846
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
847
+ function compact(obj) {
848
+ if (obj === void 0)
849
+ return obj;
850
+ return Object.fromEntries(
851
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
852
+ );
853
+ }
854
+
855
+ // src/slider.machine.ts
856
+ function machine(userContext) {
857
+ const ctx = compact(userContext);
844
858
  return createMachine(
845
859
  {
846
860
  id: "slider",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/slider",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Core logic for the slider widget implemented as a state machine",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,13 +29,14 @@
29
29
  "url": "https://github.com/chakra-ui/zag/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@zag-js/core": "0.2.0",
32
+ "@zag-js/core": "0.2.2",
33
33
  "@zag-js/element-size": "0.3.0",
34
- "@zag-js/types": "0.3.0"
34
+ "@zag-js/types": "0.3.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@zag-js/dom-utils": "0.2.0",
38
- "@zag-js/form-utils": "0.2.0",
37
+ "@zag-js/dom-utils": "0.2.1",
38
+ "@zag-js/form-utils": "0.2.1",
39
+ "@zag-js/utils": "0.3.1",
39
40
  "@zag-js/number-utils": "0.2.0"
40
41
  },
41
42
  "scripts": {