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
903
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-20220605192656 to 0.0.0-dev-20220625180418

1

dist/create-proxy.d.ts
import { StateMachine as S } from "./types";
export declare function createProxy<TContext, TState extends S.StateSchema, TEvent extends S.EventObject>(config: S.MachineConfig<TContext, TState, TEvent>): S.State<TContext, TState, TEvent>;
//# sourceMappingURL=create-proxy.d.ts.map

@@ -11,2 +11,1 @@ import { StateMachine as S } from "./types";

export declare function determineDelayFn<TContext, TEvent extends S.EventObject>(delay: S.Delay<TContext, TEvent> | undefined, delaysMap: S.DelayMap<TContext, TEvent> | undefined): (context: TContext, event: TEvent) => number;
//# sourceMappingURL=delay-utils.d.ts.map

@@ -19,2 +19,1 @@ import { StateMachine as S } from "./types";

export {};
//# sourceMappingURL=guard-utils.d.ts.map

5

dist/index.d.ts

@@ -1,7 +0,6 @@

export { proxy, ref, snapshot, subscribe } from "valtio/vanilla";
export { proxy, ref, snapshot, subscribe } from "@zag-js/store";
export { choose, guards } from "./guard-utils";
export * from "./machine";
export { mergeProps } from "./merge-props";
export type { StateFrom, ContextFrom, EventFrom } from "./type-utils";
export type { ContextFrom, EventFrom, StateFrom } from "./type-utils";
export type { StateMachine } from "./types";
//# sourceMappingURL=index.d.ts.map

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -48,9 +49,9 @@ var __defProps = Object.defineProperties;

mergeProps: () => mergeProps,
proxy: () => import_vanilla4.proxy,
ref: () => import_vanilla4.ref,
snapshot: () => import_vanilla4.snapshot,
subscribe: () => import_vanilla4.subscribe
proxy: () => import_store4.proxy,
ref: () => import_store4.ref,
snapshot: () => import_store4.snapshot,
subscribe: () => import_store4.subscribe
});
module.exports = __toCommonJS(src_exports);
var import_vanilla4 = require("valtio/vanilla");
var import_store4 = require("@zag-js/store");

@@ -64,3 +65,2 @@ // ../utilities/core/dist/index.mjs

var isDev = () => void 0 !== "production";
var isDom = () => typeof window !== "undefined";
var isArray = (v) => Array.isArray(v);

@@ -71,3 +71,2 @@ var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));

var isFunction = (v) => typeof v === "function";
var isTouchDevice = isDom() && !!navigator.maxTouchPoints;
var runIfFn = (v, ...a) => {

@@ -108,3 +107,3 @@ const res = typeof v === "function" ? v(...a) : v;

// src/utils.ts
var import_vanilla = require("valtio/vanilla");
var import_store = require("@zag-js/store");
function toEvent(event) {

@@ -123,5 +122,5 @@ const obj = isString(event) ? { type: event } : event;

function subscribeKey(obj, key, fn, sync) {
let prev = Reflect.get((0, import_vanilla.snapshot)(obj), key);
return (0, import_vanilla.subscribe)(obj, () => {
const snap = (0, import_vanilla.snapshot)(obj);
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])) {

@@ -204,8 +203,7 @@ fn(snap[key]);

// src/machine.ts
var import_store3 = require("@zag-js/store");
var import_json = require("klona/json");
var import_vanilla3 = require("valtio/vanilla");
// src/create-proxy.ts
var import_vanilla2 = require("valtio/vanilla");
var import_utils4 = require("valtio/utils");
var import_store2 = require("@zag-js/store");
function createProxy(config) {

@@ -215,7 +213,7 @@ var _a, _b;

const initialContext = (_b = config.context) != null ? _b : cast({});
const state = (0, import_vanilla2.proxy)({
const state = (0, import_store2.proxy)({
value: "",
previousValue: "",
event: cast({}),
context: (0, import_utils4.proxyWithComputed)(initialContext, computedContext),
context: (0, import_store2.proxyWithComputed)(initialContext, computedContext),
done: false,

@@ -328,3 +326,3 @@ tags: [],

this.performStateChangeEffects(this.state.value, next, event);
this.removeStateListener = (0, import_vanilla3.subscribe)(this.state, () => {
this.removeStateListener = (0, import_store3.subscribe)(this.state, () => {
this.stateListeners.forEach((listener) => {

@@ -340,3 +338,3 @@ listener(this.stateSnapshot);

}, this.sync);
this.removeContextListener = (0, import_vanilla3.subscribe)(this.state.context, () => {
this.removeContextListener = (0, import_store3.subscribe)(this.state.context, () => {
this.log("Context:", this.contextSnapshot);

@@ -449,3 +447,3 @@ this.contextListeners.forEach((listener) => {

}).start();
return cast((0, import_vanilla3.ref)(actor));
return cast((0, import_store3.ref)(actor));
});

@@ -626,3 +624,3 @@ __publicField(this, "addActivityCleanup", (state, cleanup) => {

__publicField(this, "setEvent", (event) => {
this.state.event = (0, import_vanilla3.ref)(toEvent(event));
this.state.event = (0, import_store3.ref)(toEvent(event));
});

@@ -760,3 +758,3 @@ __publicField(this, "performExitEffects", (current, event) => {

get stateSnapshot() {
return cast((0, import_vanilla3.snapshot)(this.state));
return cast((0, import_store3.snapshot)(this.state));
}

@@ -832,2 +830,1 @@ get contextSnapshot() {

}
//# sourceMappingURL=index.js.map

@@ -126,2 +126,1 @@ import { Dict, MachineStatus, MachineType, StateMachine as S, Writable } from "./types";

export declare const createMachine: <TContext extends Dict<any>, TState extends S.StateSchema = S.StateSchema, TEvent extends S.EventObject = S.AnyEventObject>(config: S.MachineConfig<TContext, TState, TEvent>, options?: S.MachineOptions<TContext, TState, TEvent>) => Machine<TContext, TState, TEvent>;
//# sourceMappingURL=machine.d.ts.map

@@ -8,2 +8,1 @@ interface Props {

export {};
//# sourceMappingURL=merge-props.d.ts.map

@@ -14,2 +14,1 @@ import type { StateMachine as S } from "./types";

export declare function determineTransitionFn<TContext, TState extends S.StateSchema, TEvent extends S.EventObject>(transitions: S.Transitions<TContext, TState, TEvent> | undefined, guardMap: S.GuardMap<TContext, TState, TEvent>): (context: TContext, event: TEvent, meta: S.GuardMeta<TContext, TState, TEvent>) => S.TransitionDefinition<TContext, TState, TEvent>;
//# sourceMappingURL=transition-utils.d.ts.map

@@ -9,2 +9,1 @@ import { Machine } from "./machine";

export {};
//# sourceMappingURL=type-utils.d.ts.map

@@ -280,2 +280,1 @@ export declare type Dict<T = any> = Record<string, T>;

export {};
//# sourceMappingURL=types.d.ts.map

@@ -8,2 +8,1 @@ import type { Dict, StateMachine as S } from "./types";

export declare function subscribeKey<T extends object, K extends keyof T>(obj: T, key: K, fn: (value: T[K]) => void, sync?: boolean): () => void;
//# sourceMappingURL=utils.d.ts.map
{
"name": "@zag-js/core",
"version": "0.0.0-dev-20220605192656",
"version": "0.0.0-dev-20220625180418",
"description": "A minimal implementation of xstate fsm for UI machines",

@@ -40,6 +40,6 @@ "keywords": [

"dependencies": {
"@zag-js/utils": "0.0.0-dev-20220605192656",
"klona": "^2.0.5",
"valtio": "^1.6.0"
"@zag-js/store": "0.0.0-dev-20220625180418",
"@zag-js/utils": "0.1.2",
"klona": "2.0.5"
}
}

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