@mmstack/primitives 21.0.25 → 22.0.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.
|
@@ -311,7 +311,8 @@ function debounced(initial, opt) {
|
|
|
311
311
|
*/
|
|
312
312
|
function debounce(source, opt) {
|
|
313
313
|
const ms = opt?.ms ?? 0;
|
|
314
|
-
const trigger = signal(false,
|
|
314
|
+
const trigger = signal(false, /* @ts-ignore */
|
|
315
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
315
316
|
let timeout;
|
|
316
317
|
try {
|
|
317
318
|
const destroyRef = opt?.destroyRef ?? inject(DestroyRef, { optional: true });
|
|
@@ -661,7 +662,8 @@ function createItemSignal(source, index, setter, opt) {
|
|
|
661
662
|
}
|
|
662
663
|
function indexArray(source, map, opt = {}) {
|
|
663
664
|
const data = isSignal(source) ? source : computed(source);
|
|
664
|
-
const len = computed(() => data().length,
|
|
665
|
+
const len = computed(() => data().length, /* @ts-ignore */
|
|
666
|
+
...(ngDevMode ? [{ debugName: "len" }] : /* istanbul ignore next */ []));
|
|
665
667
|
const setter = createSetter(data);
|
|
666
668
|
const writableData = isWritableSignal(data)
|
|
667
669
|
? data
|
|
@@ -789,7 +791,8 @@ function keyArray(source, mapFn, options = {}) {
|
|
|
789
791
|
for (j = 0; j < newLen; j++) {
|
|
790
792
|
item = newItems[j];
|
|
791
793
|
items[j] = item;
|
|
792
|
-
const indexSignal = signal(j,
|
|
794
|
+
const indexSignal = signal(j, /* @ts-ignore */
|
|
795
|
+
...(ngDevMode ? [{ debugName: "indexSignal" }] : /* istanbul ignore next */ []));
|
|
793
796
|
newIndexes[j] = indexSignal;
|
|
794
797
|
newMapped[j] = mapFn(item, indexSignal);
|
|
795
798
|
}
|
|
@@ -839,7 +842,8 @@ function keyArray(source, mapFn, options = {}) {
|
|
|
839
842
|
newIndexes[j].set(j);
|
|
840
843
|
}
|
|
841
844
|
else {
|
|
842
|
-
const indexSignal = signal(j,
|
|
845
|
+
const indexSignal = signal(j, /* @ts-ignore */
|
|
846
|
+
...(ngDevMode ? [{ debugName: "indexSignal" }] : /* istanbul ignore next */ []));
|
|
843
847
|
newIndexes[j] = indexSignal;
|
|
844
848
|
newMapped[j] = mapFn(newItems[j], indexSignal);
|
|
845
849
|
}
|
|
@@ -1276,7 +1280,8 @@ function clipboard(debugName = 'clipboard') {
|
|
|
1276
1280
|
!navigator.clipboard) {
|
|
1277
1281
|
const sig = computed(() => '', { debugName });
|
|
1278
1282
|
sig.copy = () => Promise.resolve();
|
|
1279
|
-
sig.isSupported = computed(() => false,
|
|
1283
|
+
sig.isSupported = computed(() => false, /* @ts-ignore */
|
|
1284
|
+
...(ngDevMode ? [{ debugName: "isSupported" }] : /* istanbul ignore next */ []));
|
|
1280
1285
|
return sig;
|
|
1281
1286
|
}
|
|
1282
1287
|
const state = signal('', { ...(ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {}), debugName });
|
|
@@ -1295,7 +1300,8 @@ function clipboard(debugName = 'clipboard') {
|
|
|
1295
1300
|
await navigator.clipboard.writeText(value);
|
|
1296
1301
|
state.set(value);
|
|
1297
1302
|
};
|
|
1298
|
-
sig.isSupported = computed(() => true,
|
|
1303
|
+
sig.isSupported = computed(() => true, /* @ts-ignore */
|
|
1304
|
+
...(ngDevMode ? [{ debugName: "isSupported" }] : /* istanbul ignore next */ []));
|
|
1299
1305
|
return sig;
|
|
1300
1306
|
}
|
|
1301
1307
|
|
|
@@ -1368,7 +1374,9 @@ function elementSize(target = inject(ElementRef), opt) {
|
|
|
1368
1374
|
return;
|
|
1369
1375
|
let observer = null;
|
|
1370
1376
|
observer = new ResizeObserver(([entry]) => {
|
|
1377
|
+
// eslint-disable-next-line no-useless-assignment
|
|
1371
1378
|
let width = 0;
|
|
1379
|
+
// eslint-disable-next-line no-useless-assignment
|
|
1372
1380
|
let height = 0;
|
|
1373
1381
|
const boxOption = opt?.box ?? 'border-box';
|
|
1374
1382
|
if (boxOption === 'border-box' && entry.borderBoxSize?.length > 0) {
|
|
@@ -1458,7 +1466,8 @@ function elementVisibility(target = inject(ElementRef), opt) {
|
|
|
1458
1466
|
const base = computed(() => undefined, {
|
|
1459
1467
|
debugName: opt?.debugName,
|
|
1460
1468
|
});
|
|
1461
|
-
base.visible = computed(() => false,
|
|
1469
|
+
base.visible = computed(() => false, /* @ts-ignore */
|
|
1470
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
1462
1471
|
return base;
|
|
1463
1472
|
}
|
|
1464
1473
|
const state = signal(undefined, {
|
|
@@ -1495,7 +1504,8 @@ function elementVisibility(target = inject(ElementRef), opt) {
|
|
|
1495
1504
|
if (!s)
|
|
1496
1505
|
return false;
|
|
1497
1506
|
return s.isIntersecting;
|
|
1498
|
-
},
|
|
1507
|
+
}, /* @ts-ignore */
|
|
1508
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
1499
1509
|
return base;
|
|
1500
1510
|
}
|
|
1501
1511
|
|
|
@@ -1577,15 +1587,19 @@ function geolocation(opt) {
|
|
|
1577
1587
|
const sig = computed(() => null, {
|
|
1578
1588
|
debugName: opt?.debugName ?? 'geolocation',
|
|
1579
1589
|
});
|
|
1580
|
-
sig.error = computed(() => null,
|
|
1581
|
-
|
|
1590
|
+
sig.error = computed(() => null, /* @ts-ignore */
|
|
1591
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
1592
|
+
sig.loading = computed(() => false, /* @ts-ignore */
|
|
1593
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
1582
1594
|
return sig;
|
|
1583
1595
|
}
|
|
1584
1596
|
const position = signal(null, {
|
|
1585
1597
|
debugName: opt?.debugName ?? 'geolocation',
|
|
1586
1598
|
});
|
|
1587
|
-
const error = signal(null,
|
|
1588
|
-
|
|
1599
|
+
const error = signal(null, /* @ts-ignore */
|
|
1600
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
1601
|
+
const loading = signal(true, /* @ts-ignore */
|
|
1602
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
1589
1603
|
const onSuccess = (p) => {
|
|
1590
1604
|
position.set(p);
|
|
1591
1605
|
error.set(null);
|
|
@@ -1636,13 +1650,15 @@ function idle(opt) {
|
|
|
1636
1650
|
const sig = computed(() => false, {
|
|
1637
1651
|
debugName: opt?.debugName ?? 'idle',
|
|
1638
1652
|
});
|
|
1639
|
-
sig.since = computed(() => serverDate$1,
|
|
1653
|
+
sig.since = computed(() => serverDate$1, /* @ts-ignore */
|
|
1654
|
+
...(ngDevMode ? [{ debugName: "since" }] : /* istanbul ignore next */ []));
|
|
1640
1655
|
return sig;
|
|
1641
1656
|
}
|
|
1642
1657
|
const ms = opt?.ms ?? 60_000;
|
|
1643
1658
|
const events = opt?.events ?? DEFAULT_EVENTS;
|
|
1644
1659
|
const state = signal(false, { debugName: opt?.debugName ?? 'idle' });
|
|
1645
|
-
const since = signal(new Date(),
|
|
1660
|
+
const since = signal(new Date(), /* @ts-ignore */
|
|
1661
|
+
...(ngDevMode ? [{ debugName: "since" }] : /* istanbul ignore next */ []));
|
|
1646
1662
|
let timer;
|
|
1647
1663
|
const goIdle = () => {
|
|
1648
1664
|
if (state())
|
|
@@ -1840,7 +1856,8 @@ function throttle(source, opt) {
|
|
|
1840
1856
|
const ms = opt?.ms ?? 0;
|
|
1841
1857
|
const leading = opt?.leading ?? false;
|
|
1842
1858
|
const trailing = opt?.trailing ?? true;
|
|
1843
|
-
const trigger = signal(false,
|
|
1859
|
+
const trigger = signal(false, /* @ts-ignore */
|
|
1860
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
1844
1861
|
const fire = () => trigger.update((c) => !c);
|
|
1845
1862
|
let timeout;
|
|
1846
1863
|
let pendingTrailing = false;
|
|
@@ -2007,11 +2024,13 @@ function networkStatus(debugName = 'networkStatus') {
|
|
|
2007
2024
|
const sig = computed(() => true, {
|
|
2008
2025
|
debugName,
|
|
2009
2026
|
});
|
|
2010
|
-
sig.since = computed(() => serverDate,
|
|
2027
|
+
sig.since = computed(() => serverDate, /* @ts-ignore */
|
|
2028
|
+
...(ngDevMode ? [{ debugName: "since" }] : /* istanbul ignore next */ []));
|
|
2011
2029
|
return sig;
|
|
2012
2030
|
}
|
|
2013
2031
|
const state = signal(navigator.onLine, { ...(ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {}), debugName });
|
|
2014
|
-
const since = signal(new Date(),
|
|
2032
|
+
const since = signal(new Date(), /* @ts-ignore */
|
|
2033
|
+
...(ngDevMode ? [{ debugName: "since" }] : /* istanbul ignore next */ []));
|
|
2015
2034
|
const goOnline = () => {
|
|
2016
2035
|
state.set(true);
|
|
2017
2036
|
since.set(new Date());
|
|
@@ -2470,7 +2489,8 @@ function toArrayStore(source, injector, vivify) {
|
|
|
2470
2489
|
if (!Array.isArray(v))
|
|
2471
2490
|
return 0;
|
|
2472
2491
|
return v.length;
|
|
2473
|
-
},
|
|
2492
|
+
}, /* @ts-ignore */
|
|
2493
|
+
...(ngDevMode ? [{ debugName: "lengthSignal" }] : /* istanbul ignore next */ []));
|
|
2474
2494
|
return new Proxy(source, {
|
|
2475
2495
|
has(_, prop) {
|
|
2476
2496
|
if (prop === 'length')
|
|
@@ -2717,7 +2737,8 @@ function scopedStore(parent, seed, kind, injector) {
|
|
|
2717
2737
|
const view = computed(() => ({
|
|
2718
2738
|
...parent(),
|
|
2719
2739
|
...local(),
|
|
2720
|
-
}),
|
|
2740
|
+
}), /* @ts-ignore */
|
|
2741
|
+
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
2721
2742
|
const splitSet = (next) => {
|
|
2722
2743
|
const lv = localValue();
|
|
2723
2744
|
const pv = parentValue();
|
|
@@ -2981,10 +3002,10 @@ class MessageBus {
|
|
|
2981
3002
|
this.channel.removeEventListener('message', listener);
|
|
2982
3003
|
this.listeners.delete(id);
|
|
2983
3004
|
}
|
|
2984
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2985
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
3005
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: MessageBus, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3006
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: MessageBus, providedIn: 'root' });
|
|
2986
3007
|
}
|
|
2987
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3008
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: MessageBus, decorators: [{
|
|
2988
3009
|
type: Injectable,
|
|
2989
3010
|
args: [{
|
|
2990
3011
|
providedIn: 'root',
|
|
@@ -3058,7 +3079,8 @@ function tabSync(sig, opt) {
|
|
|
3058
3079
|
return;
|
|
3059
3080
|
}
|
|
3060
3081
|
post(val);
|
|
3061
|
-
},
|
|
3082
|
+
}, /* @ts-ignore */
|
|
3083
|
+
...(ngDevMode ? [{ debugName: "effectRef" }] : /* istanbul ignore next */ []));
|
|
3062
3084
|
inject(DestroyRef).onDestroy(() => {
|
|
3063
3085
|
effectRef.destroy();
|
|
3064
3086
|
unsub();
|
|
@@ -3258,9 +3280,12 @@ function withHistory(sourceOrValue, opt) {
|
|
|
3258
3280
|
history.set([]);
|
|
3259
3281
|
redoArray.set([]);
|
|
3260
3282
|
};
|
|
3261
|
-
internal.canUndo = computed(() => history().length > 0,
|
|
3262
|
-
|
|
3263
|
-
internal.
|
|
3283
|
+
internal.canUndo = computed(() => history().length > 0, /* @ts-ignore */
|
|
3284
|
+
...(ngDevMode ? [{ debugName: "canUndo" }] : /* istanbul ignore next */ []));
|
|
3285
|
+
internal.canRedo = computed(() => redoArray().length > 0, /* @ts-ignore */
|
|
3286
|
+
...(ngDevMode ? [{ debugName: "canRedo" }] : /* istanbul ignore next */ []));
|
|
3287
|
+
internal.canClear = computed(() => internal.canUndo() || internal.canRedo(), /* @ts-ignore */
|
|
3288
|
+
...(ngDevMode ? [{ debugName: "canClear" }] : /* istanbul ignore next */ []));
|
|
3264
3289
|
return internal;
|
|
3265
3290
|
}
|
|
3266
3291
|
|