@antcde/vue-utils 0.0.9 → 0.1.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 +22 -22
- package/dist/types/utils.d.ts +0 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useColorMode as _t, objectPick as It, objectOmit as nt, useMagicKeys as Et, whenever as Ot, useAsyncState as At, watchDebounced as
|
|
2
|
-
import { computed as S, ref as g, watch as z, onBeforeUnmount as ot, inject as
|
|
1
|
+
import { useColorMode as _t, objectPick as It, objectOmit as nt, useMagicKeys as Et, whenever as Ot, useAsyncState as At, watchDebounced as jt } from "@vueuse/core";
|
|
2
|
+
import { computed as S, ref as g, watch as z, onBeforeUnmount as ot, inject as Pt, unref as Tt, watchEffect as Ct } from "vue";
|
|
3
3
|
import { useI18n as H } from "vue-i18n";
|
|
4
4
|
import { newCommsClient as kt, newCommsHost as Lt } from "@antcde/connect-ts";
|
|
5
5
|
function Ue(e, r) {
|
|
@@ -145,7 +145,7 @@ function it(e, r) {
|
|
|
145
145
|
return { value: s[0] ? s[1] : void 0, done: !0 };
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function j(e) {
|
|
149
149
|
var r = typeof Symbol == "function" && Symbol.iterator, t = r && e[r], n = 0;
|
|
150
150
|
if (t) return t.call(e);
|
|
151
151
|
if (e && typeof e.length == "number") return {
|
|
@@ -221,7 +221,7 @@ function Rt(e, r, t) {
|
|
|
221
221
|
function Ft(e) {
|
|
222
222
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
223
223
|
var r = e[Symbol.asyncIterator], t;
|
|
224
|
-
return r ? r.call(e) : (e = typeof
|
|
224
|
+
return r ? r.call(e) : (e = typeof j == "function" ? j(e) : e[Symbol.iterator](), t = {}, n("next"), n("throw"), n("return"), t[Symbol.asyncIterator] = function() {
|
|
225
225
|
return this;
|
|
226
226
|
}, t);
|
|
227
227
|
function n(i) {
|
|
@@ -261,7 +261,7 @@ function M(e, r) {
|
|
|
261
261
|
0 <= t && e.splice(t, 1);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
var
|
|
264
|
+
var P = function() {
|
|
265
265
|
function e(r) {
|
|
266
266
|
this.initialTeardown = r, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
267
267
|
}
|
|
@@ -273,7 +273,7 @@ var j = function() {
|
|
|
273
273
|
if (u)
|
|
274
274
|
if (this._parentage = null, Array.isArray(u))
|
|
275
275
|
try {
|
|
276
|
-
for (var c =
|
|
276
|
+
for (var c = j(u), a = c.next(); !a.done; a = c.next()) {
|
|
277
277
|
var s = a.value;
|
|
278
278
|
s.remove(this);
|
|
279
279
|
}
|
|
@@ -299,7 +299,7 @@ var j = function() {
|
|
|
299
299
|
if (p) {
|
|
300
300
|
this._finalizers = null;
|
|
301
301
|
try {
|
|
302
|
-
for (var y =
|
|
302
|
+
for (var y = j(p), h = y.next(); !h.done; h = y.next()) {
|
|
303
303
|
var b = h.value;
|
|
304
304
|
try {
|
|
305
305
|
Q(b);
|
|
@@ -349,9 +349,9 @@ var j = function() {
|
|
|
349
349
|
var r = new e();
|
|
350
350
|
return r.closed = !0, r;
|
|
351
351
|
}(), e;
|
|
352
|
-
}(), st =
|
|
352
|
+
}(), st = P.EMPTY;
|
|
353
353
|
function ct(e) {
|
|
354
|
-
return e instanceof
|
|
354
|
+
return e instanceof P || e && "closed" in e && d(e.remove) && d(e.add) && d(e.unsubscribe);
|
|
355
355
|
}
|
|
356
356
|
function Q(e) {
|
|
357
357
|
d(e) ? e() : e.unsubscribe();
|
|
@@ -410,7 +410,7 @@ var q = function(e) {
|
|
|
410
410
|
this.unsubscribe();
|
|
411
411
|
}
|
|
412
412
|
}, r;
|
|
413
|
-
}(
|
|
413
|
+
}(P), Bt = function() {
|
|
414
414
|
function e(r) {
|
|
415
415
|
this.partialObserver = r;
|
|
416
416
|
}
|
|
@@ -624,7 +624,7 @@ var qt = function(e) {
|
|
|
624
624
|
if (n._throwIfClosed(), !n.isStopped) {
|
|
625
625
|
n.currentObservers || (n.currentObservers = Array.from(n.observers));
|
|
626
626
|
try {
|
|
627
|
-
for (var u =
|
|
627
|
+
for (var u = j(n.currentObservers), c = u.next(); !c.done; c = u.next()) {
|
|
628
628
|
var a = c.value;
|
|
629
629
|
a.next(t);
|
|
630
630
|
}
|
|
@@ -672,7 +672,7 @@ var qt = function(e) {
|
|
|
672
672
|
return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
|
|
673
673
|
}, r.prototype._innerSubscribe = function(t) {
|
|
674
674
|
var n = this, o = this, i = o.hasError, u = o.isStopped, c = o.observers;
|
|
675
|
-
return i || u ? st : (this.currentObservers = null, c.push(t), new
|
|
675
|
+
return i || u ? st : (this.currentObservers = null, c.push(t), new P(function() {
|
|
676
676
|
n.currentObservers = null, M(c, t);
|
|
677
677
|
}));
|
|
678
678
|
}, r.prototype._checkFinalizedStatuses = function(t) {
|
|
@@ -738,7 +738,7 @@ var qt = function(e) {
|
|
|
738
738
|
return r.prototype.schedule = function(t, n) {
|
|
739
739
|
return this;
|
|
740
740
|
}, r;
|
|
741
|
-
}(
|
|
741
|
+
}(P), tt = {
|
|
742
742
|
setInterval: function(e, r) {
|
|
743
743
|
for (var t = [], n = 2; n < arguments.length; n++)
|
|
744
744
|
t[n - 2] = arguments[n];
|
|
@@ -935,7 +935,7 @@ function ue(e) {
|
|
|
935
935
|
return new w(function(r) {
|
|
936
936
|
var t, n;
|
|
937
937
|
try {
|
|
938
|
-
for (var o =
|
|
938
|
+
for (var o = j(e), i = o.next(); !i.done; i = o.next()) {
|
|
939
939
|
var u = i.value;
|
|
940
940
|
if (r.next(u), r.closed)
|
|
941
941
|
return;
|
|
@@ -1280,28 +1280,28 @@ function Ae(e, r, t) {
|
|
|
1280
1280
|
).subscribe();
|
|
1281
1281
|
return r.add(u), Ot(n, () => {
|
|
1282
1282
|
const c = Date.now();
|
|
1283
|
-
o.value && c - o.value < 300 ? (o.value = null,
|
|
1283
|
+
o.value && c - o.value < 300 ? (o.value = null, i.next({ overlay: { action: !0 } })) : o.value = c;
|
|
1284
1284
|
}), u;
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function je(e) {
|
|
1287
1287
|
return Object.fromEntries(
|
|
1288
1288
|
Object.entries(e).map(([r, t]) => [r, Tt(t)])
|
|
1289
1289
|
);
|
|
1290
1290
|
}
|
|
1291
1291
|
function Fe(e = "comms") {
|
|
1292
|
-
const [r, t] =
|
|
1292
|
+
const [r, t] = Pe(
|
|
1293
1293
|
e,
|
|
1294
1294
|
() => Ee(),
|
|
1295
1295
|
(n) => n.unsubscribe()
|
|
1296
1296
|
);
|
|
1297
1297
|
return { provideComms: r, injectComms: t };
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1299
|
+
function Pe(e, r, t) {
|
|
1300
1300
|
let n;
|
|
1301
1301
|
const o = () => (!n && (n = r()), n);
|
|
1302
1302
|
return [
|
|
1303
1303
|
(i) => (i.onUnmount(() => t && n && t(n)), i.provide(e, o)),
|
|
1304
|
-
() =>
|
|
1304
|
+
() => Pt(e)()
|
|
1305
1305
|
];
|
|
1306
1306
|
}
|
|
1307
1307
|
function Me(e, r, t) {
|
|
@@ -1322,13 +1322,13 @@ function Ve(e) {
|
|
|
1322
1322
|
J((f) => f == null ? void 0 : f.contentWindow),
|
|
1323
1323
|
Se((f) => !!f)
|
|
1324
1324
|
), c = new Y({ availableLocales: [] }), { locale: a, availableLocales: s } = H();
|
|
1325
|
-
Ct(() => c.next(
|
|
1325
|
+
Ct(() => c.next(je({ locale: a, availableLocales: s })));
|
|
1326
1326
|
const l = Lt({ ...e, contextChanges: t, windowChanges: u, locales: c });
|
|
1327
1327
|
l.toolbar.subscribe((f) => {
|
|
1328
1328
|
var C, k;
|
|
1329
1329
|
const m = e.toolbar;
|
|
1330
1330
|
m.start.value = f.start, m.title.value = f.title, m.searchEnabled.value = ((C = f.search) == null ? void 0 : C.enabled) ?? !1, m.search.value = (k = f.search) == null ? void 0 : k.input, m.menu.value = f.menu, m.isLoading.value = (f == null ? void 0 : f.isLoading) ?? !1;
|
|
1331
|
-
}),
|
|
1331
|
+
}), jt(
|
|
1332
1332
|
e.toolbar.search,
|
|
1333
1333
|
(f) => l.toolbar.set.search(f),
|
|
1334
1334
|
{ immediate: !0, debounce: 100 }
|
|
@@ -1358,5 +1358,5 @@ export {
|
|
|
1358
1358
|
Ee as useCommsClient,
|
|
1359
1359
|
Ve as useCommsHost,
|
|
1360
1360
|
Fe as useCommsInjection,
|
|
1361
|
-
|
|
1361
|
+
Pe as useSingleton
|
|
1362
1362
|
};
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ type RefObject<T> = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function unrefObject<T extends object>(obj: RefObject<T>): UnwrapRef<T>;
|
|
10
10
|
export interface CommsToolbar {
|
|
11
|
-
start: Ref<ToolbarItem | undefined>;
|
|
12
11
|
title: Ref<string | undefined>;
|
|
13
12
|
searchEnabled: Ref<boolean>;
|
|
14
13
|
search: Ref<string>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antcde/vue-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.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.0
|
|
35
|
+
"@antcde/connect-ts": "0.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@vitejs/plugin-vue": "^5.0.3",
|