Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zag-js/core

Package Overview
Dependencies
Maintainers
1
Versions
902
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 0.0.0-dev-20220714091855 to 0.0.0-dev-20220823143115

85

dist/index.js

@@ -91,3 +91,3 @@ "use strict";

return [];
return isArray(value) ? value : [value];
return isArray(value) ? value.slice() : [value];
}

@@ -99,9 +99,13 @@ function isGuardHelper(value) {

let prev = Reflect.get((0, import_store.snapshot)(obj), key);
return (0, import_store.subscribe)(obj, () => {
const snap = (0, import_store.snapshot)(obj);
if (!Object.is(prev, snap[key])) {
fn(snap[key]);
prev = Reflect.get(snap, key);
}
}, sync);
return (0, import_store.subscribe)(
obj,
() => {
const snap = (0, import_store.snapshot)(obj);
if (!Object.is(prev, snap[key])) {
fn(snap[key]);
prev = Reflect.get(snap, key);
}
},
sync
);
}

@@ -233,3 +237,6 @@

const valueOrFn = delaysMap == null ? void 0 : delaysMap[delay];
invariant(valueOrFn == null, `[@zag-js/core > determine-delay] Cannot determine delay for \`${delay}\`. It doesn't exist in \`options.delays\``);
invariant(
valueOrFn == null,
`[@zag-js/core > determine-delay] Cannot determine delay for \`${delay}\`. It doesn't exist in \`options.delays\``
);
return isFunction(valueOrFn) ? valueOrFn(context, event) : valueOrFn;

@@ -309,19 +316,32 @@ }

this.status = "Running" /* Running */;
this.removeStateListener = (0, import_store3.subscribe)(this.state, () => {
this.stateListeners.forEach((listener) => {
listener(this.stateSnapshot);
});
}, this.sync);
this.removeEventListener = subscribeKey(this.state, "event", (event2) => {
this.executeActions(this.config.onEvent, event2);
this.eventListeners.forEach((listener) => {
listener(event2);
});
}, this.sync);
this.removeContextListener = (0, import_store3.subscribe)(this.state.context, () => {
this.log("Context:", this.contextSnapshot);
this.contextListeners.forEach((listener) => {
listener(this.contextSnapshot);
});
}, this.sync || this.options.debug);
this.removeStateListener = (0, import_store3.subscribe)(
this.state,
() => {
this.stateListeners.forEach((listener) => {
listener(this.stateSnapshot);
});
},
this.sync
);
this.removeEventListener = subscribeKey(
this.state,
"event",
(event2) => {
this.executeActions(this.config.onEvent, event2);
this.eventListeners.forEach((listener) => {
listener(event2);
});
},
this.sync
);
this.removeContextListener = (0, import_store3.subscribe)(
this.state.context,
() => {
this.log("Context:", this.contextSnapshot);
this.contextListeners.forEach((listener) => {
listener(this.contextSnapshot);
});
},
this.sync || this.options.debug
);
this.setupContextWatchers();

@@ -346,5 +366,7 @@ this.executeActivities(toEvent("machine.start" /* Start */), toArray(this.config.activities), "machine.start" /* Start */);

for (const [key, fn] of Object.entries(this.config.watch ?? {})) {
this.contextWatchers.add(subscribeKey(this.state.context, key, () => {
this.executeActions(fn, this.state.event);
}));
this.contextWatchers.add(
subscribeKey(this.state.context, key, () => {
this.executeActions(fn, this.state.event);
})
);
}

@@ -587,3 +609,6 @@ };

const fn = isString(action) ? (_a = this.actionMap) == null ? void 0 : _a[action] : action;
warn(isString(action) && !fn, `[@zag-js/core > execute-actions] No implementation found for action: \`${action}\``);
warn(
isString(action) && !fn,
`[@zag-js/core > execute-actions] No implementation found for action: \`${action}\``
);
fn == null ? void 0 : fn(this.state.context, event, this.meta);

@@ -590,0 +615,0 @@ }

{
"name": "@zag-js/core",
"version": "0.0.0-dev-20220714091855",
"version": "0.0.0-dev-20220823143115",
"description": "A minimal implementation of xstate fsm for UI machines",

@@ -31,7 +31,7 @@ "keywords": [

"dependencies": {
"@zag-js/store": "0.0.0-dev-20220714091855",
"@zag-js/store": "0.1.1",
"klona": "2.0.5"
},
"devDependencies": {
"@zag-js/utils": "0.0.0-dev-20220714091855"
"@zag-js/utils": "0.1.3"
},

@@ -38,0 +38,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc