aoye 0.0.53 → 0.0.55
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/aoye.cjs.js +34 -12
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +34 -13
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.umd.js +34 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/aoye.cjs.js
CHANGED
|
@@ -299,6 +299,13 @@ function flushMicroEffect() {
|
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
+
function flushMicroEffectManual() {
|
|
303
|
+
if (schedulerStatus !== ScheduleStatus.Running && multiScheduler.hasTask) {
|
|
304
|
+
schedulerStatus = ScheduleStatus.Running;
|
|
305
|
+
multiScheduler.flushAllTask();
|
|
306
|
+
schedulerStatus = ScheduleStatus.Idle;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
302
309
|
let _batchDeep = 0;
|
|
303
310
|
const batchStart = () => _batchDeep++;
|
|
304
311
|
const batchEnd = () => {
|
|
@@ -767,10 +774,10 @@ const trackIterator = (cells, scope) => {
|
|
|
767
774
|
}
|
|
768
775
|
iter.get();
|
|
769
776
|
};
|
|
770
|
-
const triggerIterator =
|
|
777
|
+
const triggerIterator = cells => {
|
|
771
778
|
const iter = cells.get(Keys.Iterator);
|
|
772
779
|
if (iter) {
|
|
773
|
-
iter.set((
|
|
780
|
+
iter.set((iter.value || 0) + 1);
|
|
774
781
|
}
|
|
775
782
|
};
|
|
776
783
|
const trackKey = (cells, scope, key) => {
|
|
@@ -822,7 +829,7 @@ const createSharedHandler = (cells, scope, deep, targetIsMap) => {
|
|
|
822
829
|
if (had) {
|
|
823
830
|
triggerKey(cells, key);
|
|
824
831
|
cells.delete(key);
|
|
825
|
-
triggerIterator(cells
|
|
832
|
+
triggerIterator(cells);
|
|
826
833
|
}
|
|
827
834
|
batchEnd();
|
|
828
835
|
return result;
|
|
@@ -836,7 +843,7 @@ const createSharedHandler = (cells, scope, deep, targetIsMap) => {
|
|
|
836
843
|
cells.clear();
|
|
837
844
|
if (iterCell) cells.set(Keys.Iterator, iterCell);
|
|
838
845
|
if (hadItems) {
|
|
839
|
-
triggerIterator(cells
|
|
846
|
+
triggerIterator(cells);
|
|
840
847
|
}
|
|
841
848
|
batchEnd();
|
|
842
849
|
},
|
|
@@ -881,7 +888,7 @@ const createMapHandler = (cells, scope, deep) => ({
|
|
|
881
888
|
} else {
|
|
882
889
|
cell.set(value);
|
|
883
890
|
}
|
|
884
|
-
triggerIterator(cells
|
|
891
|
+
triggerIterator(cells);
|
|
885
892
|
batchEnd();
|
|
886
893
|
return this;
|
|
887
894
|
}
|
|
@@ -901,7 +908,7 @@ const createSetHandler = (cells, scope, _deep) => ({
|
|
|
901
908
|
cell.set(value);
|
|
902
909
|
}
|
|
903
910
|
if (!had) {
|
|
904
|
-
triggerIterator(cells
|
|
911
|
+
triggerIterator(cells);
|
|
905
912
|
}
|
|
906
913
|
batchEnd();
|
|
907
914
|
return this;
|
|
@@ -1404,6 +1411,7 @@ function warpCallbackArgs(isDeep, args, scope, wrapArgs = 0b01) {
|
|
|
1404
1411
|
args[0] = wrapCb;
|
|
1405
1412
|
}
|
|
1406
1413
|
|
|
1414
|
+
const isParentKey = (parentStore, expr) => expr in parentStore[Keys.Raw];
|
|
1407
1415
|
class Store {
|
|
1408
1416
|
static [IsStore] = true;
|
|
1409
1417
|
static [StoreIgnoreKeys] = ['ui', 'raw'];
|
|
@@ -1414,18 +1422,31 @@ class Store {
|
|
|
1414
1422
|
return proxy;
|
|
1415
1423
|
}
|
|
1416
1424
|
parent = () => null;
|
|
1417
|
-
static new(keyMap
|
|
1425
|
+
static new(keyMap, staticMap) {
|
|
1418
1426
|
const parentStore = Store.Current;
|
|
1419
1427
|
const child = new this();
|
|
1420
|
-
if (parentStore) {
|
|
1428
|
+
if (parentStore && keyMap) {
|
|
1429
|
+
const cells = child[Keys.Meta].cells;
|
|
1421
1430
|
for (const childKey in keyMap) {
|
|
1422
|
-
const
|
|
1423
|
-
|
|
1431
|
+
const expr = keyMap[childKey];
|
|
1432
|
+
if (typeof expr === 'function') {
|
|
1433
|
+
cells.set(childKey, new Computed(() => expr(parentStore)));
|
|
1434
|
+
child[Keys.Raw][childKey] = undefined;
|
|
1435
|
+
} else if (typeof expr === 'string') {
|
|
1436
|
+
if (isParentKey(parentStore, expr)) {
|
|
1437
|
+
shareSignal(parentStore, expr, child, childKey);
|
|
1438
|
+
} else {
|
|
1439
|
+
const fn = new Function('data', `let v;with(data){v=${expr};}return v;`);
|
|
1440
|
+
cells.set(childKey, new Computed(() => fn(parentStore)));
|
|
1441
|
+
child[Keys.Raw][childKey] = undefined;
|
|
1442
|
+
}
|
|
1443
|
+
} else {
|
|
1444
|
+
shareSignal(parentStore, expr, child, childKey);
|
|
1445
|
+
}
|
|
1424
1446
|
}
|
|
1425
1447
|
}
|
|
1426
1448
|
for (const key in staticMap) {
|
|
1427
|
-
|
|
1428
|
-
child[key] = value;
|
|
1449
|
+
child[key] = staticMap[key];
|
|
1429
1450
|
}
|
|
1430
1451
|
child.parent = () => parentStore;
|
|
1431
1452
|
Store.Current = parentStore;
|
|
@@ -1581,6 +1602,7 @@ exports.effect = effect;
|
|
|
1581
1602
|
exports.effectUt = effectUt;
|
|
1582
1603
|
exports.execId = execId;
|
|
1583
1604
|
exports.execIdInc = execIdInc;
|
|
1605
|
+
exports.flushMicroEffectManual = flushMicroEffectManual;
|
|
1584
1606
|
exports.getPulling = getPulling;
|
|
1585
1607
|
exports.ide = ide;
|
|
1586
1608
|
exports.macro = macro;
|