@warp-drive-mirror/experiments 5.10.0-alpha.10 → 5.10.0-alpha.13
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 +75 -7
- package/dist/data-worker.d.ts +3 -1
- package/dist/data-worker.d.ts.map +1 -1
- package/dist/data-worker.js +3 -1
- package/dist/data-worker.js.map +1 -1
- package/dist/{document-storage-CwwTQ49-.d.ts → document-storage-CxgHVe4i.d.ts} +4 -1
- package/dist/{document-storage-CwwTQ49-.d.ts.map → document-storage-CxgHVe4i.d.ts.map} +1 -1
- package/dist/{document-storage-LM925Stz.js → document-storage-GI-wDgId.js} +4 -1
- package/dist/{document-storage-LM925Stz.js.map → document-storage-GI-wDgId.js.map} +1 -1
- package/dist/document-storage.d.ts +1 -1
- package/dist/document-storage.js +1 -1
- package/dist/image-fetch.d.ts +2 -0
- package/dist/image-fetch.d.ts.map +1 -1
- package/dist/image-fetch.js +2 -0
- package/dist/image-fetch.js.map +1 -1
- package/dist/image-worker.d.ts +2 -0
- package/dist/image-worker.d.ts.map +1 -1
- package/dist/image-worker.js +2 -0
- package/dist/image-worker.js.map +1 -1
- package/dist/storage.d.ts +44 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +44 -0
- package/dist/storage.js.map +1 -1
- package/dist/unpkg/dev/data-worker.js +3 -1
- package/dist/unpkg/dev/data-worker.js.map +1 -1
- package/dist/unpkg/dev/{document-storage-DkiEg9rY.js → document-storage-CXjnkUtf.js} +4 -1
- package/dist/unpkg/dev/{document-storage-DkiEg9rY.js.map → document-storage-CXjnkUtf.js.map} +1 -1
- package/dist/unpkg/dev/document-storage.js +1 -1
- package/dist/unpkg/dev/image-fetch.js +2 -0
- package/dist/unpkg/dev/image-fetch.js.map +1 -1
- package/dist/unpkg/dev/image-worker.js +2 -0
- package/dist/unpkg/dev/image-worker.js.map +1 -1
- package/dist/unpkg/dev/storage.js +44 -0
- package/dist/unpkg/dev/storage.js.map +1 -1
- package/dist/unpkg/dev-deprecated/data-worker.js +3 -1
- package/dist/unpkg/dev-deprecated/data-worker.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{document-storage-DkiEg9rY.js → document-storage-CXjnkUtf.js} +4 -1
- package/dist/unpkg/dev-deprecated/{document-storage-DkiEg9rY.js.map → document-storage-CXjnkUtf.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/document-storage.js +1 -1
- package/dist/unpkg/dev-deprecated/image-fetch.js +2 -0
- package/dist/unpkg/dev-deprecated/image-fetch.js.map +1 -1
- package/dist/unpkg/dev-deprecated/image-worker.js +2 -0
- package/dist/unpkg/dev-deprecated/image-worker.js.map +1 -1
- package/dist/unpkg/dev-deprecated/storage.js +44 -0
- package/dist/unpkg/dev-deprecated/storage.js.map +1 -1
- package/dist/unpkg/prod/data-worker.js +3 -1
- package/dist/unpkg/prod/data-worker.js.map +1 -1
- package/dist/unpkg/{prod-deprecated/document-storage-D0k_6GM9.js → prod/document-storage-Boz-E7CE.js} +4 -1
- package/dist/unpkg/{prod-deprecated/document-storage-D0k_6GM9.js.map → prod/document-storage-Boz-E7CE.js.map} +1 -1
- package/dist/unpkg/prod/document-storage.js +1 -1
- package/dist/unpkg/prod/image-fetch.js +2 -0
- package/dist/unpkg/prod/image-fetch.js.map +1 -1
- package/dist/unpkg/prod/image-worker.js +2 -0
- package/dist/unpkg/prod/image-worker.js.map +1 -1
- package/dist/unpkg/prod/storage.js +44 -0
- package/dist/unpkg/prod/storage.js.map +1 -1
- package/dist/unpkg/prod-deprecated/data-worker.js +3 -1
- package/dist/unpkg/prod-deprecated/data-worker.js.map +1 -1
- package/dist/unpkg/{prod/document-storage-D0k_6GM9.js → prod-deprecated/document-storage-Boz-E7CE.js} +4 -1
- package/dist/unpkg/{prod/document-storage-D0k_6GM9.js.map → prod-deprecated/document-storage-Boz-E7CE.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/document-storage.js +1 -1
- package/dist/unpkg/prod-deprecated/image-fetch.js +2 -0
- package/dist/unpkg/prod-deprecated/image-fetch.js.map +1 -1
- package/dist/unpkg/prod-deprecated/image-worker.js +2 -0
- package/dist/unpkg/prod-deprecated/image-worker.js.map +1 -1
- package/dist/unpkg/prod-deprecated/storage.js +44 -0
- package/dist/unpkg/prod-deprecated/storage.js.map +1 -1
- package/package.json +6 -6
package/dist/storage.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export interface CacheStorageEvent {
|
|
|
17
17
|
*
|
|
18
18
|
* This is a good option for larger data sets than can be efficiently stored in localStorage
|
|
19
19
|
* but should not be used as a permanent DB or storage solution.
|
|
20
|
+
*
|
|
21
|
+
* @summary Experimental `Storage`-compatible interface over the browser Cache API, suited to larger JSON data sets than
|
|
22
|
+
* localStorage.
|
|
20
23
|
*/
|
|
21
24
|
export declare class CacheStorage implements Storage {
|
|
22
25
|
#private;
|
|
@@ -65,6 +68,9 @@ export interface ReactiveStorageOptions {
|
|
|
65
68
|
* Retrieves the singleton instance of the LocalStorage service.
|
|
66
69
|
*
|
|
67
70
|
* If the instance does not already exist, it is created.
|
|
71
|
+
*
|
|
72
|
+
* @summary Experimental function that returns the shared reactive wrapper around localStorage, creating it on first
|
|
73
|
+
* call.
|
|
68
74
|
*/
|
|
69
75
|
export declare function getLocalStorage(): ReactiveStorage;
|
|
70
76
|
export declare function getSessionStorage(): ReactiveStorage;
|
|
@@ -72,11 +78,17 @@ export declare function getCacheStorage(namespace?: string | null): ReactiveStor
|
|
|
72
78
|
/**
|
|
73
79
|
* Configure options for the localStorage singleton.
|
|
74
80
|
* Must be called before getLocalStorage() is first invoked.
|
|
81
|
+
*
|
|
82
|
+
* @summary Experimental function that sets fallback and quota-handling options for the reactive localStorage singleton
|
|
83
|
+
* before its first use.
|
|
75
84
|
*/
|
|
76
85
|
export declare function configureLocalStorage(options: ReactiveStorageOptions): void;
|
|
77
86
|
/**
|
|
78
87
|
* Configure options for the sessionStorage singleton.
|
|
79
88
|
* Must be called before getSessionStorage() is first invoked.
|
|
89
|
+
*
|
|
90
|
+
* @summary Experimental function that sets fallback and quota-handling options for the reactive sessionStorage
|
|
91
|
+
* singleton before its first use.
|
|
80
92
|
*/
|
|
81
93
|
export declare function configureSessionStorage(options: ReactiveStorageOptions): void;
|
|
82
94
|
export type EffectStorageEvent = CacheStorageEvent | StorageEvent;
|
|
@@ -97,6 +109,9 @@ export type EffectStorageEvent = CacheStorageEvent | StorageEvent;
|
|
|
97
109
|
*
|
|
98
110
|
* Route storage-event subscribers through this helper instead of calling
|
|
99
111
|
* `window.addEventListener('storage', ...)` directly.
|
|
112
|
+
*
|
|
113
|
+
* @summary Experimental helper that subscribes to storage changes from both native `StorageEvent`s and `CacheStorage`
|
|
114
|
+
* notifications, returning an unsubscribe function.
|
|
100
115
|
*/
|
|
101
116
|
export declare function onStorageEvent(listener: (event: EffectStorageEvent) => void): () => void;
|
|
102
117
|
/**
|
|
@@ -104,6 +119,9 @@ export declare function onStorageEvent(listener: (event: EffectStorageEvent) =>
|
|
|
104
119
|
* that provides signal-based access to storage items and length.
|
|
105
120
|
*
|
|
106
121
|
* Will automatically update when storage events occur in other tabs/windows.
|
|
122
|
+
*
|
|
123
|
+
* @summary Experimental signal-backed wrapper around a `Storage` area that makes reads reactive and updates on changes
|
|
124
|
+
* from other tabs.
|
|
107
125
|
*/
|
|
108
126
|
declare class ReactiveStorage implements Storage {
|
|
109
127
|
private _storage;
|
|
@@ -148,6 +166,9 @@ declare class ReactiveStorage implements Storage {
|
|
|
148
166
|
//#region src/storage/query-params.d.ts
|
|
149
167
|
/**
|
|
150
168
|
* Configuration options for fields that are also query parameters
|
|
169
|
+
*
|
|
170
|
+
* @summary Experimental config passed to the `param` decorator that describes how a field is serialized to and parsed
|
|
171
|
+
* from a URL query parameter.
|
|
151
172
|
*/
|
|
152
173
|
export interface ParamConfig {
|
|
153
174
|
/**
|
|
@@ -174,6 +195,8 @@ export interface ParamConfig {
|
|
|
174
195
|
/**
|
|
175
196
|
* Creates a {@link ParamConfig} for boolean fields that serialize to '1' or null.
|
|
176
197
|
*
|
|
198
|
+
* @summary Experimental helper that creates a query-param config serializing a boolean field as '1' when true and
|
|
199
|
+
* omitting it when false.
|
|
177
200
|
* @returns ParamConfig for boolean fields
|
|
178
201
|
*
|
|
179
202
|
* @example
|
|
@@ -187,6 +210,8 @@ export declare function BooleanParam(): ParamConfig;
|
|
|
187
210
|
/**
|
|
188
211
|
* Creates a {@link ParamConfig} for numeric fields with default value checking.
|
|
189
212
|
*
|
|
213
|
+
* @summary Experimental helper that creates a query-param config serializing numbers, optionally to a fixed precision,
|
|
214
|
+
* with an optional default value.
|
|
190
215
|
* @param precision - When given, the number of digits to serialize after the decimal point
|
|
191
216
|
* @param getDefault - Function to get the default value for comparison
|
|
192
217
|
* @returns ParamConfig for number fields
|
|
@@ -211,6 +236,8 @@ export declare function NumberParam(precision?: number, getDefault?: (instance:
|
|
|
211
236
|
* - Compare URL and local values
|
|
212
237
|
* - Determine when to include/exclude params from the URL
|
|
213
238
|
*
|
|
239
|
+
* @summary Experimental decorator that marks a storage resource field as a URL query parameter, recording how to
|
|
240
|
+
* serialize it for a router integration.
|
|
214
241
|
* @param config - Configuration for URL serialization/deserialization
|
|
215
242
|
*
|
|
216
243
|
* @example
|
|
@@ -260,6 +287,9 @@ interface StorageResourceMeta {
|
|
|
260
287
|
* Use functions when you want to create more than
|
|
261
288
|
* one instance of a resource type, each with its own
|
|
262
289
|
* persisted data.
|
|
290
|
+
*
|
|
291
|
+
* @summary Experimental function type that derives a unique storage key from a storage resource instance, so each
|
|
292
|
+
* instance persists its own data.
|
|
263
293
|
*/
|
|
264
294
|
type KeyFn = (obj: any) => string;
|
|
265
295
|
/**
|
|
@@ -304,6 +334,9 @@ declare function getParamCompanion(instance: object, groupControlMap?: Record<st
|
|
|
304
334
|
*
|
|
305
335
|
* The function will be called once per instance during
|
|
306
336
|
* initialization to determine the unique ID for that instance.
|
|
337
|
+
*
|
|
338
|
+
* @summary Experimental class decorator that turns a class into a reactive resource whose fields persist in
|
|
339
|
+
* localStorage.
|
|
307
340
|
*/
|
|
308
341
|
export declare function LocalResource(id: string | KeyFn): ClassDecorator;
|
|
309
342
|
/**
|
|
@@ -319,6 +352,9 @@ export declare function LocalResource(id: string | KeyFn): ClassDecorator;
|
|
|
319
352
|
*
|
|
320
353
|
* The function will be called once per instance during
|
|
321
354
|
* initialization to determine the unique ID for that instance.
|
|
355
|
+
*
|
|
356
|
+
* @summary Experimental class decorator that turns a class into a reactive resource whose fields persist in
|
|
357
|
+
* sessionStorage.
|
|
322
358
|
*/
|
|
323
359
|
export declare function SessionResource(id: string | KeyFn): ClassDecorator;
|
|
324
360
|
/**
|
|
@@ -339,6 +375,9 @@ export declare function SessionResource(id: string | KeyFn): ClassDecorator;
|
|
|
339
375
|
* All object cached in the same `namespace` share the namespace's storage context,
|
|
340
376
|
* so partitioning can be achieved by using different namespaces for different groups
|
|
341
377
|
* of data.
|
|
378
|
+
*
|
|
379
|
+
* @summary Experimental class decorator that turns a class into a reactive resource whose fields persist via the Cache
|
|
380
|
+
* API and are shared across tabs.
|
|
342
381
|
*/
|
|
343
382
|
export declare function CacheResource(id: string | KeyFn, namespace?: string | null): ClassDecorator;
|
|
344
383
|
/**
|
|
@@ -371,6 +410,8 @@ export declare function CacheResource(id: string | KeyFn, namespace?: string | n
|
|
|
371
410
|
* }
|
|
372
411
|
* ```
|
|
373
412
|
*
|
|
413
|
+
* @summary Experimental decorator that makes a storage resource property a reactive field persisted to local, session,
|
|
414
|
+
* or cache storage.
|
|
374
415
|
*/
|
|
375
416
|
export declare function field(type: "local" | "session" | "cache"): PropertyDecorator;
|
|
376
417
|
export declare function field(target: object, key: string, descriptor?: PropertyDescriptor): void;
|
|
@@ -425,6 +466,9 @@ export declare function input(type: "number" | "boolean" | "float"): PropertyDec
|
|
|
425
466
|
* }
|
|
426
467
|
* }
|
|
427
468
|
* ```
|
|
469
|
+
*
|
|
470
|
+
* @summary Experimental field decorator for storage resources that runs a callback when the stored value changes in
|
|
471
|
+
* another tab or window.
|
|
428
472
|
*/
|
|
429
473
|
export declare function effect(fn: <K>(update: ValueTransition<K>) => void, type?: "local" | "session"): PropertyDecorator;
|
|
430
474
|
//#endregion
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","names":[],"sources":["../src/storage/cache.ts","../src/storage/storage.ts","../src/storage/query-params.ts","../src/storage/-private/storage-infra.ts","../src/storage/storage-resource.ts"],"mappings":";qBAEa;iBAKI;EACf;EACA;EACA;EACA;;iBAEe;EACf,aAAa;EACb;EACA;EACA
|
|
1
|
+
{"version":3,"file":"storage.d.ts","names":[],"sources":["../src/storage/cache.ts","../src/storage/storage.ts","../src/storage/query-params.ts","../src/storage/-private/storage-infra.ts","../src/storage/storage-resource.ts"],"mappings":";qBAEa;iBAKI;EACf;EACA;EACA;EACA;;iBAEe;EACf,aAAa;EACb;EACA;EACA;;;;;;;;;;;qBAqEW,wBAAwB;;EAInC,OAAO;EACP;EACA,iBAAiB;EAYjB,YAAY;MAMR;EA4BJ;EAKA,QAAQ;EAIR,IAAI;EAgBJ,WAAW;EAQX,QAAQ,aAAa;;;;;SAed,IAAI,mBAAqC,QAAQ;SASjD,YAAY,mBAAqC;;;;;SAYjD;;;;iBCzMQ;;;;;EAKf;;;;;EAMA;;;;;EAMA,mBAAmB,aAAa,4BAA4B;;;;;;;;;;wBAmB9C,mBAAmB;wBAOnB,qBAAqB;wBAQrB,gBAAgB,4BAAkC;;;;;;;;wBAkBlD,sBAAsB,SAAS;;;;;;;;wBAW/B,wBAAwB,SAAS;YA8BrC,qBAAqB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;wBAuBrC,eAAe,WAAW,OAAO;;;;;;;;;;cAkB3C,2BAA2B;UACvB;UACA;UACA;UACA;UAEQ;UACA;UAER;EACR,UAAU,aAAa,KAAK,OAAO;EAKnC,YAAY,SAAS,SAAS,UAAS;;;;MAyCnC;;;;EAOJ,SAAS;;;;EAsBT,QAAQ;;;;EAyBR,QAAQ,aAAa;;;;EA2DrB,WAAW;;;;EAsBX;;;;EAeA,IAAI;;;;;;;;;;iBChWW;;;;;EAKf,YAAY,gBAAgB;;;;;EAK5B,cAAc,kBAAkB;;;;;;;;;;EAUhC,cAAc;;;;;;;;;;;;;;;;wBAiBA,gBAAgB;;;;;;;;;;;;;;;;;wBAuBhB,YAAY,oBAAoB,cAAc,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiDrF,MAAM,QAAQ,cAAc;;;UClHlC,4BAA4B;EACpC;;UAGe,gBAAgB;EAC/B;EACA,MAAM;EACN,IAAI;;;;;UAMW;EACf;EACA;EACA,MAAM;EACN;EACA,eAAe;EACf,QAAQ,qBAAqB,QAAQ;EACrC,cAAc;EACd,cAAc,YAAY;EAC1B;EACA,WAAW,gBAAgB;;;;;;;;;;;;;;KAgBjB,SAAS;;;;;;;iBAaL,SAAS,iBAAiB;iBAsG1B,iBAAiB,kBAAkB;;;;;;;;;;;;;;;;;;;iBAgNnC,kBAAkB,kBAAkB,kBAAkB;;;;;;;;;;;;;;;;;;;;wBCjVtD,cAAc,aAAa,QAAQ;;;;;;;;;;;;;;;;;;wBAqBnC,gBAAgB,aAAa,QAAQ;;;;;;;;;;;;;;;;;;;;;;;wBA0BrC,cAAc,aAAa,OAAO,4BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqCpE,MAAM,sCAAsC;wBAC5C,MAAM,gBAAgB,aAAa,aAAa;wBAgBhD,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAuF7C,OAAO,KAAK,GAAG,QAAQ,gBAAgB,aAAa,6BAA6B"}
|
package/dist/storage.js
CHANGED
|
@@ -81,6 +81,9 @@ StorageEvents.addEventListener("message", handleCacheEvent);
|
|
|
81
81
|
*
|
|
82
82
|
* This is a good option for larger data sets than can be efficiently stored in localStorage
|
|
83
83
|
* but should not be used as a permanent DB or storage solution.
|
|
84
|
+
*
|
|
85
|
+
* @summary Experimental `Storage`-compatible interface over the browser Cache API, suited to larger JSON data sets than
|
|
86
|
+
* localStorage.
|
|
84
87
|
*/
|
|
85
88
|
var CacheStorage = class CacheStorage {
|
|
86
89
|
#cache;
|
|
@@ -217,6 +220,9 @@ let sessionStorageOptions = {};
|
|
|
217
220
|
* Retrieves the singleton instance of the LocalStorage service.
|
|
218
221
|
*
|
|
219
222
|
* If the instance does not already exist, it is created.
|
|
223
|
+
*
|
|
224
|
+
* @summary Experimental function that returns the shared reactive wrapper around localStorage, creating it on first
|
|
225
|
+
* call.
|
|
220
226
|
*/
|
|
221
227
|
function getLocalStorage() {
|
|
222
228
|
if (!localStorageInstance) localStorageInstance = new ReactiveStorage(localStorage, localStorageOptions);
|
|
@@ -240,6 +246,9 @@ function getCacheStorage(namespace = null) {
|
|
|
240
246
|
/**
|
|
241
247
|
* Configure options for the localStorage singleton.
|
|
242
248
|
* Must be called before getLocalStorage() is first invoked.
|
|
249
|
+
*
|
|
250
|
+
* @summary Experimental function that sets fallback and quota-handling options for the reactive localStorage singleton
|
|
251
|
+
* before its first use.
|
|
243
252
|
*/
|
|
244
253
|
function configureLocalStorage(options) {
|
|
245
254
|
localStorageOptions = options;
|
|
@@ -247,6 +256,9 @@ function configureLocalStorage(options) {
|
|
|
247
256
|
/**
|
|
248
257
|
* Configure options for the sessionStorage singleton.
|
|
249
258
|
* Must be called before getSessionStorage() is first invoked.
|
|
259
|
+
*
|
|
260
|
+
* @summary Experimental function that sets fallback and quota-handling options for the reactive sessionStorage
|
|
261
|
+
* singleton before its first use.
|
|
250
262
|
*/
|
|
251
263
|
function configureSessionStorage(options) {
|
|
252
264
|
sessionStorageOptions = options;
|
|
@@ -288,6 +300,9 @@ function isStorageUnavailableError(error) {
|
|
|
288
300
|
*
|
|
289
301
|
* Route storage-event subscribers through this helper instead of calling
|
|
290
302
|
* `window.addEventListener('storage', ...)` directly.
|
|
303
|
+
*
|
|
304
|
+
* @summary Experimental helper that subscribes to storage changes from both native `StorageEvent`s and `CacheStorage`
|
|
305
|
+
* notifications, returning an unsubscribe function.
|
|
291
306
|
*/
|
|
292
307
|
function onStorageEvent(listener) {
|
|
293
308
|
const handler = (event) => {
|
|
@@ -301,6 +316,9 @@ function onStorageEvent(listener) {
|
|
|
301
316
|
* that provides signal-based access to storage items and length.
|
|
302
317
|
*
|
|
303
318
|
* Will automatically update when storage events occur in other tabs/windows.
|
|
319
|
+
*
|
|
320
|
+
* @summary Experimental signal-backed wrapper around a `Storage` area that makes reads reactive and updates on changes
|
|
321
|
+
* from other tabs.
|
|
304
322
|
*/
|
|
305
323
|
var ReactiveStorage = class {
|
|
306
324
|
_storage;
|
|
@@ -477,6 +495,9 @@ defineSignal(ReactiveStorage.prototype, "_signals", makeInitializer(() => new Si
|
|
|
477
495
|
* Use functions when you want to create more than
|
|
478
496
|
* one instance of a resource type, each with its own
|
|
479
497
|
* persisted data.
|
|
498
|
+
*
|
|
499
|
+
* @summary Experimental function type that derives a unique storage key from a storage resource instance, so each
|
|
500
|
+
* instance persists its own data.
|
|
480
501
|
*/
|
|
481
502
|
/**
|
|
482
503
|
* Symbol used to store persistence metadata on classes
|
|
@@ -761,6 +782,9 @@ function createParamField(companion, fieldName, config, controlFieldName, instan
|
|
|
761
782
|
*
|
|
762
783
|
* The function will be called once per instance during
|
|
763
784
|
* initialization to determine the unique ID for that instance.
|
|
785
|
+
*
|
|
786
|
+
* @summary Experimental class decorator that turns a class into a reactive resource whose fields persist in
|
|
787
|
+
* localStorage.
|
|
764
788
|
*/
|
|
765
789
|
function LocalResource(id) {
|
|
766
790
|
return _createStorageResource(id, "local-resource", null);
|
|
@@ -778,6 +802,9 @@ function LocalResource(id) {
|
|
|
778
802
|
*
|
|
779
803
|
* The function will be called once per instance during
|
|
780
804
|
* initialization to determine the unique ID for that instance.
|
|
805
|
+
*
|
|
806
|
+
* @summary Experimental class decorator that turns a class into a reactive resource whose fields persist in
|
|
807
|
+
* sessionStorage.
|
|
781
808
|
*/
|
|
782
809
|
function SessionResource(id) {
|
|
783
810
|
return _createStorageResource(id, "session-resource", null);
|
|
@@ -800,6 +827,9 @@ function SessionResource(id) {
|
|
|
800
827
|
* All object cached in the same `namespace` share the namespace's storage context,
|
|
801
828
|
* so partitioning can be achieved by using different namespaces for different groups
|
|
802
829
|
* of data.
|
|
830
|
+
*
|
|
831
|
+
* @summary Experimental class decorator that turns a class into a reactive resource whose fields persist via the Cache
|
|
832
|
+
* API and are shared across tabs.
|
|
803
833
|
*/
|
|
804
834
|
function CacheResource(id, namespace = null) {
|
|
805
835
|
return _createStorageResource(id, "cache-resource", namespace);
|
|
@@ -834,6 +864,8 @@ function CacheResource(id, namespace = null) {
|
|
|
834
864
|
* }
|
|
835
865
|
* ```
|
|
836
866
|
*
|
|
867
|
+
* @summary Experimental decorator that makes a storage resource property a reactive field persisted to local, session,
|
|
868
|
+
* or cache storage.
|
|
837
869
|
*/
|
|
838
870
|
function field(...args) {
|
|
839
871
|
if (args.length === 0) {
|
|
@@ -928,6 +960,9 @@ function input(type) {
|
|
|
928
960
|
* }
|
|
929
961
|
* }
|
|
930
962
|
* ```
|
|
963
|
+
*
|
|
964
|
+
* @summary Experimental field decorator for storage resources that runs a callback when the stored value changes in
|
|
965
|
+
* another tab or window.
|
|
931
966
|
*/
|
|
932
967
|
function effect(fn, type) {
|
|
933
968
|
const overrideType = type === "local" ? "local-storage" : type === "session" ? "session-storage" : null;
|
|
@@ -952,10 +987,15 @@ function effect(fn, type) {
|
|
|
952
987
|
//#region src/storage/query-params.ts
|
|
953
988
|
/**
|
|
954
989
|
* Configuration options for fields that are also query parameters
|
|
990
|
+
*
|
|
991
|
+
* @summary Experimental config passed to the `param` decorator that describes how a field is serialized to and parsed
|
|
992
|
+
* from a URL query parameter.
|
|
955
993
|
*/
|
|
956
994
|
/**
|
|
957
995
|
* Creates a {@link ParamConfig} for boolean fields that serialize to '1' or null.
|
|
958
996
|
*
|
|
997
|
+
* @summary Experimental helper that creates a query-param config serializing a boolean field as '1' when true and
|
|
998
|
+
* omitting it when false.
|
|
959
999
|
* @returns ParamConfig for boolean fields
|
|
960
1000
|
*
|
|
961
1001
|
* @example
|
|
@@ -974,6 +1014,8 @@ function BooleanParam() {
|
|
|
974
1014
|
/**
|
|
975
1015
|
* Creates a {@link ParamConfig} for numeric fields with default value checking.
|
|
976
1016
|
*
|
|
1017
|
+
* @summary Experimental helper that creates a query-param config serializing numbers, optionally to a fixed precision,
|
|
1018
|
+
* with an optional default value.
|
|
977
1019
|
* @param precision - When given, the number of digits to serialize after the decimal point
|
|
978
1020
|
* @param getDefault - Function to get the default value for comparison
|
|
979
1021
|
* @returns ParamConfig for number fields
|
|
@@ -1013,6 +1055,8 @@ function NumberParam(precision, getDefault) {
|
|
|
1013
1055
|
* - Compare URL and local values
|
|
1014
1056
|
* - Determine when to include/exclude params from the URL
|
|
1015
1057
|
*
|
|
1058
|
+
* @summary Experimental decorator that marks a storage resource field as a URL query parameter, recording how to
|
|
1059
|
+
* serialize it for a router integration.
|
|
1016
1060
|
* @param config - Configuration for URL serialization/deserialization
|
|
1017
1061
|
*
|
|
1018
1062
|
* @example
|