@zag-js/react
Advanced tools
+11
-3
@@ -131,3 +131,5 @@ "use strict"; | ||
| if ((0, import_utils.isFunction)(str)) return str(getParams()); | ||
| return machine.implementations?.guards?.[str](getParams()); | ||
| const fn = machine.implementations?.guards?.[str]; | ||
| if (!fn) (0, import_utils.warn)(`[zag-js] No implementation found for guard "${JSON.stringify(str)}"`); | ||
| return fn?.(getParams()); | ||
| }; | ||
@@ -184,3 +186,6 @@ const effect = (keys) => { | ||
| const cleanup = effect(item.state?.effects); | ||
| if (cleanup) effects.current.set(item.path, cleanup); | ||
| if (cleanup) { | ||
| const existing = effects.current.get(item.path); | ||
| effects.current.set(item.path, existing ? (0, import_utils.callAll)(existing, cleanup) : cleanup); | ||
| } | ||
| }); | ||
@@ -190,3 +195,6 @@ if (prevState === import_core.INIT_STATE) { | ||
| const cleanup = effect(machine.effects); | ||
| if (cleanup) effects.current.set(import_core.INIT_STATE, cleanup); | ||
| if (cleanup) { | ||
| const existing = effects.current.get(import_core.INIT_STATE); | ||
| effects.current.set(import_core.INIT_STATE, existing ? (0, import_utils.callAll)(existing, cleanup) : cleanup); | ||
| } | ||
| } | ||
@@ -193,0 +201,0 @@ entering.forEach((item) => { |
+12
-4
@@ -14,3 +14,3 @@ "use client"; | ||
| } from "@zag-js/core"; | ||
| import { compact, ensure, isFunction, isString, toArray, warn } from "@zag-js/utils"; | ||
| import { callAll, compact, ensure, isFunction, isString, toArray, warn } from "@zag-js/utils"; | ||
| import { useMemo, useRef } from "react"; | ||
@@ -118,3 +118,5 @@ import { flushSync } from "react-dom"; | ||
| if (isFunction(str)) return str(getParams()); | ||
| return machine.implementations?.guards?.[str](getParams()); | ||
| const fn = machine.implementations?.guards?.[str]; | ||
| if (!fn) warn(`[zag-js] No implementation found for guard "${JSON.stringify(str)}"`); | ||
| return fn?.(getParams()); | ||
| }; | ||
@@ -171,3 +173,6 @@ const effect = (keys) => { | ||
| const cleanup = effect(item.state?.effects); | ||
| if (cleanup) effects.current.set(item.path, cleanup); | ||
| if (cleanup) { | ||
| const existing = effects.current.get(item.path); | ||
| effects.current.set(item.path, existing ? callAll(existing, cleanup) : cleanup); | ||
| } | ||
| }); | ||
@@ -177,3 +182,6 @@ if (prevState === INIT_STATE) { | ||
| const cleanup = effect(machine.effects); | ||
| if (cleanup) effects.current.set(INIT_STATE, cleanup); | ||
| if (cleanup) { | ||
| const existing = effects.current.get(INIT_STATE); | ||
| effects.current.set(INIT_STATE, existing ? callAll(existing, cleanup) : cleanup); | ||
| } | ||
| } | ||
@@ -180,0 +188,0 @@ entering.forEach((item) => { |
+7
-7
| { | ||
| "name": "@zag-js/react", | ||
| "version": "1.40.0", | ||
| "version": "1.41.0", | ||
| "description": "The react wrapper for zag", | ||
@@ -28,6 +28,6 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@zag-js/core": "1.40.0", | ||
| "@zag-js/store": "1.40.0", | ||
| "@zag-js/types": "1.40.0", | ||
| "@zag-js/utils": "1.40.0" | ||
| "@zag-js/core": "1.41.0", | ||
| "@zag-js/store": "1.41.0", | ||
| "@zag-js/types": "1.41.0", | ||
| "@zag-js/utils": "1.41.0" | ||
| }, | ||
@@ -38,4 +38,4 @@ "devDependencies": { | ||
| "@types/jsdom": "^28.0.1", | ||
| "react": "19.2.4", | ||
| "react-dom": "19.2.4", | ||
| "react": "19.2.6", | ||
| "react-dom": "19.2.6", | ||
| "clean-package": "2.2.0", | ||
@@ -42,0 +42,0 @@ "@testing-library/react": "^16.3.2", |
40875
1.95%1069
1.52%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated