@zag-js/utils 1.47.0 → 1.49.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.
Files changed (58) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/assertClassBrand.js +6 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/assertClassBrand.mjs +6 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/checkPrivateRedeclaration.js +5 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/checkPrivateRedeclaration.mjs +5 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldGet2.js +6 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldGet2.mjs +6 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldInitSpec.js +6 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldInitSpec.mjs +6 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.js +11 -0
  10. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.mjs +11 -0
  11. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPrimitive.js +13 -0
  12. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPrimitive.mjs +13 -0
  13. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPropertyKey.js +8 -0
  14. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPropertyKey.mjs +8 -0
  15. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/typeof.js +15 -0
  16. package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/typeof.mjs +10 -0
  17. package/dist/array.d.mts +24 -26
  18. package/dist/array.d.ts +24 -26
  19. package/dist/array.js +76 -117
  20. package/dist/array.mjs +52 -74
  21. package/dist/equal.d.mts +1 -3
  22. package/dist/equal.d.ts +1 -3
  23. package/dist/equal.js +26 -60
  24. package/dist/equal.mjs +22 -37
  25. package/dist/functions.d.mts +13 -15
  26. package/dist/functions.d.ts +13 -15
  27. package/dist/functions.js +82 -121
  28. package/dist/functions.mjs +68 -88
  29. package/dist/guard.d.mts +12 -13
  30. package/dist/guard.d.ts +12 -13
  31. package/dist/guard.js +37 -70
  32. package/dist/guard.mjs +23 -37
  33. package/dist/index.d.mts +10 -9
  34. package/dist/index.d.ts +10 -9
  35. package/dist/index.js +101 -39
  36. package/dist/index.mjs +10 -10
  37. package/dist/number.d.mts +37 -38
  38. package/dist/number.d.ts +37 -38
  39. package/dist/number.js +136 -185
  40. package/dist/number.mjs +104 -134
  41. package/dist/object.d.mts +11 -16
  42. package/dist/object.d.ts +11 -16
  43. package/dist/object.js +52 -91
  44. package/dist/object.mjs +41 -61
  45. package/dist/store.d.mts +10 -12
  46. package/dist/store.d.ts +10 -12
  47. package/dist/store.js +42 -67
  48. package/dist/store.mjs +38 -44
  49. package/dist/timers.d.mts +21 -22
  50. package/dist/timers.d.ts +21 -22
  51. package/dist/timers.js +83 -112
  52. package/dist/timers.mjs +77 -83
  53. package/dist/warning.d.mts +7 -8
  54. package/dist/warning.d.ts +7 -8
  55. package/dist/warning.js +16 -51
  56. package/dist/warning.mjs +9 -25
  57. package/package.json +3 -3
  58. package/dist/chunk-MXGZDBDQ.mjs +0 -15
package/dist/timers.js CHANGED
@@ -1,119 +1,90 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __typeError = (msg) => {
7
- throw TypeError(msg);
8
- };
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
25
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
26
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
27
-
28
- // src/timers.ts
29
- var timers_exports = {};
30
- __export(timers_exports, {
31
- Timer: () => Timer,
32
- setRafInterval: () => setRafInterval,
33
- setRafTimeout: () => setRafTimeout
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
34
4
  });
35
- module.exports = __toCommonJS(timers_exports);
36
- var currentTime = () => performance.now();
37
- var _tick;
5
+ const require_defineProperty = require("./_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.js");
6
+ const require_classPrivateFieldInitSpec = require("./_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldInitSpec.js");
7
+ const require_classPrivateFieldGet2 = require("./_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldGet2.js");
8
+ // src/timers.ts
9
+ const currentTime = () => performance.now();
10
+ var _tick = /* @__PURE__ */ new WeakMap();
38
11
  var Timer = class {
39
- constructor(onTick) {
40
- __publicField(this, "onTick", onTick);
41
- __publicField(this, "frameId", null);
42
- __publicField(this, "pausedAtMs", null);
43
- __publicField(this, "context");
44
- __publicField(this, "cancelFrame", () => {
45
- if (this.frameId === null) return;
46
- cancelAnimationFrame(this.frameId);
47
- this.frameId = null;
48
- });
49
- __publicField(this, "setStartMs", (startMs) => {
50
- this.context.startMs = startMs;
51
- });
52
- __publicField(this, "start", () => {
53
- if (this.frameId !== null) return;
54
- const now = currentTime();
55
- if (this.pausedAtMs !== null) {
56
- this.context.startMs += now - this.pausedAtMs;
57
- this.pausedAtMs = null;
58
- } else {
59
- this.context.startMs = now;
60
- }
61
- this.frameId = requestAnimationFrame(__privateGet(this, _tick));
62
- });
63
- __publicField(this, "pause", () => {
64
- if (this.frameId === null) return;
65
- this.cancelFrame();
66
- this.pausedAtMs = currentTime();
67
- });
68
- __publicField(this, "stop", () => {
69
- if (this.frameId === null) return;
70
- this.cancelFrame();
71
- this.pausedAtMs = null;
72
- });
73
- __privateAdd(this, _tick, (now) => {
74
- this.context.now = now;
75
- this.context.deltaMs = now - this.context.startMs;
76
- const shouldContinue = this.onTick(this.context);
77
- if (shouldContinue === false) {
78
- this.stop();
79
- return;
80
- }
81
- this.frameId = requestAnimationFrame(__privateGet(this, _tick));
82
- });
83
- this.context = { now: 0, startMs: currentTime(), deltaMs: 0 };
84
- }
85
- get elapsedMs() {
86
- if (this.pausedAtMs !== null) {
87
- return this.pausedAtMs - this.context.startMs;
88
- }
89
- return currentTime() - this.context.startMs;
90
- }
12
+ constructor(onTick) {
13
+ this.onTick = onTick;
14
+ require_defineProperty.default(this, "frameId", null);
15
+ require_defineProperty.default(this, "pausedAtMs", null);
16
+ require_defineProperty.default(this, "context", void 0);
17
+ require_defineProperty.default(this, "cancelFrame", () => {
18
+ if (this.frameId === null) return;
19
+ cancelAnimationFrame(this.frameId);
20
+ this.frameId = null;
21
+ });
22
+ require_defineProperty.default(this, "setStartMs", (startMs) => {
23
+ this.context.startMs = startMs;
24
+ });
25
+ require_defineProperty.default(this, "start", () => {
26
+ if (this.frameId !== null) return;
27
+ const now = currentTime();
28
+ if (this.pausedAtMs !== null) {
29
+ this.context.startMs += now - this.pausedAtMs;
30
+ this.pausedAtMs = null;
31
+ } else this.context.startMs = now;
32
+ this.frameId = requestAnimationFrame(require_classPrivateFieldGet2.default(_tick, this));
33
+ });
34
+ require_defineProperty.default(this, "pause", () => {
35
+ if (this.frameId === null) return;
36
+ this.cancelFrame();
37
+ this.pausedAtMs = currentTime();
38
+ });
39
+ require_defineProperty.default(this, "stop", () => {
40
+ if (this.frameId === null) return;
41
+ this.cancelFrame();
42
+ this.pausedAtMs = null;
43
+ });
44
+ require_classPrivateFieldInitSpec.default(this, _tick, (now) => {
45
+ this.context.now = now;
46
+ this.context.deltaMs = now - this.context.startMs;
47
+ if (this.onTick(this.context) === false) {
48
+ this.stop();
49
+ return;
50
+ }
51
+ this.frameId = requestAnimationFrame(require_classPrivateFieldGet2.default(_tick, this));
52
+ });
53
+ this.context = {
54
+ now: 0,
55
+ startMs: currentTime(),
56
+ deltaMs: 0
57
+ };
58
+ }
59
+ get elapsedMs() {
60
+ if (this.pausedAtMs !== null) return this.pausedAtMs - this.context.startMs;
61
+ return currentTime() - this.context.startMs;
62
+ }
91
63
  };
92
- _tick = new WeakMap();
93
64
  function setRafInterval(fn, intervalMs) {
94
- const timer = new Timer(({ now, deltaMs }) => {
95
- if (deltaMs >= intervalMs) {
96
- const startMs = intervalMs > 0 ? now - deltaMs % intervalMs : now;
97
- timer.setStartMs(startMs);
98
- fn({ startMs, deltaMs });
99
- }
100
- });
101
- timer.start();
102
- return () => timer.stop();
65
+ const timer = new Timer(({ now, deltaMs }) => {
66
+ if (deltaMs >= intervalMs) {
67
+ const startMs = intervalMs > 0 ? now - deltaMs % intervalMs : now;
68
+ timer.setStartMs(startMs);
69
+ fn({
70
+ startMs,
71
+ deltaMs
72
+ });
73
+ }
74
+ });
75
+ timer.start();
76
+ return () => timer.stop();
103
77
  }
104
78
  function setRafTimeout(fn, delayMs) {
105
- const timer = new Timer(({ deltaMs }) => {
106
- if (deltaMs >= delayMs) {
107
- fn();
108
- return false;
109
- }
110
- });
111
- timer.start();
112
- return () => timer.stop();
79
+ const timer = new Timer(({ deltaMs }) => {
80
+ if (deltaMs >= delayMs) {
81
+ fn();
82
+ return false;
83
+ }
84
+ });
85
+ timer.start();
86
+ return () => timer.stop();
113
87
  }
114
- // Annotate the CommonJS export names for ESM import in node:
115
- 0 && (module.exports = {
116
- Timer,
117
- setRafInterval,
118
- setRafTimeout
119
- });
88
+ exports.Timer = Timer;
89
+ exports.setRafInterval = setRafInterval;
90
+ exports.setRafTimeout = setRafTimeout;
package/dist/timers.mjs CHANGED
@@ -1,90 +1,84 @@
1
- import {
2
- __privateAdd,
3
- __privateGet,
4
- __publicField
5
- } from "./chunk-MXGZDBDQ.mjs";
6
-
1
+ import _defineProperty from "./_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.mjs";
2
+ import _classPrivateFieldInitSpec from "./_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldInitSpec.mjs";
3
+ import _classPrivateFieldGet2 from "./_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/classPrivateFieldGet2.mjs";
7
4
  // src/timers.ts
8
- var currentTime = () => performance.now();
9
- var _tick;
5
+ const currentTime = () => performance.now();
6
+ var _tick = /* @__PURE__ */ new WeakMap();
10
7
  var Timer = class {
11
- constructor(onTick) {
12
- __publicField(this, "onTick", onTick);
13
- __publicField(this, "frameId", null);
14
- __publicField(this, "pausedAtMs", null);
15
- __publicField(this, "context");
16
- __publicField(this, "cancelFrame", () => {
17
- if (this.frameId === null) return;
18
- cancelAnimationFrame(this.frameId);
19
- this.frameId = null;
20
- });
21
- __publicField(this, "setStartMs", (startMs) => {
22
- this.context.startMs = startMs;
23
- });
24
- __publicField(this, "start", () => {
25
- if (this.frameId !== null) return;
26
- const now = currentTime();
27
- if (this.pausedAtMs !== null) {
28
- this.context.startMs += now - this.pausedAtMs;
29
- this.pausedAtMs = null;
30
- } else {
31
- this.context.startMs = now;
32
- }
33
- this.frameId = requestAnimationFrame(__privateGet(this, _tick));
34
- });
35
- __publicField(this, "pause", () => {
36
- if (this.frameId === null) return;
37
- this.cancelFrame();
38
- this.pausedAtMs = currentTime();
39
- });
40
- __publicField(this, "stop", () => {
41
- if (this.frameId === null) return;
42
- this.cancelFrame();
43
- this.pausedAtMs = null;
44
- });
45
- __privateAdd(this, _tick, (now) => {
46
- this.context.now = now;
47
- this.context.deltaMs = now - this.context.startMs;
48
- const shouldContinue = this.onTick(this.context);
49
- if (shouldContinue === false) {
50
- this.stop();
51
- return;
52
- }
53
- this.frameId = requestAnimationFrame(__privateGet(this, _tick));
54
- });
55
- this.context = { now: 0, startMs: currentTime(), deltaMs: 0 };
56
- }
57
- get elapsedMs() {
58
- if (this.pausedAtMs !== null) {
59
- return this.pausedAtMs - this.context.startMs;
60
- }
61
- return currentTime() - this.context.startMs;
62
- }
8
+ constructor(onTick) {
9
+ this.onTick = onTick;
10
+ _defineProperty(this, "frameId", null);
11
+ _defineProperty(this, "pausedAtMs", null);
12
+ _defineProperty(this, "context", void 0);
13
+ _defineProperty(this, "cancelFrame", () => {
14
+ if (this.frameId === null) return;
15
+ cancelAnimationFrame(this.frameId);
16
+ this.frameId = null;
17
+ });
18
+ _defineProperty(this, "setStartMs", (startMs) => {
19
+ this.context.startMs = startMs;
20
+ });
21
+ _defineProperty(this, "start", () => {
22
+ if (this.frameId !== null) return;
23
+ const now = currentTime();
24
+ if (this.pausedAtMs !== null) {
25
+ this.context.startMs += now - this.pausedAtMs;
26
+ this.pausedAtMs = null;
27
+ } else this.context.startMs = now;
28
+ this.frameId = requestAnimationFrame(_classPrivateFieldGet2(_tick, this));
29
+ });
30
+ _defineProperty(this, "pause", () => {
31
+ if (this.frameId === null) return;
32
+ this.cancelFrame();
33
+ this.pausedAtMs = currentTime();
34
+ });
35
+ _defineProperty(this, "stop", () => {
36
+ if (this.frameId === null) return;
37
+ this.cancelFrame();
38
+ this.pausedAtMs = null;
39
+ });
40
+ _classPrivateFieldInitSpec(this, _tick, (now) => {
41
+ this.context.now = now;
42
+ this.context.deltaMs = now - this.context.startMs;
43
+ if (this.onTick(this.context) === false) {
44
+ this.stop();
45
+ return;
46
+ }
47
+ this.frameId = requestAnimationFrame(_classPrivateFieldGet2(_tick, this));
48
+ });
49
+ this.context = {
50
+ now: 0,
51
+ startMs: currentTime(),
52
+ deltaMs: 0
53
+ };
54
+ }
55
+ get elapsedMs() {
56
+ if (this.pausedAtMs !== null) return this.pausedAtMs - this.context.startMs;
57
+ return currentTime() - this.context.startMs;
58
+ }
63
59
  };
64
- _tick = new WeakMap();
65
60
  function setRafInterval(fn, intervalMs) {
66
- const timer = new Timer(({ now, deltaMs }) => {
67
- if (deltaMs >= intervalMs) {
68
- const startMs = intervalMs > 0 ? now - deltaMs % intervalMs : now;
69
- timer.setStartMs(startMs);
70
- fn({ startMs, deltaMs });
71
- }
72
- });
73
- timer.start();
74
- return () => timer.stop();
61
+ const timer = new Timer(({ now, deltaMs }) => {
62
+ if (deltaMs >= intervalMs) {
63
+ const startMs = intervalMs > 0 ? now - deltaMs % intervalMs : now;
64
+ timer.setStartMs(startMs);
65
+ fn({
66
+ startMs,
67
+ deltaMs
68
+ });
69
+ }
70
+ });
71
+ timer.start();
72
+ return () => timer.stop();
75
73
  }
76
74
  function setRafTimeout(fn, delayMs) {
77
- const timer = new Timer(({ deltaMs }) => {
78
- if (deltaMs >= delayMs) {
79
- fn();
80
- return false;
81
- }
82
- });
83
- timer.start();
84
- return () => timer.stop();
75
+ const timer = new Timer(({ deltaMs }) => {
76
+ if (deltaMs >= delayMs) {
77
+ fn();
78
+ return false;
79
+ }
80
+ });
81
+ timer.start();
82
+ return () => timer.stop();
85
83
  }
86
- export {
87
- Timer,
88
- setRafInterval,
89
- setRafTimeout
90
- };
84
+ export { Timer, setRafInterval, setRafTimeout };
@@ -1,9 +1,8 @@
1
- declare function warn(m: string): void;
2
- declare function warn(c: boolean, m: string): void;
3
- declare function invariant(m: string): void;
4
- declare function invariant(c: boolean, m: string): void;
5
- declare function ensure<T>(c: T | null | undefined, m: () => string): asserts c is T;
1
+ export declare function warn(m: string): void;
2
+ export declare function warn(c: boolean, m: string): void;
3
+ export declare function invariant(m: string): void;
4
+ export declare function invariant(c: boolean, m: string): void;
5
+ export declare function ensure<T>(c: T | null | undefined, m: () => string): asserts c is T;
6
6
  type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
7
- declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
8
-
9
- export { ensure, ensureProps, invariant, warn };
7
+ export declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
8
+ export {};
package/dist/warning.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- declare function warn(m: string): void;
2
- declare function warn(c: boolean, m: string): void;
3
- declare function invariant(m: string): void;
4
- declare function invariant(c: boolean, m: string): void;
5
- declare function ensure<T>(c: T | null | undefined, m: () => string): asserts c is T;
1
+ export declare function warn(m: string): void;
2
+ export declare function warn(c: boolean, m: string): void;
3
+ export declare function invariant(m: string): void;
4
+ export declare function invariant(c: boolean, m: string): void;
5
+ export declare function ensure<T>(c: T | null | undefined, m: () => string): asserts c is T;
6
6
  type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
7
- declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
8
-
9
- export { ensure, ensureProps, invariant, warn };
7
+ export declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
8
+ export {};
package/dist/warning.js CHANGED
@@ -1,60 +1,25 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/warning.ts
21
- var warning_exports = {};
22
- __export(warning_exports, {
23
- ensure: () => ensure,
24
- ensureProps: () => ensureProps,
25
- invariant: () => invariant,
26
- warn: () => warn
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
27
4
  });
28
- module.exports = __toCommonJS(warning_exports);
5
+ // src/warning.ts
29
6
  function warn(...a) {
30
- const m = a.length === 1 ? a[0] : a[1];
31
- const c = a.length === 2 ? a[0] : true;
32
- if (c && process.env.NODE_ENV !== "production") {
33
- console.warn(m);
34
- }
7
+ const m = a.length === 1 ? a[0] : a[1];
8
+ if ((a.length === 2 ? a[0] : true) && process.env.NODE_ENV !== "production") console.warn(m);
35
9
  }
36
10
  function invariant(...a) {
37
- const m = a.length === 1 ? a[0] : a[1];
38
- const c = a.length === 2 ? a[0] : true;
39
- if (c && process.env.NODE_ENV !== "production") {
40
- throw new Error(m);
41
- }
11
+ const m = a.length === 1 ? a[0] : a[1];
12
+ if ((a.length === 2 ? a[0] : true) && process.env.NODE_ENV !== "production") throw new Error(m);
42
13
  }
43
14
  function ensure(c, m) {
44
- if (c == null) throw new Error(m());
15
+ if (c == null) throw new Error(m());
45
16
  }
46
17
  function ensureProps(props, keys, scope) {
47
- let missingKeys = [];
48
- for (const key of keys) {
49
- if (props[key] == null) missingKeys.push(key);
50
- }
51
- if (missingKeys.length > 0)
52
- throw new Error(`[zag-js${scope ? ` > ${scope}` : ""}] missing required props: ${missingKeys.join(", ")}`);
18
+ let missingKeys = [];
19
+ for (const key of keys) if (props[key] == null) missingKeys.push(key);
20
+ if (missingKeys.length > 0) throw new Error(`[zag-js${scope ? ` > ${scope}` : ""}] missing required props: ${missingKeys.join(", ")}`);
53
21
  }
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- ensure,
57
- ensureProps,
58
- invariant,
59
- warn
60
- });
22
+ exports.ensure = ensure;
23
+ exports.ensureProps = ensureProps;
24
+ exports.invariant = invariant;
25
+ exports.warn = warn;
package/dist/warning.mjs CHANGED
@@ -1,34 +1,18 @@
1
- import "./chunk-MXGZDBDQ.mjs";
2
-
3
1
  // src/warning.ts
4
2
  function warn(...a) {
5
- const m = a.length === 1 ? a[0] : a[1];
6
- const c = a.length === 2 ? a[0] : true;
7
- if (c && process.env.NODE_ENV !== "production") {
8
- console.warn(m);
9
- }
3
+ const m = a.length === 1 ? a[0] : a[1];
4
+ if ((a.length === 2 ? a[0] : true) && process.env.NODE_ENV !== "production") console.warn(m);
10
5
  }
11
6
  function invariant(...a) {
12
- const m = a.length === 1 ? a[0] : a[1];
13
- const c = a.length === 2 ? a[0] : true;
14
- if (c && process.env.NODE_ENV !== "production") {
15
- throw new Error(m);
16
- }
7
+ const m = a.length === 1 ? a[0] : a[1];
8
+ if ((a.length === 2 ? a[0] : true) && process.env.NODE_ENV !== "production") throw new Error(m);
17
9
  }
18
10
  function ensure(c, m) {
19
- if (c == null) throw new Error(m());
11
+ if (c == null) throw new Error(m());
20
12
  }
21
13
  function ensureProps(props, keys, scope) {
22
- let missingKeys = [];
23
- for (const key of keys) {
24
- if (props[key] == null) missingKeys.push(key);
25
- }
26
- if (missingKeys.length > 0)
27
- throw new Error(`[zag-js${scope ? ` > ${scope}` : ""}] missing required props: ${missingKeys.join(", ")}`);
14
+ let missingKeys = [];
15
+ for (const key of keys) if (props[key] == null) missingKeys.push(key);
16
+ if (missingKeys.length > 0) throw new Error(`[zag-js${scope ? ` > ${scope}` : ""}] missing required props: ${missingKeys.join(", ")}`);
28
17
  }
29
- export {
30
- ensure,
31
- ensureProps,
32
- invariant,
33
- warn
34
- };
18
+ export { ensure, ensureProps, invariant, warn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/utils",
3
- "version": "1.47.0",
3
+ "version": "1.49.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",
@@ -45,8 +45,8 @@
45
45
  "./package.json": "./package.json"
46
46
  },
47
47
  "scripts": {
48
- "build": "tsup",
49
- "lint": "eslint src",
48
+ "build": "tsdown",
49
+ "lint": "oxlint src",
50
50
  "typecheck": "tsc --noEmit"
51
51
  }
52
52
  }
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __typeError = (msg) => {
3
- throw TypeError(msg);
4
- };
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
-
11
- export {
12
- __publicField,
13
- __privateGet,
14
- __privateAdd
15
- };