@zag-js/core
Advanced tools
Comparing version 0.0.0-dev-20220510084727 to 0.0.0-dev-20220512130015
@@ -285,3 +285,2 @@ var __defProp = Object.defineProperty; | ||
constructor(config, options) { | ||
this.config = config; | ||
this.status = "Not Started" /* NotStarted */; | ||
@@ -711,5 +710,6 @@ this.type = "machine" /* Machine */; | ||
}; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; | ||
this.config = (0, import_json.klona)(config); | ||
this.options = (0, import_json.klona)(options != null ? options : {}); | ||
this.id = (_a = config.id) != null ? _a : `machine-${uuid()}`; | ||
this.id = (_a = this.config.id) != null ? _a : `machine-${uuid()}`; | ||
this.guardMap = (_c = (_b = this.options) == null ? void 0 : _b.guards) != null ? _c : {}; | ||
@@ -720,5 +720,5 @@ this.actionMap = (_e = (_d = this.options) == null ? void 0 : _d.actions) != null ? _e : {}; | ||
this.sync = (_k = (_j = this.options) == null ? void 0 : _j.sync) != null ? _k : false; | ||
this.state = createProxy((0, import_json.klona)(config)); | ||
this.state = createProxy(this.config); | ||
const event = toEvent("machine.created" /* Created */); | ||
this.executeActions(config == null ? void 0 : config.created, event); | ||
this.executeActions((_l = this.config) == null ? void 0 : _l.created, event); | ||
} | ||
@@ -725,0 +725,0 @@ get stateSnapshot() { |
import { Dict, MachineStatus, MachineType, StateMachine as S, Writable } from "./types"; | ||
export declare class Machine<TContext extends Dict, TState extends S.StateSchema, TEvent extends S.EventObject = S.AnyEventObject> { | ||
config: S.MachineConfig<TContext, TState, TEvent>; | ||
status: MachineStatus; | ||
@@ -26,2 +25,3 @@ readonly state: S.State<TContext, TState, TEvent>; | ||
options: S.MachineOptions<TContext, TState, TEvent>; | ||
config: S.MachineConfig<TContext, TState, TEvent>; | ||
constructor(config: S.MachineConfig<TContext, TState, TEvent>, options?: S.MachineOptions<TContext, TState, TEvent>); | ||
@@ -28,0 +28,0 @@ private get stateSnapshot(); |
{ | ||
"name": "@zag-js/core", | ||
"version": "0.0.0-dev-20220510084727", | ||
"version": "0.0.0-dev-20220512130015", | ||
"description": "A minimal implementation of xstate fsm for UI machines", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/utils": "0.0.0-dev-20220510084727", | ||
"@zag-js/utils": "0.1.1", | ||
"klona": "^2.0.5", | ||
@@ -43,0 +43,0 @@ "valtio": "^1.6.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
222402
+ Added@zag-js/utils@0.1.1(transitive)
- Removed@zag-js/utils@0.0.0-dev-20220510084727(transitive)
Updated@zag-js/utils@0.1.1