@zag-js/store 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -18
- package/dist/index.mjs +4 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,9 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __esm = (fn, res) => function __init() {
|
|
7
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
-
};
|
|
9
6
|
var __export = (target, all) => {
|
|
10
7
|
for (var name in all)
|
|
11
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -20,14 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
17
|
};
|
|
21
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
19
|
|
|
23
|
-
// <define:import.meta.env>
|
|
24
|
-
var define_import_meta_env_default;
|
|
25
|
-
var init_define_import_meta_env = __esm({
|
|
26
|
-
"<define:import.meta.env>"() {
|
|
27
|
-
define_import_meta_env_default = { MODE: "production" };
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
20
|
// src/index.ts
|
|
32
21
|
var src_exports = {};
|
|
33
22
|
__export(src_exports, {
|
|
@@ -39,11 +28,10 @@ __export(src_exports, {
|
|
|
39
28
|
subscribeKey: () => subscribeKey
|
|
40
29
|
});
|
|
41
30
|
module.exports = __toCommonJS(src_exports);
|
|
42
|
-
init_define_import_meta_env();
|
|
43
31
|
|
|
44
32
|
// ../../node_modules/.pnpm/valtio@1.9.0/node_modules/valtio/esm/vanilla.mjs
|
|
45
|
-
init_define_import_meta_env();
|
|
46
33
|
var import_proxy_compare = require("proxy-compare");
|
|
34
|
+
var import_meta = {};
|
|
47
35
|
var isObject = (x) => typeof x === "object" && x !== null;
|
|
48
36
|
var proxyStateMap = /* @__PURE__ */ new WeakMap();
|
|
49
37
|
var refSet = /* @__PURE__ */ new WeakSet();
|
|
@@ -118,7 +106,7 @@ var buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) =>
|
|
|
118
106
|
};
|
|
119
107
|
const propProxyStates = /* @__PURE__ */ new Map();
|
|
120
108
|
const addPropListener = (prop, propProxyState) => {
|
|
121
|
-
if ((
|
|
109
|
+
if ((import_meta.env && import_meta.env.MODE) !== "production" && propProxyStates.has(prop)) {
|
|
122
110
|
throw new Error("prop listener already exists");
|
|
123
111
|
}
|
|
124
112
|
if (listeners.size) {
|
|
@@ -140,7 +128,7 @@ var buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) =>
|
|
|
140
128
|
listeners.add(listener);
|
|
141
129
|
if (listeners.size === 1) {
|
|
142
130
|
propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
|
|
143
|
-
if ((
|
|
131
|
+
if ((import_meta.env && import_meta.env.MODE) !== "production" && prevRemove) {
|
|
144
132
|
throw new Error("remove already exists");
|
|
145
133
|
}
|
|
146
134
|
const remove = propProxyState[3](createPropListener(prop));
|
|
@@ -249,7 +237,7 @@ function proxy(initialObject = {}) {
|
|
|
249
237
|
}
|
|
250
238
|
function subscribe(proxyObject, callback, notifyInSync) {
|
|
251
239
|
const proxyState = proxyStateMap.get(proxyObject);
|
|
252
|
-
if ((
|
|
240
|
+
if ((import_meta.env && import_meta.env.MODE) !== "production" && !proxyState) {
|
|
253
241
|
console.warn("Please use proxy object");
|
|
254
242
|
}
|
|
255
243
|
let promise;
|
|
@@ -280,7 +268,7 @@ function subscribe(proxyObject, callback, notifyInSync) {
|
|
|
280
268
|
}
|
|
281
269
|
function snapshot(proxyObject, handlePromise) {
|
|
282
270
|
const proxyState = proxyStateMap.get(proxyObject);
|
|
283
|
-
if ((
|
|
271
|
+
if ((import_meta.env && import_meta.env.MODE) !== "production" && !proxyState) {
|
|
284
272
|
console.warn("Please use proxy object");
|
|
285
273
|
}
|
|
286
274
|
const [target, ensureVersion, createSnapshot] = proxyState;
|
|
@@ -292,7 +280,6 @@ function ref(obj) {
|
|
|
292
280
|
}
|
|
293
281
|
|
|
294
282
|
// ../../node_modules/.pnpm/valtio@1.9.0/node_modules/valtio/esm/vanilla/utils.mjs
|
|
295
|
-
init_define_import_meta_env();
|
|
296
283
|
function subscribeKey(proxyObject, key, callback, notifyInSync) {
|
|
297
284
|
let prevValue = proxyObject[key];
|
|
298
285
|
return subscribe(
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __esm = (fn, res) => function __init() {
|
|
3
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
// <define:import.meta.env>
|
|
7
|
-
var define_import_meta_env_default;
|
|
8
|
-
var init_define_import_meta_env = __esm({
|
|
9
|
-
"<define:import.meta.env>"() {
|
|
10
|
-
define_import_meta_env_default = { MODE: "production" };
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// src/index.ts
|
|
15
|
-
init_define_import_meta_env();
|
|
16
|
-
|
|
17
1
|
// ../../node_modules/.pnpm/valtio@1.9.0/node_modules/valtio/esm/vanilla.mjs
|
|
18
|
-
init_define_import_meta_env();
|
|
19
2
|
import { markToTrack, getUntracked } from "proxy-compare";
|
|
20
3
|
var isObject = (x) => typeof x === "object" && x !== null;
|
|
21
4
|
var proxyStateMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -91,7 +74,7 @@ var buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) =>
|
|
|
91
74
|
};
|
|
92
75
|
const propProxyStates = /* @__PURE__ */ new Map();
|
|
93
76
|
const addPropListener = (prop, propProxyState) => {
|
|
94
|
-
if ((
|
|
77
|
+
if ((import.meta.env && import.meta.env.MODE) !== "production" && propProxyStates.has(prop)) {
|
|
95
78
|
throw new Error("prop listener already exists");
|
|
96
79
|
}
|
|
97
80
|
if (listeners.size) {
|
|
@@ -113,7 +96,7 @@ var buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) =>
|
|
|
113
96
|
listeners.add(listener);
|
|
114
97
|
if (listeners.size === 1) {
|
|
115
98
|
propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
|
|
116
|
-
if ((
|
|
99
|
+
if ((import.meta.env && import.meta.env.MODE) !== "production" && prevRemove) {
|
|
117
100
|
throw new Error("remove already exists");
|
|
118
101
|
}
|
|
119
102
|
const remove = propProxyState[3](createPropListener(prop));
|
|
@@ -222,7 +205,7 @@ function proxy(initialObject = {}) {
|
|
|
222
205
|
}
|
|
223
206
|
function subscribe(proxyObject, callback, notifyInSync) {
|
|
224
207
|
const proxyState = proxyStateMap.get(proxyObject);
|
|
225
|
-
if ((
|
|
208
|
+
if ((import.meta.env && import.meta.env.MODE) !== "production" && !proxyState) {
|
|
226
209
|
console.warn("Please use proxy object");
|
|
227
210
|
}
|
|
228
211
|
let promise;
|
|
@@ -253,7 +236,7 @@ function subscribe(proxyObject, callback, notifyInSync) {
|
|
|
253
236
|
}
|
|
254
237
|
function snapshot(proxyObject, handlePromise) {
|
|
255
238
|
const proxyState = proxyStateMap.get(proxyObject);
|
|
256
|
-
if ((
|
|
239
|
+
if ((import.meta.env && import.meta.env.MODE) !== "production" && !proxyState) {
|
|
257
240
|
console.warn("Please use proxy object");
|
|
258
241
|
}
|
|
259
242
|
const [target, ensureVersion, createSnapshot] = proxyState;
|
|
@@ -265,7 +248,6 @@ function ref(obj) {
|
|
|
265
248
|
}
|
|
266
249
|
|
|
267
250
|
// ../../node_modules/.pnpm/valtio@1.9.0/node_modules/valtio/esm/vanilla/utils.mjs
|
|
268
|
-
init_define_import_meta_env();
|
|
269
251
|
function subscribeKey(proxyObject, key, callback, notifyInSync) {
|
|
270
252
|
let prevValue = proxyObject[key];
|
|
271
253
|
return subscribe(
|