Socket
Socket
Sign inDemoInstall

@zag-js/core

Package Overview
Dependencies
Maintainers
1
Versions
885
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.61.1 to 0.62.0

6

dist/index.d.ts

@@ -157,5 +157,6 @@ export { Ref, proxy, ref, snapshot, subscribe } from '@zag-js/store';

context: TContext;
value: TState["value"];
value: TState["value"] | null;
tags?: TState["tags"][];
};
type StateInit<TContext, TState extends StateSchema> = TState["value"] | StateInitObject<TContext, TState>;
type StateInit<TContext, TState extends StateSchema> = StateInitObject<TContext, TState>;
type StateListener<TContext extends Dict, TState extends StateSchema, TEvent extends EventObject = EventObject> = (state: State<TContext, TState, TEvent>) => void;

@@ -405,2 +406,3 @@ interface StateInfo<TContext extends Dict, TState extends StateSchema, TEvent extends EventObject> {

get [Symbol.toStringTag](): string;
getHydrationState(): StateMachine.StateInit<TContext, TState>;
}

@@ -407,0 +409,0 @@ type MachineSrc<TContext extends Dict, TState extends StateMachine.StateSchema, TEvent extends StateMachine.EventObject = StateMachine.AnyEventObject> = Machine<TContext, TState, TEvent> | (() => Machine<TContext, TState, TEvent>);

@@ -76,2 +76,22 @@ "use strict";

// ../utilities/core/src/split-props.ts
function splitProps(props, keys) {
const rest = {};
const result = {};
const keySet = new Set(keys);
for (const key in props) {
if (keySet.has(key)) {
result[key] = props[key];
} else {
rest[key] = props[key];
}
}
return [result, rest];
}
var createSplitProps = (keys) => {
return function split(props) {
return splitProps(props, keys);
};
};
// ../utilities/core/src/object.ts

@@ -95,2 +115,5 @@ function compact(obj) {

};
function omit(obj, keys) {
return createSplitProps(keys)(obj)[1];
}

@@ -848,2 +871,11 @@ // ../utilities/core/src/warning.ts

}
getHydrationState() {
const state = this.getState();
const computedKeys = Object.keys(this.config.computed ?? {});
return {
value: state.value,
context: omit(state.context, computedKeys),
tags: state.tags
};
}
};

@@ -850,0 +882,0 @@ var createMachine = (config, options) => new Machine(config, options);

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

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

"klona": "2.0.6",
"@zag-js/store": "0.61.1"
"@zag-js/store": "0.62.0"
},
"devDependencies": {
"clean-package": "2.2.0",
"@zag-js/utils": "0.61.1"
"@zag-js/utils": "0.62.0"
},

@@ -37,0 +37,0 @@ "clean-package": "../../clean-package.config.json",

@@ -13,2 +13,3 @@ import { ref, snapshot, subscribe } from "@zag-js/store"

noop,
omit,
runIfFn,

@@ -801,2 +802,12 @@ uuid,

}
public getHydrationState(): S.StateInit<TContext, TState> {
const state = this.getState()
const computedKeys = Object.keys(this.config.computed ?? {})
return {
value: state.value,
context: omit(state.context, computedKeys) as any,
tags: state.tags,
}
}
}

@@ -803,0 +814,0 @@

@@ -280,6 +280,7 @@ /* -----------------------------------------------------------------------------

context: TContext
value: TState["value"]
value: TState["value"] | null
tags?: TState["tags"][]
}
export type StateInit<TContext, TState extends StateSchema> = TState["value"] | StateInitObject<TContext, TState>
export type StateInit<TContext, TState extends StateSchema> = StateInitObject<TContext, TState>

@@ -286,0 +287,0 @@ export type StateListener<

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

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