ivue 0.1.0 → 0.1.1

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.
@@ -8,7 +8,7 @@ export default {
8
8
  import { getCurrentScope } from 'vue'
9
9
  import { init } from '@/index';
10
10
  import { Test } from '../tests/Test'
11
- import { Mouse } from 'demo/tests/Mouse';
11
+ import { Mouse } from '../tests/Mouse';
12
12
  import { inject, reactive, toRaw } from 'vue'
13
13
  import { ivue } from '../../src/ivue';
14
14
  const emit = defineEmits<{
package/dist/index.es.js CHANGED
@@ -209,25 +209,22 @@ function J(t2, e2, n2, r2) {
209
209
  return new Proxy(t2, { get: (e3, n3) => n3 in u2 ? u2[n3] : n3 in e3 ? e3[n3].bind(t2) : void 0 });
210
210
  };
211
211
  }
212
- function z(t2) {
213
- return !!e() && (i(t2), true);
214
- }
215
- const A = (t2) => {
212
+ const z = (t2) => {
216
213
  let e2 = u(t2), n2 = Object.getOwnPropertyNames(e2);
217
214
  for (let t3 = 0; t3 < n2.length; t3++)
218
215
  delete e2[n2[t3]];
219
216
  e2 = null, n2 = null;
220
217
  };
221
- class U {
218
+ class A {
222
219
  constructor(t2) {
223
220
  __publicField(this, "to");
224
221
  __publicField(this, "scope", "singleton");
225
222
  __publicField(this, "type", "generic");
226
- __publicField(this, "onInit", q);
223
+ __publicField(this, "onInit", K);
227
224
  this.from = t2, this.to = t2;
228
225
  }
229
226
  }
230
- class K {
227
+ class U {
231
228
  constructor() {
232
229
  __publicField(this, "transients", /* @__PURE__ */ new WeakMap());
233
230
  __publicField(this, "singletons", /* @__PURE__ */ new WeakMap());
@@ -237,7 +234,7 @@ class K {
237
234
  __publicField(this, "current");
238
235
  }
239
236
  bind(t2) {
240
- return this.current = new U(t2), this;
237
+ return this.current = new A(t2), this;
241
238
  }
242
239
  to(t2) {
243
240
  return this.current.to = t2, this;
@@ -270,97 +267,97 @@ class K {
270
267
  let n2 = this.transients.get(t2);
271
268
  return n2 || (this.bind(t2).transient(), n2 = this.transients.get(t2)), n2.onInit(n2, ...e2);
272
269
  }
273
- use(i2, ...s2) {
274
- let u2, a2, f2, l2, h2, p2, b2;
275
- if (this.subscribers.set(i2, (this.subscribers.get(i2) || 0) + 1), z(() => {
270
+ use(s2, ...u2) {
271
+ let a2, f2, l2, h2, p2, b2, g2, d2 = e();
272
+ if (this.subscribers.set(s2, (this.subscribers.get(s2) || 0) + 1), d2 && i(() => {
276
273
  var _a;
277
- const t2 = (this.subscribers.get(i2) || 0) - 1;
278
- if (this.subscribers.set(i2, t2), this.effectScopes.has(i2) && t2 <= 0) {
274
+ const t2 = (this.subscribers.get(s2) || 0) - 1;
275
+ if (this.subscribers.set(s2, t2), this.effectScopes.has(s2) && t2 <= 0) {
279
276
  let t3;
280
- if ((_a = this.effectScopes.get(i2)) == null ? void 0 : _a.stop(), f2)
281
- for (t3 in f2)
282
- delete f2[t3];
283
- if (h2)
284
- for (t3 in h2)
285
- h2[t3] = null;
277
+ if ((_a = this.effectScopes.get(s2)) == null ? void 0 : _a.stop(), l2)
278
+ for (t3 in l2)
279
+ delete l2[t3];
286
280
  if (p2)
287
281
  for (t3 in p2)
288
- p2[t3] = null;
282
+ delete p2[t3];
289
283
  if (b2)
290
284
  for (t3 in b2)
291
- b2[t3] = null;
292
- f2 && A(f2), u2 = a2 = f2 = h2 = p2 = b2 = t3 = null, this.effectScopes.delete(i2), this.instances.delete(i2), this.subscribers.delete(i2), F.debug && console.log("ivue.kernel: instance deleted:", i2.name);
285
+ delete b2[t3];
286
+ if (g2)
287
+ for (t3 in g2)
288
+ delete g2[t3];
289
+ l2 && z(l2), d2 = a2 = f2 = l2 = p2 = b2 = g2 = t3 = null, this.effectScopes.delete(s2), this.instances.delete(s2), this.subscribers.delete(s2), F.debug && console.log("ivue.kernel: instance deleted:", s2.name);
293
290
  }
294
- }), this.instances.has(i2))
295
- return this.instances.get(i2);
291
+ }), this.instances.has(s2))
292
+ return this.instances.get(s2);
296
293
  {
297
- if (a2 = this.singletons.get(i2), a2) {
298
- if ("ivue" !== a2.type)
299
- throw new Error("ivue.kernel: use(" + E(i2) + ") method should be used only with 'ivue' mappings, use get(" + E(i2) + ") method for standard JavaScript singleton Kernel mappings.");
294
+ if (f2 = this.singletons.get(s2), f2) {
295
+ if ("ivue" !== f2.type)
296
+ throw new Error("ivue.kernel: use(" + E(s2) + ") method should be used only with 'ivue' mappings, use get(" + E(s2) + ") method for standard JavaScript singleton Kernel mappings.");
300
297
  } else
301
- this.bind(i2).singleton().ivue(), a2 = this.singletons.get(i2);
302
- if (u2 = n(!!e()), this.effectScopes.set(i2, u2), S.before.has(a2.to) && (p2 = { mapping: a2, self: null, return: null, name: a2.to.constructor.name, args: s2 }, true === k("before", a2.to, p2)))
303
- return this.instances.set(i2, p2.return), p2.return;
304
- l2 = P(a2.to.prototype), h2 = l2.size ? {} : null;
305
- let f3 = new Proxy(r(new i2(...s2)), { get: (t2, e2) => {
298
+ this.bind(s2).singleton().ivue(), f2 = this.singletons.get(s2);
299
+ if (a2 = n(!!d2), this.effectScopes.set(s2, a2), S.before.has(f2.to) && (b2 = { mapping: f2, self: null, return: null, name: f2.to.constructor.name, args: u2 }, true === k("before", f2.to, b2)))
300
+ return this.instances.set(s2, b2.return), b2.return;
301
+ h2 = P(f2.to.prototype), p2 = h2.size ? {} : null;
302
+ let i2 = new Proxy(r(new s2(...u2)), { get: (t2, e2) => {
306
303
  var _a, _b;
307
- return l2.has(e2) && ((_b = (_a = f3.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[e2]) !== R.OFF ? (e2 in h2 || (u2 == null ? void 0 : u2.run(() => h2[e2] = o(() => l2.get(e2).get.bind(f3)()))), h2[e2].value) : "toRefs" === e2 ? J(f3, l2, h2, u2) : t2[e2];
304
+ return h2.has(e2) && ((_b = (_a = i2.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[e2]) !== R.OFF ? (e2 in p2 || (a2 == null ? void 0 : a2.run(() => p2[e2] = o(() => h2.get(e2).get.bind(i2)()))), p2[e2].value) : "toRefs" === e2 ? J(i2, h2, p2, a2) : t2[e2];
308
305
  } });
309
- if ("behavior" in f3.constructor) {
310
- for (const e2 in f3.constructor.behavior)
311
- if (!l2.has(e2))
312
- if ("function" == typeof f3[e2]) {
313
- if (f3.constructor.behavior[e2] === R.OFF)
306
+ if ("behavior" in i2.constructor) {
307
+ for (const e2 in i2.constructor.behavior)
308
+ if (!h2.has(e2))
309
+ if ("function" == typeof i2[e2]) {
310
+ if (i2.constructor.behavior[e2] === R.OFF)
314
311
  continue;
315
- y(b2) || (b2 = {}), b2[e2] = f3[e2], $(a2, f3.constructor.behavior[e2], b2[e2], f3, e2, u2, p2);
312
+ y(g2) || (g2 = {}), g2[e2] = i2[e2], $(f2, i2.constructor.behavior[e2], g2[e2], i2, e2, a2, b2);
316
313
  } else
317
- f3.constructor.behavior[e2] === R.OFF && (f3 == null ? void 0 : f3[e2]) && "object" == typeof f3[e2] && (f3[e2] = t(f3[e2]));
314
+ i2.constructor.behavior[e2] === R.OFF && (i2 == null ? void 0 : i2[e2]) && "object" == typeof i2[e2] && (i2[e2] = t(i2[e2]));
318
315
  }
319
- return S.after.has(a2.to) && (p2 = { mapping: a2, self: f3, name: a2.to.constructor.name, return: f3, args: s2 }, true === k("after", a2.to, p2)) ? (this.instances.set(i2, p2.return), p2.return) : ("init" in f3 && u2.run(() => f3.init()), this.instances.set(i2, f3), F.debug && console.log("ivue.kernel: instance created:", i2.name, "current scope", e(), "current instance", c()), f3);
316
+ return S.after.has(f2.to) && (b2 = { mapping: f2, self: i2, name: f2.to.constructor.name, return: i2, args: u2 }, true === k("after", f2.to, b2)) ? (this.instances.set(s2, b2.return), b2.return) : ("init" in i2 && a2.run(() => i2.init()), this.instances.set(s2, i2), F.debug && console.log("ivue.kernel: instance created:", s2.name, "current scope", e(), "current instance", c()), i2);
320
317
  }
321
318
  }
322
- init(i2, ...s2) {
323
- let u2 = this.transients.get(i2);
324
- if (u2) {
325
- if ("ivue" !== u2.type)
326
- throw new Error("ivue.kernel: init(" + E(i2) + ") method should be used only with 'ivue' mappings, use make(" + E(i2) + ") method for standard JavaScript transient Kernel mappings.");
319
+ init(s2, ...u2) {
320
+ let c2 = this.transients.get(s2);
321
+ if (c2) {
322
+ if ("ivue" !== c2.type)
323
+ throw new Error("ivue.kernel: init(" + E(s2) + ") method should be used only with 'ivue' mappings, use make(" + E(s2) + ") method for standard JavaScript transient Kernel mappings.");
327
324
  } else
328
- this.bind(i2).transient().ivue(), u2 = this.transients.get(i2);
329
- let c2, a2, f2, l2 = n(!!e());
330
- if (S.before.has(u2.to) && (c2 = { mapping: u2, self: null, return: null, name: u2.to.constructor.name, args: s2 }, true === k("before", u2.to, c2)))
331
- return c2.return;
332
- let h2 = P(u2.to.prototype);
333
- a2 = h2.size ? {} : null;
334
- let p2 = new Proxy(r(new i2(...s2)), { get: (t2, e2) => {
325
+ this.bind(s2).transient().ivue(), c2 = this.transients.get(s2);
326
+ let a2, f2, l2, h2 = e(), p2 = n(!!h2);
327
+ if (S.before.has(c2.to) && (a2 = { mapping: c2, self: null, return: null, name: c2.to.constructor.name, args: u2 }, true === k("before", c2.to, a2)))
328
+ return a2.return;
329
+ let b2 = P(c2.to.prototype);
330
+ f2 = b2.size ? {} : null;
331
+ let g2 = new Proxy(r(new s2(...u2)), { get: (t2, e2) => {
335
332
  var _a, _b;
336
- return h2.has(e2) && ((_b = (_a = p2.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[e2]) !== R.OFF ? (e2 in a2 || (l2 == null ? void 0 : l2.run(() => a2[e2] = o(() => h2.get(e2).get.bind(p2)()))), a2[e2].value) : "toRefs" === e2 ? J(p2, h2, a2, l2) : t2[e2];
333
+ return b2.has(e2) && ((_b = (_a = g2.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[e2]) !== R.OFF ? (e2 in f2 || (p2 == null ? void 0 : p2.run(() => f2[e2] = o(() => b2.get(e2).get.bind(g2)()))), f2[e2].value) : "toRefs" === e2 ? J(g2, b2, f2, p2) : t2[e2];
337
334
  } });
338
- if ("behavior" in p2.constructor) {
339
- for (const e2 in p2.constructor.behavior)
340
- if (!h2.has(e2))
341
- if ("function" == typeof p2[e2]) {
342
- if (p2.constructor.behavior[e2] === R.OFF)
335
+ if ("behavior" in g2.constructor) {
336
+ for (const e2 in g2.constructor.behavior)
337
+ if (!b2.has(e2))
338
+ if ("function" == typeof g2[e2]) {
339
+ if (g2.constructor.behavior[e2] === R.OFF)
343
340
  continue;
344
- y(f2) || (f2 = {}), f2[e2] = p2[e2], $(u2, p2.constructor.behavior[e2], f2[e2], p2, e2, l2, c2);
341
+ y(l2) || (l2 = {}), l2[e2] = g2[e2], $(c2, g2.constructor.behavior[e2], l2[e2], g2, e2, p2, a2);
345
342
  } else
346
- p2.constructor.behavior[e2] === R.OFF && (p2 == null ? void 0 : p2[e2]) && "object" == typeof p2[e2] && (p2[e2] = t(p2[e2]));
343
+ g2.constructor.behavior[e2] === R.OFF && (g2 == null ? void 0 : g2[e2]) && "object" == typeof g2[e2] && (g2[e2] = t(g2[e2]));
347
344
  }
348
- return S.after.has(u2.to) && (c2 = { mapping: u2, self: p2, return: p2, name: u2.to.constructor.name, args: s2 }, true === k("after", u2.to, c2)) ? c2.return : ("init" in p2 && l2.run(() => p2.init()), z(() => {
345
+ return S.after.has(c2.to) && (a2 = { mapping: c2, self: g2, return: g2, name: c2.to.constructor.name, args: u2 }, true === k("after", c2.to, a2)) ? a2.return : ("init" in g2 && p2.run(() => g2.init()), h2 && i(() => {
349
346
  let t2;
350
- if (l2 == null ? void 0 : l2.stop(), A(p2), c2)
351
- for (t2 in c2)
352
- c2[t2] = null;
353
- if (a2)
347
+ if (p2 == null ? void 0 : p2.stop(), z(g2), a2)
354
348
  for (t2 in a2)
355
- a2[t2] = null;
349
+ delete a2[t2];
356
350
  if (f2)
357
351
  for (t2 in f2)
358
- f2[t2] = null;
359
- l2 = p2 = u2 = a2 = c2 = f2 = t2 = null;
360
- }), p2);
352
+ delete f2[t2];
353
+ if (l2)
354
+ for (t2 in l2)
355
+ delete l2[t2];
356
+ h2 = p2 = g2 = c2 = f2 = a2 = l2 = t2 = null;
357
+ }), g2);
361
358
  }
362
359
  }
363
- function q(t2, ...r2) {
360
+ function K(t2, ...r2) {
364
361
  if (S.before.has(t2.to)) {
365
362
  const e2 = { mapping: t2, self: null, return: null, name: t2.to.constructor.name, args: r2 };
366
363
  if (true === k("before", t2.to, e2))
@@ -383,48 +380,49 @@ function q(t2, ...r2) {
383
380
  }
384
381
  return i2;
385
382
  }
386
- function B(t2, o2, ...i2) {
387
- let s2 = n(!!e()), u2 = P(Reflect.getPrototypeOf(o2)), c2 = u2.value ? {} : null, a2 = W(r(Object.create(o2)), u2, c2, s2, ...i2);
388
- return "function" == typeof a2.init && s2.run(() => a2.init()), z(() => {
389
- s2 == null ? void 0 : s2.stop(), A(a2), s2 = a2 = null;
390
- }), a2;
383
+ function q(t2, o2, ...s2) {
384
+ let u2 = n(!!e()), c2 = P(Reflect.getPrototypeOf(o2)), a2 = c2.value ? {} : null, f2 = W(r(Object.create(o2)), c2, a2, u2, ...s2);
385
+ var l2;
386
+ return "function" == typeof f2.init && u2.run(() => f2.init()), l2 = () => {
387
+ u2 == null ? void 0 : u2.stop(), z(f2), u2 = f2 = null;
388
+ }, e() && i(l2), f2;
391
389
  }
392
- const G = new K(), H = G.bind.bind(G), L = G.get.bind(G), Q = G.make.bind(G), V = G.use.bind(G), X = G.init.bind(G);
393
- class Y {
390
+ const B = new U(), G = B.bind.bind(B), H = B.get.bind(B), L = B.make.bind(B), Q = B.use.bind(B), V = B.init.bind(B);
391
+ class X {
394
392
  constructor() {
395
393
  __publicField(this, "$");
396
394
  __publicField(this, "capsule");
397
395
  }
398
396
  useCapsule(e2 = []) {
399
- this.$ = V(this.capsule, this, ...e2), t(this.$);
397
+ this.$ = Q(this.capsule, this, ...e2), t(this.$);
400
398
  }
401
399
  initCapsule(e2 = []) {
402
- this.$ = X(this.capsule, this, ...e2), t(this.$);
400
+ this.$ = V(this.capsule, this, ...e2), t(this.$);
403
401
  }
404
402
  getCapsule(t2 = []) {
405
- this.$ = L(this.capsule, this, ...t2);
403
+ this.$ = H(this.capsule, this, ...t2);
406
404
  }
407
405
  makeCapsule(t2 = []) {
408
- this.$ = Q(this.capsule, this, ...t2);
406
+ this.$ = L(this.capsule, this, ...t2);
409
407
  }
410
408
  }
411
- function Z(t2, e2) {
409
+ function Y(t2, e2) {
412
410
  t2.behavior = v(t2.behavior ?? {}, { $instance: R.OFF });
413
411
  }
414
- class tt {
412
+ class Z {
415
413
  get $instance() {
416
414
  return c();
417
415
  }
418
416
  constructor(t2) {
419
- Z(t2);
417
+ Y(t2);
420
418
  }
421
419
  }
422
- function et(t2, e2) {
420
+ function tt(t2, e2) {
423
421
  I(t2, ({ self: t3 }) => {
424
422
  "beforeMount" in t3 && a(() => t3.beforeMount()), "mounted" in t3 && f(() => t3.mounted()), "beforeUnmount" in t3 && l(() => t3.beforeUnmount()), "unmounted" in t3 && h(() => t3.unmounted());
425
423
  });
426
424
  }
427
- class nt {
425
+ class et {
428
426
  constructor(t2) {
429
427
  __publicField(this, "beforeMount", function() {
430
428
  });
@@ -434,85 +432,85 @@ class nt {
434
432
  });
435
433
  __publicField(this, "unmounted", function() {
436
434
  });
437
- et(t2);
435
+ tt(t2);
438
436
  }
439
437
  }
440
- function rt(t2, e2) {
438
+ function nt(t2, e2) {
441
439
  t2.behavior = v(t2.behavior ?? {}, { $refs: R.OFF });
442
440
  }
443
- class ot {
441
+ class rt {
444
442
  get $refs() {
445
443
  var _a;
446
444
  return (_a = c()) == null ? void 0 : _a.refs;
447
445
  }
448
446
  constructor(t2) {
449
- rt(t2);
447
+ nt(t2);
450
448
  }
451
449
  }
452
- class it {
450
+ class ot {
453
451
  get route() {
454
452
  var _a;
455
453
  return p((_a = F.router) == null ? void 0 : _a.currentRoute);
456
454
  }
457
455
  }
458
- class st {
456
+ class it {
459
457
  get router() {
460
458
  return F.router;
461
459
  }
462
460
  }
463
- class ut {
461
+ class st {
464
462
  }
465
- O(ut, [st, it]);
466
- class ct {
463
+ O(st, [it, ot]);
464
+ class ut {
467
465
  constructor() {
468
466
  __publicField(this, "$emit", (...t2) => {
469
467
  });
470
468
  }
471
469
  }
472
- class at {
470
+ class ct {
473
471
  constructor() {
474
472
  __publicField(this, "$nextTick", b);
475
473
  }
476
474
  }
477
- class ft {
475
+ class at {
478
476
  constructor(t2) {
479
477
  !function(t3, e2) {
480
- Z(t3), rt(t3), et(t3);
478
+ Y(t3), nt(t3), tt(t3);
481
479
  }(t2);
482
480
  }
483
481
  }
484
- O(ft, [ut, nt, ct, at, ot, tt]);
482
+ O(at, [st, et, ut, ct, rt, Z]);
485
483
  export {
486
484
  R as IVUE,
487
- K as Kernel,
488
- U as Mapping,
485
+ U as Kernel,
486
+ A as Mapping,
489
487
  O as Traits,
490
- Y as UseCapsule,
491
- ct as UseEmit,
492
- tt as UseInstance,
493
- nt as UseMounting,
494
- ot as UseRefs,
495
- it as UseRoute,
496
- st as UseRouter,
497
- ut as UseRouting,
498
- at as UseTick,
499
- ft as UseVue,
488
+ X as UseCapsule,
489
+ ut as UseEmit,
490
+ Z as UseInstance,
491
+ et as UseMounting,
492
+ rt as UseRefs,
493
+ ot as UseRoute,
494
+ it as UseRouter,
495
+ st as UseRouting,
496
+ ct as UseTick,
497
+ at as UseVue,
500
498
  I as after,
501
499
  _ as before,
502
- H as bind,
500
+ G as bind,
503
501
  F as config,
504
502
  v as extend,
505
- L as get,
506
- X as init,
503
+ H as get,
504
+ V as init,
507
505
  x as iobj,
508
506
  D as ivue,
509
- B as ivueInversify,
507
+ q as ivueInversify,
510
508
  W as ivueTransform,
511
- G as kernel,
512
- Q as make,
509
+ B as kernel,
510
+ L as make,
513
511
  j as pre,
514
512
  d as raw,
515
513
  C as setup,
516
514
  g as unraw,
517
- V as use
515
+ Q as use
518
516
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- var __defProp=Object.defineProperty,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ivue={},e.Vue)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&!Array.isArray(e)}function r(e,...t){return o(e,[...t],new WeakMap)}function o(e,t,r=null){if(!t.length)return e;r.set(e,!0);const i=t.shift();if(n(e)&&n(i))for(const u in i)n(i[u])&&"Object"===i[u].constructor.name?r.has(i[u])||null!==(s=i[u])&&"object"==typeof s&&"function"==typeof s.then&&"function"==typeof s.catch||void 0===e[u]?e[u]=i[u]:n(e[u])?"Object"!==e[u].constructor.name?e[u]=i[u]:o(e[u],[i[u]],r):e[u]=i[u]:e[u]=i[u];var s;return o(e,t,r)}function i(e,t){const n={},r=Object.getOwnPropertyNames(e.prototype).reduce(((t,r)=>{const o=Object.getOwnPropertyDescriptor(e.prototype,r);let i=!1;return(null==o?void 0:o.set)&&!(null==o?void 0:o.get)&&(n[r]=null==o?void 0:o.set,i=!0),i||(t[r]=!0),t}),{}),o={};t.reverse().forEach((t=>{const i=new t(e);for(const n in i)n in r||(o[n]=!0),n in o&&Object.defineProperty(e.prototype,n,{value:i[n],writable:!0});Object.getOwnPropertyNames(t.prototype).forEach((i=>{if("constructor"!==i&&(i in r||(o[i]=!0),i in o)){const r=Object.getOwnPropertyDescriptor(t.prototype,i)||Object.create(null);(null==r?void 0:r.set)&&!(i in n)&&(n[i]=null==r?void 0:r.set),(null==r?void 0:r.get)&&!(null==r?void 0:r.set)&&i in n&&(r.set=n[i]),Object.defineProperty(e.prototype,i,r)}}))}))}const s=new Map;function u(e){if(s.has(e))return s.get(e);const t=e,n=[];for(;e&&"Object"!==e.constructor.name;)n.push.apply(n,Object.entries(Object.getOwnPropertyDescriptors(e))),e=Object.getPrototypeOf(e.constructor.prototype);const r=new Map;for(let o=0;o<n.length;o++)"__proto__"!==n[o][0]&&"function"==typeof n[o][1].get&&r.set(n[o][0],n[o][1]);return s.set(t,r),r}function c(e){let t="";try{t=(null==e?void 0:e.name)||String(e)}catch(n){t="Unknown[failed to convert to string]"}return t}let l={router:null,debug:!1};const a={before:new Map,after:new Map};function f(e,t,n){const r=a[e].get(t);for(let o=0;o<(null==r?void 0:r.length);o++)if(!0===r[o](n,...n.args))return n.return}function p(e,t,n,r){var o;a[e].has(t)?null==(o=a[e].get(t))||o[r.top?"unshift":"push"](n):a[e].set(t,[n])}function h(e,t){var n;if(Array.isArray(e)){if("function"!=typeof e[0])throw new Error("ivue.kernel.behavior: Cannot autobind intercept to "+e[0]+". Supply a valid Class to autobind behavior.");if("function"==typeof e[1]){const n=e[1].toString();if("class"!==n.substring(0,5)){const r=n.indexOf("(");n.substring(0,r).split(" "),e[0].behavior={..."object"==typeof e[0].behavior?e[0].behavior:{},funcName:t?"SCOPED_INTERCEPT":"INTERCEPT"}}return e[1]}throw new Error('ivue.kernel.behavior: Cannot autobind intercept "'+e[1]+'" to '+((null==(n=e[0])?void 0:n.name)??e[0]))}return e}function b(e,t,n={top:!1,scoped:!1}){p("after",h(e,n.scoped),t,n)}function d(e,t,n,r,o){let i=a[e].get(t.constructor.prototype[n]);for(let s=0;s<(null==i?void 0:i.length);s++)if(!0===i[s](o,...r))return!0;i=a[e].get(t[n]);for(let s=0;s<(null==i?void 0:i.length);s++)if(!0===i[s](o,...r))return!0}var g,v=((g=v||{}).SCOPED="SCOPED",g.SCOPED_INTERCEPT="SCOPED_INTERCEPT",g.INTERCEPT="INTERCEPT",g.OFF="OFF",g);function m(e,t,n,r,o,i,s){let u;if("SCOPED"===t)return Object.defineProperty(r,o,{value:function(...e){return i.run((()=>u=n.bind(r)(...e))),u},writable:!0,configurable:!0,enumerable:!1});const c=(...t)=>(!0===d("before",r,o,t,s={mapping:e,self:r,return:u,name:o,args:t})||(u=n.bind(r)(...t),s.return=u,d("after",r,o,t,s)),s.return);switch(t){case"INTERCEPT":return Object.defineProperty(r,o,{value:function(...e){return c(...e)},writable:!0,configurable:!0,enumerable:!1});case"SCOPED_INTERCEPT":return Object.defineProperty(r,o,{value:function(...e){return i.run((()=>u=c(...e))),u},writable:!0,configurable:!0,enumerable:!1})}}function y(e,n,r,o,...i){return new Proxy(e,{get:(i,s)=>{var u,c;return n.has(s)&&(null==(c=null==(u=e.constructor)?void 0:u.behavior)?void 0:c[s])!==v.OFF?(s in r||(null==o||o.run((()=>r[s]=t.computed((()=>{var t;return null==(t=n.get(s))?void 0:t.get.bind(e)()}))))),r[s].value):"toRefs"===s?_(e,n,r,o):i[s]}})}function _(e,n,r,o){return function(...i){const s={};if(i.length)for(let u=0;u<i.length;u++){const c=i[u];n.has(c)?c in r?s[c]=r[c]:o.run((()=>s[c]=r[c]=t.computed((()=>{var t;return null==(t=n.get(c))?void 0:t.get.bind(e)()})))):"function"==typeof e[c]?s[c]=e[c].bind(e):s[c]=t.toRef(e,c)}else{for(const r in e)n.has(r)||("function"==typeof e[r]?s[r]=e[r].bind(e):s[r]=t.toRef(e,r));n.forEach(((n,i)=>{i in r?s[i]=r[i]:o.run((()=>s[i]=r[i]=t.computed((()=>n.get.bind(e)()))))}))}return new Proxy(e,{get:(t,n)=>n in s?s[n]:n in t?t[n].bind(e):void 0})}}function w(e){return!!t.getCurrentScope()&&(t.onScopeDispose(e),!0)}const O=e=>{let n=t.toRaw(e),r=Object.getOwnPropertyNames(n);for(let t=0;t<r.length;t++)delete n[r[t]];n=null,r=null};class F{constructor(e){__publicField(this,"to"),__publicField(this,"scope","singleton"),__publicField(this,"type","generic"),__publicField(this,"onInit",S),this.from=e,this.to=e}}class P{constructor(){__publicField(this,"transients",new WeakMap),__publicField(this,"singletons",new WeakMap),__publicField(this,"instances",new WeakMap),__publicField(this,"subscribers",new WeakMap),__publicField(this,"effectScopes",new WeakMap),__publicField(this,"current")}bind(e){return this.current=new F(e),this}to(e){return this.current.to=e,this}singleton(){return this.current.scope="singleton",this[this.current.scope+"s"].set(this.current.from,this.current),this}transient(){return this.current.scope="transient",this[this.current.scope+"s"].set(this.current.from,this.current),this}type(e){return this.current.type=e,this}ivue(){return this.current.type="ivue",this.current.onInit=()=>{},this}onInit(e){return this.current.onInit=e,this}get(e,...t){if(this.instances.has(e))return this.instances.get(e);let n=this.singletons.get(e);n||(this.bind(e).singleton(),n=this.singletons.get(e));const r=n.onInit(n,...t);return this.instances.set(e,r),r}make(e,...t){let n=this.transients.get(e);return n||(this.bind(e).transient(),n=this.transients.get(e)),n.onInit(n,...t)}use(e,...r){let o,i,s,p,h,b,d;if(this.subscribers.set(e,(this.subscribers.get(e)||0)+1),w((()=>{var t;const n=(this.subscribers.get(e)||0)-1;if(this.subscribers.set(e,n),this.effectScopes.has(e)&&n<=0){let n;if(null==(t=this.effectScopes.get(e))||t.stop(),s)for(n in s)delete s[n];if(h)for(n in h)h[n]=null;if(b)for(n in b)b[n]=null;if(d)for(n in d)d[n]=null;s&&O(s),o=i=s=h=b=d=n=null,this.effectScopes.delete(e),this.instances.delete(e),this.subscribers.delete(e),l.debug&&console.log("ivue.kernel: instance deleted:",e.name)}})),this.instances.has(e))return this.instances.get(e);{if(i=this.singletons.get(e),i){if("ivue"!==i.type)throw new Error("ivue.kernel: use("+c(e)+") method should be used only with 'ivue' mappings, use get("+c(e)+") method for standard JavaScript singleton Kernel mappings.")}else this.bind(e).singleton().ivue(),i=this.singletons.get(e);if(o=t.effectScope(!!t.getCurrentScope()),this.effectScopes.set(e,o),a.before.has(i.to)&&(b={mapping:i,self:null,return:null,name:i.to.constructor.name,args:r},!0===f("before",i.to,b)))return this.instances.set(e,b.return),b.return;p=u(i.to.prototype),h=p.size?{}:null;let s=new Proxy(t.reactive(new e(...r)),{get:(e,n)=>{var r,i;return p.has(n)&&(null==(i=null==(r=s.constructor)?void 0:r.behavior)?void 0:i[n])!==v.OFF?(n in h||(null==o||o.run((()=>h[n]=t.computed((()=>p.get(n).get.bind(s)()))))),h[n].value):"toRefs"===n?_(s,p,h,o):e[n]}});if("behavior"in s.constructor)for(const e in s.constructor.behavior)if(!p.has(e))if("function"==typeof s[e]){if(s.constructor.behavior[e]===v.OFF)continue;n(d)||(d={}),d[e]=s[e],m(i,s.constructor.behavior[e],d[e],s,e,o,b)}else s.constructor.behavior[e]===v.OFF&&(null==s?void 0:s[e])&&"object"==typeof s[e]&&(s[e]=t.markRaw(s[e]));return a.after.has(i.to)&&(b={mapping:i,self:s,name:i.to.constructor.name,return:s,args:r},!0===f("after",i.to,b))?(this.instances.set(e,b.return),b.return):("init"in s&&o.run((()=>s.init())),this.instances.set(e,s),l.debug&&console.log("ivue.kernel: instance created:",e.name,"current scope",t.getCurrentScope(),"current instance",t.getCurrentInstance()),s)}}init(e,...r){let o=this.transients.get(e);if(o){if("ivue"!==o.type)throw new Error("ivue.kernel: init("+c(e)+") method should be used only with 'ivue' mappings, use make("+c(e)+") method for standard JavaScript transient Kernel mappings.")}else this.bind(e).transient().ivue(),o=this.transients.get(e);let i,s,l,p=t.effectScope(!!t.getCurrentScope());if(a.before.has(o.to)&&(i={mapping:o,self:null,return:null,name:o.to.constructor.name,args:r},!0===f("before",o.to,i)))return i.return;let h=u(o.to.prototype);s=h.size?{}:null;let b=new Proxy(t.reactive(new e(...r)),{get:(e,n)=>{var r,o;return h.has(n)&&(null==(o=null==(r=b.constructor)?void 0:r.behavior)?void 0:o[n])!==v.OFF?(n in s||(null==p||p.run((()=>s[n]=t.computed((()=>h.get(n).get.bind(b)()))))),s[n].value):"toRefs"===n?_(b,h,s,p):e[n]}});if("behavior"in b.constructor)for(const u in b.constructor.behavior)if(!h.has(u))if("function"==typeof b[u]){if(b.constructor.behavior[u]===v.OFF)continue;n(l)||(l={}),l[u]=b[u],m(o,b.constructor.behavior[u],l[u],b,u,p,i)}else b.constructor.behavior[u]===v.OFF&&(null==b?void 0:b[u])&&"object"==typeof b[u]&&(b[u]=t.markRaw(b[u]));return a.after.has(o.to)&&(i={mapping:o,self:b,return:b,name:o.to.constructor.name,args:r},!0===f("after",o.to,i))?i.return:("init"in b&&p.run((()=>b.init())),w((()=>{let e;if(null==p||p.stop(),O(b),i)for(e in i)i[e]=null;if(s)for(e in s)s[e]=null;if(l)for(e in l)l[e]=null;p=b=o=s=i=l=e=null})),b)}}function S(e,...r){if(a.before.has(e.to)){const t={mapping:e,self:null,return:null,name:e.to.constructor.name,args:r};if(!0===f("before",e.to,t))return t.return}let o,i=new e.to(...r);const s=u(e.to.prototype);if("behavior"in i.constructor&&"object"==typeof i.constructor.behavior)for(const u in i.constructor.behavior)if(!s.has(u)&&"function"==typeof i[u]){if(i.constructor.behavior[u]===v.OFF)continue;n(o)||(o={}),o[u]=i[u],m(e,i.constructor.behavior[u],o[u],i,u,t.effectScope(!!t.getCurrentScope()),void 0)}if(a.after.has(e.to)){const t={mapping:e,self:i,return:i,name:e.to.constructor.name,args:r};if(!0===f("after",e.to,t))return t.return}return i}const C=new P,E=C.bind.bind(C),j=C.get.bind(C),k=C.make.bind(C),R=C.use.bind(C),T=C.init.bind(C);function I(e,t){e.behavior=r(e.behavior??{},{$instance:v.OFF})}class M{get $instance(){return t.getCurrentInstance()}constructor(e){I(e)}}function N(e,n){b(e,(({self:e})=>{"beforeMount"in e&&t.onBeforeMount((()=>e.beforeMount())),"mounted"in e&&t.onMounted((()=>e.mounted())),"beforeUnmount"in e&&t.onBeforeUnmount((()=>e.beforeUnmount())),"unmounted"in e&&t.onUnmounted((()=>e.unmounted()))}))}class U{constructor(e){__publicField(this,"beforeMount",(function(){})),__publicField(this,"mounted",(function(){})),__publicField(this,"beforeUnmount",(function(){})),__publicField(this,"unmounted",(function(){})),N(e)}}function D(e,t){e.behavior=r(e.behavior??{},{$refs:v.OFF})}class ${get $refs(){var e;return null==(e=t.getCurrentInstance())?void 0:e.refs}constructor(e){D(e)}}class x{get route(){var e;return t.toValue(null==(e=l.router)?void 0:e.currentRoute)}}class W{get router(){return l.router}}class J{}i(J,[W,x]);class z{constructor(){__publicField(this,"$emit",((...e)=>{}))}}class A{constructor(){__publicField(this,"$nextTick",t.nextTick)}}class V{constructor(e){var t;I(t=e),D(t),N(t)}}i(V,[J,U,z,A,$,M]),e.IVUE=v,e.Kernel=P,e.Mapping=F,e.Traits=i,e.UseCapsule=class{constructor(){__publicField(this,"$"),__publicField(this,"capsule")}useCapsule(e=[]){this.$=R(this.capsule,this,...e),t.markRaw(this.$)}initCapsule(e=[]){this.$=T(this.capsule,this,...e),t.markRaw(this.$)}getCapsule(e=[]){this.$=j(this.capsule,this,...e)}makeCapsule(e=[]){this.$=k(this.capsule,this,...e)}},e.UseEmit=z,e.UseInstance=M,e.UseMounting=U,e.UseRefs=$,e.UseRoute=x,e.UseRouter=W,e.UseRouting=J,e.UseTick=A,e.UseVue=V,e.after=b,e.before=function(e,t,n={top:!1,scoped:!1}){p("before",h(e,n.scoped),t,n)},e.bind=E,e.config=l,e.extend=r,e.get=j,e.init=T,e.iobj=function(e){let n=t.getCurrentScope(),r=t.effectScope(!!n),o=function(e){const t=new Map,n=Object.entries(Object.getOwnPropertyDescriptors(e));for(let r=0;r<n.length;r++)"function"==typeof n[r][1].get&&"__proto__"!==n[r][0]&&t.set(n[r][0],n[r][1]);return t}(e),i=o.size?{}:null,s=y(t.reactive(e),o,i,r);return"init"in s&&r.run((()=>s.init())),n&&t.onScopeDispose((()=>{let t;for(t in null==r||r.stop(),s)delete s[t];for(t in i)delete i[t];n=r=o=i=e=s=t=null})),s},e.ivue=function(e,...n){let r=t.getCurrentScope(),o=t.effectScope(!!r),i=u(e.prototype),s=i.size?{}:null,c=new Proxy(t.reactive(new e(...n)),{get:(e,n)=>{var r,u;return i.has(n)&&(null==(u=null==(r=c.constructor)?void 0:r.behavior)?void 0:u[n])!==v.OFF?(n in s||(null==o||o.run((()=>s[n]=t.computed((()=>i.get(n).get.bind(c)()))))),s[n].value):"toRefs"===n?_(c,i,s,o):e[n]}});return"init"in c&&o.run((()=>c.init())),r&&t.onScopeDispose((()=>{let e;for(e in null==o||o.stop(),c)delete c[e];for(e in s)delete s[e];r=o=i=s=c=e=null})),c},e.ivueInversify=function(e,n,...r){let o=t.effectScope(!!t.getCurrentScope()),i=u(Reflect.getPrototypeOf(n)),s=i.value?{}:null,c=y(t.reactive(Object.create(n)),i,s,o,...r);return"function"==typeof c.init&&o.run((()=>c.init())),w((()=>{null==o||o.stop(),O(c),o=c=null})),c},e.ivueTransform=y,e.kernel=C,e.make=k,e.pre=function(e,t=2){const n=new Set;return JSON.stringify(e,(function(e,t){if("object"==typeof t&&null!==t){if(n.has(t))try{return JSON.parse(JSON.stringify(t))}catch(r){return"[**circular**]"}n.add(t)}return t}),t)},e.raw=function(e){return t.markRaw(e)},e.setup=function(e={}){r(l,e)},e.unraw=function(e){delete e.__v_skip},e.use=R,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
1
+ var __defProp=Object.defineProperty,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ivue={},e.Vue)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&!Array.isArray(e)}function r(e,...t){return o(e,[...t],new WeakMap)}function o(e,t,r=null){if(!t.length)return e;r.set(e,!0);const i=t.shift();if(n(e)&&n(i))for(const u in i)n(i[u])&&"Object"===i[u].constructor.name?r.has(i[u])||null!==(s=i[u])&&"object"==typeof s&&"function"==typeof s.then&&"function"==typeof s.catch||void 0===e[u]?e[u]=i[u]:n(e[u])?"Object"!==e[u].constructor.name?e[u]=i[u]:o(e[u],[i[u]],r):e[u]=i[u]:e[u]=i[u];var s;return o(e,t,r)}function i(e,t){const n={},r=Object.getOwnPropertyNames(e.prototype).reduce(((t,r)=>{const o=Object.getOwnPropertyDescriptor(e.prototype,r);let i=!1;return(null==o?void 0:o.set)&&!(null==o?void 0:o.get)&&(n[r]=null==o?void 0:o.set,i=!0),i||(t[r]=!0),t}),{}),o={};t.reverse().forEach((t=>{const i=new t(e);for(const n in i)n in r||(o[n]=!0),n in o&&Object.defineProperty(e.prototype,n,{value:i[n],writable:!0});Object.getOwnPropertyNames(t.prototype).forEach((i=>{if("constructor"!==i&&(i in r||(o[i]=!0),i in o)){const r=Object.getOwnPropertyDescriptor(t.prototype,i)||Object.create(null);(null==r?void 0:r.set)&&!(i in n)&&(n[i]=null==r?void 0:r.set),(null==r?void 0:r.get)&&!(null==r?void 0:r.set)&&i in n&&(r.set=n[i]),Object.defineProperty(e.prototype,i,r)}}))}))}const s=new Map;function u(e){if(s.has(e))return s.get(e);const t=e,n=[];for(;e&&"Object"!==e.constructor.name;)n.push.apply(n,Object.entries(Object.getOwnPropertyDescriptors(e))),e=Object.getPrototypeOf(e.constructor.prototype);const r=new Map;for(let o=0;o<n.length;o++)"__proto__"!==n[o][0]&&"function"==typeof n[o][1].get&&r.set(n[o][0],n[o][1]);return s.set(t,r),r}function c(e){let t="";try{t=(null==e?void 0:e.name)||String(e)}catch(n){t="Unknown[failed to convert to string]"}return t}let l={router:null,debug:!1};const a={before:new Map,after:new Map};function f(e,t,n){const r=a[e].get(t);for(let o=0;o<(null==r?void 0:r.length);o++)if(!0===r[o](n,...n.args))return n.return}function p(e,t,n,r){var o;a[e].has(t)?null==(o=a[e].get(t))||o[r.top?"unshift":"push"](n):a[e].set(t,[n])}function h(e,t){var n;if(Array.isArray(e)){if("function"!=typeof e[0])throw new Error("ivue.kernel.behavior: Cannot autobind intercept to "+e[0]+". Supply a valid Class to autobind behavior.");if("function"==typeof e[1]){const n=e[1].toString();if("class"!==n.substring(0,5)){const r=n.indexOf("(");n.substring(0,r).split(" "),e[0].behavior={..."object"==typeof e[0].behavior?e[0].behavior:{},funcName:t?"SCOPED_INTERCEPT":"INTERCEPT"}}return e[1]}throw new Error('ivue.kernel.behavior: Cannot autobind intercept "'+e[1]+'" to '+((null==(n=e[0])?void 0:n.name)??e[0]))}return e}function b(e,t,n={top:!1,scoped:!1}){p("after",h(e,n.scoped),t,n)}function d(e,t,n,r,o){let i=a[e].get(t.constructor.prototype[n]);for(let s=0;s<(null==i?void 0:i.length);s++)if(!0===i[s](o,...r))return!0;i=a[e].get(t[n]);for(let s=0;s<(null==i?void 0:i.length);s++)if(!0===i[s](o,...r))return!0}var g,v=((g=v||{}).SCOPED="SCOPED",g.SCOPED_INTERCEPT="SCOPED_INTERCEPT",g.INTERCEPT="INTERCEPT",g.OFF="OFF",g);function m(e,t,n,r,o,i,s){let u;if("SCOPED"===t)return Object.defineProperty(r,o,{value:function(...e){return i.run((()=>u=n.bind(r)(...e))),u},writable:!0,configurable:!0,enumerable:!1});const c=(...t)=>(!0===d("before",r,o,t,s={mapping:e,self:r,return:u,name:o,args:t})||(u=n.bind(r)(...t),s.return=u,d("after",r,o,t,s)),s.return);switch(t){case"INTERCEPT":return Object.defineProperty(r,o,{value:function(...e){return c(...e)},writable:!0,configurable:!0,enumerable:!1});case"SCOPED_INTERCEPT":return Object.defineProperty(r,o,{value:function(...e){return i.run((()=>u=c(...e))),u},writable:!0,configurable:!0,enumerable:!1})}}function y(e,n,r,o,...i){return new Proxy(e,{get:(i,s)=>{var u,c;return n.has(s)&&(null==(c=null==(u=e.constructor)?void 0:u.behavior)?void 0:c[s])!==v.OFF?(s in r||(null==o||o.run((()=>r[s]=t.computed((()=>{var t;return null==(t=n.get(s))?void 0:t.get.bind(e)()}))))),r[s].value):"toRefs"===s?_(e,n,r,o):i[s]}})}function _(e,n,r,o){return function(...i){const s={};if(i.length)for(let u=0;u<i.length;u++){const c=i[u];n.has(c)?c in r?s[c]=r[c]:o.run((()=>s[c]=r[c]=t.computed((()=>{var t;return null==(t=n.get(c))?void 0:t.get.bind(e)()})))):"function"==typeof e[c]?s[c]=e[c].bind(e):s[c]=t.toRef(e,c)}else{for(const r in e)n.has(r)||("function"==typeof e[r]?s[r]=e[r].bind(e):s[r]=t.toRef(e,r));n.forEach(((n,i)=>{i in r?s[i]=r[i]:o.run((()=>s[i]=r[i]=t.computed((()=>n.get.bind(e)()))))}))}return new Proxy(e,{get:(t,n)=>n in s?s[n]:n in t?t[n].bind(e):void 0})}}const w=e=>{let n=t.toRaw(e),r=Object.getOwnPropertyNames(n);for(let t=0;t<r.length;t++)delete n[r[t]];n=null,r=null};class O{constructor(e){__publicField(this,"to"),__publicField(this,"scope","singleton"),__publicField(this,"type","generic"),__publicField(this,"onInit",S),this.from=e,this.to=e}}class F{constructor(){__publicField(this,"transients",new WeakMap),__publicField(this,"singletons",new WeakMap),__publicField(this,"instances",new WeakMap),__publicField(this,"subscribers",new WeakMap),__publicField(this,"effectScopes",new WeakMap),__publicField(this,"current")}bind(e){return this.current=new O(e),this}to(e){return this.current.to=e,this}singleton(){return this.current.scope="singleton",this[this.current.scope+"s"].set(this.current.from,this.current),this}transient(){return this.current.scope="transient",this[this.current.scope+"s"].set(this.current.from,this.current),this}type(e){return this.current.type=e,this}ivue(){return this.current.type="ivue",this.current.onInit=()=>{},this}onInit(e){return this.current.onInit=e,this}get(e,...t){if(this.instances.has(e))return this.instances.get(e);let n=this.singletons.get(e);n||(this.bind(e).singleton(),n=this.singletons.get(e));const r=n.onInit(n,...t);return this.instances.set(e,r),r}make(e,...t){let n=this.transients.get(e);return n||(this.bind(e).transient(),n=this.transients.get(e)),n.onInit(n,...t)}use(e,...r){let o,i,s,p,h,b,d,g=t.getCurrentScope();if(this.subscribers.set(e,(this.subscribers.get(e)||0)+1),g&&t.onScopeDispose((()=>{var t;const n=(this.subscribers.get(e)||0)-1;if(this.subscribers.set(e,n),this.effectScopes.has(e)&&n<=0){let n;if(null==(t=this.effectScopes.get(e))||t.stop(),s)for(n in s)delete s[n];if(h)for(n in h)delete h[n];if(b)for(n in b)delete b[n];if(d)for(n in d)delete d[n];s&&w(s),g=o=i=s=h=b=d=n=null,this.effectScopes.delete(e),this.instances.delete(e),this.subscribers.delete(e),l.debug&&console.log("ivue.kernel: instance deleted:",e.name)}})),this.instances.has(e))return this.instances.get(e);{if(i=this.singletons.get(e),i){if("ivue"!==i.type)throw new Error("ivue.kernel: use("+c(e)+") method should be used only with 'ivue' mappings, use get("+c(e)+") method for standard JavaScript singleton Kernel mappings.")}else this.bind(e).singleton().ivue(),i=this.singletons.get(e);if(o=t.effectScope(!!g),this.effectScopes.set(e,o),a.before.has(i.to)&&(b={mapping:i,self:null,return:null,name:i.to.constructor.name,args:r},!0===f("before",i.to,b)))return this.instances.set(e,b.return),b.return;p=u(i.to.prototype),h=p.size?{}:null;let s=new Proxy(t.reactive(new e(...r)),{get:(e,n)=>{var r,i;return p.has(n)&&(null==(i=null==(r=s.constructor)?void 0:r.behavior)?void 0:i[n])!==v.OFF?(n in h||(null==o||o.run((()=>h[n]=t.computed((()=>p.get(n).get.bind(s)()))))),h[n].value):"toRefs"===n?_(s,p,h,o):e[n]}});if("behavior"in s.constructor)for(const e in s.constructor.behavior)if(!p.has(e))if("function"==typeof s[e]){if(s.constructor.behavior[e]===v.OFF)continue;n(d)||(d={}),d[e]=s[e],m(i,s.constructor.behavior[e],d[e],s,e,o,b)}else s.constructor.behavior[e]===v.OFF&&(null==s?void 0:s[e])&&"object"==typeof s[e]&&(s[e]=t.markRaw(s[e]));return a.after.has(i.to)&&(b={mapping:i,self:s,name:i.to.constructor.name,return:s,args:r},!0===f("after",i.to,b))?(this.instances.set(e,b.return),b.return):("init"in s&&o.run((()=>s.init())),this.instances.set(e,s),l.debug&&console.log("ivue.kernel: instance created:",e.name,"current scope",t.getCurrentScope(),"current instance",t.getCurrentInstance()),s)}}init(e,...r){let o=this.transients.get(e);if(o){if("ivue"!==o.type)throw new Error("ivue.kernel: init("+c(e)+") method should be used only with 'ivue' mappings, use make("+c(e)+") method for standard JavaScript transient Kernel mappings.")}else this.bind(e).transient().ivue(),o=this.transients.get(e);let i,s,l,p=t.getCurrentScope(),h=t.effectScope(!!p);if(a.before.has(o.to)&&(i={mapping:o,self:null,return:null,name:o.to.constructor.name,args:r},!0===f("before",o.to,i)))return i.return;let b=u(o.to.prototype);s=b.size?{}:null;let d=new Proxy(t.reactive(new e(...r)),{get:(e,n)=>{var r,o;return b.has(n)&&(null==(o=null==(r=d.constructor)?void 0:r.behavior)?void 0:o[n])!==v.OFF?(n in s||(null==h||h.run((()=>s[n]=t.computed((()=>b.get(n).get.bind(d)()))))),s[n].value):"toRefs"===n?_(d,b,s,h):e[n]}});if("behavior"in d.constructor)for(const u in d.constructor.behavior)if(!b.has(u))if("function"==typeof d[u]){if(d.constructor.behavior[u]===v.OFF)continue;n(l)||(l={}),l[u]=d[u],m(o,d.constructor.behavior[u],l[u],d,u,h,i)}else d.constructor.behavior[u]===v.OFF&&(null==d?void 0:d[u])&&"object"==typeof d[u]&&(d[u]=t.markRaw(d[u]));return a.after.has(o.to)&&(i={mapping:o,self:d,return:d,name:o.to.constructor.name,args:r},!0===f("after",o.to,i))?i.return:("init"in d&&h.run((()=>d.init())),p&&t.onScopeDispose((()=>{let e;if(null==h||h.stop(),w(d),i)for(e in i)delete i[e];if(s)for(e in s)delete s[e];if(l)for(e in l)delete l[e];p=h=d=o=s=i=l=e=null})),d)}}function S(e,...r){if(a.before.has(e.to)){const t={mapping:e,self:null,return:null,name:e.to.constructor.name,args:r};if(!0===f("before",e.to,t))return t.return}let o,i=new e.to(...r);const s=u(e.to.prototype);if("behavior"in i.constructor&&"object"==typeof i.constructor.behavior)for(const u in i.constructor.behavior)if(!s.has(u)&&"function"==typeof i[u]){if(i.constructor.behavior[u]===v.OFF)continue;n(o)||(o={}),o[u]=i[u],m(e,i.constructor.behavior[u],o[u],i,u,t.effectScope(!!t.getCurrentScope()),void 0)}if(a.after.has(e.to)){const t={mapping:e,self:i,return:i,name:e.to.constructor.name,args:r};if(!0===f("after",e.to,t))return t.return}return i}const P=new F,C=P.bind.bind(P),E=P.get.bind(P),j=P.make.bind(P),k=P.use.bind(P),R=P.init.bind(P);function T(e,t){e.behavior=r(e.behavior??{},{$instance:v.OFF})}class I{get $instance(){return t.getCurrentInstance()}constructor(e){T(e)}}function M(e,n){b(e,(({self:e})=>{"beforeMount"in e&&t.onBeforeMount((()=>e.beforeMount())),"mounted"in e&&t.onMounted((()=>e.mounted())),"beforeUnmount"in e&&t.onBeforeUnmount((()=>e.beforeUnmount())),"unmounted"in e&&t.onUnmounted((()=>e.unmounted()))}))}class N{constructor(e){__publicField(this,"beforeMount",(function(){})),__publicField(this,"mounted",(function(){})),__publicField(this,"beforeUnmount",(function(){})),__publicField(this,"unmounted",(function(){})),M(e)}}function U(e,t){e.behavior=r(e.behavior??{},{$refs:v.OFF})}class D{get $refs(){var e;return null==(e=t.getCurrentInstance())?void 0:e.refs}constructor(e){U(e)}}class ${get route(){var e;return t.toValue(null==(e=l.router)?void 0:e.currentRoute)}}class x{get router(){return l.router}}class W{}i(W,[x,$]);class J{constructor(){__publicField(this,"$emit",((...e)=>{}))}}class z{constructor(){__publicField(this,"$nextTick",t.nextTick)}}class A{constructor(e){var t;T(t=e),U(t),M(t)}}i(A,[W,N,J,z,D,I]),e.IVUE=v,e.Kernel=F,e.Mapping=O,e.Traits=i,e.UseCapsule=class{constructor(){__publicField(this,"$"),__publicField(this,"capsule")}useCapsule(e=[]){this.$=k(this.capsule,this,...e),t.markRaw(this.$)}initCapsule(e=[]){this.$=R(this.capsule,this,...e),t.markRaw(this.$)}getCapsule(e=[]){this.$=E(this.capsule,this,...e)}makeCapsule(e=[]){this.$=j(this.capsule,this,...e)}},e.UseEmit=J,e.UseInstance=I,e.UseMounting=N,e.UseRefs=D,e.UseRoute=$,e.UseRouter=x,e.UseRouting=W,e.UseTick=z,e.UseVue=A,e.after=b,e.before=function(e,t,n={top:!1,scoped:!1}){p("before",h(e,n.scoped),t,n)},e.bind=C,e.config=l,e.extend=r,e.get=E,e.init=R,e.iobj=function(e){let n=t.getCurrentScope(),r=t.effectScope(!!n),o=function(e){const t=new Map,n=Object.entries(Object.getOwnPropertyDescriptors(e));for(let r=0;r<n.length;r++)"function"==typeof n[r][1].get&&"__proto__"!==n[r][0]&&t.set(n[r][0],n[r][1]);return t}(e),i=o.size?{}:null,s=y(t.reactive(e),o,i,r);return"init"in s&&r.run((()=>s.init())),n&&t.onScopeDispose((()=>{let t;for(t in null==r||r.stop(),s)delete s[t];for(t in i)delete i[t];n=r=o=i=e=s=t=null})),s},e.ivue=function(e,...n){let r=t.getCurrentScope(),o=t.effectScope(!!r),i=u(e.prototype),s=i.size?{}:null,c=new Proxy(t.reactive(new e(...n)),{get:(e,n)=>{var r,u;return i.has(n)&&(null==(u=null==(r=c.constructor)?void 0:r.behavior)?void 0:u[n])!==v.OFF?(n in s||(null==o||o.run((()=>s[n]=t.computed((()=>i.get(n).get.bind(c)()))))),s[n].value):"toRefs"===n?_(c,i,s,o):e[n]}});return"init"in c&&o.run((()=>c.init())),r&&t.onScopeDispose((()=>{let e;for(e in null==o||o.stop(),c)delete c[e];for(e in s)delete s[e];r=o=i=s=c=e=null})),c},e.ivueInversify=function(e,n,...r){let o=t.effectScope(!!t.getCurrentScope()),i=u(Reflect.getPrototypeOf(n)),s=i.value?{}:null,c=y(t.reactive(Object.create(n)),i,s,o,...r);var l;return"function"==typeof c.init&&o.run((()=>c.init())),l=()=>{null==o||o.stop(),w(c),o=c=null},t.getCurrentScope()&&t.onScopeDispose(l),c},e.ivueTransform=y,e.kernel=P,e.make=j,e.pre=function(e,t=2){const n=new Set;return JSON.stringify(e,(function(e,t){if("object"==typeof t&&null!==t){if(n.has(t))try{return JSON.parse(JSON.stringify(t))}catch(r){return"[**circular**]"}n.add(t)}return t}),t)},e.raw=function(e){return t.markRaw(e)},e.setup=function(e={}){r(l,e)},e.unraw=function(e){delete e.__v_skip},e.use=k,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ivue",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "ivue – Infinite Vue. Advanced State Management & Class Architecture for Vue 3+.",
5
5
  "exports": {
6
6
  ".": {
@@ -66,11 +66,11 @@
66
66
  },
67
67
  "repository": {
68
68
  "type": "git",
69
- "url": "https://github.com/infinite-system/infinite-vue"
69
+ "url": "https://github.com/infinite-system/ivue"
70
70
  },
71
- "homepage": "https://github.com/infinite-system/infinite-vue",
71
+ "homepage": "https://github.com/infinite-system/ivue",
72
72
  "bugs": {
73
- "url": "https://github.com/infinite-system/infinite-vue/issues",
73
+ "url": "https://github.com/infinite-system/ivue/issues",
74
74
  "email": "ekalashnikov@gmail.com"
75
75
  },
76
76
  "keywords": [
package/src/kernel.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { reactive, markRaw, effectScope, type EffectScope, getCurrentScope, computed, getCurrentInstance } from 'vue';
1
+ import { reactive, markRaw, effectScope, type EffectScope, getCurrentScope, computed, getCurrentInstance, onScopeDispose } from 'vue';
2
2
 
3
3
  import type { MappingScope, MappingType, IVue, AnyClass, InferredArgs, Intercept, Null, Getters, Computeds } from './types/core';
4
4
 
@@ -265,7 +265,8 @@ export class Kernel {
265
265
  /**
266
266
  * Define context variables.
267
267
  */
268
- let scope: Null<EffectScope>,
268
+ let current: Null<EffectScope | undefined> = getCurrentScope(),
269
+ scope: Null<EffectScope>,
269
270
  mapping: Mapping | any,
270
271
  vue: IVue<T> | any,
271
272
  getters: Getters | any,
@@ -297,15 +298,15 @@ export class Kernel {
297
298
  */
298
299
  let prop
299
300
  if (vue) for (prop in vue) delete vue[prop]
300
- if (computeds) for (prop in computeds) computeds[prop] = null
301
- if (intercept) for (prop in intercept) intercept[prop] = null
302
- if (fns) for (prop in fns) fns[prop] = null
301
+ if (computeds) for (prop in computeds) delete computeds[prop]
302
+ if (intercept) for (prop in intercept) delete intercept[prop]
303
+ if (fns) for (prop in fns) delete fns[prop]
303
304
 
304
305
  if (vue) disposeGarbage(vue)
305
306
  /**
306
307
  * Dispose objects to null for gc to be able to collect and dispose.
307
308
  */
308
- scope = mapping = vue = computeds = intercept = fns = prop = null
309
+ current = scope = mapping = vue = computeds = intercept = fns = prop = null
309
310
  /**
310
311
  * Delete data from WeakMaps.
311
312
  */
@@ -325,7 +326,7 @@ export class Kernel {
325
326
  /**
326
327
  * Add garbage disposal mechanism.
327
328
  */
328
- tryOnScopeDispose(dispose)
329
+ current ? onScopeDispose(dispose) : null
329
330
  /**
330
331
  * Instance exists? Return it.
331
332
  */
@@ -359,7 +360,7 @@ export class Kernel {
359
360
  /**
360
361
  * Create & save effect scope.
361
362
  */
362
- scope = effectScope(!!getCurrentScope())
363
+ scope = effectScope(!!current)
363
364
  this.effectScopes.set(className, scope)
364
365
  /**
365
366
  * Run before constructor() intercept functions.
@@ -535,8 +536,8 @@ export class Kernel {
535
536
  /**
536
537
  * Define context variables.
537
538
  */
538
- let
539
- scope: Null<EffectScope> = effectScope(!!getCurrentScope()),
539
+ let current: Null<EffectScope | undefined> = getCurrentScope(),
540
+ scope: Null<EffectScope> = effectScope(!!current),
540
541
  intercept: Intercept | any,
541
542
  computeds: Computeds | any,
542
543
  fns: any
@@ -667,18 +668,18 @@ export class Kernel {
667
668
  /**
668
669
  * Advanced garabage collection and disposal mechanism.
669
670
  */
670
- tryOnScopeDispose(() => {
671
+ current ? onScopeDispose(() => {
671
672
  scope?.stop();
672
673
  let prop
673
674
  // Dispose object props of object under the vue reactive proxy
674
675
  disposeGarbage(vue)
675
676
  // Dispose object props of utility objects properties
676
- if (intercept) for (prop in intercept) intercept[prop] = null
677
- if (computeds) for (prop in computeds) computeds[prop] = null
678
- if (fns) for (prop in fns) fns[prop] = null
677
+ if (intercept) for (prop in intercept) delete intercept[prop]
678
+ if (computeds) for (prop in computeds) delete computeds[prop]
679
+ if (fns) for (prop in fns) delete fns[prop]
679
680
  // Dispose all used objects to null
680
- scope = vue = mapping = computeds = intercept = fns = prop = null
681
- })
681
+ current = scope = vue = mapping = computeds = intercept = fns = prop = null
682
+ }) : null
682
683
  /**
683
684
  * Return instance.
684
685
  */