aoye 0.0.56 → 0.0.57
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 +19 -4
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +19 -5
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.umd.js +19 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -220,6 +220,7 @@ declare class Store {
|
|
|
220
220
|
static new<T extends Store = any, P extends Store = any, O extends string = ''>(this: new (...args: any[]) => T, keyMap?: PRecord<keyof T, keyof Omit<P, O> | DeepOmitPath<P, O>> | Record<string, string | Function>, staticMap?: PRecord<keyof T, any>): T;
|
|
221
221
|
map<P extends Store = any, O extends string = ''>(keyMap?: PRecord<keyof this, keyof Omit<P, O> | DeepOmitPath<P, O>>): void;
|
|
222
222
|
}
|
|
223
|
+
declare const isStore: (s: any) => s is typeof Store;
|
|
223
224
|
|
|
224
225
|
declare const ide: typeof requestIdleCallback | typeof setTimeout;
|
|
225
226
|
declare const now: () => number;
|
|
@@ -244,5 +245,5 @@ declare function effectUt(callback: (...args: ValueDiff[]) => void, depOrOpt?: a
|
|
|
244
245
|
declare function effect(callback: (...args: ValueDiff[]) => void, depOrOpt?: any[] | CustomEffectOpt, opt?: CustomEffectOpt): Effect;
|
|
245
246
|
declare function scope(...args: any[]): any;
|
|
246
247
|
|
|
247
|
-
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 };
|
|
248
|
+
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, isStore, macro, micro, noopEffect, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
|
|
248
249
|
export type { CreateScope, CreateTaskProps, CustomEffectOpt, DeepOmitPath, DeepPath, DeepValue, Dispose, Key, Link, MatchValue, Mix, OnClean, OutLink, PRecord, ScheduleTypeStr, SideEffect, SignalNode, SignalType, Task, TaskControlReturn, ValueDiff };
|
package/dist/index.umd.js
CHANGED
|
@@ -987,7 +987,17 @@
|
|
|
987
987
|
if (targetIsArray) {
|
|
988
988
|
return arrayMethodReWrites[prop] || value;
|
|
989
989
|
} else {
|
|
990
|
-
|
|
990
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
991
|
+
return value;
|
|
992
|
+
}
|
|
993
|
+
let s = cells.get(prop);
|
|
994
|
+
if (s) {
|
|
995
|
+
return s.get();
|
|
996
|
+
}
|
|
997
|
+
s = new Signal(value);
|
|
998
|
+
s.scope = scope;
|
|
999
|
+
cells.set(prop, s);
|
|
1000
|
+
return s.get();
|
|
991
1001
|
}
|
|
992
1002
|
}
|
|
993
1003
|
let s = cells.get(prop);
|
|
@@ -1001,7 +1011,7 @@
|
|
|
1001
1011
|
return s.get();
|
|
1002
1012
|
},
|
|
1003
1013
|
set(obj, prop, value, receiver) {
|
|
1004
|
-
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)
|
|
1014
|
+
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
|
|
1005
1015
|
return Reflect.set(obj, prop, value, receiver);
|
|
1006
1016
|
}
|
|
1007
1017
|
const isNewKey = !Reflect.has(obj, prop);
|
|
@@ -1009,7 +1019,7 @@
|
|
|
1009
1019
|
const success = Reflect.set(obj, prop, value, receiver);
|
|
1010
1020
|
const cell = cells.get(prop);
|
|
1011
1021
|
if (cell) {
|
|
1012
|
-
cell.set(deep ? deepSignal(value, scope)
|
|
1022
|
+
cell.set(typeof value === 'function' || !deep ? value : deepSignal(value, scope));
|
|
1013
1023
|
}
|
|
1014
1024
|
if (targetIsArray) {
|
|
1015
1025
|
handleArraySet(obj, prop, value, receiver);
|
|
@@ -1020,7 +1030,10 @@
|
|
|
1020
1030
|
return success;
|
|
1021
1031
|
},
|
|
1022
1032
|
deleteProperty(obj, prop) {
|
|
1023
|
-
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)
|
|
1033
|
+
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
|
|
1034
|
+
return Reflect.deleteProperty(obj, prop);
|
|
1035
|
+
}
|
|
1036
|
+
if (typeof obj[prop] === 'function' && !Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
1024
1037
|
return Reflect.deleteProperty(obj, prop);
|
|
1025
1038
|
}
|
|
1026
1039
|
cells.delete(prop);
|
|
@@ -1465,6 +1478,7 @@
|
|
|
1465
1478
|
this.parent = null;
|
|
1466
1479
|
}
|
|
1467
1480
|
}
|
|
1481
|
+
const isStore = s => typeof s === 'function' && s[IsStore];
|
|
1468
1482
|
|
|
1469
1483
|
function $(data) {
|
|
1470
1484
|
if (typeof data === 'object' && data !== null) {
|
|
@@ -1607,6 +1621,7 @@
|
|
|
1607
1621
|
exports.flushMicroEffectManual = flushMicroEffectManual;
|
|
1608
1622
|
exports.getPulling = getPulling;
|
|
1609
1623
|
exports.ide = ide;
|
|
1624
|
+
exports.isStore = isStore;
|
|
1610
1625
|
exports.macro = macro;
|
|
1611
1626
|
exports.micro = micro;
|
|
1612
1627
|
exports.noopEffect = noopEffect;
|