edges-svelte 1.0.0 → 1.0.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.
@@ -1,12 +1,15 @@
|
|
1
|
-
import { createDerivedState } from '../store/index.js';
|
1
|
+
import { createDerivedState as BaseCreateDerivedState } from '../store/index.js';
|
2
2
|
import type { Writable } from 'svelte/store';
|
3
3
|
type StoreDeps = {
|
4
4
|
createRawState: <T>(initial: T | (() => T)) => {
|
5
5
|
value: T;
|
6
6
|
};
|
7
7
|
createState: <T>(initial: T | (() => T)) => Writable<T>;
|
8
|
-
createDerivedState: typeof
|
8
|
+
createDerivedState: typeof BaseCreateDerivedState;
|
9
9
|
};
|
10
|
-
|
11
|
-
|
10
|
+
type NoConflict<I> = {
|
11
|
+
[K in keyof I]: K extends keyof StoreDeps ? never : I[K];
|
12
|
+
};
|
13
|
+
export declare const createProvider: <T, I extends Record<string, unknown> = Record<string, unknown>>(name: string, factory: (args: StoreDeps & NoConflict<I>) => T, inject?: I) => (() => T);
|
14
|
+
export declare const createProviderFactory: <I extends Record<string, unknown>>(inject: I) => <T>(name: string, factory: (args: StoreDeps & NoConflict<I>) => T) => () => T;
|
12
15
|
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { createState, createDerivedState, createRawState } from '../store/index.js';
|
1
|
+
import { createState as BaseCreateState, createDerivedState as BaseCreateDerivedState, createRawState as BaseCreateRawState } from '../store/index.js';
|
2
2
|
import { RequestContext } from '../context/index.js';
|
3
3
|
import { browser } from '$app/environment';
|
4
4
|
const globalClientCache = new Map();
|
@@ -25,14 +25,14 @@ export const createProvider = (name, factory, inject) => {
|
|
25
25
|
createState: (initial) => {
|
26
26
|
const key = `${cacheKey ?? 'provider'}::state::${stateCounter++}`;
|
27
27
|
const initFn = typeof initial === 'function' ? initial : () => initial;
|
28
|
-
return
|
28
|
+
return BaseCreateState(key, initFn);
|
29
29
|
},
|
30
30
|
createRawState: (initial) => {
|
31
31
|
const key = `${cacheKey ?? 'provider'}::rawstate::${stateCounter++}`;
|
32
32
|
const initFn = typeof initial === 'function' ? initial : () => initial;
|
33
|
-
return
|
33
|
+
return BaseCreateRawState(key, initFn);
|
34
34
|
},
|
35
|
-
createDerivedState
|
35
|
+
createDerivedState: BaseCreateDerivedState
|
36
36
|
};
|
37
37
|
const instance = factory(autoKeyDeps);
|
38
38
|
if (cacheKey) {
|