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.esm.js
CHANGED
|
@@ -297,6 +297,13 @@ function flushMicroEffect() {
|
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
+
function flushMicroEffectManual() {
|
|
301
|
+
if (schedulerStatus !== ScheduleStatus.Running && multiScheduler.hasTask) {
|
|
302
|
+
schedulerStatus = ScheduleStatus.Running;
|
|
303
|
+
multiScheduler.flushAllTask();
|
|
304
|
+
schedulerStatus = ScheduleStatus.Idle;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
300
307
|
let _batchDeep = 0;
|
|
301
308
|
const batchStart = () => _batchDeep++;
|
|
302
309
|
const batchEnd = () => {
|
|
@@ -765,10 +772,10 @@ const trackIterator = (cells, scope) => {
|
|
|
765
772
|
}
|
|
766
773
|
iter.get();
|
|
767
774
|
};
|
|
768
|
-
const triggerIterator =
|
|
775
|
+
const triggerIterator = cells => {
|
|
769
776
|
const iter = cells.get(Keys.Iterator);
|
|
770
777
|
if (iter) {
|
|
771
|
-
iter.set((
|
|
778
|
+
iter.set((iter.value || 0) + 1);
|
|
772
779
|
}
|
|
773
780
|
};
|
|
774
781
|
const trackKey = (cells, scope, key) => {
|
|
@@ -820,7 +827,7 @@ const createSharedHandler = (cells, scope, deep, targetIsMap) => {
|
|
|
820
827
|
if (had) {
|
|
821
828
|
triggerKey(cells, key);
|
|
822
829
|
cells.delete(key);
|
|
823
|
-
triggerIterator(cells
|
|
830
|
+
triggerIterator(cells);
|
|
824
831
|
}
|
|
825
832
|
batchEnd();
|
|
826
833
|
return result;
|
|
@@ -834,7 +841,7 @@ const createSharedHandler = (cells, scope, deep, targetIsMap) => {
|
|
|
834
841
|
cells.clear();
|
|
835
842
|
if (iterCell) cells.set(Keys.Iterator, iterCell);
|
|
836
843
|
if (hadItems) {
|
|
837
|
-
triggerIterator(cells
|
|
844
|
+
triggerIterator(cells);
|
|
838
845
|
}
|
|
839
846
|
batchEnd();
|
|
840
847
|
},
|
|
@@ -879,7 +886,7 @@ const createMapHandler = (cells, scope, deep) => ({
|
|
|
879
886
|
} else {
|
|
880
887
|
cell.set(value);
|
|
881
888
|
}
|
|
882
|
-
triggerIterator(cells
|
|
889
|
+
triggerIterator(cells);
|
|
883
890
|
batchEnd();
|
|
884
891
|
return this;
|
|
885
892
|
}
|
|
@@ -899,7 +906,7 @@ const createSetHandler = (cells, scope, _deep) => ({
|
|
|
899
906
|
cell.set(value);
|
|
900
907
|
}
|
|
901
908
|
if (!had) {
|
|
902
|
-
triggerIterator(cells
|
|
909
|
+
triggerIterator(cells);
|
|
903
910
|
}
|
|
904
911
|
batchEnd();
|
|
905
912
|
return this;
|
|
@@ -1402,6 +1409,7 @@ function warpCallbackArgs(isDeep, args, scope, wrapArgs = 0b01) {
|
|
|
1402
1409
|
args[0] = wrapCb;
|
|
1403
1410
|
}
|
|
1404
1411
|
|
|
1412
|
+
const isParentKey = (parentStore, expr) => expr in parentStore[Keys.Raw];
|
|
1405
1413
|
class Store {
|
|
1406
1414
|
static [IsStore] = true;
|
|
1407
1415
|
static [StoreIgnoreKeys] = ['ui', 'raw'];
|
|
@@ -1412,18 +1420,31 @@ class Store {
|
|
|
1412
1420
|
return proxy;
|
|
1413
1421
|
}
|
|
1414
1422
|
parent = () => null;
|
|
1415
|
-
static new(keyMap
|
|
1423
|
+
static new(keyMap, staticMap) {
|
|
1416
1424
|
const parentStore = Store.Current;
|
|
1417
1425
|
const child = new this();
|
|
1418
|
-
if (parentStore) {
|
|
1426
|
+
if (parentStore && keyMap) {
|
|
1427
|
+
const cells = child[Keys.Meta].cells;
|
|
1419
1428
|
for (const childKey in keyMap) {
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1429
|
+
const expr = keyMap[childKey];
|
|
1430
|
+
if (typeof expr === 'function') {
|
|
1431
|
+
cells.set(childKey, new Computed(() => expr(parentStore)));
|
|
1432
|
+
child[Keys.Raw][childKey] = undefined;
|
|
1433
|
+
} else if (typeof expr === 'string') {
|
|
1434
|
+
if (isParentKey(parentStore, expr)) {
|
|
1435
|
+
shareSignal(parentStore, expr, child, childKey);
|
|
1436
|
+
} else {
|
|
1437
|
+
const fn = new Function('data', `let v;with(data){v=${expr};}return v;`);
|
|
1438
|
+
cells.set(childKey, new Computed(() => fn(parentStore)));
|
|
1439
|
+
child[Keys.Raw][childKey] = undefined;
|
|
1440
|
+
}
|
|
1441
|
+
} else {
|
|
1442
|
+
shareSignal(parentStore, expr, child, childKey);
|
|
1443
|
+
}
|
|
1422
1444
|
}
|
|
1423
1445
|
}
|
|
1424
1446
|
for (const key in staticMap) {
|
|
1425
|
-
|
|
1426
|
-
child[key] = value;
|
|
1447
|
+
child[key] = staticMap[key];
|
|
1427
1448
|
}
|
|
1428
1449
|
child.parent = () => parentStore;
|
|
1429
1450
|
Store.Current = parentStore;
|
|
@@ -1557,5 +1578,5 @@ function scope(...args) {
|
|
|
1557
1578
|
return run;
|
|
1558
1579
|
}
|
|
1559
1580
|
|
|
1560
|
-
export { $, Computed, Effect, EffectStrType2Enum, IsStore, Keys, NoopEffect, ScheduleStatus, ScheduleType, Scope, Signal, Store, StoreIgnoreKeys, batchDeep, batchEnd, batchStart, clean, deepSignal, effect, effectUt, execId, execIdInc, getPulling, ide, macro, micro, noopEffect, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
|
|
1581
|
+
export { $, Computed, Effect, EffectStrType2Enum, IsStore, Keys, NoopEffect, ScheduleStatus, ScheduleType, Scope, Signal, Store, StoreIgnoreKeys, batchDeep, batchEnd, batchStart, clean, deepSignal, effect, effectUt, execId, execIdInc, flushMicroEffectManual, getPulling, ide, macro, micro, noopEffect, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
|
|
1561
1582
|
//# sourceMappingURL=aoye.esm.js.map
|