@flowgram.ai/utils 0.1.0-alpha.7 → 0.1.0-alpha.8
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/esm/index.js +22 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -1451,6 +1451,9 @@ var DisposableCollection = class {
|
|
|
1451
1451
|
this._disposed = false;
|
|
1452
1452
|
toDispose.forEach((d) => this.push(d));
|
|
1453
1453
|
}
|
|
1454
|
+
get length() {
|
|
1455
|
+
return this.disposables.length;
|
|
1456
|
+
}
|
|
1454
1457
|
get onDispose() {
|
|
1455
1458
|
return this.onDisposeEmitter.event;
|
|
1456
1459
|
}
|
|
@@ -1474,25 +1477,26 @@ var DisposableCollection = class {
|
|
|
1474
1477
|
}
|
|
1475
1478
|
push(disposable) {
|
|
1476
1479
|
if (this.disposed) return Disposable.NULL;
|
|
1480
|
+
if (disposable === Disposable.NULL) {
|
|
1481
|
+
return Disposable.NULL;
|
|
1482
|
+
}
|
|
1477
1483
|
const { disposables } = this;
|
|
1478
|
-
if (disposables.find((d) => d
|
|
1484
|
+
if (disposables.find((d) => d === disposable)) {
|
|
1479
1485
|
return Disposable.NULL;
|
|
1480
1486
|
}
|
|
1481
|
-
|
|
1487
|
+
const originalDispose = disposable.dispose;
|
|
1482
1488
|
const toRemove = Disposable.create(() => {
|
|
1483
|
-
const index = disposables.indexOf(
|
|
1489
|
+
const index = disposables.indexOf(disposable);
|
|
1484
1490
|
if (index !== -1) {
|
|
1485
1491
|
disposables.splice(index, 1);
|
|
1486
1492
|
}
|
|
1493
|
+
disposable.dispose = originalDispose;
|
|
1487
1494
|
});
|
|
1488
|
-
|
|
1489
|
-
dispose
|
|
1490
|
-
|
|
1491
|
-
disposable.dispose();
|
|
1492
|
-
},
|
|
1493
|
-
_origin: disposable
|
|
1495
|
+
disposable.dispose = () => {
|
|
1496
|
+
toRemove.dispose();
|
|
1497
|
+
disposable.dispose();
|
|
1494
1498
|
};
|
|
1495
|
-
disposables.push(
|
|
1499
|
+
disposables.push(disposable);
|
|
1496
1500
|
return toRemove;
|
|
1497
1501
|
}
|
|
1498
1502
|
pushAll(disposables) {
|
|
@@ -1713,6 +1717,7 @@ var Cache;
|
|
|
1713
1717
|
return cache;
|
|
1714
1718
|
},
|
|
1715
1719
|
getMore(count, autoDelete = true) {
|
|
1720
|
+
var _a;
|
|
1716
1721
|
if (count === cache.length) {
|
|
1717
1722
|
} else if (count > cache.length) {
|
|
1718
1723
|
let added = count - cache.length;
|
|
@@ -1721,7 +1726,7 @@ var Cache;
|
|
|
1721
1726
|
added--;
|
|
1722
1727
|
}
|
|
1723
1728
|
} else if (autoDelete) {
|
|
1724
|
-
const deleteLimit = opts.deleteLimit
|
|
1729
|
+
const deleteLimit = (_a = opts.deleteLimit) != null ? _a : 0;
|
|
1725
1730
|
if (cache.length - count > deleteLimit) {
|
|
1726
1731
|
const deleted = cache.splice(count);
|
|
1727
1732
|
deleted.forEach((el) => el.dispose && el.dispose());
|
|
@@ -1737,11 +1742,12 @@ var Cache;
|
|
|
1737
1742
|
const newCache = [];
|
|
1738
1743
|
const findedMap = /* @__PURE__ */ new Map();
|
|
1739
1744
|
cache.forEach((item) => {
|
|
1745
|
+
var _a;
|
|
1740
1746
|
const finded = items.find((i) => i.key === item.key);
|
|
1741
1747
|
if (finded) {
|
|
1742
1748
|
findedMap.set(item.key, item);
|
|
1743
1749
|
} else {
|
|
1744
|
-
item.dispose
|
|
1750
|
+
(_a = item.dispose) == null ? void 0 : _a.call(item);
|
|
1745
1751
|
}
|
|
1746
1752
|
});
|
|
1747
1753
|
items.forEach((item) => {
|
|
@@ -1763,11 +1769,12 @@ var Cache;
|
|
|
1763
1769
|
const newCache = [];
|
|
1764
1770
|
const findedMap = /* @__PURE__ */ new Map();
|
|
1765
1771
|
cache.forEach((cacheItem) => {
|
|
1772
|
+
var _a;
|
|
1766
1773
|
const finded = items.find((ref) => ref === cacheItem.key);
|
|
1767
1774
|
if (finded) {
|
|
1768
1775
|
findedMap.set(cacheItem.key, cacheItem);
|
|
1769
1776
|
} else {
|
|
1770
|
-
cacheItem.dispose
|
|
1777
|
+
(_a = cacheItem.dispose) == null ? void 0 : _a.call(cacheItem);
|
|
1771
1778
|
}
|
|
1772
1779
|
});
|
|
1773
1780
|
items.forEach((item) => {
|
|
@@ -1847,11 +1854,11 @@ var SchemaDecoration;
|
|
|
1847
1854
|
return {
|
|
1848
1855
|
type: "object",
|
|
1849
1856
|
properties: {
|
|
1850
|
-
...baseDecoration
|
|
1857
|
+
...baseDecoration == null ? void 0 : baseDecoration.properties,
|
|
1851
1858
|
...properties
|
|
1852
1859
|
},
|
|
1853
1860
|
mixinDefaults: {
|
|
1854
|
-
...baseDecoration
|
|
1861
|
+
...baseDecoration == null ? void 0 : baseDecoration.mixinDefaults,
|
|
1855
1862
|
...mixinDefaults
|
|
1856
1863
|
}
|
|
1857
1864
|
};
|