foldkit-mirror 0.5.2 → 0.6.0
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.d.mts +13 -9
- package/dist/index.d.mts.map +1 -1
- package/package.json +11 -11
package/dist/index.d.mts
CHANGED
|
@@ -33,7 +33,12 @@ export interface MirrorStore<R = never> {
|
|
|
33
33
|
/** `MirrorStore.url`: where in the URL the keys live. */
|
|
34
34
|
export type UrlLocation = 'search' | 'hash';
|
|
35
35
|
/** `href` with the mirror's keys set and dropped in its location; every other key, the path, and the other part stay. */
|
|
36
|
-
export declare const applyToHref: (href: string, write: Pick<MirrorWrite,
|
|
36
|
+
export declare const applyToHref: (href: string, write: Pick<MirrorWrite, 'set' | 'remove'>, location?: UrlLocation) => string;
|
|
37
|
+
declare const urlStore: (owned: ReadonlyArray<string>, location: UrlLocation) => MirrorStore;
|
|
38
|
+
declare const kvStore: (options: {
|
|
39
|
+
readonly key: string;
|
|
40
|
+
readonly scope?: string | undefined;
|
|
41
|
+
}) => MirrorStore<KeyValueStore.KeyValueStore>;
|
|
37
42
|
/** An in-memory store that records its writes, for tests and for a mirror with no host. */
|
|
38
43
|
export interface MemoryStore extends MirrorStore {
|
|
39
44
|
/** What the store holds now. */
|
|
@@ -41,15 +46,13 @@ export interface MemoryStore extends MirrorStore {
|
|
|
41
46
|
/** Every write, in order. */
|
|
42
47
|
readonly writes: ReadonlyArray<MirrorWrite>;
|
|
43
48
|
}
|
|
49
|
+
declare const memoryStore: (initial?: Encoded) => MemoryStore;
|
|
44
50
|
export declare const MirrorStore: {
|
|
45
51
|
/** The URL's query string (or hash), through `foldkit/navigation`. `owned` are the keys the mirror may touch. */
|
|
46
|
-
url:
|
|
52
|
+
url: typeof urlStore;
|
|
47
53
|
/** One JSON document under `key` in Effect's `KeyValueStore`, scoped and versioned. */
|
|
48
|
-
kv:
|
|
49
|
-
|
|
50
|
-
readonly scope?: string | undefined;
|
|
51
|
-
}) => MirrorStore<KeyValueStore.KeyValueStore>;
|
|
52
|
-
memory: (initial?: Encoded) => MemoryStore;
|
|
54
|
+
kv: typeof kvStore;
|
|
55
|
+
memory: typeof memoryStore;
|
|
53
56
|
};
|
|
54
57
|
/** Mirror's Message cases, for `defineMessageUnion({ ...Mirror.messages, … })`. */
|
|
55
58
|
export declare const mirrorMessageCases: {
|
|
@@ -310,7 +313,7 @@ export declare const Mirror: {
|
|
|
310
313
|
reduces: <M extends {
|
|
311
314
|
readonly _tag: string;
|
|
312
315
|
}>(message: M) => message is Extract<M, {
|
|
313
|
-
readonly _tag:
|
|
316
|
+
readonly _tag: 'MirrorRestored';
|
|
314
317
|
}>;
|
|
315
318
|
/**
|
|
316
319
|
* Folds pre-init steps into the initial Model, in list order: stores first,
|
|
@@ -370,7 +373,7 @@ export declare const Mirror: {
|
|
|
370
373
|
*/
|
|
371
374
|
routing: <AppModel, Message extends {
|
|
372
375
|
readonly _tag: string;
|
|
373
|
-
}, const Tag extends Message[
|
|
376
|
+
}, const Tag extends Message['_tag'], Args extends ReadonlyArray<unknown>, InitReturn extends {
|
|
374
377
|
readonly model: AppModel;
|
|
375
378
|
}, UpdateReturn extends {
|
|
376
379
|
readonly model: AppModel;
|
|
@@ -385,4 +388,5 @@ export declare const Mirror: {
|
|
|
385
388
|
make: <S extends Slice, R, Name extends string = string>(app: MirrorApp<SliceRoot<S>>, store: MirrorStore<R>, config: MirrorConfig<S, Name>) => Mirror<SliceRoot<S>, SliceValue<S>, R, Name>;
|
|
386
389
|
};
|
|
387
390
|
//#endregion
|
|
391
|
+
export {};
|
|
388
392
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;YAkCY,UAAU,SAAS;;iBAGd;WACN,MAAM;;;iBAIA;WACN,KAAK;WACL,QAAQ;;WAER;;;;;;;iBAQM,YAAY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,SAAS,KAAK,MAAM,YAAY,kBACrE,cAAc,UAAU,SAAS,MAAM,YAAY;;;;;;EAsBtD,KAAK,UAAU,OAAO,8BAA4B,KAC3C,UAAU,UAAU,KAAG,QACpB,eAAe,GAAG,UACzB,SAAS,UAAU,IAAI,WAAW,IAAI;;EAoCzC,OAAO,UAAU,OAAO,GAAG,8BAA4B,KAChD,UAAU,UAAU,KAAG,OACrB,YAAY,IAAE,QACb,aAAa,GAAG,UACvB,OAAO,UAAU,IAAI,WAAW,IAAI,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-mirror",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A Foldkit Model slice kept in the URL or a key-value store: written when the slice changes, read back on navigation or cold load.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "git+https://github.com/doeixd/foldkit-plus.git",
|
|
22
22
|
"directory": "packages/mirror"
|
|
23
23
|
},
|
|
24
|
-
"homepage": "https://
|
|
24
|
+
"homepage": "https://foldkit-plus.pages.dev/mirror",
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/doeixd/foldkit-plus/issues"
|
|
27
27
|
},
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"LICENSE"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"foldkit-surface": "0.
|
|
42
|
+
"foldkit-surface": "0.9.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"effect": "^4.0.0",
|
|
46
|
-
"foldkit": "^0.
|
|
46
|
+
"foldkit": "^0.168.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@effect/platform-browser": "4.0.
|
|
50
|
-
"effect": "4.0.
|
|
51
|
-
"foldkit": "0.
|
|
52
|
-
"jsdom": "
|
|
53
|
-
"tsdown": "^0.23.
|
|
54
|
-
"typescript": "
|
|
55
|
-
"foldkit-bundle": "0.
|
|
49
|
+
"@effect/platform-browser": "^4.0.4",
|
|
50
|
+
"effect": "^4.0.4",
|
|
51
|
+
"foldkit": "0.168.0",
|
|
52
|
+
"jsdom": "30.1.2",
|
|
53
|
+
"tsdown": "^0.23.1",
|
|
54
|
+
"typescript": "7.0.2",
|
|
55
|
+
"foldkit-bundle": "0.7.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|