@antcde/vue-utils 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ function Re(e, r) {
29
29
  Et(t, ["state", "system", "store"])
30
30
  );
31
31
  }
32
- function Me(e, r) {
32
+ function Fe(e, r) {
33
33
  const t = S(G(r));
34
34
  return z(
35
35
  e.locales.value,
@@ -58,31 +58,31 @@ function x(e, r) {
58
58
  }
59
59
  e.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
60
60
  }
61
- function Rt(e, r, t, n) {
61
+ function Mt(e, r, t, n) {
62
62
  function o(i) {
63
63
  return i instanceof t ? i : new t(function(u) {
64
64
  u(i);
65
65
  });
66
66
  }
67
67
  return new (t || (t = Promise))(function(i, u) {
68
- function c(l) {
68
+ function s(l) {
69
69
  try {
70
- s(n.next(l));
70
+ c(n.next(l));
71
71
  } catch (d) {
72
72
  u(d);
73
73
  }
74
74
  }
75
75
  function a(l) {
76
76
  try {
77
- s(n.throw(l));
77
+ c(n.throw(l));
78
78
  } catch (d) {
79
79
  u(d);
80
80
  }
81
81
  }
82
- function s(l) {
83
- l.done ? i(l.value) : o(l.value).then(c, a);
82
+ function c(l) {
83
+ l.done ? i(l.value) : o(l.value).then(s, a);
84
84
  }
85
- s((n = n.apply(e, r || [])).next());
85
+ c((n = n.apply(e, r || [])).next());
86
86
  });
87
87
  }
88
88
  function ut(e, r) {
@@ -90,59 +90,59 @@ function ut(e, r) {
90
90
  if (i[0] & 1) throw i[1];
91
91
  return i[1];
92
92
  }, trys: [], ops: [] }, n, o, i, u = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
93
- return u.next = c(0), u.throw = c(1), u.return = c(2), typeof Symbol == "function" && (u[Symbol.iterator] = function() {
93
+ return u.next = s(0), u.throw = s(1), u.return = s(2), typeof Symbol == "function" && (u[Symbol.iterator] = function() {
94
94
  return this;
95
95
  }), u;
96
- function c(s) {
96
+ function s(c) {
97
97
  return function(l) {
98
- return a([s, l]);
98
+ return a([c, l]);
99
99
  };
100
100
  }
101
- function a(s) {
101
+ function a(c) {
102
102
  if (n) throw new TypeError("Generator is already executing.");
103
- for (; u && (u = 0, s[0] && (t = 0)), t; ) try {
104
- if (n = 1, o && (i = s[0] & 2 ? o.return : s[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, s[1])).done) return i;
105
- switch (o = 0, i && (s = [s[0] & 2, i.value]), s[0]) {
103
+ for (; u && (u = 0, c[0] && (t = 0)), t; ) try {
104
+ if (n = 1, o && (i = c[0] & 2 ? o.return : c[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, c[1])).done) return i;
105
+ switch (o = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
106
106
  case 0:
107
107
  case 1:
108
- i = s;
108
+ i = c;
109
109
  break;
110
110
  case 4:
111
- return t.label++, { value: s[1], done: !1 };
111
+ return t.label++, { value: c[1], done: !1 };
112
112
  case 5:
113
- t.label++, o = s[1], s = [0];
113
+ t.label++, o = c[1], c = [0];
114
114
  continue;
115
115
  case 7:
116
- s = t.ops.pop(), t.trys.pop();
116
+ c = t.ops.pop(), t.trys.pop();
117
117
  continue;
118
118
  default:
119
- if (i = t.trys, !(i = i.length > 0 && i[i.length - 1]) && (s[0] === 6 || s[0] === 2)) {
119
+ if (i = t.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
120
120
  t = 0;
121
121
  continue;
122
122
  }
123
- if (s[0] === 3 && (!i || s[1] > i[0] && s[1] < i[3])) {
124
- t.label = s[1];
123
+ if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
124
+ t.label = c[1];
125
125
  break;
126
126
  }
127
- if (s[0] === 6 && t.label < i[1]) {
128
- t.label = i[1], i = s;
127
+ if (c[0] === 6 && t.label < i[1]) {
128
+ t.label = i[1], i = c;
129
129
  break;
130
130
  }
131
131
  if (i && t.label < i[2]) {
132
- t.label = i[2], t.ops.push(s);
132
+ t.label = i[2], t.ops.push(c);
133
133
  break;
134
134
  }
135
135
  i[2] && t.ops.pop(), t.trys.pop();
136
136
  continue;
137
137
  }
138
- s = r.call(e, t);
138
+ c = r.call(e, t);
139
139
  } catch (l) {
140
- s = [6, l], o = 0;
140
+ c = [6, l], o = 0;
141
141
  } finally {
142
142
  n = i = 0;
143
143
  }
144
- if (s[0] & 5) throw s[1];
145
- return { value: s[0] ? s[1] : void 0, done: !0 };
144
+ if (c[0] & 5) throw c[1];
145
+ return { value: c[0] ? c[1] : void 0, done: !0 };
146
146
  }
147
147
  }
148
148
  function P(e) {
@@ -155,14 +155,14 @@ function P(e) {
155
155
  };
156
156
  throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
157
157
  }
158
- function M(e, r) {
158
+ function R(e, r) {
159
159
  var t = typeof Symbol == "function" && e[Symbol.iterator];
160
160
  if (!t) return e;
161
161
  var n = t.call(e), o, i = [], u;
162
162
  try {
163
163
  for (; (r === void 0 || r-- > 0) && !(o = n.next()).done; ) i.push(o.value);
164
- } catch (c) {
165
- u = { error: c };
164
+ } catch (s) {
165
+ u = { error: s };
166
166
  } finally {
167
167
  try {
168
168
  o && !o.done && (t = n.return) && t.call(n);
@@ -180,10 +180,10 @@ function F(e, r, t) {
180
180
  function j(e) {
181
181
  return this instanceof j ? (this.v = e, this) : new j(e);
182
182
  }
183
- function Mt(e, r, t) {
183
+ function Rt(e, r, t) {
184
184
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
185
185
  var n = t.apply(e, r || []), o, i = [];
186
- return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), c("next"), c("throw"), c("return", u), o[Symbol.asyncIterator] = function() {
186
+ return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), s("next"), s("throw"), s("return", u), o[Symbol.asyncIterator] = function() {
187
187
  return this;
188
188
  }, o;
189
189
  function u(f) {
@@ -191,7 +191,7 @@ function Mt(e, r, t) {
191
191
  return Promise.resolve(b).then(f, d);
192
192
  };
193
193
  }
194
- function c(f, b) {
194
+ function s(f, b) {
195
195
  n[f] && (o[f] = function(v) {
196
196
  return new Promise(function(A, h) {
197
197
  i.push([f, v, A, h]) > 1 || a(f, v);
@@ -200,12 +200,12 @@ function Mt(e, r, t) {
200
200
  }
201
201
  function a(f, b) {
202
202
  try {
203
- s(n[f](b));
203
+ c(n[f](b));
204
204
  } catch (v) {
205
205
  y(i[0][3], v);
206
206
  }
207
207
  }
208
- function s(f) {
208
+ function c(f) {
209
209
  f.value instanceof j ? Promise.resolve(f.value.v).then(l, d) : y(i[0][2], f);
210
210
  }
211
211
  function l(f) {
@@ -226,27 +226,27 @@ function Ft(e) {
226
226
  }, t);
227
227
  function n(i) {
228
228
  t[i] = e[i] && function(u) {
229
- return new Promise(function(c, a) {
230
- u = e[i](u), o(c, a, u.done, u.value);
229
+ return new Promise(function(s, a) {
230
+ u = e[i](u), o(s, a, u.done, u.value);
231
231
  });
232
232
  };
233
233
  }
234
- function o(i, u, c, a) {
235
- Promise.resolve(a).then(function(s) {
236
- i({ value: s, done: c });
234
+ function o(i, u, s, a) {
235
+ Promise.resolve(a).then(function(c) {
236
+ i({ value: c, done: s });
237
237
  }, u);
238
238
  }
239
239
  }
240
240
  function p(e) {
241
241
  return typeof e == "function";
242
242
  }
243
- function st(e) {
243
+ function ct(e) {
244
244
  var r = function(n) {
245
245
  Error.call(n), n.stack = new Error().stack;
246
246
  }, t = e(r);
247
247
  return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
248
248
  }
249
- var H = st(function(e) {
249
+ var H = ct(function(e) {
250
250
  return function(t) {
251
251
  e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
252
252
  ` + t.map(function(n, o) {
@@ -273,15 +273,15 @@ var T = function() {
273
273
  if (u)
274
274
  if (this._parentage = null, Array.isArray(u))
275
275
  try {
276
- for (var c = P(u), a = c.next(); !a.done; a = c.next()) {
277
- var s = a.value;
278
- s.remove(this);
276
+ for (var s = P(u), a = s.next(); !a.done; a = s.next()) {
277
+ var c = a.value;
278
+ c.remove(this);
279
279
  }
280
280
  } catch (v) {
281
281
  r = { error: v };
282
282
  } finally {
283
283
  try {
284
- a && !a.done && (t = c.return) && t.call(c);
284
+ a && !a.done && (t = s.return) && t.call(s);
285
285
  } finally {
286
286
  if (r) throw r.error;
287
287
  }
@@ -304,7 +304,7 @@ var T = function() {
304
304
  try {
305
305
  X(b);
306
306
  } catch (v) {
307
- i = i ?? [], v instanceof H ? i = F(F([], M(i)), M(v.errors)) : i.push(v);
307
+ i = i ?? [], v instanceof H ? i = F(F([], R(i)), R(v.errors)) : i.push(v);
308
308
  }
309
309
  }
310
310
  } catch (v) {
@@ -349,7 +349,7 @@ var T = function() {
349
349
  var r = new e();
350
350
  return r.closed = !0, r;
351
351
  }(), e;
352
- }(), ct = T.EMPTY;
352
+ }(), st = T.EMPTY;
353
353
  function at(e) {
354
354
  return e instanceof T || e && "closed" in e && p(e.remove) && p(e.add) && p(e.unsubscribe);
355
355
  }
@@ -362,7 +362,7 @@ var Vt = {
362
362
  setTimeout: function(e, r) {
363
363
  for (var t = [], n = 2; n < arguments.length; n++)
364
364
  t[n - 2] = arguments[n];
365
- return setTimeout.apply(void 0, F([e, r], M(t)));
365
+ return setTimeout.apply(void 0, F([e, r], R(t)));
366
366
  },
367
367
  clearTimeout: function(e) {
368
368
  return clearTimeout(e);
@@ -376,17 +376,17 @@ function lt(e) {
376
376
  }
377
377
  function Z() {
378
378
  }
379
- function R(e) {
379
+ function M(e) {
380
380
  e();
381
381
  }
382
- var W = function(e) {
382
+ var q = function(e) {
383
383
  x(r, e);
384
384
  function r(t) {
385
385
  var n = e.call(this) || this;
386
386
  return n.isStopped = !1, t ? (n.destination = t, at(t) && t.add(n)) : n.destination = Yt, n;
387
387
  }
388
388
  return r.create = function(t, n, o) {
389
- return new q(t, n, o);
389
+ return new $(t, n, o);
390
390
  }, r.prototype.next = function(t) {
391
391
  this.isStopped || this._next(t);
392
392
  }, r.prototype.error = function(t) {
@@ -441,7 +441,7 @@ var W = function(e) {
441
441
  U(t);
442
442
  }
443
443
  }, e;
444
- }(), q = function(e) {
444
+ }(), $ = function(e) {
445
445
  x(r, e);
446
446
  function r(t, n, o) {
447
447
  var i = e.call(this) || this, u;
@@ -452,7 +452,7 @@ var W = function(e) {
452
452
  } : u = t, i.destination = new Dt(u), i;
453
453
  }
454
454
  return r;
455
- }(W);
455
+ }(q);
456
456
  function U(e) {
457
457
  lt(e);
458
458
  }
@@ -464,7 +464,7 @@ var Yt = {
464
464
  next: Z,
465
465
  error: Ht,
466
466
  complete: Z
467
- }, $ = function() {
467
+ }, W = function() {
468
468
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
469
469
  }();
470
470
  function D(e) {
@@ -485,10 +485,10 @@ var w = function() {
485
485
  var t = new e();
486
486
  return t.source = this, t.operator = r, t;
487
487
  }, e.prototype.subscribe = function(r, t, n) {
488
- var o = this, i = Kt(r) ? r : new q(r, t, n);
489
- return R(function() {
490
- var u = o, c = u.operator, a = u.source;
491
- i.add(c ? c.call(i, a) : a ? o._subscribe(i) : o._trySubscribe(i));
488
+ var o = this, i = Kt(r) ? r : new $(r, t, n);
489
+ return M(function() {
490
+ var u = o, s = u.operator, a = u.source;
491
+ i.add(s ? s.call(i, a) : a ? o._subscribe(i) : o._trySubscribe(i));
492
492
  }), i;
493
493
  }, e.prototype._trySubscribe = function(r) {
494
494
  try {
@@ -499,10 +499,10 @@ var w = function() {
499
499
  }, e.prototype.forEach = function(r, t) {
500
500
  var n = this;
501
501
  return t = N(t), new t(function(o, i) {
502
- var u = new q({
503
- next: function(c) {
502
+ var u = new $({
503
+ next: function(s) {
504
504
  try {
505
- r(c);
505
+ r(s);
506
506
  } catch (a) {
507
507
  i(a), u.unsubscribe();
508
508
  }
@@ -515,7 +515,7 @@ var w = function() {
515
515
  }, e.prototype._subscribe = function(r) {
516
516
  var t;
517
517
  return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(r);
518
- }, e.prototype[$] = function() {
518
+ }, e.prototype[W] = function() {
519
519
  return this;
520
520
  }, e.prototype.pipe = function() {
521
521
  for (var r = [], t = 0; t < arguments.length; t++)
@@ -545,14 +545,14 @@ function Gt(e) {
545
545
  return e && p(e.next) && p(e.error) && p(e.complete);
546
546
  }
547
547
  function Kt(e) {
548
- return e && e instanceof W || Gt(e) && at(e);
548
+ return e && e instanceof q || Gt(e) && at(e);
549
549
  }
550
- function qt(e) {
550
+ function $t(e) {
551
551
  return p(e == null ? void 0 : e.lift);
552
552
  }
553
553
  function I(e) {
554
554
  return function(r) {
555
- if (qt(r))
555
+ if ($t(r))
556
556
  return r.lift(function(t) {
557
557
  try {
558
558
  return e(t, this);
@@ -564,21 +564,21 @@ function I(e) {
564
564
  };
565
565
  }
566
566
  function _(e, r, t, n, o) {
567
- return new Wt(e, r, t, n, o);
567
+ return new qt(e, r, t, n, o);
568
568
  }
569
- var Wt = function(e) {
569
+ var qt = function(e) {
570
570
  x(r, e);
571
- function r(t, n, o, i, u, c) {
571
+ function r(t, n, o, i, u, s) {
572
572
  var a = e.call(this, t) || this;
573
- return a.onFinalize = u, a.shouldUnsubscribe = c, a._next = n ? function(s) {
573
+ return a.onFinalize = u, a.shouldUnsubscribe = s, a._next = n ? function(c) {
574
574
  try {
575
- n(s);
575
+ n(c);
576
576
  } catch (l) {
577
577
  t.error(l);
578
578
  }
579
- } : e.prototype._next, a._error = i ? function(s) {
579
+ } : e.prototype._next, a._error = i ? function(c) {
580
580
  try {
581
- i(s);
581
+ i(c);
582
582
  } catch (l) {
583
583
  t.error(l);
584
584
  } finally {
@@ -587,8 +587,8 @@ var Wt = function(e) {
587
587
  } : e.prototype._error, a._complete = o ? function() {
588
588
  try {
589
589
  o();
590
- } catch (s) {
591
- t.error(s);
590
+ } catch (c) {
591
+ t.error(c);
592
592
  } finally {
593
593
  this.unsubscribe();
594
594
  }
@@ -601,7 +601,7 @@ var Wt = function(e) {
601
601
  e.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
602
602
  }
603
603
  }, r;
604
- }(W), $t = st(function(e) {
604
+ }(q), Wt = ct(function(e) {
605
605
  return function() {
606
606
  e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
607
607
  };
@@ -616,23 +616,23 @@ var Wt = function(e) {
616
616
  return n.operator = t, n;
617
617
  }, r.prototype._throwIfClosed = function() {
618
618
  if (this.closed)
619
- throw new $t();
619
+ throw new Wt();
620
620
  }, r.prototype.next = function(t) {
621
621
  var n = this;
622
- R(function() {
622
+ M(function() {
623
623
  var o, i;
624
624
  if (n._throwIfClosed(), !n.isStopped) {
625
625
  n.currentObservers || (n.currentObservers = Array.from(n.observers));
626
626
  try {
627
- for (var u = P(n.currentObservers), c = u.next(); !c.done; c = u.next()) {
628
- var a = c.value;
627
+ for (var u = P(n.currentObservers), s = u.next(); !s.done; s = u.next()) {
628
+ var a = s.value;
629
629
  a.next(t);
630
630
  }
631
- } catch (s) {
632
- o = { error: s };
631
+ } catch (c) {
632
+ o = { error: c };
633
633
  } finally {
634
634
  try {
635
- c && !c.done && (i = u.return) && i.call(u);
635
+ s && !s.done && (i = u.return) && i.call(u);
636
636
  } finally {
637
637
  if (o) throw o.error;
638
638
  }
@@ -641,7 +641,7 @@ var Wt = function(e) {
641
641
  });
642
642
  }, r.prototype.error = function(t) {
643
643
  var n = this;
644
- R(function() {
644
+ M(function() {
645
645
  if (n._throwIfClosed(), !n.isStopped) {
646
646
  n.hasError = n.isStopped = !0, n.thrownError = t;
647
647
  for (var o = n.observers; o.length; )
@@ -650,7 +650,7 @@ var Wt = function(e) {
650
650
  });
651
651
  }, r.prototype.complete = function() {
652
652
  var t = this;
653
- R(function() {
653
+ M(function() {
654
654
  if (t._throwIfClosed(), !t.isStopped) {
655
655
  t.isStopped = !0;
656
656
  for (var n = t.observers; n.length; )
@@ -671,9 +671,9 @@ var Wt = function(e) {
671
671
  }, r.prototype._subscribe = function(t) {
672
672
  return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
673
673
  }, r.prototype._innerSubscribe = function(t) {
674
- var n = this, o = this, i = o.hasError, u = o.isStopped, c = o.observers;
675
- return i || u ? ct : (this.currentObservers = null, c.push(t), new T(function() {
676
- n.currentObservers = null, V(c, t);
674
+ var n = this, o = this, i = o.hasError, u = o.isStopped, s = o.observers;
675
+ return i || u ? st : (this.currentObservers = null, s.push(t), new T(function() {
676
+ n.currentObservers = null, V(s, t);
677
677
  }));
678
678
  }, r.prototype._checkFinalizedStatuses = function(t) {
679
679
  var n = this, o = n.hasError, i = n.thrownError, u = n.isStopped;
@@ -701,7 +701,7 @@ var Wt = function(e) {
701
701
  (n = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || n === void 0 || n.call(t);
702
702
  }, r.prototype._subscribe = function(t) {
703
703
  var n, o;
704
- return (o = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && o !== void 0 ? o : ct;
704
+ return (o = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && o !== void 0 ? o : st;
705
705
  }, r;
706
706
  }(J), Y = function(e) {
707
707
  x(r, e);
@@ -742,7 +742,7 @@ var Wt = function(e) {
742
742
  setInterval: function(e, r) {
743
743
  for (var t = [], n = 2; n < arguments.length; n++)
744
744
  t[n - 2] = arguments[n];
745
- return setInterval.apply(void 0, F([e, r], M(t)));
745
+ return setInterval.apply(void 0, F([e, r], R(t)));
746
746
  },
747
747
  clearInterval: function(e) {
748
748
  return clearInterval(e);
@@ -839,7 +839,7 @@ function ht(e) {
839
839
  return p(e == null ? void 0 : e.then);
840
840
  }
841
841
  function dt(e) {
842
- return p(e[$]);
842
+ return p(e[W]);
843
843
  }
844
844
  function vt(e) {
845
845
  return Symbol.asyncIterator && p(e == null ? void 0 : e[Symbol.asyncIterator]);
@@ -855,7 +855,7 @@ function bt(e) {
855
855
  return p(e == null ? void 0 : e[yt]);
856
856
  }
857
857
  function mt(e) {
858
- return Mt(this, arguments, function() {
858
+ return Rt(this, arguments, function() {
859
859
  var t, n, o, i;
860
860
  return ut(this, function(u) {
861
861
  switch (u.label) {
@@ -901,15 +901,15 @@ function C(e) {
901
901
  if (vt(e))
902
902
  return gt(e);
903
903
  if (bt(e))
904
- return se(e);
905
- if (wt(e))
906
904
  return ce(e);
905
+ if (wt(e))
906
+ return se(e);
907
907
  }
908
908
  throw pt(e);
909
909
  }
910
910
  function oe(e) {
911
911
  return new w(function(r) {
912
- var t = e[$]();
912
+ var t = e[W]();
913
913
  if (p(t.subscribe))
914
914
  return t.subscribe(r);
915
915
  throw new TypeError("Provided object does not correctly implement Symbol.observable");
@@ -931,7 +931,7 @@ function ue(e) {
931
931
  }).then(null, lt);
932
932
  });
933
933
  }
934
- function se(e) {
934
+ function ce(e) {
935
935
  return new w(function(r) {
936
936
  var t, n;
937
937
  try {
@@ -940,8 +940,8 @@ function se(e) {
940
940
  if (r.next(u), r.closed)
941
941
  return;
942
942
  }
943
- } catch (c) {
944
- t = { error: c };
943
+ } catch (s) {
944
+ t = { error: s };
945
945
  } finally {
946
946
  try {
947
947
  i && !i.done && (n = o.return) && n.call(o);
@@ -959,13 +959,13 @@ function gt(e) {
959
959
  });
960
960
  });
961
961
  }
962
- function ce(e) {
962
+ function se(e) {
963
963
  return gt(mt(e));
964
964
  }
965
965
  function ae(e, r) {
966
966
  var t, n, o, i;
967
- return Rt(this, void 0, void 0, function() {
968
- var u, c;
967
+ return Mt(this, void 0, void 0, function() {
968
+ var u, s;
969
969
  return ut(this, function(a) {
970
970
  switch (a.label) {
971
971
  case 0:
@@ -982,7 +982,7 @@ function ae(e, r) {
982
982
  case 4:
983
983
  return [3, 11];
984
984
  case 5:
985
- return c = a.sent(), o = { error: c }, [3, 11];
985
+ return s = a.sent(), o = { error: s }, [3, 11];
986
986
  case 6:
987
987
  return a.trys.push([6, , 9, 10]), n && !n.done && (i = t.return) ? [4, i.call(t)] : [3, 8];
988
988
  case 7:
@@ -1054,8 +1054,8 @@ function de(e, r) {
1054
1054
  var o, i, u;
1055
1055
  try {
1056
1056
  o = n.next(), i = o.value, u = o.done;
1057
- } catch (c) {
1058
- t.error(c);
1057
+ } catch (s) {
1058
+ t.error(s);
1059
1059
  return;
1060
1060
  }
1061
1061
  u ? t.complete() : t.next(i);
@@ -1110,13 +1110,13 @@ function Q(e, r) {
1110
1110
  }));
1111
1111
  });
1112
1112
  }
1113
- function be(e, r, t, n, o, i, u, c) {
1114
- var a = [], s = 0, l = 0, d = !1, y = function() {
1115
- d && !a.length && !s && r.complete();
1113
+ function be(e, r, t, n, o, i, u, s) {
1114
+ var a = [], c = 0, l = 0, d = !1, y = function() {
1115
+ d && !a.length && !c && r.complete();
1116
1116
  }, f = function(v) {
1117
- return s < n ? b(v) : a.push(v);
1117
+ return c < n ? b(v) : a.push(v);
1118
1118
  }, b = function(v) {
1119
- s++;
1119
+ c++;
1120
1120
  var A = !1;
1121
1121
  C(t(v, l++)).subscribe(_(r, function(h) {
1122
1122
  r.next(h);
@@ -1125,11 +1125,11 @@ function be(e, r, t, n, o, i, u, c) {
1125
1125
  }, void 0, function() {
1126
1126
  if (A)
1127
1127
  try {
1128
- s--;
1128
+ c--;
1129
1129
  for (var h = function() {
1130
1130
  var m = a.shift();
1131
1131
  u || b(m);
1132
- }; a.length && s < n; )
1132
+ }; a.length && c < n; )
1133
1133
  h();
1134
1134
  y();
1135
1135
  } catch (m) {
@@ -1175,25 +1175,25 @@ function nt(e, r) {
1175
1175
  }
1176
1176
  function xe(e, r) {
1177
1177
  return r === void 0 && (r = Nt), I(function(t, n) {
1178
- var o = null, i = null, u = null, c = function() {
1178
+ var o = null, i = null, u = null, s = function() {
1179
1179
  if (o) {
1180
1180
  o.unsubscribe(), o = null;
1181
- var s = i;
1182
- i = null, n.next(s);
1181
+ var c = i;
1182
+ i = null, n.next(c);
1183
1183
  }
1184
1184
  };
1185
1185
  function a() {
1186
- var s = u + e, l = r.now();
1187
- if (l < s) {
1188
- o = this.schedule(void 0, s - l), n.add(o);
1186
+ var c = u + e, l = r.now();
1187
+ if (l < c) {
1188
+ o = this.schedule(void 0, c - l), n.add(o);
1189
1189
  return;
1190
1190
  }
1191
- c();
1191
+ s();
1192
1192
  }
1193
- t.subscribe(_(n, function(s) {
1194
- i = s, u = r.now(), o || (o = r.schedule(a, e), n.add(o));
1193
+ t.subscribe(_(n, function(c) {
1194
+ i = c, u = r.now(), o || (o = r.schedule(a, e), n.add(o));
1195
1195
  }, function() {
1196
- c(), n.complete();
1196
+ s(), n.complete();
1197
1197
  }, void 0, function() {
1198
1198
  i = o = null;
1199
1199
  }));
@@ -1203,8 +1203,8 @@ function _e(e, r) {
1203
1203
  return r === void 0 && (r = D), e = e ?? Ie, I(function(t, n) {
1204
1204
  var o, i = !0;
1205
1205
  t.subscribe(_(n, function(u) {
1206
- var c = r(u);
1207
- (i || !e(o, c)) && (i = !1, o = c, n.next(u));
1206
+ var s = r(u);
1207
+ (i || !e(o, s)) && (i = !1, o = s, n.next(u));
1208
1208
  }));
1209
1209
  });
1210
1210
  }
@@ -1216,28 +1216,28 @@ function Ee(e, r, t) {
1216
1216
  return n ? I(function(o, i) {
1217
1217
  var u;
1218
1218
  (u = n.subscribe) === null || u === void 0 || u.call(n);
1219
- var c = !0;
1219
+ var s = !0;
1220
1220
  o.subscribe(_(i, function(a) {
1221
- var s;
1222
- (s = n.next) === null || s === void 0 || s.call(n, a), i.next(a);
1221
+ var c;
1222
+ (c = n.next) === null || c === void 0 || c.call(n, a), i.next(a);
1223
1223
  }, function() {
1224
1224
  var a;
1225
- c = !1, (a = n.complete) === null || a === void 0 || a.call(n), i.complete();
1225
+ s = !1, (a = n.complete) === null || a === void 0 || a.call(n), i.complete();
1226
1226
  }, function(a) {
1227
- var s;
1228
- c = !1, (s = n.error) === null || s === void 0 || s.call(n, a), i.error(a);
1227
+ var c;
1228
+ s = !1, (c = n.error) === null || c === void 0 || c.call(n, a), i.error(a);
1229
1229
  }, function() {
1230
- var a, s;
1231
- c && ((a = n.unsubscribe) === null || a === void 0 || a.call(n)), (s = n.finalize) === null || s === void 0 || s.call(n);
1230
+ var a, c;
1231
+ s && ((a = n.unsubscribe) === null || a === void 0 || a.call(n)), (c = n.finalize) === null || c === void 0 || c.call(n);
1232
1232
  }));
1233
1233
  }) : D;
1234
1234
  }
1235
1235
  function Oe(e, r) {
1236
1236
  const t = S({}), n = Lt({ parent: window.parent, connect: e }), o = S(""), i = g({
1237
1237
  get: () => o.value,
1238
- set: (c) => n.appState.set(c)
1238
+ set: (s) => n.appState.set(s)
1239
1239
  }), u = S({ availableLocales: [] });
1240
- return n.context.subscribe((c) => t.value = c), ge(n.appState.get(), n.appState).subscribe((c) => o.value = c), n.locales.subscribe((c) => u.value = c), je(n.signal, n, r), it(() => n.unsubscribe()), Object.assign(
1240
+ return n.context.subscribe((s) => t.value = s), ge(n.appState.get(), n.appState).subscribe((s) => o.value = s), n.locales.subscribe((s) => u.value = s), je(n.signal, n, r), it(() => n.unsubscribe()), Object.assign(
1241
1241
  ot(n, ["context", "toolbar", "appState", "locales"]),
1242
1242
  {
1243
1243
  context: t,
@@ -1270,14 +1270,14 @@ function Ae(e) {
1270
1270
  return e.toolbar.pipe(Q((t) => t.search.input ?? ""), _e(), xe(300), Ee(console.log)).forEach((t) => r.search.value = t), r;
1271
1271
  }
1272
1272
  function je(e, r, t) {
1273
- const n = Ot(), { shift: o, ctrl_shift_i: i, ctrl_shift_o: u, ctrl_shift_p: c, ctrl_h: a } = n, s = S(null), l = new J(), d = l.pipe(
1273
+ const n = Ot(), { shift: o, ctrl_shift_i: i, ctrl_shift_o: u, ctrl_shift_p: s, ctrl_h: a } = n, c = S(null), l = new J(), d = l.pipe(
1274
1274
  nt(t ?? ((y) => Promise.resolve(y))),
1275
1275
  nt((y) => e(y))
1276
1276
  ).subscribe();
1277
1277
  return r.add(d), d.add(E(o, () => {
1278
1278
  const y = Date.now();
1279
- s.value && y - s.value < 300 ? (s.value = null, l.next({ overlay: { action: !0 } })) : s.value = y;
1280
- })), d.add(E(a, () => l.next({ navigate: { to: "OS.dash" } }))), d.add(E(i, () => l.next({ immersive: { mode: "toggle" } }))), d.add(E(u, () => l.next({ notifications: { action: "toggle" } }))), d.add(E(c, () => l.next({ notepad: { action: "toggle" } }))), d.add(E(n["ctrl_/"], () => l.next({ hotkeys: { action: "toggle" } }))), d.add(Pt(
1279
+ c.value && y - c.value < 300 ? (c.value = null, l.next({ overlay: { action: !0 } })) : c.value = y;
1280
+ })), d.add(E(a, () => l.next({ navigate: { to: "OS.dash" } }))), d.add(E(i, () => l.next({ immersive: { mode: "toggle" } }))), d.add(E(u, () => l.next({ notifications: { action: "toggle" } }))), d.add(E(s, () => l.next({ notepad: { action: "toggle" } }))), d.add(E(n["ctrl_/"], () => l.next({ hotkeys: { action: "toggle" } }))), d.add(Pt(
1281
1281
  () => Array.from({ length: 10 }).forEach((y, f) => {
1282
1282
  const b = (f + 1) % 10, v = n[`ctrl_${b}`];
1283
1283
  d.add(E(v, () => l.next({ navigate: { to: { favorite: f } } })));
@@ -1289,7 +1289,7 @@ function Pe(e) {
1289
1289
  Object.entries(e).map(([r, t]) => [r, Ct(t)])
1290
1290
  );
1291
1291
  }
1292
- function Fe(e = "comms") {
1292
+ function Ve(e = "comms") {
1293
1293
  const [r, t] = Te(
1294
1294
  e,
1295
1295
  () => Oe(),
@@ -1305,14 +1305,22 @@ function Te(e, r, t) {
1305
1305
  () => Tt(e)()
1306
1306
  ];
1307
1307
  }
1308
- function Ve(e, r, t) {
1308
+ function Be(e, r, t) {
1309
1309
  const o = At(e, r, { immediate: !1, ...t });
1310
1310
  return Object.assign(ot(o, ["execute"]), {
1311
1311
  execute: (...i) => o.execute(void 0, ...i),
1312
1312
  executeDelayed: o.execute
1313
1313
  });
1314
1314
  }
1315
- function Be(e) {
1315
+ function Ce(e, r, t) {
1316
+ let n;
1317
+ return onMounted(() => n = e.signal.receive((o) => o[r] && t(o[r]))), onUnmounted(() => n == null ? void 0 : n()), () => n == null ? void 0 : n();
1318
+ }
1319
+ function De(e, r, t) {
1320
+ const n = ref(void 0);
1321
+ return Ce(e, r, (o) => n.value = t ? t(o) : o), readonly(n);
1322
+ }
1323
+ function He(e) {
1316
1324
  const { context: r } = e, t = new Y({}), n = (h) => t.next(h(t.value)), o = S(), i = new Y(void 0);
1317
1325
  Object.entries(r).forEach(([h, m]) => z(
1318
1326
  m,
@@ -1322,9 +1330,9 @@ function Be(e) {
1322
1330
  const u = i.asObservable().pipe(
1323
1331
  Q((h) => h == null ? void 0 : h.contentWindow),
1324
1332
  Se((h) => !!h)
1325
- ), c = new Y({ availableLocales: [] }), { locale: a, availableLocales: s } = G();
1326
- kt(() => c.next(Pe({ locale: a, availableLocales: s })));
1327
- const l = Ut({ ...e, contextChanges: t, windowChanges: u, locales: c });
1333
+ ), s = new Y({ availableLocales: [] }), { locale: a, availableLocales: c } = G();
1334
+ kt(() => s.next(Pe({ locale: a, availableLocales: c })));
1335
+ const l = Ut({ ...e, contextChanges: t, windowChanges: u, locales: s });
1328
1336
  l.toolbar.subscribe((h) => {
1329
1337
  var k, L;
1330
1338
  const m = e.toolbar;
@@ -1353,11 +1361,13 @@ function Be(e) {
1353
1361
  };
1354
1362
  }
1355
1363
  export {
1364
+ De as signalRef,
1356
1365
  Re as useAntColorMode,
1357
- Me as useAntI18n,
1358
- Ve as useApi,
1366
+ Fe as useAntI18n,
1367
+ Be as useApi,
1359
1368
  Oe as useCommsClient,
1360
- Be as useCommsHost,
1361
- Fe as useCommsInjection,
1362
- Te as useSingleton
1369
+ He as useCommsHost,
1370
+ Ve as useCommsInjection,
1371
+ Te as useSingleton,
1372
+ Ce as watchSignal
1363
1373
  };
@@ -2,4 +2,4 @@ export { useAntColorMode, type UseAntColorModeOptions, type UseAntColorModeRetur
2
2
  export { useAntI18n, type UseAntI18nReturn } from './useAntI18n';
3
3
  export { type UseCommsClient, useCommsClient } from './useCommsClient';
4
4
  export { type CommsHostArgs, type UseCommsHost, useCommsHost } from './useCommsHost';
5
- export { type AnyUseApiReturn, type CommsToolbar, useApi, type UseApiReturn, useCommsInjection, useSingleton } from './utils';
5
+ export { type AnyUseApiReturn, type CommsToolbar, signalRef, useApi, type UseApiReturn, useCommsInjection, useSingleton, watchSignal, } from './utils';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antcde/vue-utils",
3
3
  "type": "module",
4
- "version": "0.1.7",
4
+ "version": "0.2.0",
5
5
  "description": "Helper to use ANT Comms in Vue 3",
6
6
  "author": "CollaborAll",
7
7
  "repository": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "rxjs": "^7.8.1",
35
- "@antcde/connect-ts": "0.1.6"
35
+ "@antcde/connect-ts": "0.2.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@vitejs/plugin-vue": "^5.0.3",
@@ -1,32 +0,0 @@
1
- import { ToolbarItem } from '@antcde/connect-ts';
2
- import { UseAsyncStateOptions, UseAsyncStateReturn } from '@vueuse/core';
3
- import { FunctionPlugin, Ref, UnwrapRef } from 'vue';
4
- import { UseCommsClient } from './useCommsClient';
5
-
6
- type RefObject<T> = {
7
- [K in keyof T]: T[K];
8
- };
9
- export declare function unrefObject<T extends object>(obj: RefObject<T>): UnwrapRef<T>;
10
- export interface CommsToolbar {
11
- title: Ref<string | undefined>;
12
- searchEnabled: Ref<boolean>;
13
- search: Ref<string>;
14
- menu: Ref<ToolbarItem[]>;
15
- isLoading: Ref<boolean>;
16
- }
17
- interface UseCommsFactoryResult {
18
- provideComms: FunctionPlugin;
19
- injectComms: () => UseCommsClient;
20
- }
21
- export declare function useCommsInjection(name?: string): UseCommsFactoryResult;
22
- export declare function useSingleton<T extends object>(name: string, factory: () => T, dispose?: (value: T) => void): [provide: FunctionPlugin, inject: () => T];
23
- export declare function useApi<Data, Params extends any[] = [], Shallow extends boolean = true>(promise: Promise<Data> | ((...args: Params) => Promise<Data>), initialState: Data, options?: UseAsyncStateOptions<Shallow, Data>): UseApiReturn<Data, Params, Shallow>;
24
- export interface UseApiReturn<Data, Params extends any[], Shallow extends boolean> extends Omit<UseAsyncStateReturn<Data, Params, Shallow>, 'execute'> {
25
- execute: (...args: Params) => Promise<Data>;
26
- executeDelayed: (delay: number, ...args: Params) => void;
27
- }
28
- /**
29
- * A shorthand that implies all the generics to be any
30
- */
31
- export type AnyUseApiReturn = UseApiReturn<any, any, any>;
32
- export {};