r-state-tree 0.7.0 → 0.8.1
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/README.md +97 -51
- package/dist/api.d.ts +2 -2
- package/dist/decorators.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/model/Model.d.ts +5 -9
- package/dist/model/ModelAdministration.d.ts +11 -0
- package/dist/model/idMap.d.ts +4 -4
- package/dist/observables/preact.d.ts +1 -1
- package/dist/r-state-tree.cjs +460 -267
- package/dist/r-state-tree.js +460 -267
- package/dist/store/Store.d.ts +5 -4
- package/dist/store/StoreAdministration.d.ts +10 -5
- package/package.json +1 -1
package/dist/store/Store.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ type CreateStoreProps<T extends Record<string, any>> = {
|
|
|
8
8
|
export declare function createStore<K extends Store<any>, T extends Record<string, any> = K extends Store<infer P> ? P : never>(Type: new (props: StoreProps<T>) => K, props?: CreateStoreProps<T>): K;
|
|
9
9
|
export declare function updateStore<K extends Store<T>, T extends Record<string, any>>(store: K, props: CreateStoreProps<T>): K;
|
|
10
10
|
export declare function types<T extends Store>(config: Partial<StoreConfiguration<T>>): Partial<StoreConfiguration<T>>;
|
|
11
|
-
export default class Store<PropsType extends Record<string, any> = StoreProps<Props>> {
|
|
11
|
+
export default class Store<PropsType extends Record<string, any> = StoreProps<Props>> implements Disposable {
|
|
12
12
|
static types?: StoreConfiguration<unknown>;
|
|
13
13
|
props: StoreProps<PropsType>;
|
|
14
14
|
constructor(props: StoreProps<PropsType>);
|
|
15
15
|
get key(): string | number | undefined;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
get isMounted(): boolean;
|
|
17
|
+
reaction<T>(track: () => T, callback: (value: T, previousValue: T) => void): () => void;
|
|
18
|
+
effect(callback: () => void | (() => void)): () => void;
|
|
19
|
+
[Symbol.dispose](): void;
|
|
19
20
|
}
|
|
20
21
|
export {};
|
|
@@ -6,10 +6,11 @@ export declare function getStoreAdm(store: Store): StoreAdministration;
|
|
|
6
6
|
export declare class StoreAdministration<StoreType extends Store = Store> extends ObjectAdministration<Store> {
|
|
7
7
|
static proxyTraps: ProxyHandler<object>;
|
|
8
8
|
parent: StoreAdministration | null;
|
|
9
|
-
|
|
9
|
+
private mountedSignal;
|
|
10
|
+
private disposed;
|
|
10
11
|
private contextCache;
|
|
11
12
|
private childStoreDataMap;
|
|
12
|
-
private
|
|
13
|
+
private reactiveRegistrations;
|
|
13
14
|
private configurationGetter?;
|
|
14
15
|
setConfiguration(configurationGetter: () => StoreConfiguration<StoreType>): void;
|
|
15
16
|
private get configuration();
|
|
@@ -22,9 +23,13 @@ export declare class StoreAdministration<StoreType extends Store = Store> extend
|
|
|
22
23
|
private getStore;
|
|
23
24
|
private getModelRef;
|
|
24
25
|
isRoot(): boolean;
|
|
26
|
+
get isMounted(): boolean;
|
|
25
27
|
getContextValue<T>(contextId: symbol, provideSymbol: symbol, defaultValue: T | undefined, hasDefault: boolean): T;
|
|
26
28
|
private lookupContextValue;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
private register;
|
|
30
|
+
private startReactiveRegistrations;
|
|
31
|
+
reaction<T>(track: () => T, callback: (value: T, previousValue: T) => void): () => void;
|
|
32
|
+
effect(callback: () => void | (() => void)): () => void;
|
|
33
|
+
mount(parent?: StoreAdministration | null, childName?: PropertyKey, activationQueue?: StoreAdministration[]): void;
|
|
34
|
+
dispose(internal?: boolean): void;
|
|
30
35
|
}
|