@warp-drive-mirror/experiments 0.2.7-beta.0 → 0.2.7-beta.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/CHANGELOG.md +70 -0
- package/README.md +2 -1
- package/declarations/data-worker.d.ts +35 -2
- package/declarations/data-worker.d.ts.map +1 -0
- package/declarations/document-storage-CwwTQ49-.d.ts +91 -0
- package/declarations/document-storage-CwwTQ49-.d.ts.map +1 -0
- package/declarations/document-storage.d.ts +2 -1
- package/declarations/image-fetch.d.ts +60 -1
- package/declarations/image-fetch.d.ts.map +1 -0
- package/declarations/image-worker.d.ts +40 -1
- package/declarations/image-worker.d.ts.map +1 -0
- package/declarations/storage.d.ts +359 -0
- package/declarations/storage.d.ts.map +1 -0
- package/declarations/types-CRs-Qww6.d.ts +17 -0
- package/declarations/types-CRs-Qww6.d.ts.map +1 -0
- package/declarations/worker-fetch.d.ts +23 -1
- package/declarations/worker-fetch.d.ts.map +1 -0
- package/dist/data-worker.js +235 -339
- package/dist/data-worker.js.map +1 -0
- package/dist/document-storage-LM925Stz.js +270 -0
- package/dist/document-storage-LM925Stz.js.map +1 -0
- package/dist/document-storage.js +3 -1
- package/dist/image-fetch.js +108 -79
- package/dist/image-fetch.js.map +1 -0
- package/dist/image-worker.js +95 -95
- package/dist/image-worker.js.map +1 -0
- package/dist/storage.js +914 -0
- package/dist/storage.js.map +1 -0
- package/dist/unpkg/dev/data-worker.js +231 -338
- package/dist/unpkg/dev/data-worker.js.map +1 -0
- package/dist/unpkg/dev/document-storage-DkiEg9rY.js +268 -0
- package/dist/unpkg/dev/document-storage-DkiEg9rY.js.map +1 -0
- package/dist/unpkg/dev/document-storage.js +2 -348
- package/dist/unpkg/dev/image-fetch.js +104 -71
- package/dist/unpkg/dev/image-fetch.js.map +1 -0
- package/dist/unpkg/dev/image-worker.js +93 -94
- package/dist/unpkg/dev/image-worker.js.map +1 -0
- package/dist/unpkg/dev/storage.js +913 -0
- package/dist/unpkg/dev/storage.js.map +1 -0
- package/dist/unpkg/dev/worker-fetch.js +112 -145
- package/dist/unpkg/dev/worker-fetch.js.map +1 -0
- package/dist/unpkg/dev-deprecated/data-worker.js +231 -338
- package/dist/unpkg/dev-deprecated/data-worker.js.map +1 -0
- package/dist/unpkg/dev-deprecated/document-storage-DkiEg9rY.js +268 -0
- package/dist/unpkg/dev-deprecated/document-storage-DkiEg9rY.js.map +1 -0
- package/dist/unpkg/dev-deprecated/document-storage.js +2 -348
- package/dist/unpkg/dev-deprecated/image-fetch.js +104 -71
- package/dist/unpkg/dev-deprecated/image-fetch.js.map +1 -0
- package/dist/unpkg/dev-deprecated/image-worker.js +93 -94
- package/dist/unpkg/dev-deprecated/image-worker.js.map +1 -0
- package/dist/unpkg/dev-deprecated/storage.js +913 -0
- package/dist/unpkg/dev-deprecated/storage.js.map +1 -0
- package/dist/unpkg/dev-deprecated/worker-fetch.js +112 -145
- package/dist/unpkg/dev-deprecated/worker-fetch.js.map +1 -0
- package/dist/unpkg/prod/data-worker.js +224 -324
- package/dist/unpkg/prod/data-worker.js.map +1 -0
- package/dist/unpkg/prod/document-storage-D0k_6GM9.js +262 -0
- package/dist/unpkg/prod/document-storage-D0k_6GM9.js.map +1 -0
- package/dist/unpkg/prod/document-storage.js +2 -338
- package/dist/unpkg/prod/image-fetch.js +101 -71
- package/dist/unpkg/prod/image-fetch.js.map +1 -0
- package/dist/unpkg/prod/image-worker.js +93 -94
- package/dist/unpkg/prod/image-worker.js.map +1 -0
- package/dist/unpkg/prod/storage.js +844 -0
- package/dist/unpkg/prod/storage.js.map +1 -0
- package/dist/unpkg/prod/worker-fetch.js +109 -145
- package/dist/unpkg/prod/worker-fetch.js.map +1 -0
- package/dist/unpkg/prod-deprecated/data-worker.js +224 -324
- package/dist/unpkg/prod-deprecated/data-worker.js.map +1 -0
- package/dist/unpkg/prod-deprecated/document-storage-D0k_6GM9.js +262 -0
- package/dist/unpkg/prod-deprecated/document-storage-D0k_6GM9.js.map +1 -0
- package/dist/unpkg/prod-deprecated/document-storage.js +2 -338
- package/dist/unpkg/prod-deprecated/image-fetch.js +101 -71
- package/dist/unpkg/prod-deprecated/image-fetch.js.map +1 -0
- package/dist/unpkg/prod-deprecated/image-worker.js +93 -94
- package/dist/unpkg/prod-deprecated/image-worker.js.map +1 -0
- package/dist/unpkg/prod-deprecated/storage.js +844 -0
- package/dist/unpkg/prod-deprecated/storage.js.map +1 -0
- package/dist/unpkg/prod-deprecated/worker-fetch.js +109 -145
- package/dist/unpkg/prod-deprecated/worker-fetch.js.map +1 -0
- package/dist/worker-fetch.js +116 -153
- package/dist/worker-fetch.js.map +1 -0
- package/package.json +9 -9
- package/declarations/data-worker/cache-handler.d.ts +0 -7
- package/declarations/data-worker/fetch.d.ts +0 -21
- package/declarations/data-worker/types.d.ts +0 -31
- package/declarations/data-worker/utils.d.ts +0 -12
- package/declarations/data-worker/worker.d.ts +0 -23
- package/declarations/document-storage/index.d.ts +0 -90
- package/declarations/image-worker/fetch.d.ts +0 -18
- package/declarations/image-worker/types.d.ts +0 -21
- package/declarations/image-worker/worker.d.ts +0 -14
- package/dist/index-CGCX7hY2.js +0 -349
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
//#region src/storage/cache.d.ts
|
|
2
|
+
declare const DEFAULT_CACHE_ID = "reactive-cache";
|
|
3
|
+
interface InternalCacheStorageEvent {
|
|
4
|
+
storageArea: string;
|
|
5
|
+
key: string | null;
|
|
6
|
+
oldValue: string | null;
|
|
7
|
+
newValue: string | null;
|
|
8
|
+
}
|
|
9
|
+
interface CacheStorageEvent {
|
|
10
|
+
storageArea: CacheStorage;
|
|
11
|
+
key: string | null;
|
|
12
|
+
oldValue: string | null;
|
|
13
|
+
newValue: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A reactive interface for json stored in the browser [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache) API.
|
|
17
|
+
*
|
|
18
|
+
* This is a good option for larger data sets than can be efficiently stored in localStorage
|
|
19
|
+
* but should not be used as a permanent DB or storage solution.
|
|
20
|
+
*/
|
|
21
|
+
declare class CacheStorage implements Storage {
|
|
22
|
+
#private;
|
|
23
|
+
_data: Map<string, string | null>;
|
|
24
|
+
_nextUpdate: number | null;
|
|
25
|
+
_bufferedEvents: InternalCacheStorageEvent[];
|
|
26
|
+
constructor(cacheId: string);
|
|
27
|
+
get length(): number;
|
|
28
|
+
clear(): void;
|
|
29
|
+
getItem(key: string): string | null;
|
|
30
|
+
key(index: number): string | null;
|
|
31
|
+
removeItem(key: string): void;
|
|
32
|
+
setItem(key: string, value: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get the singleton CacheStorage instance.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
static get(cacheId?: string): Promise<CacheStorage>;
|
|
38
|
+
static expectCache(cacheId?: string): CacheStorage;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the IDs of all {@link CacheStorage} instances that have been
|
|
41
|
+
* opened in this context via {@link CacheStorage.get}.
|
|
42
|
+
*/
|
|
43
|
+
static getAllCacheIds(): string[];
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/storage/storage.d.ts
|
|
47
|
+
interface ReactiveStorageOptions {
|
|
48
|
+
/**
|
|
49
|
+
* If true, falls back to in-memory storage when the underlying
|
|
50
|
+
* storage is unavailable (e.g., private browsing mode).
|
|
51
|
+
*/
|
|
52
|
+
fallbackToMemory?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* If true, updates signal state even when writes fail due to quota.
|
|
55
|
+
* The onQuotaExceeded callback will be invoked before retrying.
|
|
56
|
+
*/
|
|
57
|
+
updateOnQuotaExceeded?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Called when a write fails due to quota exceeded.
|
|
60
|
+
* Return true to retry the write after freeing space.
|
|
61
|
+
*/
|
|
62
|
+
onQuotaExceeded?: (key: string, value: string) => boolean | Promise<boolean>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves the singleton instance of the LocalStorage service.
|
|
66
|
+
*
|
|
67
|
+
* If the instance does not already exist, it is created.
|
|
68
|
+
*/
|
|
69
|
+
declare function getLocalStorage(): ReactiveStorage;
|
|
70
|
+
declare function getSessionStorage(): ReactiveStorage;
|
|
71
|
+
declare function getCacheStorage(namespace?: string | null): ReactiveStorage;
|
|
72
|
+
/**
|
|
73
|
+
* Configure options for the localStorage singleton.
|
|
74
|
+
* Must be called before getLocalStorage() is first invoked.
|
|
75
|
+
*/
|
|
76
|
+
declare function configureLocalStorage(options: ReactiveStorageOptions): void;
|
|
77
|
+
/**
|
|
78
|
+
* Configure options for the sessionStorage singleton.
|
|
79
|
+
* Must be called before getSessionStorage() is first invoked.
|
|
80
|
+
*/
|
|
81
|
+
declare function configureSessionStorage(options: ReactiveStorageOptions): void;
|
|
82
|
+
type EffectStorageEvent = CacheStorageEvent | StorageEvent;
|
|
83
|
+
declare global {
|
|
84
|
+
interface WindowEventMap {
|
|
85
|
+
storage: CustomEvent<CacheStorageEvent> | StorageEvent;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A reactive wrapper around the Web Storage API (localStorage/sessionStorage)
|
|
90
|
+
* that provides signal-based access to storage items and length.
|
|
91
|
+
*
|
|
92
|
+
* Will automatically update when storage events occur in other tabs/windows.
|
|
93
|
+
*/
|
|
94
|
+
declare class ReactiveStorage implements Storage {
|
|
95
|
+
private _storage;
|
|
96
|
+
private _options;
|
|
97
|
+
private _memoryOnly;
|
|
98
|
+
private _values;
|
|
99
|
+
private _signals;
|
|
100
|
+
private _length;
|
|
101
|
+
private _effects;
|
|
102
|
+
setEffect(key: string, fn: (value: EffectStorageEvent) => void): void;
|
|
103
|
+
constructor(storage: Storage, options?: ReactiveStorageOptions);
|
|
104
|
+
/**
|
|
105
|
+
* Reactive access to the number of keys in Storage
|
|
106
|
+
*/
|
|
107
|
+
get length(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Non-reactive way to peek the current value of a key in Storage
|
|
110
|
+
*/
|
|
111
|
+
peekItem(key: string): string | null;
|
|
112
|
+
/**
|
|
113
|
+
* Reactive access to Storage contents
|
|
114
|
+
*/
|
|
115
|
+
getItem(key: string): string | null;
|
|
116
|
+
/**
|
|
117
|
+
* Set a value in Storage, triggering reactivity
|
|
118
|
+
*/
|
|
119
|
+
setItem(key: string, value: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Remove a value from Storage, triggering reactivity
|
|
122
|
+
*/
|
|
123
|
+
removeItem(key: string): void;
|
|
124
|
+
/**
|
|
125
|
+
* Clears all keys from Storage, triggering reactivity
|
|
126
|
+
*/
|
|
127
|
+
clear(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Reactive access to the key at the given index
|
|
130
|
+
*/
|
|
131
|
+
key(index: number): string | null;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/storage/-private/storage-infra.d.ts
|
|
135
|
+
/**
|
|
136
|
+
* Configuration options for fields that are also query parameters
|
|
137
|
+
*/
|
|
138
|
+
interface ParamConfig {
|
|
139
|
+
/**
|
|
140
|
+
* Convert a value into a string for storage in the URL.
|
|
141
|
+
* `null` indicates the value should be omitted from the URL.
|
|
142
|
+
*/
|
|
143
|
+
serialize: (value: unknown, instance: any) => string | null;
|
|
144
|
+
/**
|
|
145
|
+
* Convert a string value from the URL back into
|
|
146
|
+
* its original type
|
|
147
|
+
*/
|
|
148
|
+
deserialize: (urlValue: string, instance: any) => unknown;
|
|
149
|
+
/**
|
|
150
|
+
* Get the default value for this param from the given instance.
|
|
151
|
+
*
|
|
152
|
+
* If not present, the value passed to the field initializer
|
|
153
|
+
* will be used as the default.
|
|
154
|
+
*
|
|
155
|
+
* This should return the value in the field's native type,
|
|
156
|
+
* not the serialized URL form.
|
|
157
|
+
*/
|
|
158
|
+
getDefault?: (instance: any) => unknown;
|
|
159
|
+
}
|
|
160
|
+
interface InternalParamConfig extends ParamConfig {
|
|
161
|
+
initialized?: boolean;
|
|
162
|
+
}
|
|
163
|
+
interface ValueTransition<T = unknown> {
|
|
164
|
+
key: string;
|
|
165
|
+
from: T;
|
|
166
|
+
to: T;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Metadata attached to persisted resource classes
|
|
170
|
+
*/
|
|
171
|
+
interface StorageResourceMeta {
|
|
172
|
+
id: string;
|
|
173
|
+
namespace: string | null;
|
|
174
|
+
pkFn: KeyFn | null;
|
|
175
|
+
type: "local-resource" | "session-resource" | "cache-resource";
|
|
176
|
+
typeOverrides: Map<string, "local-storage" | "session-storage" | "cache-storage"> | null;
|
|
177
|
+
fields: Map<string, null | ((update: ValueTransition<string>) => void)>;
|
|
178
|
+
initializers: Map<string, (() => unknown) | null>;
|
|
179
|
+
paramConfigs: Map<string, InternalParamConfig> | null;
|
|
180
|
+
paramCompanion: object | null;
|
|
181
|
+
instances: WeakMap<object, StorageResourceMeta> | null;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A function which generates a unique primary-key
|
|
185
|
+
* string for a given LocalResource or SessionResource
|
|
186
|
+
* instance.
|
|
187
|
+
*
|
|
188
|
+
* Use functions when you want to create more than
|
|
189
|
+
* one instance of a resource type, each with its own
|
|
190
|
+
* persisted data.
|
|
191
|
+
*/
|
|
192
|
+
type KeyFn = (obj: any) => string;
|
|
193
|
+
/**
|
|
194
|
+
* Setup persisted resource metadata on target
|
|
195
|
+
* if not already present
|
|
196
|
+
*
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
declare function initMeta(target: object): StorageResourceMeta;
|
|
200
|
+
/**
|
|
201
|
+
* Get or create the param companion object for a StorageResource instance.
|
|
202
|
+
*
|
|
203
|
+
* The companion object contains URL-serialized versions of all @param decorated fields.
|
|
204
|
+
* Each param field gets a corresponding property on the companion that:
|
|
205
|
+
* - Reads: Serializes the storage value to a URL string (returns null if not active)
|
|
206
|
+
* - Writes: Deserializes the URL string and updates the storage value
|
|
207
|
+
*
|
|
208
|
+
* The companion object is reactive using trackedObject, ensuring that changes
|
|
209
|
+
* to the underlying storage fields trigger updates in the query param system.
|
|
210
|
+
*
|
|
211
|
+
* This companion object is what QPRoute will bind to for URL query params.
|
|
212
|
+
*
|
|
213
|
+
* @private
|
|
214
|
+
* @param instance - The StorageResource instance
|
|
215
|
+
* @param groupControlMap - Optional map of fieldName -> controlFieldName for grouped params
|
|
216
|
+
* @returns The companion object with serialized param properties
|
|
217
|
+
*/
|
|
218
|
+
declare function getParamCompanion(instance: object, groupControlMap?: Record<string, string>): object;
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/storage/storage-resource.d.ts
|
|
221
|
+
/**
|
|
222
|
+
* Decorator which transforms a class into a StorageResource
|
|
223
|
+
* persisted in localStorage.
|
|
224
|
+
*
|
|
225
|
+
* LocalResources must either be singletons or expect all instances
|
|
226
|
+
* to share state unless a primary key function is provided.
|
|
227
|
+
*
|
|
228
|
+
* When a primary key function is provided, each instance
|
|
229
|
+
* will have its own persisted data based on the key generated
|
|
230
|
+
* by the function.
|
|
231
|
+
*
|
|
232
|
+
* The function will be called once per instance during
|
|
233
|
+
* initialization to determine the unique ID for that instance.
|
|
234
|
+
*/
|
|
235
|
+
declare function LocalResource(id: string | KeyFn): ClassDecorator;
|
|
236
|
+
/**
|
|
237
|
+
* Decorator which transforms a class into a StorageResource
|
|
238
|
+
* persisted in sessionStorage.
|
|
239
|
+
*
|
|
240
|
+
* SessionResources must either be singletons or expect all instances
|
|
241
|
+
* to share state unless a primary key function is provided.
|
|
242
|
+
*
|
|
243
|
+
* When a primary key function is provided, each instance
|
|
244
|
+
* will have its own persisted data based on the key generated
|
|
245
|
+
* by the function.
|
|
246
|
+
*
|
|
247
|
+
* The function will be called once per instance during
|
|
248
|
+
* initialization to determine the unique ID for that instance.
|
|
249
|
+
*/
|
|
250
|
+
declare function SessionResource(id: string | KeyFn): ClassDecorator;
|
|
251
|
+
/**
|
|
252
|
+
* Decorator which transforms a class into a StorageResource
|
|
253
|
+
* persisted via the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache).
|
|
254
|
+
* api and shared across all tabs/windows under the same origin.
|
|
255
|
+
*
|
|
256
|
+
* CacheResources must either be singletons or expect all instances
|
|
257
|
+
* to share state unless a primary key function is provided.
|
|
258
|
+
*
|
|
259
|
+
* When a primary key function is provided, each instance
|
|
260
|
+
* will have its own persisted data based on the key generated
|
|
261
|
+
* by the function.
|
|
262
|
+
*
|
|
263
|
+
* The function will be called once per instance during
|
|
264
|
+
* initialization to determine the unique ID for that instance.
|
|
265
|
+
*
|
|
266
|
+
* All object cached in the same `namespace` share the namespace's storage context,
|
|
267
|
+
* so partitioning can be achieved by using different namespaces for different groups
|
|
268
|
+
* of data.
|
|
269
|
+
*/
|
|
270
|
+
declare function CacheResource(id: string | KeyFn, namespace?: string | null): ClassDecorator;
|
|
271
|
+
/**
|
|
272
|
+
* Decorator which marks a property as a field on
|
|
273
|
+
* a LocalResource or SessionResource
|
|
274
|
+
*
|
|
275
|
+
* The field's value will be initialized from the persisted resource data
|
|
276
|
+
* if available, falling back to the property's default value otherwise.
|
|
277
|
+
*
|
|
278
|
+
* Fields can be of any type that is serializable to and restorable from JSON,
|
|
279
|
+
* but complex types (like objects or arrays) should be handled with care to avoid
|
|
280
|
+
* unintended mutations or reactivity issues.
|
|
281
|
+
*
|
|
282
|
+
* By default, fields are persisted in the storage type defined by the resource decorator
|
|
283
|
+
* (@LocalResource or @SessionResource). However, you can override this behavior
|
|
284
|
+
* by passing 'local' or 'session' as an argument to the decorator.
|
|
285
|
+
*
|
|
286
|
+
* ---
|
|
287
|
+
*
|
|
288
|
+
* **Example:**
|
|
289
|
+
*
|
|
290
|
+
* ```ts
|
|
291
|
+
* @LocalResource('user-settings')
|
|
292
|
+
* class UserSettings {
|
|
293
|
+
* @field
|
|
294
|
+
* theme: 'light' | 'dark' = 'light';
|
|
295
|
+
*
|
|
296
|
+
* @field('session')
|
|
297
|
+
* sessionToken: string | null = null;
|
|
298
|
+
* }
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
*/
|
|
302
|
+
declare function field(type: "local" | "session" | "cache"): PropertyDecorator;
|
|
303
|
+
declare function field(target: object, key: string, descriptor?: PropertyDescriptor): void;
|
|
304
|
+
declare function input(type: "number" | "boolean" | "float"): PropertyDecorator;
|
|
305
|
+
/**
|
|
306
|
+
* Effects are fields that run a side-effecting function.
|
|
307
|
+
*
|
|
308
|
+
* Effects are intended to enable synchronizing get states between
|
|
309
|
+
* tabs or windows that result in needing to synchronize other
|
|
310
|
+
* non-reactive state.
|
|
311
|
+
*
|
|
312
|
+
* For example, when a user selects a light/dark mode theme preference
|
|
313
|
+
* that differs from the system preference, effects can be used to trigger
|
|
314
|
+
* DOM updates on the documentElement necessary to ensure its state is
|
|
315
|
+
* consistent with the persisted resource state and reactive application state.
|
|
316
|
+
*
|
|
317
|
+
* To do this without an effect would require either setting up your own
|
|
318
|
+
* storage event listeners or consuming the reactive state of the property
|
|
319
|
+
* in another effect-like API such as an Ember modifier or React useEffect,
|
|
320
|
+
*
|
|
321
|
+
* Effects *only* run when the stored value changes due to storage events
|
|
322
|
+
* emitted from other tabs or windows. They do not run when the property
|
|
323
|
+
* is updated in the same context.
|
|
324
|
+
*
|
|
325
|
+
* ---
|
|
326
|
+
*
|
|
327
|
+
* **Example:**
|
|
328
|
+
*
|
|
329
|
+
* ```ts
|
|
330
|
+
* @LocalResource('user-preferences')
|
|
331
|
+
* class UserPreferences {
|
|
332
|
+
* @effect(syncThemeToDOM)
|
|
333
|
+
* explicitThemePreference: 'light' | 'dark' | null = null;
|
|
334
|
+
*
|
|
335
|
+
* @matchMedia('(prefers-color-scheme: dark)')
|
|
336
|
+
* systemPrefersDarkMode: boolean = false;
|
|
337
|
+
* }
|
|
338
|
+
*
|
|
339
|
+
* function syncThemeToDOM(update: ValueTransition<'light' | 'dark' | null>): void {
|
|
340
|
+
* const newTheme = update.to;
|
|
341
|
+
* document.documentElement.style.colorScheme = newTheme ?? 'light dark';
|
|
342
|
+
*
|
|
343
|
+
* if (newTheme === 'dark') {
|
|
344
|
+
* document.documentElement.classList.add('dark-theme');
|
|
345
|
+
* document.documentElement.classList.remove('light-theme');
|
|
346
|
+
* } else if (newTheme === 'light') {
|
|
347
|
+
* document.documentElement.classList.add('light-theme');
|
|
348
|
+
* document.documentElement.classList.remove('dark-theme');
|
|
349
|
+
* } else {
|
|
350
|
+
* document.documentElement.classList.remove('light-theme');
|
|
351
|
+
* document.documentElement.classList.remove('dark-theme');
|
|
352
|
+
* }
|
|
353
|
+
* }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
declare function effect(fn: <K>(update: ValueTransition<K>) => void, type?: "local" | "session"): PropertyDecorator;
|
|
357
|
+
//#endregion
|
|
358
|
+
export { CacheResource, CacheStorage, CacheStorageEvent, DEFAULT_CACHE_ID, EffectStorageEvent, InternalCacheStorageEvent, LocalResource, type ReactiveStorage, ReactiveStorageOptions, SessionResource, getParamCompanion as _getParamCompanion, initMeta as _initMeta, configureLocalStorage, configureSessionStorage, effect, field, getCacheStorage, getLocalStorage, getSessionStorage, input };
|
|
359
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","names":[],"sources":["../src/storage/cache.ts","../src/storage/storage.ts","../src/storage/-private/storage-infra.ts","../src/storage/storage-resource.ts"],"mappings":";cAEa;UAKI;EACf;EACA;EACA;EACA;;UAEe;EACf,aAAa;EACb;EACA;EACA;;;;;;;;cAkEW,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;;;;UCtMQ;;;;;EAKf;;;;;EAMA;;;;;EAMA,mBAAmB,aAAa,4BAA4B;;;;;;;iBAgB9C,mBAAmB;iBAOnB,qBAAqB;iBAQrB,gBAAgB,4BAAkC;;;;;iBAelD,sBAAsB,SAAS;;;;;iBAQ/B,wBAAwB,SAAS;KA8BrC,qBAAqB,oBAAoB;QAEtC;YACH;IACR,SAAS,YAAY,qBAAqB;;;;;;;;;cAUxC,2BAA2B;UACvB;UACA;UACA;UACA;UAEQ;UACA;UAER;EACR,UAAU,aAAa,KAAK,OAAO;EAKnC,YAAY,SAAS,SAAS,UAAS;;;;MA2CnC;;;;EAOJ,SAAS;;;;EAsBT,QAAQ;;;;EAyBR,QAAQ,aAAa;;;;EA2DrB,WAAW;;;;EAsBX;;;;EAeA,IAAI;;;;;;;UCjUW;;;;;EAMf,YAAY,gBAAgB;;;;;EAM5B,cAAc,kBAAkB;;;;;;;;;;EAWhC,cAAc;;UAGN,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;;;;;;;;;;;KAajB,SAAS;;;;;;;iBAaL,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;iBAiT1B,kBAAkB,kBAAkB,kBAAkB;;;;;;;;;;;;;;;;;iBCxWtD,cAAc,aAAa,QAAQ;;;;;;;;;;;;;;;iBAkBnC,gBAAgB,aAAa,QAAQ;;;;;;;;;;;;;;;;;;;;iBAuBrC,cAAc,aAAa,OAAO,4BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCpE,MAAM,sCAAsC;iBAC5C,MAAM,gBAAgB,aAAa,aAAa;iBAgBhD,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoF7C,OAAO,KAAK,GAAG,QAAQ,gBAAgB,aAAa,6BAA6B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RequestInfo } from "@warp-drive-mirror/core/types/request";
|
|
2
|
+
//#region src/data-worker/types.d.ts
|
|
3
|
+
type RequestEventData = {
|
|
4
|
+
type: "request";
|
|
5
|
+
thread: string;
|
|
6
|
+
id: number;
|
|
7
|
+
data: RequestInfo;
|
|
8
|
+
};
|
|
9
|
+
type AbortEventData = {
|
|
10
|
+
type: "abort";
|
|
11
|
+
thread: string;
|
|
12
|
+
id: number;
|
|
13
|
+
data: string;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { RequestEventData as n, AbortEventData as t };
|
|
17
|
+
//# sourceMappingURL=types-CRs-Qww6.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CRs-Qww6.d.ts","names":[],"sources":["../src/data-worker/types.ts"],"mappings":";;KAeY;EACV;EACA;EACA;EACA,MAAM;;KAGI;EACV;EACA;EACA;EACA"}
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { n as RequestEventData, t as AbortEventData } from "./types-CRs-Qww6.js";
|
|
2
|
+
import { Context, Deferred, Future, NextFn } from "@warp-drive-mirror/core/request";
|
|
3
|
+
//#region src/data-worker/fetch.d.ts
|
|
4
|
+
interface PendingItem {
|
|
5
|
+
context: Context;
|
|
6
|
+
signal: AbortSignal | null;
|
|
7
|
+
abortFn: () => void;
|
|
8
|
+
deferred: Deferred<unknown>;
|
|
9
|
+
stack: string;
|
|
10
|
+
}
|
|
11
|
+
declare class WorkerFetch {
|
|
12
|
+
worker: Worker | SharedWorker;
|
|
13
|
+
threadId: string;
|
|
14
|
+
pending: Map<number, PendingItem>;
|
|
15
|
+
channel: MessageChannel;
|
|
16
|
+
constructor(worker: Worker | SharedWorker | null);
|
|
17
|
+
cleanupRequest(id: number): PendingItem | undefined;
|
|
18
|
+
send(event: RequestEventData | AbortEventData): void;
|
|
19
|
+
request<T>(context: Context, next: NextFn<T>): Promise<T> | Future<T>;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { WorkerFetch };
|
|
23
|
+
//# sourceMappingURL=worker-fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-fetch.d.ts","names":[],"sources":["../src/data-worker/fetch.ts"],"mappings":";;;UAwCU;EACR,SAAS;EACT,QAAQ;EACR;EACA,UAAU;EACV;;cAGW;EACX,QAAgB,SAAS;EACzB;EACA,SAAiB,YAAY;EAC7B,SAAiB;EAEjB,YAAY,QAAQ,SAAS;EAoD7B,eAAe,aAAa;EAW5B,KAAK,OAAO,mBAAmB;EAK/B,QAAQ,GAAG,SAAS,SAAS,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO"}
|