cradova 3.12.0 → 3.12.2
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/index.js
CHANGED
|
@@ -434,8 +434,8 @@ function invoke(fn, ...args) {
|
|
|
434
434
|
return toComp(fn, args);
|
|
435
435
|
}
|
|
436
436
|
var useExternalEffect = (effect) => {
|
|
437
|
-
return (
|
|
438
|
-
return effect
|
|
437
|
+
return (ctx, ...args) => {
|
|
438
|
+
return effect(ctx, ...args);
|
|
439
439
|
};
|
|
440
440
|
};
|
|
441
441
|
|
|
@@ -531,6 +531,27 @@ class Store {
|
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
|
|
534
|
+
class SilentStore {
|
|
535
|
+
$store;
|
|
536
|
+
constructor(store) {
|
|
537
|
+
this.$store = store;
|
|
538
|
+
for (const key in this.$store.$_internal_data) {
|
|
539
|
+
if (this.$store.$_internal_data.hasOwnProperty(key)) {
|
|
540
|
+
Object.defineProperty(this, key, {
|
|
541
|
+
get() {
|
|
542
|
+
return this.$store.$_internal_data[key];
|
|
543
|
+
},
|
|
544
|
+
set(value) {
|
|
545
|
+
this.$store.$_internal_data[key] = value;
|
|
546
|
+
},
|
|
547
|
+
enumerable: true,
|
|
548
|
+
configurable: true
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
534
555
|
class List2 {
|
|
535
556
|
_data;
|
|
536
557
|
_dirtyIndices;
|
|
@@ -608,6 +629,7 @@ class Signal {
|
|
|
608
629
|
isList = false;
|
|
609
630
|
subscribers = {};
|
|
610
631
|
store;
|
|
632
|
+
silentStore = undefined;
|
|
611
633
|
passers;
|
|
612
634
|
constructor(initial, props) {
|
|
613
635
|
if (!initial || typeof initial !== "object") {
|
|
@@ -617,6 +639,7 @@ class Signal {
|
|
|
617
639
|
this.store = new Store(initial, (key) => {
|
|
618
640
|
this.publish(key);
|
|
619
641
|
});
|
|
642
|
+
this.silentStore = new SilentStore(this.store);
|
|
620
643
|
} else {
|
|
621
644
|
this.isList = true;
|
|
622
645
|
this.store = new List2(initial, (eventType) => {
|
|
@@ -632,6 +655,7 @@ class Signal {
|
|
|
632
655
|
this.store = new Store(Object.assign(initial, restored), (key2) => {
|
|
633
656
|
this.publish(key2);
|
|
634
657
|
});
|
|
658
|
+
this.silentStore = new SilentStore(this.store);
|
|
635
659
|
} else if (Array.isArray(restored)) {
|
|
636
660
|
this.isList = true;
|
|
637
661
|
this.store = new List2(restored, (eventType) => {
|
|
@@ -23,6 +23,7 @@ declare class List<Type extends any[]> {
|
|
|
23
23
|
*/
|
|
24
24
|
export declare class Signal<Type = any> {
|
|
25
25
|
store: Type extends Array<any> ? List<Type> : Type extends Record<string, any> ? Type : never;
|
|
26
|
+
silentStore: Type extends Array<any> ? never : Type;
|
|
26
27
|
passers?: Record<keyof Type, [string, Signal<Type>]>;
|
|
27
28
|
constructor(initial: Type, props?: {
|
|
28
29
|
persistName?: string | undefined;
|
|
@@ -45,5 +45,5 @@ export declare function invoke(fn: (...args: any[]) => HTMLElement, ...args: any
|
|
|
45
45
|
* Gives you access the component instance
|
|
46
46
|
* @param effect - The function to invoke
|
|
47
47
|
*/
|
|
48
|
-
export declare const useExternalEffect: <T>(effect: (
|
|
48
|
+
export declare const useExternalEffect: <T>(effect: (ctx: Comp, ...args: any[]) => T) => (ctx: Comp, ...args: any[]) => T;
|
|
49
49
|
export {};
|