New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zag-js/vue

Package Overview
Dependencies
Maintainers
1
Versions
964
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/vue - npm Package Compare versions

Comparing version 0.0.0-dev-20220525062850 to 0.0.0-dev-20220526103720

11

dist/index.d.ts

@@ -0,8 +1,9 @@

export { mergeProps } from "@zag-js/core";
export type { ContextFrom, EventFrom, StateFrom } from "@zag-js/core";
export * from "./normalize-props";
export type { PropTypes } from "./prop-types";
export * from "./use-actor";
export * from "./use-machine";
export * from "./use-actor";
export * from "./normalize-props";
export * from "./use-setup";
export * from "./use-snapshot";
export * from "./use-setup";
export type { PropTypes } from "./prop-types";
export { mergeProps } from "@zag-js/core";
//# sourceMappingURL=index.d.ts.map

@@ -30,66 +30,4 @@ var __defProp = Object.defineProperty;

module.exports = __toCommonJS(src_exports);
var import_core = require("@zag-js/core");
// src/use-machine.ts
var import_vue = require("vue");
function useMachine(machine, options) {
const { actions, state: hydratedState, context } = options != null ? options : {};
const service = typeof machine === "function" ? machine() : machine;
const state = (0, import_vue.shallowRef)(service.state);
const consumableState = (0, import_vue.computed)({
get() {
return state.value;
},
set(value) {
if (state.value !== value) {
state.value = value;
}
}
});
service.start(hydratedState);
let unsubscribe;
(0, import_vue.onMounted)(() => {
unsubscribe = service.subscribe((nextState) => {
consumableState.value = nextState;
});
});
(0, import_vue.onBeforeUnmount)(() => {
unsubscribe == null ? void 0 : unsubscribe();
service.stop();
});
(0, import_vue.watch)(() => actions, service.setActions, { flush: "post", immediate: true });
if (context) {
(0, import_vue.watch)(context, (ctx) => {
service.setContext(ctx);
}, { immediate: true, deep: true });
}
return [consumableState, service.send, service];
}
// src/use-actor.ts
var import_vue2 = require("vue");
function useActor(service) {
const state = (0, import_vue2.shallowRef)(service.state);
const consumableState = (0, import_vue2.computed)({
get() {
return state.value;
},
set(value) {
if (state.value !== value) {
state.value = value;
}
}
});
let unsubscribe;
function listener(nextState) {
consumableState.value = nextState;
}
(0, import_vue2.onMounted)(() => {
unsubscribe = service.subscribe(listener);
});
(0, import_vue2.onBeforeUnmount)(() => {
unsubscribe == null ? void 0 : unsubscribe();
});
return [consumableState, service.send];
}
// ../../types/dist/index.mjs

@@ -141,26 +79,75 @@ function createNormalizer(fn) {

// src/use-snapshot.ts
var import_vue3 = require("vue");
var import_vanilla = require("valtio/vanilla");
var useSnapshot = (object) => {
const state = (0, import_vue3.ref)({});
const unsubscribe = (0, import_vanilla.subscribe)(object, () => {
state.value = (0, import_vanilla.snapshot)(object);
// src/use-actor.ts
var import_vue = require("vue");
function useActor(service) {
const state = (0, import_vue.shallowRef)(service.state);
const consumableState = (0, import_vue.computed)({
get() {
return state.value;
},
set(value) {
if (state.value !== value) {
state.value = value;
}
}
});
(0, import_vue3.onUnmounted)(() => {
let unsubscribe;
function listener(nextState) {
consumableState.value = nextState;
}
(0, import_vue.onMounted)(() => {
unsubscribe = service.subscribe(listener);
});
(0, import_vue.onBeforeUnmount)(() => {
unsubscribe == null ? void 0 : unsubscribe();
});
return state;
};
return [consumableState, service.send];
}
// src/use-machine.ts
var import_vue2 = require("vue");
function useMachine(machine, options) {
const { actions, state: hydratedState, context } = options != null ? options : {};
const service = typeof machine === "function" ? machine() : machine;
const state = (0, import_vue2.shallowRef)(service.state);
const consumableState = (0, import_vue2.computed)({
get() {
return state.value;
},
set(value) {
if (state.value !== value) {
state.value = value;
}
}
});
service.start(hydratedState);
let unsubscribe;
(0, import_vue2.onMounted)(() => {
unsubscribe = service.subscribe((nextState) => {
consumableState.value = nextState;
});
});
(0, import_vue2.onBeforeUnmount)(() => {
unsubscribe == null ? void 0 : unsubscribe();
service.stop();
});
(0, import_vue2.watch)(() => actions, service.setActions, { flush: "post", immediate: true });
if (context) {
(0, import_vue2.watch)(context, (ctx) => {
service.setContext(ctx);
}, { immediate: true, deep: true });
}
return [consumableState, service.send, service];
}
// src/use-setup.ts
var import_vue4 = require("vue");
var import_vue3 = require("vue");
function useSetup(props) {
const { id, send } = props;
const nodeRef = (0, import_vue4.ref)(null);
(0, import_vue4.onMounted)(() => {
const nodeRef = (0, import_vue3.ref)(null);
(0, import_vue3.onMounted)(() => {
const el = nodeRef.value;
const doc = el == null ? void 0 : el.ownerDocument;
const root = el == null ? void 0 : el.getRootNode();
const uid = (0, import_vue4.isRef)(id) ? id.value : id;
const uid = (0, import_vue3.isRef)(id) ? id.value : id;
send({ type: "SETUP", doc, root, id: uid });

@@ -171,4 +158,15 @@ });

// src/index.ts
var import_core = require("@zag-js/core");
// src/use-snapshot.ts
var import_vue4 = require("vue");
var import_vanilla = require("valtio/vanilla");
var useSnapshot = (object) => {
const state = (0, import_vue4.ref)({});
const unsubscribe = (0, import_vanilla.subscribe)(object, () => {
state.value = (0, import_vanilla.snapshot)(object);
});
(0, import_vue4.onUnmounted)(() => {
unsubscribe == null ? void 0 : unsubscribe();
});
return state;
};
//# sourceMappingURL=index.js.map
{
"name": "@zag-js/vue",
"version": "0.0.0-dev-20220525062850",
"version": "0.0.0-dev-20220526103720",
"description": "The vue wrapper for zag",

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

"dependencies": {
"@zag-js/core": "0.1.4",
"@zag-js/core": "0.0.0-dev-20220526103720",
"valtio": "^1.6.0"

@@ -34,0 +34,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

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