@zag-js/splitter 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
@@ -112,6 +112,6 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
112
112
  splitterProps: T["element"];
113
113
  };
114
114
 
115
- declare function machine(ctx: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
115
+ declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
116
116
 
117
117
  export { UserDefinedContext as Context, MachineState, connect, machine };
package/dist/index.js CHANGED
@@ -581,9 +581,21 @@ function decimalOperation(a, op, b) {
581
581
  }
582
582
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
583
583
 
584
+ // ../../utilities/core/dist/index.mjs
585
+ var isArray2 = (v) => Array.isArray(v);
586
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
587
+ function compact(obj) {
588
+ if (obj === void 0)
589
+ return obj;
590
+ return Object.fromEntries(
591
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
592
+ );
593
+ }
594
+
584
595
  // src/splitter.machine.ts
585
596
  var { not } = import_core.guards;
586
- function machine(ctx) {
597
+ function machine(userContext) {
598
+ const ctx = compact(userContext);
587
599
  return (0, import_core.createMachine)(
588
600
  {
589
601
  id: "splitter",
package/dist/index.mjs CHANGED
@@ -554,9 +554,21 @@ function decimalOperation(a, op, b) {
554
554
  }
555
555
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
556
556
 
557
+ // ../../utilities/core/dist/index.mjs
558
+ var isArray2 = (v) => Array.isArray(v);
559
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
560
+ function compact(obj) {
561
+ if (obj === void 0)
562
+ return obj;
563
+ return Object.fromEntries(
564
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
565
+ );
566
+ }
567
+
557
568
  // src/splitter.machine.ts
558
569
  var { not } = guards;
559
- function machine(ctx) {
570
+ function machine(userContext) {
571
+ const ctx = compact(userContext);
560
572
  return createMachine(
561
573
  {
562
574
  id: "splitter",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/splitter",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Core logic for the splitter widget implemented as a state machine",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -30,12 +30,13 @@
30
30
  "url": "https://github.com/chakra-ui/zag/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@zag-js/core": "0.2.0",
34
- "@zag-js/types": "0.3.0"
33
+ "@zag-js/core": "0.2.2",
34
+ "@zag-js/types": "0.3.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@zag-js/dom-utils": "0.2.0",
38
- "@zag-js/number-utils": "0.2.0"
37
+ "@zag-js/dom-utils": "0.2.1",
38
+ "@zag-js/number-utils": "0.2.0",
39
+ "@zag-js/utils": "0.3.1"
39
40
  },
40
41
  "scripts": {
41
42
  "build-fast": "tsup src/index.ts --format=esm,cjs",