@madronejs/core 1.0.16

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -0
  3. package/dist/core.mjs +617 -0
  4. package/dist/core.umd.js +1 -0
  5. package/package.json +74 -0
  6. package/types/__spec__/decorateComputed.spec.d.ts +2 -0
  7. package/types/__spec__/decorateReactive.spec.d.ts +2 -0
  8. package/types/__spec__/examples.spec.d.ts +2 -0
  9. package/types/__spec__/merge.spec.d.ts +2 -0
  10. package/types/auto.d.ts +7 -0
  11. package/types/decorate.d.ts +24 -0
  12. package/types/global.d.ts +12 -0
  13. package/types/index.d.ts +24 -0
  14. package/types/integrations/MadroneState.d.ts +25 -0
  15. package/types/integrations/MadroneVue2.d.ts +3 -0
  16. package/types/integrations/MadroneVue3.d.ts +3 -0
  17. package/types/integrations/__spec__/madroneState.spec.d.ts +2 -0
  18. package/types/integrations/__spec__/testAccess.d.ts +2 -0
  19. package/types/integrations/__spec__/testAll.d.ts +4 -0
  20. package/types/integrations/__spec__/testAuto.d.ts +2 -0
  21. package/types/integrations/__spec__/testClass.d.ts +2 -0
  22. package/types/integrations/__spec__/testVue.d.ts +2 -0
  23. package/types/integrations/__spec__/vue2.spec.d.ts +2 -0
  24. package/types/integrations/__spec__/vue3.spec.d.ts +2 -0
  25. package/types/integrations/index.d.ts +4 -0
  26. package/types/interfaces.d.ts +27 -0
  27. package/types/reactivity/Computed.d.ts +8 -0
  28. package/types/reactivity/Observer.d.ts +50 -0
  29. package/types/reactivity/Reactive.d.ts +15 -0
  30. package/types/reactivity/Watcher.d.ts +10 -0
  31. package/types/reactivity/__spec__/observer.spec.d.ts +2 -0
  32. package/types/reactivity/__spec__/observer_array.spec.d.ts +2 -0
  33. package/types/reactivity/__spec__/observer_object.spec.d.ts +2 -0
  34. package/types/reactivity/__spec__/observer_set.xspec.d.ts +2 -0
  35. package/types/reactivity/__spec__/reactive.spec.d.ts +2 -0
  36. package/types/reactivity/__spec__/reactive_array.spec.d.ts +2 -0
  37. package/types/reactivity/__spec__/reactive_object.spec.d.ts +2 -0
  38. package/types/reactivity/__spec__/reactive_set.xspec.d.ts +2 -0
  39. package/types/reactivity/__spec__/watcher.spec.d.ts +2 -0
  40. package/types/reactivity/global.d.ts +51 -0
  41. package/types/reactivity/index.d.ts +5 -0
  42. package/types/reactivity/interfaces.d.ts +28 -0
  43. package/types/reactivity/typeHandlers.d.ts +20 -0
  44. package/types/test/util.d.ts +2 -0
  45. package/types/util.d.ts +32 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 madronejs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # madrone (mah droh nuh)
2
+ 🌳
3
+
4
+ Madrone is an easy way to make reactive objects in JS.
5
+
6
+ ## Installation
7
+ ```javascript
8
+ // npm
9
+ npm install madronejs --save
10
+
11
+ // pnpm
12
+ pnpm install madronejs
13
+
14
+ // yarn
15
+ yarn add madronejs
16
+ ```
17
+
18
+ ## Quick start
19
+
20
+ ### Reactivity
21
+
22
+ ```javascript
23
+ import Madrone, { MadroneState } from '@madronejs/core'
24
+
25
+ // add reactivity integration
26
+ // MadroneVue2, and MadroneVue3 are also available
27
+ Madrone.use(MadroneState);
28
+
29
+ const PersonFactory = ({ name } = {}) => Madrone.auto({
30
+ // When using reactivity integration, getters become cached computeds
31
+ // that only get recomputed when a reactive data property changes.
32
+ // In this case, `name` is a reactive data property.
33
+ name,
34
+ get greeting() {
35
+ return `Hi, I'm ${this.name}`
36
+ },
37
+ });
38
+
39
+ const person = PersonFactory({ name: 'Greg' });
40
+ const newVals = [];
41
+ const oldVals = [];
42
+
43
+ // Watch a reactive property when it changes. Any reactive property accessed
44
+ // in the first argument will cause the watcher callback to trigger. Anything
45
+ // returned from the first argument will define what the newVal/oldVal is.
46
+ Madrone.watch(() => person.greeting, (newVal, oldVal) => {
47
+ newVals.push(newVal);
48
+ oldVals.push(oldVal);
49
+ });
50
+
51
+ person.name; // Greg
52
+ person.greeting; // Hi, I'm Greg
53
+
54
+ person.name = 'Not Greg';
55
+ person.greeting; // Hi, I'm Not Greg
56
+
57
+ // watcher is async...
58
+ console.log('New Vals:', newVals); // ["Hi, I'm Not Greg"]
59
+ console.log('Old Vals:', oldVals); // ["Hi, I'm Greg"]
60
+ ```
61
+
62
+ ### Decorator support
63
+
64
+ ```javascript
65
+
66
+ import Madrone, { MadroneState, computed, reactive } from '@madronejs/core'
67
+
68
+ Madrone.use(MadroneState);
69
+
70
+ class Person {
71
+ @reactive name: string;
72
+ @reactive age;
73
+
74
+ @computed get greeting() {
75
+ return `Hi, I'm ${this.name}`;
76
+ }
77
+
78
+ constructor(options) {
79
+ this.name = options?.name;
80
+ this.age = options?.age;
81
+ }
82
+ }
83
+
84
+ const person = new Person({ name: 'Greg' });
85
+
86
+
87
+ person.name; // Greg
88
+ person.greeting; // Hi, I'm Greg
89
+
90
+ person.name = 'Not Greg';
91
+ person.greeting; // Hi, I'm Not Greg
92
+ ```
package/dist/core.mjs ADDED
@@ -0,0 +1,617 @@
1
+ const U = /* @__PURE__ */ new Set();
2
+ let ee;
3
+ function be() {
4
+ return [...U];
5
+ }
6
+ function we() {
7
+ return be().at(-1);
8
+ }
9
+ function te() {
10
+ ee = we();
11
+ }
12
+ function ne(e) {
13
+ e && (U.add(e), te());
14
+ }
15
+ function Oe(e) {
16
+ U.delete(e), te();
17
+ }
18
+ function P() {
19
+ return ee;
20
+ }
21
+ const re = /* @__PURE__ */ new WeakMap();
22
+ function ce(e) {
23
+ var t;
24
+ return (((t = P()) == null ? void 0 : t.toRaw) ?? (() => e))(e);
25
+ }
26
+ function S(e) {
27
+ re.set(ce(e), Date.now());
28
+ }
29
+ function Ce(e) {
30
+ return re.get(ce(e));
31
+ }
32
+ function _(e, n, t) {
33
+ var a;
34
+ const r = P();
35
+ if (!r)
36
+ throw new Error("No integration specified");
37
+ typeof t.get == "function" && (r != null && r.defineComputed) ? r.defineComputed(e, n, {
38
+ get: t.get.bind(e),
39
+ set: (a = t.set) == null ? void 0 : a.bind(e),
40
+ enumerable: t.enumerable,
41
+ configurable: t.configurable,
42
+ cache: t.cache ?? !0
43
+ }) : !t.get && (r != null && r.defineProperty) && r.defineProperty(e, n, {
44
+ value: t.value,
45
+ enumerable: t.enumerable,
46
+ configurable: t.configurable,
47
+ deep: t.deep
48
+ });
49
+ }
50
+ function Re(e, n) {
51
+ var a, f;
52
+ const t = Object.getOwnPropertyDescriptors(e), r = (u, d) => {
53
+ var l;
54
+ return (l = n == null ? void 0 : n[u]) == null ? void 0 : l[d];
55
+ };
56
+ for (const [u, d] of Object.entries(t))
57
+ _(e, u, {
58
+ get: (a = d.get) == null ? void 0 : a.bind(e),
59
+ set: (f = d.set) == null ? void 0 : f.bind(e),
60
+ value: r(u, "value") ?? d.value,
61
+ enumerable: r(u, "enumerable") ?? d.enumerable,
62
+ configurable: r(u, "configurable") ?? d.configurable,
63
+ cache: r(u, "cache") ?? !0,
64
+ deep: r(u, "deep") ?? !0
65
+ });
66
+ return e;
67
+ }
68
+ function ye(e, n, t) {
69
+ var a;
70
+ const r = P();
71
+ return (a = r == null ? void 0 : r.watch) == null ? void 0 : a.call(r, e, n, t);
72
+ }
73
+ const Y = Symbol("keys"), D = Symbol("computed"), K = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
74
+ let B = [], N = null;
75
+ const Se = (e) => K.has(e), ae = (e) => X.has(e), k = (e) => K.get(e), Pe = (e) => X.get(e), Ie = (e) => ae(e) ? Pe(e) : e, Te = (e, n) => {
76
+ K.set(e, n), X.set(n, e);
77
+ }, _e = () => {
78
+ N === null && (N = setTimeout(() => {
79
+ const e = B;
80
+ for (B = []; e.length > 0; )
81
+ e.shift()();
82
+ N = null;
83
+ }));
84
+ }, Ee = (e) => {
85
+ B.push(e), _e();
86
+ }, ue = (e, n) => {
87
+ const t = R.get(e), r = t == null ? void 0 : t.get(n);
88
+ if (r) {
89
+ for (const a of r)
90
+ C.get(a).delete(e);
91
+ r.clear(), t.delete(n), t.size === 0 && R.delete(e);
92
+ }
93
+ }, se = (e, n) => {
94
+ const t = Me();
95
+ if (!t)
96
+ return;
97
+ R.has(t) || R.set(t, /* @__PURE__ */ new Map()), C.has(e) || C.set(e, /* @__PURE__ */ new Map());
98
+ const r = C.get(e), a = R.get(t);
99
+ r.has(n) || r.set(n, /* @__PURE__ */ new Set()), a.has(n) || a.set(n, /* @__PURE__ */ new Set());
100
+ const f = r.get(n), u = a.get(n);
101
+ f.add(t), u.add(e);
102
+ }, ie = (e, n) => {
103
+ const t = k(e);
104
+ t && se(t, n);
105
+ }, fe = (e, n) => {
106
+ const t = C.get(e);
107
+ if (t != null && t.get(n))
108
+ for (const r of t.get(n))
109
+ r.setDirty(), ue(r, n);
110
+ }, y = (e, n) => {
111
+ fe(k(e), n);
112
+ }, W = [];
113
+ function Me() {
114
+ return W.at(-1);
115
+ }
116
+ class x {
117
+ static create(...n) {
118
+ return new x(...n);
119
+ }
120
+ constructor(n) {
121
+ 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 = {
122
+ onGet: n.onGet,
123
+ onSet: n.onSet,
124
+ onChange: n.onChange,
125
+ onImmediateChange: n.onImmediateChange
126
+ };
127
+ }
128
+ callHook(n) {
129
+ typeof this.hooks[n] == "function" && this.hooks[n](this);
130
+ }
131
+ /**
132
+ * Stop observing and dispose of the observer
133
+ * @returns {void}
134
+ */
135
+ dispose() {
136
+ ue(this, D), this.alive = !1, this.dirty = !1, this.cachedVal = void 0, this.prev = void 0;
137
+ }
138
+ wrap(n) {
139
+ W.push(this);
140
+ const t = n();
141
+ return W.pop(), t;
142
+ }
143
+ setHook(n, t) {
144
+ this.hooks[n] = t;
145
+ }
146
+ setDirty() {
147
+ this.alive && !this.dirty && (this.dirty = !0, fe(this, D), this.prev = this.cachedVal, this.callHook(
148
+ "onImmediateChange"
149
+ /* onImmediateChange */
150
+ ), Ee(() => this.notifyChange()));
151
+ }
152
+ notifyChange() {
153
+ this.callHook(
154
+ "onChange"
155
+ /* onChange */
156
+ ), this.prev = void 0;
157
+ }
158
+ run() {
159
+ if (!this.alive)
160
+ return;
161
+ const n = this.wrap(() => ((this.cache && this.dirty || !this.cache) && (this.cachedVal = this.get(), this.dirty = !1), this.cachedVal));
162
+ return se(this, D), this.callHook(
163
+ "onGet"
164
+ /* onGet */
165
+ ), n;
166
+ }
167
+ /** The value of the observer */
168
+ get value() {
169
+ return this.run();
170
+ }
171
+ set value(n) {
172
+ if (typeof this.set == "function")
173
+ this.set(n), this.callHook(
174
+ "onSet"
175
+ /* onSet */
176
+ );
177
+ else
178
+ throw new TypeError(`No setter defined for "${this.name}"`);
179
+ }
180
+ }
181
+ function de(...e) {
182
+ return x.create(...e);
183
+ }
184
+ function Ae(e) {
185
+ return de(e);
186
+ }
187
+ const E = (e) => {
188
+ const {
189
+ name: n,
190
+ target: t,
191
+ key: r,
192
+ receiver: a,
193
+ value: f,
194
+ keysChanged: u = !1,
195
+ valueChanged: d = !1
196
+ } = e;
197
+ return {
198
+ name: n,
199
+ target: t,
200
+ key: r,
201
+ receiver: a,
202
+ value: f,
203
+ keysChanged: u,
204
+ valueChanged: d
205
+ };
206
+ }, Ge = (e, n, t, r) => {
207
+ var a;
208
+ ie(n, t), (a = e == null ? void 0 : e.onGet) == null || a.call(
209
+ e,
210
+ E({
211
+ name: e.name,
212
+ target: n,
213
+ key: t,
214
+ receiver: r
215
+ })
216
+ );
217
+ }, He = (e, n, t, r) => {
218
+ var l;
219
+ const a = n[t], f = Array.isArray(n);
220
+ let u = !1, d = !1;
221
+ t in n || (y(n, Y), d = !0, f && y(n, "length")), (a !== r || f) && (y(n, t), u = !0), (d || u) && ((l = e == null ? void 0 : e.onSet) == null || l.call(
222
+ e,
223
+ E({
224
+ name: e.name,
225
+ target: n,
226
+ key: t,
227
+ value: r,
228
+ keysChanged: d,
229
+ valueChanged: u
230
+ })
231
+ ));
232
+ }, De = (e, n, t) => {
233
+ var r;
234
+ y(n, t), y(n, Y), (r = e == null ? void 0 : e.onDelete) == null || r.call(
235
+ e,
236
+ E({
237
+ name: e.name,
238
+ target: n,
239
+ key: t,
240
+ keysChanged: !0
241
+ })
242
+ );
243
+ }, J = (e, n, t) => {
244
+ var r;
245
+ ie(n, Y), (r = e == null ? void 0 : e.onHas) == null || r.call(
246
+ e,
247
+ E({
248
+ name: e.name,
249
+ target: n,
250
+ key: t
251
+ })
252
+ );
253
+ };
254
+ function oe(e) {
255
+ const n = e.needsProxy || (() => !0);
256
+ return {
257
+ get: (t, r, a) => {
258
+ var u;
259
+ Ge(e, t, r, a);
260
+ const f = Reflect.get(t, r, a);
261
+ return n({ target: t, key: r, value: f }) && (e != null && e.deep) && ((u = Object.getOwnPropertyDescriptor(t, r)) != null && u.configurable) ? w(f, e) : f;
262
+ },
263
+ set: (t, r, a) => (He(e, t, r, a), Reflect.set(t, r, a)),
264
+ deleteProperty: (...t) => (De(e, ...t), Reflect.deleteProperty(...t)),
265
+ has: (t, r) => (J(e, t), Reflect.has(t, r)),
266
+ ownKeys: (t) => (J(e, t), Reflect.ownKeys(t)),
267
+ getPrototypeOf: (t) => Object.getPrototypeOf(t)
268
+ };
269
+ }
270
+ const Ne = (e) => ({
271
+ ...oe(e)
272
+ }), Ve = (e) => ({
273
+ ...oe(e)
274
+ }), I = Object.freeze({
275
+ object: Ne,
276
+ array: Ve
277
+ // set: setHandler,
278
+ // map: mapHandler,
279
+ // weakset: weaksetHandler,
280
+ // weakmap: weakmapHandler,
281
+ });
282
+ function w(e, n) {
283
+ if (Se(e))
284
+ return k(e);
285
+ if (ae(e))
286
+ return e;
287
+ const t = n || {}, r = { ...t, deep: (t == null ? void 0 : t.deep) ?? !0 }, a = w.getStringType(e);
288
+ if (!w.hasHandler(a))
289
+ return e;
290
+ const f = new Proxy(e, w.typeHandler(a, r));
291
+ return Te(e, f), f;
292
+ }
293
+ w.getStringType = (e) => Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
294
+ w.hasHandler = (e) => !!I[e];
295
+ w.typeHandler = (e, n) => {
296
+ var t;
297
+ return (t = I[e]) == null ? void 0 : t.call(I, n);
298
+ };
299
+ function z(e, n, t) {
300
+ const r = de({
301
+ get: e,
302
+ onChange: ({ value: f, prev: u }) => n(f, u)
303
+ }), a = r.run();
304
+ return t != null && t.immediate && n(a), () => r.dispose();
305
+ }
306
+ function M(e, n, t) {
307
+ var f, u, d, l;
308
+ let r, a;
309
+ if (n.cache) {
310
+ const m = Ae({
311
+ ...n,
312
+ get: n.get,
313
+ name: e,
314
+ onImmediateChange: (f = t == null ? void 0 : t.computed) == null ? void 0 : f.onImmediateChange,
315
+ onChange: (u = t == null ? void 0 : t.computed) == null ? void 0 : u.onChange,
316
+ onGet: (d = t == null ? void 0 : t.computed) == null ? void 0 : d.onGet,
317
+ onSet: (l = t == null ? void 0 : t.computed) == null ? void 0 : l.onSet
318
+ });
319
+ r = function() {
320
+ return S(this), m.value;
321
+ }, a = function(g) {
322
+ m.value = g;
323
+ };
324
+ } else
325
+ r = function() {
326
+ return S(this), n.get.call(this);
327
+ }, a = function(...h) {
328
+ n.set.call(this, ...h);
329
+ };
330
+ return {
331
+ enumerable: n.enumerable,
332
+ configurable: n.configurable,
333
+ get: r,
334
+ set: a
335
+ };
336
+ }
337
+ function A(e, n, t) {
338
+ var f, u, d, l, m, h;
339
+ const r = { value: n.value }, a = w(r, {
340
+ name: e,
341
+ onGet: (f = t == null ? void 0 : t.reactive) == null ? void 0 : f.onGet,
342
+ onHas: (u = t == null ? void 0 : t.reactive) == null ? void 0 : u.onHas,
343
+ onSet: (d = t == null ? void 0 : t.reactive) == null ? void 0 : d.onSet,
344
+ onDelete: (l = t == null ? void 0 : t.reactive) == null ? void 0 : l.onDelete,
345
+ needsProxy: (m = t == null ? void 0 : t.reactive) == null ? void 0 : m.needsProxy,
346
+ deep: n.deep ?? ((h = t == null ? void 0 : t.reactive) == null ? void 0 : h.deep)
347
+ });
348
+ return {
349
+ configurable: n.configurable,
350
+ enumerable: n.enumerable,
351
+ get: function() {
352
+ S(this);
353
+ const { value: v } = a;
354
+ return Array.isArray(v) && Reflect.get(v, "length"), v;
355
+ },
356
+ set: function(v) {
357
+ a.value = v;
358
+ }
359
+ };
360
+ }
361
+ function F(e, n, t, r) {
362
+ Object.defineProperty(e, n, M(n, t, r));
363
+ }
364
+ function p(e, n, t, r) {
365
+ Object.defineProperty(e, n, A(n, t, r));
366
+ }
367
+ const q = {
368
+ toRaw: Ie,
369
+ watch: z,
370
+ describeProperty: A,
371
+ defineProperty: p,
372
+ describeComputed: M,
373
+ defineComputed: F
374
+ }, V = /* @__PURE__ */ new Set(["__proto__", "__ob__"]), O = "value";
375
+ function je(e) {
376
+ const { observable: n, set: t } = e, r = /* @__PURE__ */ new WeakMap(), a = (c, s) => {
377
+ let o = r.get(c);
378
+ o || (o = /* @__PURE__ */ new Map(), r.set(c, o));
379
+ let b = o.get(s);
380
+ return b || (b = n({ [O]: 0 }), o.set(s, b)), b;
381
+ }, f = t ? (c) => t(c, O, c[O] + 1) : (c) => {
382
+ c[O] += 1;
383
+ }, u = (c, s) => {
384
+ V.has(s) || Reflect.get(a(c, s), O);
385
+ }, d = (c, s) => {
386
+ V.has(s) || f(a(c, s));
387
+ }, l = (c, s) => {
388
+ const o = r.get(c);
389
+ o && d(o, s), r.delete(c);
390
+ }, g = {
391
+ computed: {
392
+ onGet: (c) => {
393
+ u(c, c.name);
394
+ },
395
+ onImmediateChange: (c) => {
396
+ d(c, c.name);
397
+ }
398
+ },
399
+ reactive: {
400
+ onGet: ({ target: c, key: s }) => {
401
+ S(c), u(c, s);
402
+ },
403
+ onHas: ({ target: c, key: s }) => {
404
+ u(c, s);
405
+ },
406
+ onDelete: ({ target: c, key: s }) => {
407
+ l(c, s);
408
+ },
409
+ onSet: ({ target: c, key: s, keysChanged: o }) => {
410
+ d(c, s), o && d(c);
411
+ },
412
+ needsProxy: ({ key: c }) => !V.has(c)
413
+ }
414
+ };
415
+ function v(c, s) {
416
+ return M(c, s, g);
417
+ }
418
+ function G(c, s) {
419
+ return A(c, s, g);
420
+ }
421
+ function H(c, s, o) {
422
+ return F(c, s, o, g);
423
+ }
424
+ function i(c, s, o) {
425
+ return p(c, s, o, g);
426
+ }
427
+ return {
428
+ toRaw: q.toRaw,
429
+ watch: z,
430
+ describeProperty: G,
431
+ defineProperty: i,
432
+ describeComputed: v,
433
+ defineComputed: H
434
+ };
435
+ }
436
+ const $ = /* @__PURE__ */ new Set(["__proto__", "__ob__"]), j = "value", $e = (e) => {
437
+ e[j] += 1;
438
+ };
439
+ function Ue({ reactive: e, toRaw: n } = {}) {
440
+ const t = n ?? ((i) => i), r = /* @__PURE__ */ new WeakMap(), a = (i, c) => {
441
+ const s = t(i);
442
+ let o = r.get(s);
443
+ o || (o = /* @__PURE__ */ new Map(), r.set(s, o));
444
+ let b = o.get(c);
445
+ return b || (b = e({ [j]: 0 }), o.set(c, b)), b;
446
+ }, f = (i, c) => {
447
+ $.has(c) || Reflect.get(a(i, c), j);
448
+ }, u = (i, c) => {
449
+ $.has(c) || $e(a(i, c));
450
+ }, d = (i, c) => {
451
+ const s = t(i), o = r.get(s);
452
+ o && u(o, c), r.delete(s);
453
+ }, h = {
454
+ computed: {
455
+ onGet: (i) => {
456
+ f(i, i.name);
457
+ },
458
+ onImmediateChange: (i) => {
459
+ u(i, i.name);
460
+ }
461
+ },
462
+ reactive: {
463
+ onGet: ({ target: i, key: c }) => {
464
+ S(i), f(i, c);
465
+ },
466
+ onHas: ({ target: i, key: c }) => {
467
+ f(i, c);
468
+ },
469
+ onDelete: ({ target: i, key: c }) => {
470
+ d(i, c);
471
+ },
472
+ onSet: ({ target: i, key: c, keysChanged: s }) => {
473
+ u(i, c), s && u(i);
474
+ },
475
+ needsProxy: ({ key: i }) => !$.has(i)
476
+ }
477
+ };
478
+ function g(i, c) {
479
+ return M(i, c, h);
480
+ }
481
+ function v(i, c) {
482
+ return A(i, c, h);
483
+ }
484
+ function G(i, c, s) {
485
+ return F(i, c, s, h);
486
+ }
487
+ function H(i, c, s) {
488
+ return p(i, c, s, h);
489
+ }
490
+ return {
491
+ toRaw: q.toRaw,
492
+ watch: z,
493
+ describeProperty: v,
494
+ defineProperty: H,
495
+ describeComputed: g,
496
+ defineComputed: G
497
+ };
498
+ }
499
+ function Le(...e) {
500
+ const n = {}, t = {};
501
+ for (const r of e) {
502
+ const a = typeof r == "function" ? r() : r;
503
+ Object.assign(n, Object.getOwnPropertyDescriptors(a ?? r ?? {}));
504
+ }
505
+ return Object.defineProperties(t, n), t;
506
+ }
507
+ function Be(e, n) {
508
+ Object.defineProperties(
509
+ e.prototype,
510
+ Object.getOwnPropertyDescriptors(Le(...[...n, e].map((t) => t.prototype)))
511
+ );
512
+ }
513
+ const T = /* @__PURE__ */ new WeakMap();
514
+ function Ye(...e) {
515
+ return (n) => {
516
+ e != null && e.length && Be(n, e);
517
+ };
518
+ }
519
+ function le(e) {
520
+ T.has(e) || T.set(e, /* @__PURE__ */ new Set());
521
+ }
522
+ function he(e, n) {
523
+ return le(e), T.get(e).has(n);
524
+ }
525
+ function ge(e, n) {
526
+ le(e), T.get(e).add(n);
527
+ }
528
+ function Z(e, n, t, r) {
529
+ var f;
530
+ return P() && !he(e, n) ? (_(e, n, {
531
+ ...t,
532
+ get: t.get.bind(e),
533
+ set: (f = t.set) == null ? void 0 : f.bind(e),
534
+ enumerable: !0,
535
+ ...r == null ? void 0 : r.descriptors,
536
+ cache: !0
537
+ }), ge(e, n), !0) : !1;
538
+ }
539
+ function me(e, n, t, r) {
540
+ if (typeof t.get == "function") {
541
+ const a = {
542
+ ...t,
543
+ enumerable: !0,
544
+ configurable: !0
545
+ };
546
+ return a.get = function() {
547
+ return Z(this, n, t, r), this[n];
548
+ }, a.set = function(u) {
549
+ Z(this, n, t, r), this[n] = u;
550
+ }, a;
551
+ }
552
+ return t;
553
+ }
554
+ function We(e, n, t) {
555
+ return me(e, n, t);
556
+ }
557
+ We.configure = function(n) {
558
+ return (t, r, a) => me(t, r, a, { descriptors: n });
559
+ };
560
+ function L(e, n, t) {
561
+ return P() && !he(e, n) ? (ge(e, n), _(e, n, {
562
+ ...Object.getOwnPropertyDescriptor(e, n),
563
+ enumerable: !0,
564
+ ...t == null ? void 0 : t.descriptors
565
+ }), !0) : !1;
566
+ }
567
+ function Q(e, n, t) {
568
+ typeof e == "function" ? L(e, n) : Object.defineProperty(e, n, {
569
+ configurable: !0,
570
+ enumerable: !0,
571
+ get() {
572
+ if (L(this, n, t))
573
+ return this[n];
574
+ },
575
+ set(r) {
576
+ L(this, n, t) && (this[n] = r);
577
+ }
578
+ });
579
+ }
580
+ function ve(e, n) {
581
+ return Q(e, n);
582
+ }
583
+ ve.shallow = function(n, t) {
584
+ return Q(n, t, { descriptors: { deep: !1 } });
585
+ };
586
+ ve.configure = function(n) {
587
+ return (t, r) => Q(t, r, { descriptors: n });
588
+ };
589
+ ne(q);
590
+ const Ke = {
591
+ /** Configure a global plugin */
592
+ use: ne,
593
+ /** Remove a global plugin */
594
+ unuse: Oe,
595
+ /** Create reactive objects */
596
+ auto: Re,
597
+ /** Define properties on objects */
598
+ define: _,
599
+ /** Watch reactive objects */
600
+ watch: ye,
601
+ /** Get the last time any reactive property was touched on a given object */
602
+ lastAccessed: Ce
603
+ };
604
+ export {
605
+ q as MadroneState,
606
+ je as MadroneVue2,
607
+ Ue as MadroneVue3,
608
+ Be as applyClassMixins,
609
+ Re as auto,
610
+ Ye as classMixin,
611
+ We as computed,
612
+ Ke as default,
613
+ Le as merge,
614
+ ve as reactive,
615
+ ce as toRaw,
616
+ ye as watch
617
+ };