@zag-js/solid
Advanced tools
Comparing version 0.70.0 to 0.71.0
@@ -1,32 +0,9 @@ | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
'use strict'; | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
mergeProps: () => mergeProps, | ||
normalizeProps: () => normalizeProps, | ||
useActor: () => useActor, | ||
useMachine: () => useMachine | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var core = require('@zag-js/core'); | ||
var types = require('@zag-js/types'); | ||
var solidJs = require('solid-js'); | ||
var store = require('solid-js/store'); | ||
// src/merge-props.ts | ||
var import_core = require("@zag-js/core"); | ||
function mergeProps(...sources) { | ||
@@ -49,3 +26,3 @@ const target = {}; | ||
if (typeof s === "function") s = s(); | ||
e = (0, import_core.mergeProps)(e, { [key]: (s || {})[key] }); | ||
e = core.mergeProps(e, { [key]: (s || {})[key] }); | ||
} | ||
@@ -68,5 +45,2 @@ return e[key]; | ||
// src/normalize-props.ts | ||
var import_types = require("@zag-js/types"); | ||
// ../../utilities/core/src/guard.ts | ||
@@ -79,3 +53,3 @@ var isArray = (v) => Array.isArray(v); | ||
var fnToString = Function.prototype.toString; | ||
var objectCtorString = fnToString.call(Object); | ||
fnToString.call(Object); | ||
@@ -97,3 +71,3 @@ // src/normalize-props.ts | ||
} | ||
var normalizeProps = (0, import_types.createNormalizer)((props) => { | ||
var normalizeProps = types.createNormalizer((props) => { | ||
const normalized = {}; | ||
@@ -139,22 +113,18 @@ for (const key in props) { | ||
} | ||
// src/use-snapshot.ts | ||
var import_solid_js = require("solid-js"); | ||
var import_store = require("solid-js/store"); | ||
function useSnapshot(service, options) { | ||
const { actions, context } = options ?? {}; | ||
const [state, setState] = (0, import_store.createStore)(service.getState()); | ||
(0, import_solid_js.onMount)(() => { | ||
const [state, setState] = store.createStore(service.getState()); | ||
solidJs.onMount(() => { | ||
const unsubscribe = service.subscribe((nextState) => { | ||
setState((0, import_store.reconcile)(nextState)); | ||
setState(store.reconcile(nextState)); | ||
}); | ||
(0, import_solid_js.onCleanup)(() => { | ||
solidJs.onCleanup(() => { | ||
unsubscribe(); | ||
}); | ||
}); | ||
(0, import_solid_js.createEffect)(() => { | ||
solidJs.createEffect(() => { | ||
const contextValue = typeof context === "function" ? context() : context; | ||
service.setContext(contextValue); | ||
}); | ||
(0, import_solid_js.createEffect)(() => { | ||
solidJs.createEffect(() => { | ||
service.setOptions({ actions }); | ||
@@ -170,5 +140,2 @@ }); | ||
} | ||
// src/use-service.ts | ||
var import_solid_js2 = require("solid-js"); | ||
function useService(machine, options) { | ||
@@ -183,5 +150,5 @@ const { state: hydratedState, context } = options ?? {}; | ||
})(); | ||
(0, import_solid_js2.onMount)(() => { | ||
solidJs.onMount(() => { | ||
service.start(hydratedState); | ||
(0, import_solid_js2.onCleanup)(() => { | ||
solidJs.onCleanup(() => { | ||
service.stop(); | ||
@@ -199,9 +166,6 @@ }); | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
mergeProps, | ||
normalizeProps, | ||
useActor, | ||
useMachine | ||
}); | ||
//# sourceMappingURL=index.js.map | ||
exports.mergeProps = mergeProps; | ||
exports.normalizeProps = normalizeProps; | ||
exports.useActor = useActor; | ||
exports.useMachine = useMachine; |
{ | ||
"name": "@zag-js/solid", | ||
"version": "0.70.0", | ||
"version": "0.71.0", | ||
"description": "The solid.js wrapper for zag", | ||
@@ -19,4 +19,3 @@ "keywords": [ | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -30,5 +29,5 @@ "publishConfig": { | ||
"dependencies": { | ||
"@zag-js/core": "0.70.0", | ||
"@zag-js/store": "0.70.0", | ||
"@zag-js/types": "0.70.0" | ||
"@zag-js/core": "0.71.0", | ||
"@zag-js/store": "0.71.0", | ||
"@zag-js/types": "0.71.0" | ||
}, | ||
@@ -38,3 +37,3 @@ "devDependencies": { | ||
"clean-package": "2.2.0", | ||
"@zag-js/utils": "0.70.0" | ||
"@zag-js/utils": "0.71.0" | ||
}, | ||
@@ -41,0 +40,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16113
6
332
+ Added@zag-js/core@0.71.0(transitive)
+ Added@zag-js/store@0.71.0(transitive)
+ Added@zag-js/types@0.71.0(transitive)
+ Added@zag-js/utils@0.71.0(transitive)
- Removed@zag-js/core@0.70.0(transitive)
- Removed@zag-js/store@0.70.0(transitive)
- Removed@zag-js/types@0.70.0(transitive)
Updated@zag-js/core@0.71.0
Updated@zag-js/store@0.71.0
Updated@zag-js/types@0.71.0