Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@zag-js/core

Package Overview
Dependencies
Maintainers
1
Versions
1024
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/core - npm Package Compare versions

Comparing version
1.38.0
to
1.38.1
+9
-4
dist/state.js

@@ -33,2 +33,3 @@ "use strict";

module.exports = __toCommonJS(state_exports);
var import_utils = require("@zag-js/utils");
var STATE_DELIMITER = ".";

@@ -64,3 +65,3 @@ var ABSOLUTE_PREFIX = "#";

if (idIndex.has(stateId)) {
throw new Error(`Duplicate state id: ${stateId}`);
(0, import_utils.invariant)(`[zag-js] Duplicate state id: "${stateId}"`);
}

@@ -71,2 +72,8 @@ idIndex.set(stateId, basePath);

if (!childStates) return;
(0, import_utils.ensure)(state.initial, () => `[zag-js] Compound state "${basePath}" has child states but no "initial" property`);
if (!(state.initial in childStates)) {
(0, import_utils.invariant)(
`[zag-js] Compound state "${basePath}" has initial "${String(state.initial)}" which is not a child state`
);
}
for (const [childKey, childState] of Object.entries(childStates)) {

@@ -145,5 +152,3 @@ if (!childState) continue;

const statePath = getStatePathById(machine, stateId);
if (!statePath) {
throw new Error(`Unknown state id: ${stateId}`);
}
(0, import_utils.ensure)(statePath, () => `[zag-js] Unknown state id: "${stateId}"`);
return resolveAbsoluteStateValue(machine, statePath);

@@ -150,0 +155,0 @@ }

// src/state.ts
import { ensure, invariant } from "@zag-js/utils";
var STATE_DELIMITER = ".";

@@ -32,3 +33,3 @@ var ABSOLUTE_PREFIX = "#";

if (idIndex.has(stateId)) {
throw new Error(`Duplicate state id: ${stateId}`);
invariant(`[zag-js] Duplicate state id: "${stateId}"`);
}

@@ -39,2 +40,8 @@ idIndex.set(stateId, basePath);

if (!childStates) return;
ensure(state.initial, () => `[zag-js] Compound state "${basePath}" has child states but no "initial" property`);
if (!(state.initial in childStates)) {
invariant(
`[zag-js] Compound state "${basePath}" has initial "${String(state.initial)}" which is not a child state`
);
}
for (const [childKey, childState] of Object.entries(childStates)) {

@@ -113,5 +120,3 @@ if (!childState) continue;

const statePath = getStatePathById(machine, stateId);
if (!statePath) {
throw new Error(`Unknown state id: ${stateId}`);
}
ensure(statePath, () => `[zag-js] Unknown state id: "${stateId}"`);
return resolveAbsoluteStateValue(machine, statePath);

@@ -118,0 +123,0 @@ }

{
"name": "@zag-js/core",
"version": "1.38.0",
"version": "1.38.1",
"description": "A minimal implementation of xstate fsm for UI machines",

@@ -28,4 +28,4 @@ "keywords": [

"dependencies": {
"@zag-js/utils": "1.38.0",
"@zag-js/dom-query": "1.38.0"
"@zag-js/utils": "1.38.1",
"@zag-js/dom-query": "1.38.1"
},

@@ -32,0 +32,0 @@ "devDependencies": {