@storix-js/vuex 0.1.0 → 0.1.2
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/README.md +46 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +440 -374
- package/package.json +9 -2
- package/src/index.ts +0 -91
- package/tsconfig.build.json +0 -8
- package/tsconfig.json +0 -4
- package/vite.config.ts +0 -15
package/dist/index.js
CHANGED
|
@@ -1,560 +1,626 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
|
|
1
|
+
var vt = Symbol.for("preact-signals");
|
|
2
|
+
function H() {
|
|
3
|
+
if (E > 1)
|
|
4
|
+
E--;
|
|
5
5
|
else {
|
|
6
|
-
for (var
|
|
7
|
-
var n =
|
|
8
|
-
for (
|
|
9
|
-
var
|
|
10
|
-
if (n.o = void 0, n.f &= -3, !(8 & n.f) &&
|
|
6
|
+
for (var t, e = !1; J !== void 0; ) {
|
|
7
|
+
var n = J;
|
|
8
|
+
for (J = void 0, G++; n !== void 0; ) {
|
|
9
|
+
var s = n.o;
|
|
10
|
+
if (n.o = void 0, n.f &= -3, !(8 & n.f) && ut(n)) try {
|
|
11
11
|
n.c();
|
|
12
|
-
} catch (
|
|
13
|
-
|
|
12
|
+
} catch (h) {
|
|
13
|
+
e || (t = h, e = !0);
|
|
14
14
|
}
|
|
15
|
-
n =
|
|
15
|
+
n = s;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
18
|
+
if (G = 0, E--, e) throw t;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
|
|
21
|
+
function Y(t) {
|
|
22
|
+
if (E > 0) return t();
|
|
23
|
+
E++;
|
|
24
24
|
try {
|
|
25
|
-
return
|
|
25
|
+
return t();
|
|
26
26
|
} finally {
|
|
27
|
-
|
|
27
|
+
H();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var l = void 0;
|
|
31
|
-
function
|
|
32
|
-
var
|
|
31
|
+
function at(t) {
|
|
32
|
+
var e = l;
|
|
33
33
|
l = void 0;
|
|
34
34
|
try {
|
|
35
|
-
return
|
|
35
|
+
return t();
|
|
36
36
|
} finally {
|
|
37
|
-
l =
|
|
37
|
+
l = e;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
function
|
|
40
|
+
var J = void 0, E = 0, G = 0, Z = 0;
|
|
41
|
+
function ct(t) {
|
|
42
42
|
if (l !== void 0) {
|
|
43
|
-
var
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
46
|
-
if (
|
|
47
|
-
return
|
|
43
|
+
var e = t.n;
|
|
44
|
+
if (e === void 0 || e.t !== l)
|
|
45
|
+
return e = { i: 0, S: t, p: l.s, n: void 0, t: l, e: void 0, x: void 0, r: e }, l.s !== void 0 && (l.s.n = e), l.s = e, t.n = e, 32 & l.f && t.S(e), e;
|
|
46
|
+
if (e.i === -1)
|
|
47
|
+
return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = l.s, e.n = void 0, l.s.n = e, l.s = e), e;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
this.v =
|
|
50
|
+
function w(t, e) {
|
|
51
|
+
this.v = t, this.i = 0, this.n = void 0, this.t = void 0, this.W = e == null ? void 0 : e.watched, this.Z = e == null ? void 0 : e.unwatched, this.name = e == null ? void 0 : e.name;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
w.prototype.brand = vt;
|
|
54
|
+
w.prototype.h = function() {
|
|
55
55
|
return !0;
|
|
56
56
|
};
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
n !==
|
|
60
|
-
var
|
|
61
|
-
(
|
|
57
|
+
w.prototype.S = function(t) {
|
|
58
|
+
var e = this, n = this.t;
|
|
59
|
+
n !== t && t.e === void 0 && (t.x = n, this.t = t, n !== void 0 ? n.e = t : at(function() {
|
|
60
|
+
var s;
|
|
61
|
+
(s = e.W) == null || s.call(e);
|
|
62
62
|
}));
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
var
|
|
64
|
+
w.prototype.U = function(t) {
|
|
65
|
+
var e = this;
|
|
66
66
|
if (this.t !== void 0) {
|
|
67
|
-
var n =
|
|
68
|
-
n !== void 0 && (n.x =
|
|
69
|
-
var
|
|
70
|
-
(
|
|
67
|
+
var n = t.e, s = t.x;
|
|
68
|
+
n !== void 0 && (n.x = s, t.e = void 0), s !== void 0 && (s.e = n, t.x = void 0), t === this.t && (this.t = s, s === void 0 && at(function() {
|
|
69
|
+
var h;
|
|
70
|
+
(h = e.Z) == null || h.call(e);
|
|
71
71
|
}));
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
return
|
|
77
|
-
var n =
|
|
74
|
+
w.prototype.subscribe = function(t) {
|
|
75
|
+
var e = this;
|
|
76
|
+
return gt(function() {
|
|
77
|
+
var n = e.value, s = l;
|
|
78
78
|
l = void 0;
|
|
79
79
|
try {
|
|
80
|
-
|
|
80
|
+
t(n);
|
|
81
81
|
} finally {
|
|
82
|
-
l =
|
|
82
|
+
l = s;
|
|
83
83
|
}
|
|
84
84
|
}, { name: "sub" });
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
w.prototype.valueOf = function() {
|
|
87
87
|
return this.value;
|
|
88
88
|
};
|
|
89
|
-
|
|
89
|
+
w.prototype.toString = function() {
|
|
90
90
|
return this.value + "";
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
w.prototype.toJSON = function() {
|
|
93
93
|
return this.value;
|
|
94
94
|
};
|
|
95
|
-
|
|
96
|
-
var
|
|
95
|
+
w.prototype.peek = function() {
|
|
96
|
+
var t = l;
|
|
97
97
|
l = void 0;
|
|
98
98
|
try {
|
|
99
99
|
return this.value;
|
|
100
100
|
} finally {
|
|
101
|
-
l =
|
|
101
|
+
l = t;
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
Object.defineProperty(
|
|
105
|
-
var
|
|
106
|
-
return
|
|
107
|
-
}, set: function(
|
|
108
|
-
if (
|
|
109
|
-
if (
|
|
110
|
-
this.v =
|
|
104
|
+
Object.defineProperty(w.prototype, "value", { get: function() {
|
|
105
|
+
var t = ct(this);
|
|
106
|
+
return t !== void 0 && (t.i = this.i), this.v;
|
|
107
|
+
}, set: function(t) {
|
|
108
|
+
if (t !== this.v) {
|
|
109
|
+
if (G > 100) throw new Error("Cycle detected");
|
|
110
|
+
this.v = t, this.i++, Z++, E++;
|
|
111
111
|
try {
|
|
112
|
-
for (var
|
|
112
|
+
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
113
113
|
} finally {
|
|
114
|
-
|
|
114
|
+
H();
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
} });
|
|
118
|
-
function
|
|
119
|
-
return new
|
|
118
|
+
function pt(t, e) {
|
|
119
|
+
return new w(t, e);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
for (var
|
|
121
|
+
function ut(t) {
|
|
122
|
+
for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
|
|
123
123
|
return !1;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
for (var
|
|
127
|
-
var n =
|
|
128
|
-
if (n !== void 0 && (
|
|
129
|
-
|
|
125
|
+
function ft(t) {
|
|
126
|
+
for (var e = t.s; e !== void 0; e = e.n) {
|
|
127
|
+
var n = e.S.n;
|
|
128
|
+
if (n !== void 0 && (e.r = n), e.S.n = e, e.i = -1, e.n === void 0) {
|
|
129
|
+
t.s = e;
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
for (var
|
|
136
|
-
var
|
|
137
|
-
|
|
134
|
+
function lt(t) {
|
|
135
|
+
for (var e = t.s, n = void 0; e !== void 0; ) {
|
|
136
|
+
var s = e.p;
|
|
137
|
+
e.i === -1 ? (e.S.U(e), s !== void 0 && (s.n = e.n), e.n !== void 0 && (e.n.p = s)) : n = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = s;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
t.s = n;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
141
|
+
function B(t, e) {
|
|
142
|
+
w.call(this, void 0), this.x = t, this.s = void 0, this.g = Z - 1, this.f = 4, this.W = e == null ? void 0 : e.watched, this.Z = e == null ? void 0 : e.unwatched, this.name = e == null ? void 0 : e.name;
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
B.prototype = new w();
|
|
145
|
+
B.prototype.h = function() {
|
|
146
146
|
if (this.f &= -3, 1 & this.f) return !1;
|
|
147
|
-
if ((36 & this.f) == 32 || (this.f &= -5, this.g ===
|
|
148
|
-
if (this.g =
|
|
147
|
+
if ((36 & this.f) == 32 || (this.f &= -5, this.g === Z)) return !0;
|
|
148
|
+
if (this.g = Z, this.f |= 1, this.i > 0 && !ut(this))
|
|
149
149
|
return this.f &= -2, !0;
|
|
150
|
-
var
|
|
150
|
+
var t = l;
|
|
151
151
|
try {
|
|
152
|
-
|
|
153
|
-
var
|
|
154
|
-
(16 & this.f || this.v !==
|
|
152
|
+
ft(this), l = this;
|
|
153
|
+
var e = this.x();
|
|
154
|
+
(16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
|
|
155
155
|
} catch (n) {
|
|
156
156
|
this.v = n, this.f |= 16, this.i++;
|
|
157
157
|
}
|
|
158
|
-
return l =
|
|
158
|
+
return l = t, lt(this), this.f &= -2, !0;
|
|
159
159
|
};
|
|
160
|
-
|
|
160
|
+
B.prototype.S = function(t) {
|
|
161
161
|
if (this.t === void 0) {
|
|
162
162
|
this.f |= 36;
|
|
163
|
-
for (var
|
|
163
|
+
for (var e = this.s; e !== void 0; e = e.n) e.S.S(e);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
w.prototype.S.call(this, t);
|
|
166
166
|
};
|
|
167
|
-
|
|
168
|
-
if (this.t !== void 0 && (
|
|
167
|
+
B.prototype.U = function(t) {
|
|
168
|
+
if (this.t !== void 0 && (w.prototype.U.call(this, t), this.t === void 0)) {
|
|
169
169
|
this.f &= -33;
|
|
170
|
-
for (var
|
|
170
|
+
for (var e = this.s; e !== void 0; e = e.n) e.S.U(e);
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
|
|
173
|
+
B.prototype.N = function() {
|
|
174
174
|
if (!(2 & this.f)) {
|
|
175
175
|
this.f |= 6;
|
|
176
|
-
for (var
|
|
176
|
+
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
|
-
Object.defineProperty(
|
|
179
|
+
Object.defineProperty(B.prototype, "value", { get: function() {
|
|
180
180
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
181
|
-
var
|
|
182
|
-
if (this.h(),
|
|
181
|
+
var t = ct(this);
|
|
182
|
+
if (this.h(), t !== void 0 && (t.i = this.i), 16 & this.f) throw this.v;
|
|
183
183
|
return this.v;
|
|
184
184
|
} });
|
|
185
|
-
function
|
|
186
|
-
return new
|
|
185
|
+
function nt(t, e) {
|
|
186
|
+
return new B(t, e);
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
var
|
|
190
|
-
if (
|
|
191
|
-
|
|
188
|
+
function ht(t) {
|
|
189
|
+
var e = t.u;
|
|
190
|
+
if (t.u = void 0, typeof e == "function") {
|
|
191
|
+
E++;
|
|
192
192
|
var n = l;
|
|
193
193
|
l = void 0;
|
|
194
194
|
try {
|
|
195
|
-
|
|
196
|
-
} catch (
|
|
197
|
-
throw
|
|
195
|
+
e();
|
|
196
|
+
} catch (s) {
|
|
197
|
+
throw t.f &= -2, t.f |= 8, X(t), s;
|
|
198
198
|
} finally {
|
|
199
|
-
l = n,
|
|
199
|
+
l = n, H();
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
for (var
|
|
205
|
-
|
|
203
|
+
function X(t) {
|
|
204
|
+
for (var e = t.s; e !== void 0; e = e.n) e.S.U(e);
|
|
205
|
+
t.x = void 0, t.s = void 0, ht(t);
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function yt(t) {
|
|
208
208
|
if (l !== this) throw new Error("Out-of-order effect");
|
|
209
|
-
|
|
209
|
+
lt(this), l = t, this.f &= -2, 8 & this.f && X(this), H();
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
this.x =
|
|
211
|
+
function q(t, e) {
|
|
212
|
+
this.x = t, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = e == null ? void 0 : e.name;
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
var
|
|
214
|
+
q.prototype.c = function() {
|
|
215
|
+
var t = this.S();
|
|
216
216
|
try {
|
|
217
217
|
if (8 & this.f || this.x === void 0) return;
|
|
218
|
-
var
|
|
219
|
-
typeof
|
|
218
|
+
var e = this.x();
|
|
219
|
+
typeof e == "function" && (this.u = e);
|
|
220
220
|
} finally {
|
|
221
|
-
|
|
221
|
+
t();
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
|
|
224
|
+
q.prototype.S = function() {
|
|
225
225
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
226
|
-
this.f |= 1, this.f &= -9,
|
|
227
|
-
var
|
|
228
|
-
return l = this,
|
|
226
|
+
this.f |= 1, this.f &= -9, ht(this), ft(this), E++;
|
|
227
|
+
var t = l;
|
|
228
|
+
return l = this, yt.bind(this, t);
|
|
229
229
|
};
|
|
230
|
-
|
|
231
|
-
2 & this.f || (this.f |= 2, this.o =
|
|
230
|
+
q.prototype.N = function() {
|
|
231
|
+
2 & this.f || (this.f |= 2, this.o = J, J = this);
|
|
232
232
|
};
|
|
233
|
-
|
|
234
|
-
this.f |= 8, 1 & this.f ||
|
|
233
|
+
q.prototype.d = function() {
|
|
234
|
+
this.f |= 8, 1 & this.f || X(this);
|
|
235
235
|
};
|
|
236
|
-
|
|
236
|
+
q.prototype.dispose = function() {
|
|
237
237
|
this.d();
|
|
238
238
|
};
|
|
239
|
-
function
|
|
240
|
-
var n = new
|
|
239
|
+
function gt(t, e) {
|
|
240
|
+
var n = new q(t, e);
|
|
241
241
|
try {
|
|
242
242
|
n.c();
|
|
243
|
-
} catch (
|
|
244
|
-
throw n.d(),
|
|
243
|
+
} catch (h) {
|
|
244
|
+
throw n.d(), h;
|
|
245
245
|
}
|
|
246
|
-
var
|
|
247
|
-
return
|
|
246
|
+
var s = n.d.bind(n);
|
|
247
|
+
return s[Symbol.dispose] = s, s;
|
|
248
248
|
}
|
|
249
|
-
const
|
|
250
|
-
function
|
|
251
|
-
if (Object.is(
|
|
252
|
-
if (
|
|
253
|
-
return
|
|
254
|
-
if (Array.isArray(
|
|
255
|
-
if (
|
|
256
|
-
for (let n = 0; n <
|
|
257
|
-
if (!
|
|
249
|
+
const rt = (t) => t !== null && typeof t == "object" && !Array.isArray(t);
|
|
250
|
+
function Q(t, e) {
|
|
251
|
+
if (Object.is(t, e)) return !0;
|
|
252
|
+
if (t instanceof Date && e instanceof Date)
|
|
253
|
+
return t.getTime() === e.getTime();
|
|
254
|
+
if (Array.isArray(t) && Array.isArray(e)) {
|
|
255
|
+
if (t.length !== e.length) return !1;
|
|
256
|
+
for (let n = 0; n < t.length; n += 1)
|
|
257
|
+
if (!Q(t[n], e[n])) return !1;
|
|
258
258
|
return !0;
|
|
259
259
|
}
|
|
260
|
-
if (
|
|
261
|
-
const n = Object.keys(
|
|
262
|
-
if (n.length !==
|
|
263
|
-
for (const
|
|
264
|
-
if (!(
|
|
260
|
+
if (rt(t) && rt(e)) {
|
|
261
|
+
const n = Object.keys(t), s = Object.keys(e);
|
|
262
|
+
if (n.length !== s.length) return !1;
|
|
263
|
+
for (const h of n)
|
|
264
|
+
if (!(h in e) || !Q(t[h], e[h])) return !1;
|
|
265
265
|
return !0;
|
|
266
266
|
}
|
|
267
267
|
return !1;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function dt(t) {
|
|
270
270
|
if (typeof structuredClone == "function")
|
|
271
|
-
return structuredClone(
|
|
271
|
+
return structuredClone(t);
|
|
272
272
|
try {
|
|
273
|
-
return JSON.parse(JSON.stringify(
|
|
273
|
+
return JSON.parse(JSON.stringify(t));
|
|
274
274
|
} catch {
|
|
275
|
-
return
|
|
275
|
+
return t;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
const
|
|
280
|
-
for (const [
|
|
281
|
-
const
|
|
282
|
-
n(
|
|
278
|
+
function it(t, e, n = Object.is, s = dt) {
|
|
279
|
+
const h = {};
|
|
280
|
+
for (const [y, S] of Object.entries(e)) {
|
|
281
|
+
const T = t[y];
|
|
282
|
+
n(T, S, y) || (h[y] = s(S));
|
|
283
283
|
}
|
|
284
|
-
return
|
|
285
|
-
}
|
|
286
|
-
function pt(e) {
|
|
287
|
-
const t = e.projectExternalToStore ?? ((y) => y), n = e.projectStoreToExternal ?? ((y) => y), o = e.equals ?? H, c = e.clone ?? Y, h = e.externalMutationOrigin ?? "local";
|
|
288
|
-
let d = !1, w = !1, E = !1;
|
|
289
|
-
const C = (y) => Object.keys(y).length > 0, P = () => {
|
|
290
|
-
if (d || E) return;
|
|
291
|
-
const y = c(t(e.getExternalState())), U = e.store.$snapshot(), j = nt(U, y, o, c);
|
|
292
|
-
if (C(j)) {
|
|
293
|
-
w = !0;
|
|
294
|
-
try {
|
|
295
|
-
e.store.$patch(j, h);
|
|
296
|
-
} finally {
|
|
297
|
-
w = !1;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}, S = () => {
|
|
301
|
-
if (d || w) return;
|
|
302
|
-
const y = c(n(e.store.$snapshot())), U = c(t(e.getExternalState())), j = nt(U, y, o, c);
|
|
303
|
-
if (C(j)) {
|
|
304
|
-
E = !0;
|
|
305
|
-
try {
|
|
306
|
-
e.applyExternalPatch(j);
|
|
307
|
-
} finally {
|
|
308
|
-
E = !1;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}, q = e.subscribeExternal(P), p = e.store.$subscribe(() => {
|
|
312
|
-
S();
|
|
313
|
-
});
|
|
314
|
-
return P(), {
|
|
315
|
-
dispose() {
|
|
316
|
-
d || (d = !0, q(), p());
|
|
317
|
-
},
|
|
318
|
-
syncFromExternal: P,
|
|
319
|
-
syncFromStore: S
|
|
320
|
-
};
|
|
284
|
+
return h;
|
|
321
285
|
}
|
|
322
|
-
function
|
|
323
|
-
const
|
|
324
|
-
function
|
|
286
|
+
function bt(t = {}) {
|
|
287
|
+
const e = (t.namespace ?? "default").trim() || "default", n = t.plugins ?? [], s = /* @__PURE__ */ new Map();
|
|
288
|
+
function h(y, S) {
|
|
325
289
|
return function() {
|
|
326
|
-
var
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
const
|
|
330
|
-
for (const [
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
...
|
|
335
|
-
[
|
|
290
|
+
var T;
|
|
291
|
+
const C = `${e}:${y}`, _ = s.get(y);
|
|
292
|
+
if (_) return _;
|
|
293
|
+
const A = S.state(), j = S.modules ?? {}, U = { ...A };
|
|
294
|
+
for (const [i, r] of Object.entries(j))
|
|
295
|
+
U[i] = r.state();
|
|
296
|
+
const g = pt(U), m = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set(), N = new Set(Object.keys(A)), L = new Set(Object.keys(S.getters ?? {})), W = new Set(Object.keys(S.actions ?? {})), o = (i) => g.value[i] ?? {}, d = (i, r) => {
|
|
297
|
+
g.value = {
|
|
298
|
+
...g.value,
|
|
299
|
+
[i]: r
|
|
336
300
|
};
|
|
337
|
-
},
|
|
301
|
+
}, p = new Proxy(
|
|
338
302
|
{},
|
|
339
303
|
{
|
|
340
|
-
get(
|
|
341
|
-
var
|
|
342
|
-
if (
|
|
343
|
-
if (
|
|
344
|
-
if (
|
|
345
|
-
const v =
|
|
346
|
-
return v ?
|
|
304
|
+
get(i, r) {
|
|
305
|
+
var c, u;
|
|
306
|
+
if (m.has(r)) return (c = m.get(r)) == null ? void 0 : c.value;
|
|
307
|
+
if (R.has(r)) return (u = R.get(r)) == null ? void 0 : u.value;
|
|
308
|
+
if (N.has(r)) return g.value[r];
|
|
309
|
+
const v = M.get(r);
|
|
310
|
+
return v ? o(v.moduleName)[v.key] : g.value[r];
|
|
347
311
|
}
|
|
348
312
|
}
|
|
349
313
|
);
|
|
350
|
-
for (const [
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
314
|
+
for (const [i, r] of Object.entries(S.getters ?? {}))
|
|
315
|
+
m.set(
|
|
316
|
+
i,
|
|
317
|
+
nt(() => r(g.value, p))
|
|
354
318
|
);
|
|
355
|
-
const
|
|
356
|
-
var
|
|
357
|
-
for (const
|
|
358
|
-
for (const
|
|
359
|
-
(
|
|
360
|
-
},
|
|
361
|
-
const v =
|
|
362
|
-
Object.is(v,
|
|
363
|
-
...
|
|
364
|
-
[
|
|
365
|
-
},
|
|
319
|
+
const b = (i, r) => {
|
|
320
|
+
var c;
|
|
321
|
+
for (const u of D) u(i);
|
|
322
|
+
for (const u of n)
|
|
323
|
+
(c = u.onMutation) == null || c.call(u, r, i);
|
|
324
|
+
}, O = (i, r, c, u) => {
|
|
325
|
+
const v = g.value[i];
|
|
326
|
+
Object.is(v, r) || (g.value = {
|
|
327
|
+
...g.value,
|
|
328
|
+
[i]: r
|
|
329
|
+
}, b(
|
|
366
330
|
{
|
|
367
|
-
namespace:
|
|
368
|
-
scopeId:
|
|
369
|
-
storeId:
|
|
370
|
-
key:
|
|
331
|
+
namespace: e,
|
|
332
|
+
scopeId: C,
|
|
333
|
+
storeId: y,
|
|
334
|
+
key: i,
|
|
371
335
|
oldValue: v,
|
|
372
|
-
newValue:
|
|
373
|
-
origin:
|
|
336
|
+
newValue: r,
|
|
337
|
+
origin: c
|
|
374
338
|
},
|
|
375
|
-
|
|
339
|
+
u
|
|
376
340
|
));
|
|
377
|
-
},
|
|
378
|
-
const
|
|
379
|
-
Object.is(
|
|
380
|
-
...
|
|
381
|
-
[
|
|
382
|
-
}),
|
|
341
|
+
}, $ = (i, r, c, u, v) => {
|
|
342
|
+
const x = o(i), a = x[r];
|
|
343
|
+
Object.is(a, c) || (d(i, {
|
|
344
|
+
...x,
|
|
345
|
+
[r]: c
|
|
346
|
+
}), b(
|
|
383
347
|
{
|
|
384
|
-
namespace:
|
|
385
|
-
scopeId:
|
|
386
|
-
storeId:
|
|
387
|
-
key: `${
|
|
388
|
-
oldValue:
|
|
389
|
-
newValue:
|
|
390
|
-
origin:
|
|
348
|
+
namespace: e,
|
|
349
|
+
scopeId: C,
|
|
350
|
+
storeId: y,
|
|
351
|
+
key: `${i}.${r}`,
|
|
352
|
+
oldValue: a,
|
|
353
|
+
newValue: c,
|
|
354
|
+
origin: u
|
|
391
355
|
},
|
|
392
356
|
v
|
|
393
357
|
));
|
|
394
|
-
},
|
|
395
|
-
$id:
|
|
396
|
-
$namespace:
|
|
397
|
-
$scopeId:
|
|
398
|
-
$subscribe(
|
|
399
|
-
return
|
|
358
|
+
}, P = {
|
|
359
|
+
$id: y,
|
|
360
|
+
$namespace: e,
|
|
361
|
+
$scopeId: C,
|
|
362
|
+
$subscribe(i) {
|
|
363
|
+
return D.add(i), () => D.delete(i);
|
|
400
364
|
},
|
|
401
365
|
$dispose() {
|
|
402
|
-
var
|
|
403
|
-
|
|
404
|
-
for (const
|
|
405
|
-
(
|
|
406
|
-
|
|
366
|
+
var i;
|
|
367
|
+
D.clear();
|
|
368
|
+
for (const r of n)
|
|
369
|
+
(i = r.onDispose) == null || i.call(r, k);
|
|
370
|
+
s.delete(y);
|
|
407
371
|
},
|
|
408
|
-
$patch(
|
|
409
|
-
|
|
410
|
-
for (const [
|
|
411
|
-
const v =
|
|
372
|
+
$patch(i, r = "local") {
|
|
373
|
+
Y(() => {
|
|
374
|
+
for (const [c, u] of Object.entries(i)) {
|
|
375
|
+
const v = M.get(c);
|
|
412
376
|
if (v) {
|
|
413
|
-
|
|
377
|
+
$(v.moduleName, v.key, u, r, k);
|
|
414
378
|
continue;
|
|
415
379
|
}
|
|
416
|
-
if (
|
|
417
|
-
const [
|
|
418
|
-
if (
|
|
419
|
-
|
|
380
|
+
if (c.includes(".")) {
|
|
381
|
+
const [x, a] = c.split(".", 2);
|
|
382
|
+
if (j[x]) {
|
|
383
|
+
$(x, a, u, r, k);
|
|
420
384
|
continue;
|
|
421
385
|
}
|
|
422
386
|
}
|
|
423
|
-
if (
|
|
424
|
-
for (const [
|
|
425
|
-
|
|
387
|
+
if (j[c] && u && typeof u == "object" && !Array.isArray(u)) {
|
|
388
|
+
for (const [x, a] of Object.entries(u))
|
|
389
|
+
$(c, x, a, r, k);
|
|
426
390
|
continue;
|
|
427
391
|
}
|
|
428
|
-
|
|
392
|
+
O(c, u, r, k);
|
|
429
393
|
}
|
|
430
394
|
});
|
|
431
395
|
},
|
|
432
396
|
$snapshot() {
|
|
433
|
-
return { ...
|
|
397
|
+
return { ...g.value };
|
|
434
398
|
}
|
|
435
399
|
};
|
|
436
|
-
for (const [
|
|
437
|
-
const
|
|
400
|
+
for (const [i, r] of Object.entries(j)) {
|
|
401
|
+
const c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), v = new Proxy(
|
|
438
402
|
{},
|
|
439
403
|
{
|
|
440
|
-
get(
|
|
441
|
-
var
|
|
442
|
-
if (
|
|
443
|
-
if (
|
|
444
|
-
if (
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
if (
|
|
404
|
+
get(a, f) {
|
|
405
|
+
var V, I, tt;
|
|
406
|
+
if (c.has(f)) return (V = c.get(f)) == null ? void 0 : V.value;
|
|
407
|
+
if (m.has(f)) return (I = m.get(f)) == null ? void 0 : I.value;
|
|
408
|
+
if (R.has(f)) return (tt = R.get(f)) == null ? void 0 : tt.value;
|
|
409
|
+
const et = o(i);
|
|
410
|
+
if (f in et) return et[f];
|
|
411
|
+
if (N.has(f)) return g.value[f];
|
|
448
412
|
}
|
|
449
413
|
}
|
|
450
414
|
);
|
|
451
|
-
for (const [
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
415
|
+
for (const [a, f] of Object.entries(r.getters ?? {}))
|
|
416
|
+
c.set(
|
|
417
|
+
a,
|
|
418
|
+
nt(() => f(o(i), g.value, v))
|
|
455
419
|
);
|
|
456
|
-
let
|
|
457
|
-
for (const [
|
|
458
|
-
|
|
459
|
-
|
|
420
|
+
let x;
|
|
421
|
+
for (const [a, f] of Object.entries(r.actions ?? {}))
|
|
422
|
+
u.set(a, (...V) => Y(() => f.apply(x, V)));
|
|
423
|
+
x = new Proxy(
|
|
460
424
|
{},
|
|
461
425
|
{
|
|
462
|
-
get(
|
|
463
|
-
var
|
|
464
|
-
if (
|
|
465
|
-
if (
|
|
466
|
-
const
|
|
467
|
-
return
|
|
426
|
+
get(a, f) {
|
|
427
|
+
var V;
|
|
428
|
+
if (u.has(f)) return u.get(f);
|
|
429
|
+
if (c.has(f)) return (V = c.get(f)) == null ? void 0 : V.value;
|
|
430
|
+
const I = o(i);
|
|
431
|
+
return f in I ? I[f] : k[f];
|
|
468
432
|
},
|
|
469
|
-
set(
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
472
|
-
return
|
|
433
|
+
set(a, f, V) {
|
|
434
|
+
if (u.has(f) || c.has(f)) return !1;
|
|
435
|
+
const I = o(i);
|
|
436
|
+
return f in I ? $(i, f, V, "local", k) : k[f] = V, !0;
|
|
473
437
|
}
|
|
474
438
|
}
|
|
475
|
-
),
|
|
476
|
-
for (const
|
|
477
|
-
!(
|
|
478
|
-
for (const [
|
|
479
|
-
!(
|
|
480
|
-
for (const [
|
|
481
|
-
!(
|
|
439
|
+
), F.set(i, x), z.set(i, c);
|
|
440
|
+
for (const a of Object.keys(o(i)))
|
|
441
|
+
!(N.has(a) || L.has(a) || W.has(a) || Reflect.has(P, a) || j[a] !== void 0) && !M.has(a) && M.set(a, { moduleName: i, key: a });
|
|
442
|
+
for (const [a, f] of c.entries())
|
|
443
|
+
!(N.has(a) || L.has(a) || W.has(a) || Reflect.has(P, a) || j[a] !== void 0) && !R.has(a) && R.set(a, f);
|
|
444
|
+
for (const [a, f] of u.entries())
|
|
445
|
+
!(N.has(a) || L.has(a) || W.has(a) || Reflect.has(P, a) || j[a] !== void 0) && !Reflect.has(P, a) && (P[a] = f);
|
|
482
446
|
}
|
|
483
|
-
const
|
|
484
|
-
get(
|
|
485
|
-
var
|
|
486
|
-
if (Reflect.has(
|
|
487
|
-
if (
|
|
488
|
-
if (
|
|
489
|
-
if (
|
|
490
|
-
if (
|
|
491
|
-
const
|
|
492
|
-
return
|
|
447
|
+
const k = new Proxy(P, {
|
|
448
|
+
get(i, r, c) {
|
|
449
|
+
var u, v;
|
|
450
|
+
if (Reflect.has(i, r)) return Reflect.get(i, r, c);
|
|
451
|
+
if (F.has(r)) return F.get(r);
|
|
452
|
+
if (m.has(r)) return (u = m.get(r)) == null ? void 0 : u.value;
|
|
453
|
+
if (R.has(r)) return (v = R.get(r)) == null ? void 0 : v.value;
|
|
454
|
+
if (N.has(r)) return g.value[r];
|
|
455
|
+
const x = M.get(r);
|
|
456
|
+
return x ? o(x.moduleName)[x.key] : g.value[r];
|
|
493
457
|
},
|
|
494
|
-
set(
|
|
495
|
-
if (Reflect.has(
|
|
496
|
-
return Reflect.set(
|
|
497
|
-
const v =
|
|
498
|
-
return v ? (
|
|
458
|
+
set(i, r, c, u) {
|
|
459
|
+
if (Reflect.has(i, r))
|
|
460
|
+
return Reflect.set(i, r, c, u);
|
|
461
|
+
const v = M.get(r);
|
|
462
|
+
return v ? ($(v.moduleName, v.key, c, "local", u), !0) : (O(r, c, "local", u), !0);
|
|
499
463
|
}
|
|
500
464
|
});
|
|
501
|
-
for (const [
|
|
502
|
-
|
|
503
|
-
for (const
|
|
504
|
-
(
|
|
505
|
-
return
|
|
465
|
+
for (const [i, r] of Object.entries(S.actions ?? {}))
|
|
466
|
+
P[i] = (...c) => Y(() => r.apply(k, c));
|
|
467
|
+
for (const i of n)
|
|
468
|
+
(T = i.onInit) == null || T.call(i, k);
|
|
469
|
+
return s.set(y, k), k;
|
|
506
470
|
};
|
|
507
471
|
}
|
|
508
472
|
return {
|
|
509
|
-
defineStore:
|
|
510
|
-
use(
|
|
511
|
-
n.push(
|
|
473
|
+
defineStore: h,
|
|
474
|
+
use(y) {
|
|
475
|
+
n.push(y);
|
|
512
476
|
}
|
|
513
477
|
};
|
|
514
478
|
}
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
function
|
|
518
|
-
if (!
|
|
519
|
-
const
|
|
520
|
-
if (!
|
|
521
|
-
const
|
|
522
|
-
if (
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
for (const
|
|
526
|
-
const
|
|
527
|
-
n(
|
|
479
|
+
bt();
|
|
480
|
+
const K = (t) => t !== null && typeof t == "object";
|
|
481
|
+
function xt(t) {
|
|
482
|
+
if (!K(t)) return t;
|
|
483
|
+
const e = /* @__PURE__ */ new WeakSet(), n = (s) => {
|
|
484
|
+
if (!K(s)) return;
|
|
485
|
+
const h = s;
|
|
486
|
+
if (e.has(h)) return;
|
|
487
|
+
e.add(h);
|
|
488
|
+
const y = Reflect.ownKeys(h);
|
|
489
|
+
for (const S of y) {
|
|
490
|
+
const T = Reflect.get(h, S);
|
|
491
|
+
n(T);
|
|
528
492
|
}
|
|
529
|
-
Object.freeze(
|
|
493
|
+
Object.freeze(h);
|
|
530
494
|
};
|
|
531
|
-
return n(
|
|
495
|
+
return n(t), t;
|
|
532
496
|
}
|
|
533
|
-
function
|
|
534
|
-
for (const [n,
|
|
535
|
-
|
|
497
|
+
function mt(t, e) {
|
|
498
|
+
for (const [n, s] of Object.entries(e))
|
|
499
|
+
t[n] = s;
|
|
536
500
|
}
|
|
537
|
-
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
501
|
+
const ot = (t) => Object.keys(t).length > 0, st = (t) => t ? Array.isArray(t) ? t : [t] : [], wt = (t) => {
|
|
502
|
+
const e = [t];
|
|
503
|
+
if (t.includes(".")) {
|
|
504
|
+
const n = t.split(".", 1)[0];
|
|
505
|
+
n && n !== t && e.push(n);
|
|
506
|
+
}
|
|
507
|
+
return e;
|
|
508
|
+
}, St = (t, e) => {
|
|
509
|
+
if (!e || !K(t)) return t;
|
|
510
|
+
try {
|
|
511
|
+
Object.defineProperty(t, e, {
|
|
512
|
+
value: !0,
|
|
513
|
+
enumerable: !1,
|
|
514
|
+
configurable: !0
|
|
515
|
+
});
|
|
516
|
+
} catch {
|
|
517
|
+
return t;
|
|
518
|
+
}
|
|
519
|
+
return t;
|
|
520
|
+
};
|
|
521
|
+
function jt(t) {
|
|
522
|
+
const e = t.mutationType ?? "storix/APPLY_PATCH", n = t.immutable ?? !0, s = t.clone ?? dt, h = t.equals ?? Q, y = t.projectVuexToStorix ?? ((o) => o), S = t.projectStorixToVuex ?? ((o) => o), T = t.suppressBridgeEcho ?? !1, C = t.bridgeOriginKey ?? "__storixBridge", _ = t.outboundDefault ?? {
|
|
523
|
+
mode: "patch",
|
|
524
|
+
type: e
|
|
525
|
+
}, A = (o) => {
|
|
526
|
+
const d = s(o);
|
|
527
|
+
return n ? xt(d) : d;
|
|
541
528
|
};
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
529
|
+
let j = !1, U = !1, g = !1;
|
|
530
|
+
const m = /* @__PURE__ */ new Map(), z = (o) => {
|
|
531
|
+
if (T)
|
|
532
|
+
for (const d of o) {
|
|
533
|
+
const p = m.get(d) ?? 0;
|
|
534
|
+
m.set(d, p + 1);
|
|
535
|
+
}
|
|
536
|
+
}, F = (o) => {
|
|
537
|
+
if (!T || !K(o)) return !1;
|
|
538
|
+
const d = Reflect.get(o, "payload");
|
|
539
|
+
if (C && K(d) && Reflect.get(d, C))
|
|
540
|
+
return !0;
|
|
541
|
+
const p = Reflect.get(o, "type");
|
|
542
|
+
if (typeof p != "string") return !1;
|
|
543
|
+
const b = m.get(p) ?? 0;
|
|
544
|
+
return b <= 0 ? !1 : (b === 1 ? m.delete(p) : m.set(p, b - 1), !0);
|
|
545
|
+
}, M = () => {
|
|
546
|
+
if (j || g) return;
|
|
547
|
+
const o = A(y(t.vuex.state)), d = t.store.$snapshot(), p = it(d, o, h, A);
|
|
548
|
+
if (ot(p)) {
|
|
549
|
+
U = !0;
|
|
550
|
+
try {
|
|
551
|
+
t.store.$patch(p, t.externalMutationOrigin ?? "local");
|
|
552
|
+
} finally {
|
|
553
|
+
U = !1;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}, R = (o) => {
|
|
557
|
+
const p = wt(o.storixMutation.key).flatMap((b) => {
|
|
558
|
+
var O;
|
|
559
|
+
return st((O = t.outboundRoutes) == null ? void 0 : O[b]);
|
|
560
|
+
});
|
|
561
|
+
return p.push(...st(_)), p.find((b) => b.when ? b.when(o) : !0);
|
|
562
|
+
}, D = (o, d) => {
|
|
563
|
+
var $;
|
|
564
|
+
if (o.mode === "custom") {
|
|
565
|
+
($ = o.handler) == null || $.call(o, d), z(o.suppressMutationTypes ?? []);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
const p = (o.mode === "patch", d.projectedPatch), b = St(A(o.mapPayload ? o.mapPayload(d) : p), C);
|
|
569
|
+
if (o.mode === "dispatch") {
|
|
570
|
+
if (typeof t.vuex.dispatch != "function")
|
|
571
|
+
throw new Error('Vuex bridge route mode "dispatch" requires vuex.dispatch to be available.');
|
|
572
|
+
if (!o.type)
|
|
573
|
+
throw new Error('Vuex bridge dispatch route requires a "type".');
|
|
574
|
+
t.vuex.dispatch(o.type, b), z(o.suppressMutationTypes ?? []);
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
const O = o.type ?? e;
|
|
578
|
+
t.vuex.commit(O, b), z(o.suppressMutationTypes ?? [O]);
|
|
579
|
+
}, N = (o) => {
|
|
580
|
+
if (j || U) return;
|
|
581
|
+
const d = t.store.$snapshot(), p = A(S(d)), b = A(y(t.vuex.state)), O = it(b, p, h, A);
|
|
582
|
+
if (!ot(O)) return;
|
|
583
|
+
const $ = {
|
|
584
|
+
storixMutation: o ?? {
|
|
585
|
+
namespace: t.store.$namespace,
|
|
586
|
+
scopeId: t.store.$scopeId,
|
|
587
|
+
storeId: t.store.$id,
|
|
588
|
+
key: Object.keys(O)[0] ?? "*",
|
|
589
|
+
oldValue: void 0,
|
|
590
|
+
newValue: void 0,
|
|
591
|
+
origin: "local"
|
|
592
|
+
},
|
|
593
|
+
storixSnapshot: d,
|
|
594
|
+
vuexState: t.vuex.state,
|
|
595
|
+
projectedPatch: O,
|
|
596
|
+
projectedVuexState: p,
|
|
597
|
+
origin: "storix"
|
|
598
|
+
}, P = R($);
|
|
599
|
+
if (P) {
|
|
600
|
+
g = !0;
|
|
601
|
+
try {
|
|
602
|
+
D(P, $);
|
|
603
|
+
} finally {
|
|
604
|
+
g = !1;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}, L = t.vuex.subscribe((o) => {
|
|
608
|
+
F(o) || M();
|
|
609
|
+
}), W = t.store.$subscribe((o) => {
|
|
610
|
+
N(o);
|
|
554
611
|
});
|
|
612
|
+
return M(), {
|
|
613
|
+
dispose() {
|
|
614
|
+
j || (j = !0, L(), W());
|
|
615
|
+
},
|
|
616
|
+
syncFromExternal: M,
|
|
617
|
+
syncFromStore() {
|
|
618
|
+
N();
|
|
619
|
+
}
|
|
620
|
+
};
|
|
555
621
|
}
|
|
556
622
|
export {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
623
|
+
mt as applyVuexPatchMutation,
|
|
624
|
+
jt as createVuexBridge,
|
|
625
|
+
xt as deepFreeze
|
|
560
626
|
};
|