@madronejs/core 1.1.4 → 1.1.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/{MadroneVue3-DWfxzJoA.js → MadroneVue3-BBL8NMJk.js} +175 -172
- package/dist/MadroneVue3-BO-MRnQn.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +1 -1
- package/package.json +1 -1
- package/types/reactivity/Observer.d.ts +11 -0
- package/dist/MadroneVue3-BTKiUAll.cjs +0 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const
|
|
1
|
+
const M = /* @__PURE__ */ new Set();
|
|
2
2
|
let Y;
|
|
3
|
-
function
|
|
4
|
-
return [...
|
|
3
|
+
function ie() {
|
|
4
|
+
return [...M];
|
|
5
5
|
}
|
|
6
6
|
function oe() {
|
|
7
|
-
return
|
|
7
|
+
return ie().at(-1);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function $() {
|
|
10
10
|
Y = oe();
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
e && (
|
|
12
|
+
function Ve(e) {
|
|
13
|
+
e && (M.add(e), $());
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
15
|
+
function Ne(e) {
|
|
16
|
+
M.delete(e), $();
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function ue() {
|
|
19
19
|
return Y;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
return (
|
|
21
|
+
const X = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
function q(e) {
|
|
23
|
+
return (ue()?.toRaw ?? ((t) => t))(e);
|
|
24
24
|
}
|
|
25
25
|
function T(e) {
|
|
26
|
-
|
|
26
|
+
X.set(q(e), Date.now());
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function ge(e) {
|
|
29
|
+
return X.get(q(e));
|
|
30
30
|
}
|
|
31
|
-
const f = /* @__PURE__ */ Symbol("keys"),
|
|
31
|
+
const f = /* @__PURE__ */ Symbol("keys"), W = /* @__PURE__ */ Symbol("computed"), V = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
|
|
32
32
|
let I = [], _ = null;
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
},
|
|
33
|
+
const fe = (e) => V.has(e), K = (e) => N.has(e), g = (e) => V.get(e), le = (e) => N.get(e), de = (e) => K(e) ? le(e) : e, he = (e, n) => {
|
|
34
|
+
V.set(e, n), N.set(n, e);
|
|
35
|
+
}, me = () => {
|
|
36
36
|
_ === null && (_ = /* @__PURE__ */ Symbol("scheduler"), queueMicrotask(() => {
|
|
37
37
|
try {
|
|
38
38
|
for (; I.length > 0; ) {
|
|
@@ -49,52 +49,55 @@ const ue = (e) => M.has(e), q = (e) => V.has(e), j = (e) => M.get(e), fe = (e) =
|
|
|
49
49
|
_ = null;
|
|
50
50
|
}
|
|
51
51
|
}));
|
|
52
|
-
},
|
|
53
|
-
I.push(e),
|
|
54
|
-
},
|
|
55
|
-
const t =
|
|
52
|
+
}, Se = (e) => {
|
|
53
|
+
I.push(e), me();
|
|
54
|
+
}, ve = (e, n) => {
|
|
55
|
+
const t = R.get(e), s = t?.get(n);
|
|
56
56
|
if (s) {
|
|
57
57
|
for (const r of s)
|
|
58
58
|
b.get(r)?.get(n)?.delete(e);
|
|
59
|
-
s.clear(), t.delete(n), t.size === 0 &&
|
|
59
|
+
s.clear(), t.delete(n), t.size === 0 && R.delete(e);
|
|
60
60
|
}
|
|
61
|
-
},
|
|
62
|
-
const n =
|
|
61
|
+
}, x = (e) => {
|
|
62
|
+
const n = R.get(e);
|
|
63
63
|
if (n) {
|
|
64
64
|
for (const [t, s] of n)
|
|
65
65
|
for (const r of s)
|
|
66
66
|
b.get(r)?.get(t)?.delete(e);
|
|
67
|
-
|
|
67
|
+
R.delete(e);
|
|
68
68
|
}
|
|
69
|
-
},
|
|
70
|
-
const t =
|
|
69
|
+
}, F = (e, n) => {
|
|
70
|
+
const t = we();
|
|
71
71
|
if (!t) return;
|
|
72
|
-
|
|
73
|
-
const s = b.get(e), r =
|
|
72
|
+
R.has(t) || R.set(t, /* @__PURE__ */ new Map()), b.has(e) || b.set(e, /* @__PURE__ */ new Map());
|
|
73
|
+
const s = b.get(e), r = R.get(t);
|
|
74
74
|
s.has(n) || s.set(n, /* @__PURE__ */ new Set()), r.has(n) || r.set(n, /* @__PURE__ */ new Set());
|
|
75
|
-
const c = s.get(n),
|
|
76
|
-
c.add(t),
|
|
75
|
+
const c = s.get(n), i = r.get(n);
|
|
76
|
+
c.add(t), i.add(e);
|
|
77
77
|
}, h = (e, n) => {
|
|
78
|
-
const t =
|
|
79
|
-
t &&
|
|
80
|
-
},
|
|
78
|
+
const t = g(e);
|
|
79
|
+
t && F(t, n);
|
|
80
|
+
}, Q = (e, n) => {
|
|
81
81
|
const t = b.get(e);
|
|
82
82
|
if (t?.get(n))
|
|
83
83
|
for (const s of t.get(n))
|
|
84
|
-
s.setDirty(),
|
|
84
|
+
s.setDirty(), Re(s) || ve(s, n);
|
|
85
85
|
}, m = (e, n) => {
|
|
86
|
-
|
|
87
|
-
}, P = [];
|
|
88
|
-
function
|
|
86
|
+
Q(g(e), n);
|
|
87
|
+
}, P = [], H = /* @__PURE__ */ new WeakSet();
|
|
88
|
+
function we() {
|
|
89
89
|
return P.at(-1);
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
function Re(e) {
|
|
92
|
+
return H.has(e);
|
|
93
|
+
}
|
|
94
|
+
class j {
|
|
92
95
|
/**
|
|
93
96
|
* Factory method to create a new ObservableItem.
|
|
94
97
|
* @internal
|
|
95
98
|
*/
|
|
96
99
|
static create(...n) {
|
|
97
|
-
return new
|
|
100
|
+
return new j(...n);
|
|
98
101
|
}
|
|
99
102
|
/**
|
|
100
103
|
* Creates a new ObservableItem.
|
|
@@ -116,21 +119,21 @@ class z {
|
|
|
116
119
|
* @returns {void}
|
|
117
120
|
*/
|
|
118
121
|
dispose() {
|
|
119
|
-
|
|
122
|
+
x(this), this.alive = !1, this.dirty = !1, this.cachedVal = void 0, this.prev = void 0;
|
|
120
123
|
}
|
|
121
124
|
wrap(n) {
|
|
122
|
-
P.push(this);
|
|
125
|
+
P.push(this), H.add(this);
|
|
123
126
|
try {
|
|
124
127
|
return n();
|
|
125
128
|
} finally {
|
|
126
|
-
P.pop();
|
|
129
|
+
P.pop(), H.delete(this);
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
setDirty() {
|
|
130
|
-
this.alive && !this.dirty && (this.dirty = !0,
|
|
133
|
+
this.alive && !this.dirty && (this.dirty = !0, Q(this, W), this.prev = this.cachedVal, this.cachedVal = void 0, this.callHook(
|
|
131
134
|
"onImmediateChange"
|
|
132
135
|
/* onImmediateChange */
|
|
133
|
-
),
|
|
136
|
+
), Se(() => this.notifyChange()));
|
|
134
137
|
}
|
|
135
138
|
notifyChange() {
|
|
136
139
|
this.callHook(
|
|
@@ -142,7 +145,7 @@ class z {
|
|
|
142
145
|
if (!this.alive) return;
|
|
143
146
|
const n = this.wrap(() => {
|
|
144
147
|
if (this.cache && this.dirty || !this.cache) {
|
|
145
|
-
|
|
148
|
+
x(this);
|
|
146
149
|
try {
|
|
147
150
|
this.cachedVal = this.get();
|
|
148
151
|
} finally {
|
|
@@ -151,7 +154,7 @@ class z {
|
|
|
151
154
|
}
|
|
152
155
|
return this.cachedVal;
|
|
153
156
|
});
|
|
154
|
-
return
|
|
157
|
+
return F(this, W), this.callHook(
|
|
155
158
|
"onGet"
|
|
156
159
|
/* onGet */
|
|
157
160
|
), n;
|
|
@@ -170,11 +173,11 @@ class z {
|
|
|
170
173
|
throw new TypeError(`No setter defined for "${this.name}"`);
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
176
|
+
function J(...e) {
|
|
177
|
+
return j.create(...e);
|
|
175
178
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
179
|
+
function Ce(e) {
|
|
180
|
+
return J(e);
|
|
178
181
|
}
|
|
179
182
|
const u = (e) => {
|
|
180
183
|
const {
|
|
@@ -183,7 +186,7 @@ const u = (e) => {
|
|
|
183
186
|
key: s,
|
|
184
187
|
receiver: r,
|
|
185
188
|
value: c,
|
|
186
|
-
keysChanged:
|
|
189
|
+
keysChanged: i = !1,
|
|
187
190
|
valueChanged: l = !1
|
|
188
191
|
} = e;
|
|
189
192
|
return {
|
|
@@ -192,62 +195,62 @@ const u = (e) => {
|
|
|
192
195
|
key: s,
|
|
193
196
|
receiver: r,
|
|
194
197
|
value: c,
|
|
195
|
-
keysChanged:
|
|
198
|
+
keysChanged: i,
|
|
196
199
|
valueChanged: l
|
|
197
200
|
};
|
|
198
|
-
},
|
|
201
|
+
}, be = (e, n, t, s) => {
|
|
199
202
|
h(n, t), e?.onGet && e.onGet(u({
|
|
200
203
|
name: e.name,
|
|
201
204
|
target: n,
|
|
202
205
|
key: t,
|
|
203
206
|
receiver: s
|
|
204
207
|
}));
|
|
205
|
-
},
|
|
208
|
+
}, Oe = (e, n, t, s) => {
|
|
206
209
|
const r = n[t], c = Array.isArray(n);
|
|
207
|
-
let
|
|
208
|
-
t in n || (m(n, f), l = !0, c && m(n, "length")), (r !== s || c) && (m(n, t),
|
|
210
|
+
let i = !1, l = !1;
|
|
211
|
+
t in n || (m(n, f), l = !0, c && m(n, "length")), (r !== s || c) && (m(n, t), i = !0), (l || i) && e?.onSet && e.onSet(u({
|
|
209
212
|
name: e.name,
|
|
210
213
|
target: n,
|
|
211
214
|
key: t,
|
|
212
215
|
value: s,
|
|
213
216
|
keysChanged: l,
|
|
214
|
-
valueChanged:
|
|
217
|
+
valueChanged: i
|
|
215
218
|
}));
|
|
216
|
-
},
|
|
219
|
+
}, ye = (e, n, t) => {
|
|
217
220
|
m(n, t), m(n, f), e?.onDelete && e.onDelete(u({
|
|
218
221
|
name: e.name,
|
|
219
222
|
target: n,
|
|
220
223
|
key: t,
|
|
221
224
|
keysChanged: !0
|
|
222
225
|
}));
|
|
223
|
-
},
|
|
226
|
+
}, U = (e, n, t) => {
|
|
224
227
|
h(n, f), e?.onHas && e.onHas(u({ name: e.name, target: n, key: t }));
|
|
225
228
|
};
|
|
226
|
-
function
|
|
229
|
+
function Z(e) {
|
|
227
230
|
const n = e.needsProxy || (() => !0);
|
|
228
231
|
return {
|
|
229
232
|
get: (t, s, r) => {
|
|
230
|
-
|
|
233
|
+
be(e, t, s, r);
|
|
231
234
|
const c = Reflect.get(t, s, r);
|
|
232
235
|
return e?.deep && c && typeof c == "object" && n({ target: t, key: s, value: c }) && Object.getOwnPropertyDescriptor(t, s)?.configurable ? w(c, e) : c;
|
|
233
236
|
},
|
|
234
|
-
set: (t, s, r) => (
|
|
235
|
-
deleteProperty: (...t) => (
|
|
236
|
-
has: (t, s) => (
|
|
237
|
-
ownKeys: (t) => (
|
|
237
|
+
set: (t, s, r) => (Oe(e, t, s, r), Reflect.set(t, s, r)),
|
|
238
|
+
deleteProperty: (...t) => (ye(e, ...t), Reflect.deleteProperty(...t)),
|
|
239
|
+
has: (t, s) => (U(e, t), Reflect.has(t, s)),
|
|
240
|
+
ownKeys: (t) => (U(e, t), Reflect.ownKeys(t)),
|
|
238
241
|
getPrototypeOf: (t) => Object.getPrototypeOf(t)
|
|
239
242
|
};
|
|
240
243
|
}
|
|
241
|
-
const
|
|
242
|
-
...
|
|
243
|
-
}),
|
|
244
|
-
...
|
|
244
|
+
const Ge = (e) => ({
|
|
245
|
+
...Z(e)
|
|
246
|
+
}), Ie = (e) => ({
|
|
247
|
+
...Z(e)
|
|
245
248
|
}), v = (e, n) => n?.deep && e && typeof e == "object" ? w(e, n) : e;
|
|
246
249
|
function* O(e, n, t) {
|
|
247
250
|
for (const s of e)
|
|
248
251
|
yield t(s);
|
|
249
252
|
}
|
|
250
|
-
const
|
|
253
|
+
const Te = (e) => ({
|
|
251
254
|
get: (n, t, s) => t === "size" ? (h(n, f), e?.onGet?.(u({
|
|
252
255
|
name: e.name,
|
|
253
256
|
target: n,
|
|
@@ -267,14 +270,14 @@ const Ge = (e) => ({
|
|
|
267
270
|
keysChanged: !0
|
|
268
271
|
}))), s;
|
|
269
272
|
} : t === "delete" ? (r) => {
|
|
270
|
-
const c = n.has(r),
|
|
273
|
+
const c = n.has(r), i = n.delete(r);
|
|
271
274
|
return c && (m(n, f), e?.onDelete?.(u({
|
|
272
275
|
name: e.name,
|
|
273
276
|
target: n,
|
|
274
277
|
key: t,
|
|
275
278
|
value: r,
|
|
276
279
|
keysChanged: !0
|
|
277
|
-
}))),
|
|
280
|
+
}))), i;
|
|
278
281
|
} : t === "clear" ? () => {
|
|
279
282
|
const r = n.size > 0;
|
|
280
283
|
n.clear(), r && (m(n, f), e?.onDelete?.(u({
|
|
@@ -289,8 +292,8 @@ const Ge = (e) => ({
|
|
|
289
292
|
target: n,
|
|
290
293
|
key: t
|
|
291
294
|
}));
|
|
292
|
-
for (const [
|
|
293
|
-
r.call(c, v(
|
|
295
|
+
for (const [i, l] of n.entries())
|
|
296
|
+
r.call(c, v(i, e), v(l, e), s);
|
|
294
297
|
} : t === "values" || t === "keys" ? () => (h(n, f), e?.onGet?.(u({
|
|
295
298
|
name: e.name,
|
|
296
299
|
target: n,
|
|
@@ -308,7 +311,7 @@ const Ge = (e) => ({
|
|
|
308
311
|
target: n,
|
|
309
312
|
key: t
|
|
310
313
|
})), O(n[Symbol.iterator](), e, (r) => v(r, e))) : t === Symbol.toStringTag ? "Set" : Reflect.get(n, t, s)
|
|
311
|
-
}),
|
|
314
|
+
}), Ee = (e) => ({
|
|
312
315
|
get: (n, t, s) => t === "size" ? (h(n, f), e?.onGet?.(u({
|
|
313
316
|
name: e.name,
|
|
314
317
|
target: n,
|
|
@@ -322,29 +325,29 @@ const Ge = (e) => ({
|
|
|
322
325
|
target: n,
|
|
323
326
|
key: r
|
|
324
327
|
})), v(n.get(r), e)) : t === "set" ? (r, c) => {
|
|
325
|
-
const
|
|
326
|
-
return n.set(r, c),
|
|
328
|
+
const i = n.has(r), l = n.get(r);
|
|
329
|
+
return n.set(r, c), i || m(n, f), (!i || l !== c) && (m(n, r), e?.onSet?.(u({
|
|
327
330
|
name: e.name,
|
|
328
331
|
target: n,
|
|
329
332
|
key: r,
|
|
330
333
|
value: c,
|
|
331
|
-
keysChanged: !
|
|
334
|
+
keysChanged: !i,
|
|
332
335
|
valueChanged: l !== c
|
|
333
336
|
}))), s;
|
|
334
337
|
} : t === "delete" ? (r) => {
|
|
335
|
-
const c = n.has(r),
|
|
338
|
+
const c = n.has(r), i = n.delete(r);
|
|
336
339
|
return c && (m(n, f), m(n, r), e?.onDelete?.(u({
|
|
337
340
|
name: e.name,
|
|
338
341
|
target: n,
|
|
339
342
|
key: r,
|
|
340
343
|
keysChanged: !0
|
|
341
|
-
}))),
|
|
344
|
+
}))), i;
|
|
342
345
|
} : t === "clear" ? () => {
|
|
343
346
|
const r = [...n.keys()], c = n.size > 0;
|
|
344
347
|
if (n.clear(), c) {
|
|
345
348
|
m(n, f);
|
|
346
|
-
for (const
|
|
347
|
-
m(n,
|
|
349
|
+
for (const i of r)
|
|
350
|
+
m(n, i);
|
|
348
351
|
e?.onDelete?.(u({
|
|
349
352
|
name: e.name,
|
|
350
353
|
target: n,
|
|
@@ -358,8 +361,8 @@ const Ge = (e) => ({
|
|
|
358
361
|
target: n,
|
|
359
362
|
key: t
|
|
360
363
|
}));
|
|
361
|
-
for (const [
|
|
362
|
-
r.call(c, v(l, e),
|
|
364
|
+
for (const [i, l] of n.entries())
|
|
365
|
+
r.call(c, v(l, e), i, s);
|
|
363
366
|
} : t === "keys" ? () => (h(n, f), e?.onGet?.(u({
|
|
364
367
|
name: e.name,
|
|
365
368
|
target: n,
|
|
@@ -385,38 +388,38 @@ const Ge = (e) => ({
|
|
|
385
388
|
e,
|
|
386
389
|
([r, c]) => [r, v(c, e)]
|
|
387
390
|
)) : t === Symbol.toStringTag ? "Map" : Reflect.get(n, t, s)
|
|
388
|
-
}),
|
|
389
|
-
object:
|
|
390
|
-
array:
|
|
391
|
-
set:
|
|
392
|
-
map:
|
|
391
|
+
}), p = Object.freeze({
|
|
392
|
+
object: Ge,
|
|
393
|
+
array: Ie,
|
|
394
|
+
set: Te,
|
|
395
|
+
map: Ee
|
|
393
396
|
});
|
|
394
397
|
function w(e, n) {
|
|
395
|
-
if (
|
|
396
|
-
if (
|
|
398
|
+
if (fe(e)) return g(e);
|
|
399
|
+
if (K(e)) return e;
|
|
397
400
|
const t = n || {}, s = { ...t, deep: t?.deep ?? !0 }, r = w.getStringType(e);
|
|
398
401
|
if (!w.hasHandler(r)) return e;
|
|
399
402
|
const c = new Proxy(e, w.typeHandler(r, s));
|
|
400
|
-
return
|
|
403
|
+
return he(e, c), c;
|
|
401
404
|
}
|
|
402
|
-
const
|
|
405
|
+
const _e = (e) => {
|
|
403
406
|
const n = Object.getPrototypeOf(e);
|
|
404
407
|
return n === null ? !0 : n === Object.prototype;
|
|
405
408
|
};
|
|
406
|
-
w.getStringType = (e) => e === null ? "null" : typeof e != "object" ? typeof e : Array.isArray(e) ? "array" : e instanceof Map ? "map" : e instanceof Set ? "set" :
|
|
407
|
-
w.hasHandler = (e) => !!
|
|
408
|
-
w.typeHandler = (e, n) =>
|
|
409
|
-
function
|
|
410
|
-
const s =
|
|
409
|
+
w.getStringType = (e) => e === null ? "null" : typeof e != "object" ? typeof e : Array.isArray(e) ? "array" : e instanceof Map ? "map" : e instanceof Set ? "set" : _e(e) ? "object" : "native";
|
|
410
|
+
w.hasHandler = (e) => !!p[e];
|
|
411
|
+
w.typeHandler = (e, n) => p[e]?.(n);
|
|
412
|
+
function k(e, n, t) {
|
|
413
|
+
const s = J({
|
|
411
414
|
get: e,
|
|
412
|
-
onChange: ({ value: c, prev:
|
|
415
|
+
onChange: ({ value: c, prev: i }) => n(c, i)
|
|
413
416
|
}), r = s.run();
|
|
414
417
|
return t?.immediate && n(r), () => s.dispose();
|
|
415
418
|
}
|
|
416
|
-
function
|
|
419
|
+
function z(e, n, t) {
|
|
417
420
|
let s, r;
|
|
418
421
|
if (n.cache) {
|
|
419
|
-
const c =
|
|
422
|
+
const c = Ce({
|
|
420
423
|
...n,
|
|
421
424
|
get: n.get,
|
|
422
425
|
name: e,
|
|
@@ -433,8 +436,8 @@ function L(e, n, t) {
|
|
|
433
436
|
} else
|
|
434
437
|
s = function() {
|
|
435
438
|
return T(this), n.get.call(this);
|
|
436
|
-
}, r = function(...
|
|
437
|
-
n.set.call(this, ...
|
|
439
|
+
}, r = function(...i) {
|
|
440
|
+
n.set.call(this, ...i);
|
|
438
441
|
};
|
|
439
442
|
return {
|
|
440
443
|
enumerable: n.enumerable,
|
|
@@ -443,7 +446,7 @@ function L(e, n, t) {
|
|
|
443
446
|
set: r
|
|
444
447
|
};
|
|
445
448
|
}
|
|
446
|
-
function
|
|
449
|
+
function B(e, n, t) {
|
|
447
450
|
const s = { value: n.value }, r = w(s, {
|
|
448
451
|
name: e,
|
|
449
452
|
onGet: t?.reactive?.onGet,
|
|
@@ -458,28 +461,28 @@ function N(e, n, t) {
|
|
|
458
461
|
enumerable: n.enumerable,
|
|
459
462
|
get: function() {
|
|
460
463
|
T(this);
|
|
461
|
-
const { value:
|
|
462
|
-
return Array.isArray(
|
|
464
|
+
const { value: i } = r;
|
|
465
|
+
return Array.isArray(i) && Reflect.get(i, "length"), i;
|
|
463
466
|
},
|
|
464
|
-
set: function(
|
|
465
|
-
r.value =
|
|
467
|
+
set: function(i) {
|
|
468
|
+
r.value = i;
|
|
466
469
|
}
|
|
467
470
|
};
|
|
468
471
|
}
|
|
469
|
-
function k(e, n, t, s) {
|
|
470
|
-
Object.defineProperty(e, n, L(n, t, s));
|
|
471
|
-
}
|
|
472
472
|
function ee(e, n, t, s) {
|
|
473
|
-
Object.defineProperty(e, n,
|
|
473
|
+
Object.defineProperty(e, n, z(n, t, s));
|
|
474
|
+
}
|
|
475
|
+
function ne(e, n, t, s) {
|
|
476
|
+
Object.defineProperty(e, n, B(n, t, s));
|
|
474
477
|
}
|
|
475
|
-
const
|
|
476
|
-
toRaw:
|
|
477
|
-
watch:
|
|
478
|
-
describeProperty:
|
|
479
|
-
defineProperty:
|
|
480
|
-
describeComputed:
|
|
481
|
-
defineComputed:
|
|
482
|
-
}, A = /* @__PURE__ */ new Set(["__proto__", "__ob__"]),
|
|
478
|
+
const Ae = {
|
|
479
|
+
toRaw: de,
|
|
480
|
+
watch: k,
|
|
481
|
+
describeProperty: B,
|
|
482
|
+
defineProperty: ne,
|
|
483
|
+
describeComputed: z,
|
|
484
|
+
defineComputed: ee
|
|
485
|
+
}, A = /* @__PURE__ */ new Set(["__proto__", "__ob__"]), D = "value", Pe = /* @__PURE__ */ new Set([
|
|
483
486
|
Symbol.iterator,
|
|
484
487
|
"size",
|
|
485
488
|
"has",
|
|
@@ -488,89 +491,89 @@ const Ee = {
|
|
|
488
491
|
"keys",
|
|
489
492
|
"entries",
|
|
490
493
|
"forEach"
|
|
491
|
-
]),
|
|
492
|
-
e[
|
|
494
|
+
]), He = (e) => {
|
|
495
|
+
e[D] += 1;
|
|
493
496
|
};
|
|
494
497
|
function je(e) {
|
|
495
498
|
if (!e?.reactive || typeof e.reactive != "function")
|
|
496
499
|
throw new Error(
|
|
497
500
|
`MadroneVue3 requires Vue's reactive function. Either use "madrone/integrations/vue" for automatic setup, or pass { reactive, toRaw } from "vue".`
|
|
498
501
|
);
|
|
499
|
-
const { reactive: n, toRaw: t } = e, s = t ?? ((a) => a), r = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(),
|
|
500
|
-
if (!
|
|
502
|
+
const { reactive: n, toRaw: t } = e, s = t ?? ((a) => a), r = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), i = (a, o) => {
|
|
503
|
+
if (!Pe.has(o)) return;
|
|
501
504
|
const d = s(a);
|
|
502
505
|
let S = c.get(d);
|
|
503
|
-
S || (S = /* @__PURE__ */ new Set(), c.set(d, S)), S.add(
|
|
504
|
-
}, l = (a,
|
|
506
|
+
S || (S = /* @__PURE__ */ new Set(), c.set(d, S)), S.add(o);
|
|
507
|
+
}, l = (a, o) => {
|
|
505
508
|
const d = s(a);
|
|
506
509
|
let S = r.get(d);
|
|
507
510
|
S || (S = /* @__PURE__ */ new Map(), r.set(d, S));
|
|
508
|
-
let G = S.get(
|
|
509
|
-
return G || (G = n({ [
|
|
510
|
-
}, E = (a,
|
|
511
|
-
A.has(
|
|
512
|
-
},
|
|
513
|
-
A.has(
|
|
514
|
-
},
|
|
511
|
+
let G = S.get(o);
|
|
512
|
+
return G || (G = n({ [D]: 0 }), S.set(o, G)), G;
|
|
513
|
+
}, E = (a, o) => {
|
|
514
|
+
A.has(o) || Reflect.get(l(a, o), D);
|
|
515
|
+
}, C = (a, o) => {
|
|
516
|
+
A.has(o) || He(l(a, o));
|
|
517
|
+
}, te = (a, o) => {
|
|
515
518
|
const d = s(a);
|
|
516
|
-
r.get(d) &&
|
|
517
|
-
},
|
|
518
|
-
const
|
|
519
|
-
if (
|
|
520
|
-
for (const d of
|
|
521
|
-
|
|
519
|
+
r.get(d) && C(a, o);
|
|
520
|
+
}, L = (a) => {
|
|
521
|
+
const o = c.get(s(a));
|
|
522
|
+
if (o)
|
|
523
|
+
for (const d of o)
|
|
524
|
+
C(a, d);
|
|
522
525
|
}, y = {
|
|
523
526
|
computed: {
|
|
524
527
|
onGet: (a) => {
|
|
525
528
|
E(a, a.name);
|
|
526
529
|
},
|
|
527
530
|
onImmediateChange: (a) => {
|
|
528
|
-
|
|
531
|
+
C(a, a.name);
|
|
529
532
|
}
|
|
530
533
|
},
|
|
531
534
|
reactive: {
|
|
532
|
-
onGet: ({ target: a, key:
|
|
533
|
-
T(a), E(a,
|
|
535
|
+
onGet: ({ target: a, key: o }) => {
|
|
536
|
+
T(a), E(a, o), i(a, o);
|
|
534
537
|
},
|
|
535
|
-
onHas: ({ target: a, key:
|
|
536
|
-
E(a,
|
|
538
|
+
onHas: ({ target: a, key: o }) => {
|
|
539
|
+
E(a, o);
|
|
537
540
|
},
|
|
538
|
-
onDelete: ({ target: a, key:
|
|
539
|
-
|
|
541
|
+
onDelete: ({ target: a, key: o, keysChanged: d }) => {
|
|
542
|
+
te(a, o), d && (C(a), L(a));
|
|
540
543
|
},
|
|
541
|
-
onSet: ({ target: a, key:
|
|
542
|
-
|
|
544
|
+
onSet: ({ target: a, key: o, keysChanged: d }) => {
|
|
545
|
+
C(a, o), d && (C(a), L(a));
|
|
543
546
|
},
|
|
544
547
|
needsProxy: ({ key: a }) => !A.has(a)
|
|
545
548
|
}
|
|
546
549
|
};
|
|
547
|
-
function
|
|
548
|
-
return
|
|
550
|
+
function re(a, o) {
|
|
551
|
+
return z(a, o, y);
|
|
549
552
|
}
|
|
550
|
-
function
|
|
551
|
-
return
|
|
553
|
+
function se(a, o) {
|
|
554
|
+
return B(a, o, y);
|
|
552
555
|
}
|
|
553
|
-
function
|
|
554
|
-
return
|
|
556
|
+
function ce(a, o, d) {
|
|
557
|
+
return ee(a, o, d, y);
|
|
555
558
|
}
|
|
556
|
-
function
|
|
557
|
-
return
|
|
559
|
+
function ae(a, o, d) {
|
|
560
|
+
return ne(a, o, d, y);
|
|
558
561
|
}
|
|
559
562
|
return {
|
|
560
|
-
toRaw:
|
|
561
|
-
watch:
|
|
562
|
-
describeProperty:
|
|
563
|
-
defineProperty:
|
|
564
|
-
describeComputed:
|
|
565
|
-
defineComputed:
|
|
563
|
+
toRaw: Ae.toRaw,
|
|
564
|
+
watch: k,
|
|
565
|
+
describeProperty: se,
|
|
566
|
+
defineProperty: ae,
|
|
567
|
+
describeComputed: re,
|
|
568
|
+
defineComputed: ce
|
|
566
569
|
};
|
|
567
570
|
}
|
|
568
571
|
export {
|
|
569
|
-
|
|
570
|
-
|
|
572
|
+
Ae as M,
|
|
573
|
+
Ve as a,
|
|
571
574
|
je as b,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
575
|
+
ue as g,
|
|
576
|
+
ge as l,
|
|
577
|
+
Ne as r,
|
|
578
|
+
q as t
|
|
576
579
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const V=new Set;let $;function ue(){return[...V]}function fe(){return ue().at(-1)}function X(){$=fe()}function le(e){e&&(V.add(e),X())}function de(e){V.delete(e),X()}function q(){return $}const K=new WeakMap;function D(e){return(q()?.toRaw??(t=>t))(e)}function T(e){K.set(D(e),Date.now())}function he(e){return K.get(D(e))}const f=Symbol("keys"),U=Symbol("computed"),g=new WeakMap,N=new WeakMap,b=new WeakMap,R=new WeakMap;let G=[],_=null;const me=e=>g.has(e),F=e=>N.has(e),j=e=>g.get(e),Se=e=>N.get(e),ve=e=>F(e)?Se(e):e,we=(e,n)=>{g.set(e,n),N.set(n,e)},Re=()=>{_===null&&(_=Symbol("scheduler"),queueMicrotask(()=>{try{for(;G.length>0;){const e=G;G=[];for(const n of e)try{n()}catch(t){console.error("Unhandled error in scheduled task:",t)}}}finally{_=null}}))},Ce=e=>{G.push(e),Re()},be=(e,n)=>{const t=R.get(e),s=t?.get(n);if(s){for(const r of s)b.get(r)?.get(n)?.delete(e);s.clear(),t.delete(n),t.size===0&&R.delete(e)}},Y=e=>{const n=R.get(e);if(n){for(const[t,s]of n)for(const r of s)b.get(r)?.get(t)?.delete(e);R.delete(e)}},Q=(e,n)=>{const t=Oe();if(!t)return;R.has(t)||R.set(t,new Map),b.has(e)||b.set(e,new Map);const s=b.get(e),r=R.get(t);s.has(n)||s.set(n,new Set),r.has(n)||r.set(n,new Set);const c=s.get(n),i=r.get(n);c.add(t),i.add(e)},h=(e,n)=>{const t=j(e);t&&Q(t,n)},J=(e,n)=>{const t=b.get(e);if(t?.get(n))for(const s of t.get(n))s.setDirty(),ye(s)||be(s,n)},m=(e,n)=>{J(j(e),n)},P=[],H=new WeakSet;function Oe(){return P.at(-1)}function ye(e){return H.has(e)}class z{static create(...n){return new z(...n)}constructor(n){this.name=n.name,this.get=n.get,this.set=n.set,this.cache=!!(n.cache??!0),this.alive=!0,this.dirty=!0,this.cachedVal=void 0,this.hooks={onGet:n.onGet,onSet:n.onSet,onChange:n.onChange,onImmediateChange:n.onImmediateChange}}callHook(n){typeof this.hooks[n]=="function"&&this.hooks[n](this)}dispose(){Y(this),this.alive=!1,this.dirty=!1,this.cachedVal=void 0,this.prev=void 0}wrap(n){P.push(this),H.add(this);try{return n()}finally{P.pop(),H.delete(this)}}setDirty(){this.alive&&!this.dirty&&(this.dirty=!0,J(this,U),this.prev=this.cachedVal,this.cachedVal=void 0,this.callHook("onImmediateChange"),Ce(()=>this.notifyChange()))}notifyChange(){this.callHook("onChange"),this.prev=void 0}run(){if(!this.alive)return;const n=this.wrap(()=>{if(this.cache&&this.dirty||!this.cache){Y(this);try{this.cachedVal=this.get()}finally{this.dirty=!1}}return this.cachedVal});return Q(this,U),this.callHook("onGet"),n}get value(){return this.run()}set value(n){if(typeof this.set=="function")this.set(n),this.callHook("onSet");else throw new TypeError(`No setter defined for "${this.name}"`)}}function Z(...e){return z.create(...e)}function Ie(e){return Z(e)}const u=e=>{const{name:n,target:t,key:s,receiver:r,value:c,keysChanged:i=!1,valueChanged:l=!1}=e;return{name:n,target:t,key:s,receiver:r,value:c,keysChanged:i,valueChanged:l}},Ge=(e,n,t,s)=>{h(n,t),e?.onGet&&e.onGet(u({name:e.name,target:n,key:t,receiver:s}))},Te=(e,n,t,s)=>{const r=n[t],c=Array.isArray(n);let i=!1,l=!1;t in n||(m(n,f),l=!0,c&&m(n,"length")),(r!==s||c)&&(m(n,t),i=!0),(l||i)&&e?.onSet&&e.onSet(u({name:e.name,target:n,key:t,value:s,keysChanged:l,valueChanged:i}))},Ee=(e,n,t)=>{m(n,t),m(n,f),e?.onDelete&&e.onDelete(u({name:e.name,target:n,key:t,keysChanged:!0}))},x=(e,n,t)=>{h(n,f),e?.onHas&&e.onHas(u({name:e.name,target:n,key:t}))};function k(e){const n=e.needsProxy||(()=>!0);return{get:(t,s,r)=>{Ge(e,t,s,r);const c=Reflect.get(t,s,r);return e?.deep&&c&&typeof c=="object"&&n({target:t,key:s,value:c})&&Object.getOwnPropertyDescriptor(t,s)?.configurable?w(c,e):c},set:(t,s,r)=>(Te(e,t,s,r),Reflect.set(t,s,r)),deleteProperty:(...t)=>(Ee(e,...t),Reflect.deleteProperty(...t)),has:(t,s)=>(x(e,t),Reflect.has(t,s)),ownKeys:t=>(x(e,t),Reflect.ownKeys(t)),getPrototypeOf:t=>Object.getPrototypeOf(t)}}const _e=e=>({...k(e)}),Ae=e=>({...k(e)}),v=(e,n)=>n?.deep&&e&&typeof e=="object"?w(e,n):e;function*O(e,n,t){for(const s of e)yield t(s)}const Pe=e=>({get:(n,t,s)=>t==="size"?(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),n.size):t==="has"?r=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t,value:r})),n.has(r)):t==="add"?r=>{const c=n.has(r);return n.add(r),c||(m(n,f),e?.onSet?.(u({name:e.name,target:n,key:t,value:r,keysChanged:!0}))),s}:t==="delete"?r=>{const c=n.has(r),i=n.delete(r);return c&&(m(n,f),e?.onDelete?.(u({name:e.name,target:n,key:t,value:r,keysChanged:!0}))),i}:t==="clear"?()=>{const r=n.size>0;n.clear(),r&&(m(n,f),e?.onDelete?.(u({name:e.name,target:n,key:t,keysChanged:!0})))}:t==="forEach"?(r,c)=>{h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t}));for(const[i,l]of n.entries())r.call(c,v(i,e),v(l,e),s)}:t==="values"||t==="keys"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.values(),e,r=>v(r,e))):t==="entries"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.entries(),e,([r,c])=>[v(r,e),v(c,e)])):t===Symbol.iterator?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n[Symbol.iterator](),e,r=>v(r,e))):t===Symbol.toStringTag?"Set":Reflect.get(n,t,s)}),He=e=>({get:(n,t,s)=>t==="size"?(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),n.size):t==="has"?r=>(h(n,r),e?.onGet?.(u({name:e.name,target:n,key:r})),n.has(r)):t==="get"?r=>(h(n,r),e?.onGet?.(u({name:e.name,target:n,key:r})),v(n.get(r),e)):t==="set"?(r,c)=>{const i=n.has(r),l=n.get(r);return n.set(r,c),i||m(n,f),(!i||l!==c)&&(m(n,r),e?.onSet?.(u({name:e.name,target:n,key:r,value:c,keysChanged:!i,valueChanged:l!==c}))),s}:t==="delete"?r=>{const c=n.has(r),i=n.delete(r);return c&&(m(n,f),m(n,r),e?.onDelete?.(u({name:e.name,target:n,key:r,keysChanged:!0}))),i}:t==="clear"?()=>{const r=[...n.keys()],c=n.size>0;if(n.clear(),c){m(n,f);for(const i of r)m(n,i);e?.onDelete?.(u({name:e.name,target:n,key:t,keysChanged:!0}))}}:t==="forEach"?(r,c)=>{h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t}));for(const[i,l]of n.entries())r.call(c,v(l,e),i,s)}:t==="keys"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),n.keys()):t==="values"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.values(),e,r=>v(r,e))):t==="entries"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.entries(),e,([r,c])=>[r,v(c,e)])):t===Symbol.iterator?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n[Symbol.iterator](),e,([r,c])=>[r,v(c,e)])):t===Symbol.toStringTag?"Map":Reflect.get(n,t,s)}),p=Object.freeze({object:_e,array:Ae,set:Pe,map:He});function w(e,n){if(me(e))return j(e);if(F(e))return e;const t=n||{},s={...t,deep:t?.deep??!0},r=w.getStringType(e);if(!w.hasHandler(r))return e;const c=new Proxy(e,w.typeHandler(r,s));return we(e,c),c}const Me=e=>{const n=Object.getPrototypeOf(e);return n===null?!0:n===Object.prototype};w.getStringType=e=>e===null?"null":typeof e!="object"?typeof e:Array.isArray(e)?"array":e instanceof Map?"map":e instanceof Set?"set":Me(e)?"object":"native";w.hasHandler=e=>!!p[e];w.typeHandler=(e,n)=>p[e]?.(n);function ee(e,n,t){const s=Z({get:e,onChange:({value:c,prev:i})=>n(c,i)}),r=s.run();return t?.immediate&&n(r),()=>s.dispose()}function B(e,n,t){let s,r;if(n.cache){const c=Ie({...n,get:n.get,name:e,onImmediateChange:t?.computed?.onImmediateChange,onChange:t?.computed?.onChange,onGet:t?.computed?.onGet,onSet:t?.computed?.onSet});s=function(){return T(this),c.value},r=function(l){c.value=l}}else s=function(){return T(this),n.get.call(this)},r=function(...i){n.set.call(this,...i)};return{enumerable:n.enumerable,configurable:n.configurable,get:s,set:r}}function L(e,n,t){const s={value:n.value},r=w(s,{name:e,onGet:t?.reactive?.onGet,onHas:t?.reactive?.onHas,onSet:t?.reactive?.onSet,onDelete:t?.reactive?.onDelete,needsProxy:t?.reactive?.needsProxy,deep:n.deep??t?.reactive?.deep});return{configurable:n.configurable,enumerable:n.enumerable,get:function(){T(this);const{value:i}=r;return Array.isArray(i)&&Reflect.get(i,"length"),i},set:function(i){r.value=i}}}function ne(e,n,t,s){Object.defineProperty(e,n,B(n,t,s))}function te(e,n,t,s){Object.defineProperty(e,n,L(n,t,s))}const re={toRaw:ve,watch:ee,describeProperty:L,defineProperty:te,describeComputed:B,defineComputed:ne},A=new Set(["__proto__","__ob__"]),M="value",Ve=new Set([Symbol.iterator,"size","has","get","values","keys","entries","forEach"]),De=e=>{e[M]+=1};function ge(e){if(!e?.reactive||typeof e.reactive!="function")throw new Error(`MadroneVue3 requires Vue's reactive function. Either use "madrone/integrations/vue" for automatic setup, or pass { reactive, toRaw } from "vue".`);const{reactive:n,toRaw:t}=e,s=t??(a=>a),r=new WeakMap,c=new WeakMap,i=(a,o)=>{if(!Ve.has(o))return;const d=s(a);let S=c.get(d);S||(S=new Set,c.set(d,S)),S.add(o)},l=(a,o)=>{const d=s(a);let S=r.get(d);S||(S=new Map,r.set(d,S));let I=S.get(o);return I||(I=n({[M]:0}),S.set(o,I)),I},E=(a,o)=>{A.has(o)||Reflect.get(l(a,o),M)},C=(a,o)=>{A.has(o)||De(l(a,o))},se=(a,o)=>{const d=s(a);r.get(d)&&C(a,o)},W=a=>{const o=c.get(s(a));if(o)for(const d of o)C(a,d)},y={computed:{onGet:a=>{E(a,a.name)},onImmediateChange:a=>{C(a,a.name)}},reactive:{onGet:({target:a,key:o})=>{T(a),E(a,o),i(a,o)},onHas:({target:a,key:o})=>{E(a,o)},onDelete:({target:a,key:o,keysChanged:d})=>{se(a,o),d&&(C(a),W(a))},onSet:({target:a,key:o,keysChanged:d})=>{C(a,o),d&&(C(a),W(a))},needsProxy:({key:a})=>!A.has(a)}};function ce(a,o){return B(a,o,y)}function ae(a,o){return L(a,o,y)}function ie(a,o,d){return ne(a,o,d,y)}function oe(a,o,d){return te(a,o,d,y)}return{toRaw:re.toRaw,watch:ee,describeProperty:ae,defineProperty:oe,describeComputed:ce,defineComputed:ie}}exports.MadroneState=re;exports.MadroneVue3=ge;exports.addIntegration=le;exports.getIntegration=q;exports.lastAccessed=he;exports.removeIntegration=de;exports.toRaw=D;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./MadroneVue3-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./MadroneVue3-BO-MRnQn.cjs");function a(e,t,n){const r=o.getIntegration();if(!r)throw new Error("No integration specified");typeof n.get=="function"&&r?.defineComputed?r.defineComputed(e,t,{get:n.get.bind(e),set:n.set?.bind(e),enumerable:n.enumerable,configurable:n.configurable,cache:n.cache??!0}):!n.get&&r?.defineProperty&&r.defineProperty(e,t,{value:n.value,enumerable:n.enumerable,configurable:n.configurable,deep:n.deep})}function p(e,t){const n=Object.getOwnPropertyDescriptors(e),r=(u,i)=>t?.[u]?.[i];for(const[u,i]of Object.entries(n))a(e,u,{get:i.get?.bind(e),set:i.set?.bind(e),value:r(u,"value")??i.value,enumerable:r(u,"enumerable")??i.enumerable,configurable:r(u,"configurable")??i.configurable,cache:r(u,"cache")??!0,deep:r(u,"deep")??!0});return e}function g(e,t,n){return o.getIntegration()?.watch?.(e,t,n)}function b(...e){const t={},n={};for(const r of e){const u=typeof r=="function"?r():r;Object.assign(t,Object.getOwnPropertyDescriptors(u??r??{}))}return Object.defineProperties(n,t),n}function m(e,t){Object.defineProperties(e.prototype,Object.getOwnPropertyDescriptors(b(...[...t,e].map(n=>n.prototype))))}const c=new WeakMap;function P(...e){return t=>{e?.length&&m(t,e)}}function h(e){c.has(e)||c.set(e,new Set)}function v(e,t){return h(e),c.get(e).has(t)}function w(e,t){h(e),c.get(e).add(t)}function d(e,t,n,r){return o.getIntegration()&&!v(e,t)?(a(e,t,{...n,get:n.get.bind(e),set:n.set?.bind(e),enumerable:!0,...r?.descriptors,cache:!0}),w(e,t),!0):!1}function O(e,t,n,r){return typeof n.get=="function"?{...n,enumerable:!0,configurable:!0,get:function(){return d(this,t,n,r),this[t]},set:function(I){d(this,t,n,r),this[t]=I}}:n}function M(e,t,n){return O(e,t,n)}M.configure=function(t){return(n,r,u)=>O(n,r,u,{descriptors:t})};function f(e,t,n){return o.getIntegration()&&!v(e,t)?(w(e,t),a(e,t,{...Object.getOwnPropertyDescriptor(e,t),enumerable:!0,...n?.descriptors}),!0):!1}function s(e,t,n){typeof e=="function"?f(e,t):Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){if(f(this,t,n))return this[t]},set(r){f(this,t,n)&&(this[t]=r)}})}function l(e,t){return s(e,t)}l.shallow=function(t,n){return s(t,n,{descriptors:{deep:!1}})};l.configure=function(t){return(n,r)=>s(n,r,{descriptors:t})};o.addIntegration(o.MadroneState);const D={use:o.addIntegration,unuse:o.removeIntegration,auto:p,define:a,watch:g,lastAccessed:o.lastAccessed};exports.MadroneState=o.MadroneState;exports.MadroneVue3=o.MadroneVue3;exports.toRaw=o.toRaw;exports.applyClassMixins=m;exports.auto=p;exports.classMixin=P;exports.computed=M;exports.default=D;exports.merge=b;exports.reactive=l;exports.watch=g;
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as i, a as p, l as O, r as v, M as P } from "./MadroneVue3-
|
|
2
|
-
import { b as j, t as V } from "./MadroneVue3-
|
|
1
|
+
import { g as i, a as p, l as O, r as v, M as P } from "./MadroneVue3-BBL8NMJk.js";
|
|
2
|
+
import { b as j, t as V } from "./MadroneVue3-BBL8NMJk.js";
|
|
3
3
|
function f(e, t, n) {
|
|
4
4
|
const r = i();
|
|
5
5
|
if (!r)
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),r=require("./MadroneVue3-
|
|
1
|
+
"use strict";const e=require("vue"),r=require("./MadroneVue3-BO-MRnQn.cjs"),t=r.MadroneVue3({reactive:e.reactive,toRaw:e.toRaw});module.exports=t;
|
package/dist/vue.js
CHANGED
package/package.json
CHANGED
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export declare function getCurrentObserver(): ObservableItem<unknown> | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if an Observer is currently running (on the execution stack).
|
|
22
|
+
*
|
|
23
|
+
* Used to prevent clearing dependencies for an observer that is still
|
|
24
|
+
* collecting dependencies during its getter execution.
|
|
25
|
+
*
|
|
26
|
+
* @param obs - The observer to check
|
|
27
|
+
* @returns true if the observer is currently running
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function isObserverRunning(obs: ObservableItem<unknown>): boolean;
|
|
20
31
|
/**
|
|
21
32
|
* Lifecycle hooks that can be called on an Observer.
|
|
22
33
|
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const M=new Set;let U;function ie(){return[...M]}function ue(){return ie().at(-1)}function $(){U=ue()}function fe(e){e&&(M.add(e),$())}function le(e){M.delete(e),$()}function X(){return U}const q=new WeakMap;function D(e){return(X()?.toRaw??(t=>t))(e)}function T(e){q.set(D(e),Date.now())}function de(e){return q.get(D(e))}const f=Symbol("keys"),W=Symbol("computed"),V=new WeakMap,g=new WeakMap,b=new WeakMap,C=new WeakMap;let G=[],A=null;const he=e=>V.has(e),K=e=>g.has(e),j=e=>V.get(e),me=e=>g.get(e),Se=e=>K(e)?me(e):e,ve=(e,n)=>{V.set(e,n),g.set(n,e)},we=()=>{A===null&&(A=Symbol("scheduler"),queueMicrotask(()=>{try{for(;G.length>0;){const e=G;G=[];for(const n of e)try{n()}catch(t){console.error("Unhandled error in scheduled task:",t)}}}finally{A=null}}))},Ce=e=>{G.push(e),we()},Re=(e,n)=>{const t=C.get(e),s=t?.get(n);if(s){for(const r of s)b.get(r)?.get(n)?.delete(e);s.clear(),t.delete(n),t.size===0&&C.delete(e)}},Y=e=>{const n=C.get(e);if(n){for(const[t,s]of n)for(const r of s)b.get(r)?.get(t)?.delete(e);C.delete(e)}},F=(e,n)=>{const t=be();if(!t)return;C.has(t)||C.set(t,new Map),b.has(e)||b.set(e,new Map);const s=b.get(e),r=C.get(t);s.has(n)||s.set(n,new Set),r.has(n)||r.set(n,new Set);const c=s.get(n),o=r.get(n);c.add(t),o.add(e)},h=(e,n)=>{const t=j(e);t&&F(t,n)},Q=(e,n)=>{const t=b.get(e);if(t?.get(n))for(const s of t.get(n))s.setDirty(),Re(s,n)},m=(e,n)=>{Q(j(e),n)},P=[];function be(){return P.at(-1)}class z{static create(...n){return new z(...n)}constructor(n){this.name=n.name,this.get=n.get,this.set=n.set,this.cache=!!(n.cache??!0),this.alive=!0,this.dirty=!0,this.cachedVal=void 0,this.hooks={onGet:n.onGet,onSet:n.onSet,onChange:n.onChange,onImmediateChange:n.onImmediateChange}}callHook(n){typeof this.hooks[n]=="function"&&this.hooks[n](this)}dispose(){Y(this),this.alive=!1,this.dirty=!1,this.cachedVal=void 0,this.prev=void 0}wrap(n){P.push(this);try{return n()}finally{P.pop()}}setDirty(){this.alive&&!this.dirty&&(this.dirty=!0,Q(this,W),this.prev=this.cachedVal,this.cachedVal=void 0,this.callHook("onImmediateChange"),Ce(()=>this.notifyChange()))}notifyChange(){this.callHook("onChange"),this.prev=void 0}run(){if(!this.alive)return;const n=this.wrap(()=>{if(this.cache&&this.dirty||!this.cache){Y(this);try{this.cachedVal=this.get()}finally{this.dirty=!1}}return this.cachedVal});return F(this,W),this.callHook("onGet"),n}get value(){return this.run()}set value(n){if(typeof this.set=="function")this.set(n),this.callHook("onSet");else throw new TypeError(`No setter defined for "${this.name}"`)}}function J(...e){return z.create(...e)}function Oe(e){return J(e)}const u=e=>{const{name:n,target:t,key:s,receiver:r,value:c,keysChanged:o=!1,valueChanged:l=!1}=e;return{name:n,target:t,key:s,receiver:r,value:c,keysChanged:o,valueChanged:l}},ye=(e,n,t,s)=>{h(n,t),e?.onGet&&e.onGet(u({name:e.name,target:n,key:t,receiver:s}))},Ie=(e,n,t,s)=>{const r=n[t],c=Array.isArray(n);let o=!1,l=!1;t in n||(m(n,f),l=!0,c&&m(n,"length")),(r!==s||c)&&(m(n,t),o=!0),(l||o)&&e?.onSet&&e.onSet(u({name:e.name,target:n,key:t,value:s,keysChanged:l,valueChanged:o}))},Ge=(e,n,t)=>{m(n,t),m(n,f),e?.onDelete&&e.onDelete(u({name:e.name,target:n,key:t,keysChanged:!0}))},x=(e,n,t)=>{h(n,f),e?.onHas&&e.onHas(u({name:e.name,target:n,key:t}))};function Z(e){const n=e.needsProxy||(()=>!0);return{get:(t,s,r)=>{ye(e,t,s,r);const c=Reflect.get(t,s,r);return e?.deep&&c&&typeof c=="object"&&n({target:t,key:s,value:c})&&Object.getOwnPropertyDescriptor(t,s)?.configurable?w(c,e):c},set:(t,s,r)=>(Ie(e,t,s,r),Reflect.set(t,s,r)),deleteProperty:(...t)=>(Ge(e,...t),Reflect.deleteProperty(...t)),has:(t,s)=>(x(e,t),Reflect.has(t,s)),ownKeys:t=>(x(e,t),Reflect.ownKeys(t)),getPrototypeOf:t=>Object.getPrototypeOf(t)}}const Te=e=>({...Z(e)}),Ee=e=>({...Z(e)}),v=(e,n)=>n?.deep&&e&&typeof e=="object"?w(e,n):e;function*O(e,n,t){for(const s of e)yield t(s)}const Ae=e=>({get:(n,t,s)=>t==="size"?(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),n.size):t==="has"?r=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t,value:r})),n.has(r)):t==="add"?r=>{const c=n.has(r);return n.add(r),c||(m(n,f),e?.onSet?.(u({name:e.name,target:n,key:t,value:r,keysChanged:!0}))),s}:t==="delete"?r=>{const c=n.has(r),o=n.delete(r);return c&&(m(n,f),e?.onDelete?.(u({name:e.name,target:n,key:t,value:r,keysChanged:!0}))),o}:t==="clear"?()=>{const r=n.size>0;n.clear(),r&&(m(n,f),e?.onDelete?.(u({name:e.name,target:n,key:t,keysChanged:!0})))}:t==="forEach"?(r,c)=>{h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t}));for(const[o,l]of n.entries())r.call(c,v(o,e),v(l,e),s)}:t==="values"||t==="keys"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.values(),e,r=>v(r,e))):t==="entries"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.entries(),e,([r,c])=>[v(r,e),v(c,e)])):t===Symbol.iterator?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n[Symbol.iterator](),e,r=>v(r,e))):t===Symbol.toStringTag?"Set":Reflect.get(n,t,s)}),_e=e=>({get:(n,t,s)=>t==="size"?(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),n.size):t==="has"?r=>(h(n,r),e?.onGet?.(u({name:e.name,target:n,key:r})),n.has(r)):t==="get"?r=>(h(n,r),e?.onGet?.(u({name:e.name,target:n,key:r})),v(n.get(r),e)):t==="set"?(r,c)=>{const o=n.has(r),l=n.get(r);return n.set(r,c),o||m(n,f),(!o||l!==c)&&(m(n,r),e?.onSet?.(u({name:e.name,target:n,key:r,value:c,keysChanged:!o,valueChanged:l!==c}))),s}:t==="delete"?r=>{const c=n.has(r),o=n.delete(r);return c&&(m(n,f),m(n,r),e?.onDelete?.(u({name:e.name,target:n,key:r,keysChanged:!0}))),o}:t==="clear"?()=>{const r=[...n.keys()],c=n.size>0;if(n.clear(),c){m(n,f);for(const o of r)m(n,o);e?.onDelete?.(u({name:e.name,target:n,key:t,keysChanged:!0}))}}:t==="forEach"?(r,c)=>{h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t}));for(const[o,l]of n.entries())r.call(c,v(l,e),o,s)}:t==="keys"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),n.keys()):t==="values"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.values(),e,r=>v(r,e))):t==="entries"?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n.entries(),e,([r,c])=>[r,v(c,e)])):t===Symbol.iterator?()=>(h(n,f),e?.onGet?.(u({name:e.name,target:n,key:t})),O(n[Symbol.iterator](),e,([r,c])=>[r,v(c,e)])):t===Symbol.toStringTag?"Map":Reflect.get(n,t,s)}),p=Object.freeze({object:Te,array:Ee,set:Ae,map:_e});function w(e,n){if(he(e))return j(e);if(K(e))return e;const t=n||{},s={...t,deep:t?.deep??!0},r=w.getStringType(e);if(!w.hasHandler(r))return e;const c=new Proxy(e,w.typeHandler(r,s));return ve(e,c),c}const Pe=e=>{const n=Object.getPrototypeOf(e);return n===null?!0:n===Object.prototype};w.getStringType=e=>e===null?"null":typeof e!="object"?typeof e:Array.isArray(e)?"array":e instanceof Map?"map":e instanceof Set?"set":Pe(e)?"object":"native";w.hasHandler=e=>!!p[e];w.typeHandler=(e,n)=>p[e]?.(n);function k(e,n,t){const s=J({get:e,onChange:({value:c,prev:o})=>n(c,o)}),r=s.run();return t?.immediate&&n(r),()=>s.dispose()}function L(e,n,t){let s,r;if(n.cache){const c=Oe({...n,get:n.get,name:e,onImmediateChange:t?.computed?.onImmediateChange,onChange:t?.computed?.onChange,onGet:t?.computed?.onGet,onSet:t?.computed?.onSet});s=function(){return T(this),c.value},r=function(l){c.value=l}}else s=function(){return T(this),n.get.call(this)},r=function(...o){n.set.call(this,...o)};return{enumerable:n.enumerable,configurable:n.configurable,get:s,set:r}}function N(e,n,t){const s={value:n.value},r=w(s,{name:e,onGet:t?.reactive?.onGet,onHas:t?.reactive?.onHas,onSet:t?.reactive?.onSet,onDelete:t?.reactive?.onDelete,needsProxy:t?.reactive?.needsProxy,deep:n.deep??t?.reactive?.deep});return{configurable:n.configurable,enumerable:n.enumerable,get:function(){T(this);const{value:o}=r;return Array.isArray(o)&&Reflect.get(o,"length"),o},set:function(o){r.value=o}}}function ee(e,n,t,s){Object.defineProperty(e,n,L(n,t,s))}function ne(e,n,t,s){Object.defineProperty(e,n,N(n,t,s))}const te={toRaw:Se,watch:k,describeProperty:N,defineProperty:ne,describeComputed:L,defineComputed:ee},_=new Set(["__proto__","__ob__"]),H="value",He=new Set([Symbol.iterator,"size","has","get","values","keys","entries","forEach"]),Me=e=>{e[H]+=1};function De(e){if(!e?.reactive||typeof e.reactive!="function")throw new Error(`MadroneVue3 requires Vue's reactive function. Either use "madrone/integrations/vue" for automatic setup, or pass { reactive, toRaw } from "vue".`);const{reactive:n,toRaw:t}=e,s=t??(a=>a),r=new WeakMap,c=new WeakMap,o=(a,i)=>{if(!He.has(i))return;const d=s(a);let S=c.get(d);S||(S=new Set,c.set(d,S)),S.add(i)},l=(a,i)=>{const d=s(a);let S=r.get(d);S||(S=new Map,r.set(d,S));let I=S.get(i);return I||(I=n({[H]:0}),S.set(i,I)),I},E=(a,i)=>{_.has(i)||Reflect.get(l(a,i),H)},R=(a,i)=>{_.has(i)||Me(l(a,i))},re=(a,i)=>{const d=s(a);r.get(d)&&R(a,i)},B=a=>{const i=c.get(s(a));if(i)for(const d of i)R(a,d)},y={computed:{onGet:a=>{E(a,a.name)},onImmediateChange:a=>{R(a,a.name)}},reactive:{onGet:({target:a,key:i})=>{T(a),E(a,i),o(a,i)},onHas:({target:a,key:i})=>{E(a,i)},onDelete:({target:a,key:i,keysChanged:d})=>{re(a,i),d&&(R(a),B(a))},onSet:({target:a,key:i,keysChanged:d})=>{R(a,i),d&&(R(a),B(a))},needsProxy:({key:a})=>!_.has(a)}};function se(a,i){return L(a,i,y)}function ce(a,i){return N(a,i,y)}function ae(a,i,d){return ee(a,i,d,y)}function oe(a,i,d){return ne(a,i,d,y)}return{toRaw:te.toRaw,watch:k,describeProperty:ce,defineProperty:oe,describeComputed:se,defineComputed:ae}}exports.MadroneState=te;exports.MadroneVue3=De;exports.addIntegration=fe;exports.getIntegration=X;exports.lastAccessed=de;exports.removeIntegration=le;exports.toRaw=D;
|