sia-reactor 0.0.21 → 0.0.22
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 +115 -89
- package/dist/{TimeTravelOverlay-CJv-S_Km.d.cts → TimeTravelOverlay-DiXUgbUU.d.cts} +9 -8
- package/dist/{TimeTravelOverlay-DxqJL0Zk.d.ts → TimeTravelOverlay-eWjAy0yr.d.ts} +9 -8
- package/dist/adapters/react.cjs +66 -84
- package/dist/adapters/react.d.cts +23 -22
- package/dist/adapters/react.d.ts +23 -22
- package/dist/adapters/react.js +3 -3
- package/dist/adapters/vanilla.cjs +66 -84
- package/dist/adapters/vanilla.d.cts +4 -4
- package/dist/adapters/vanilla.d.ts +4 -4
- package/dist/adapters/vanilla.js +3 -3
- package/dist/{chunk-2WBPGSRL.js → chunk-3SKLWTEA.js} +52 -70
- package/dist/{chunk-DP74DVRT.js → chunk-BTA6MIQ6.js} +40 -8
- package/dist/{chunk-TFLYCXK4.js → chunk-CS3FOV6J.js} +14 -13
- package/dist/{index-Oie9hhE8.d.cts → index-BgbbNXTW.d.cts} +306 -207
- package/dist/{index-Oie9hhE8.d.ts → index-BgbbNXTW.d.ts} +306 -207
- package/dist/index.cjs +54 -75
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -4
- package/dist/{plugins.cjs → modules.cjs} +437 -166
- package/dist/modules.d.cts +53 -0
- package/dist/modules.d.ts +53 -0
- package/dist/modules.js +627 -0
- package/dist/super.d.ts +610 -281
- package/dist/super.global.js +445 -174
- package/dist/timeTravel-CraHdbXZ.d.cts +352 -0
- package/dist/timeTravel-YUxRHRgh.d.ts +352 -0
- package/dist/utils.cjs +41 -7
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -1
- package/package.json +6 -6
- package/dist/plugins.d.cts +0 -112
- package/dist/plugins.d.ts +0 -112
- package/dist/plugins.js +0 -370
- package/dist/timeTravel-B1vedDQc.d.ts +0 -76
- package/dist/timeTravel-WpgWmKu-.d.cts +0 -76
package/dist/super.d.ts
CHANGED
|
@@ -20,24 +20,31 @@ type NoTraverse =
|
|
|
20
20
|
| AbortSignal
|
|
21
21
|
| Inert<unknown>;
|
|
22
22
|
|
|
23
|
-
/** Dot-path union for traversable keys in `T`. */
|
|
24
|
-
type Paths<T, S extends string = ".", D extends number =
|
|
23
|
+
/** Dot-path union for traversable keys in `T` up to depth `D{11}`. */
|
|
24
|
+
type Paths<T, S extends string = ".", D extends number = MaxDepth> = [D] extends [0]
|
|
25
25
|
? never // Circuit Breaker Triggered
|
|
26
26
|
: T extends NoTraverse
|
|
27
27
|
? never
|
|
28
28
|
: T extends readonly (infer U)[]
|
|
29
|
-
? `${Extract<keyof T, number>}` | `${Extract<keyof T, number>}${S}${Paths<U, S,
|
|
29
|
+
? `${Extract<keyof T, number>}` | `${Extract<keyof T, number>}${S}${Paths<U, S, PrevDepth[D]>}`
|
|
30
30
|
: {
|
|
31
31
|
[K in keyof T & (string | number)]: T[K] extends Primitive
|
|
32
32
|
? `${K}`
|
|
33
|
-
: `${K}` | `${K}${S}${Paths<T[K], S,
|
|
33
|
+
: `${K}` | `${K}${S}${Paths<T[K], S, PrevDepth[D]>}`;
|
|
34
34
|
}[keyof T & (string | number)];
|
|
35
35
|
/** Wildcard path (`*`) or concrete dot-path. */
|
|
36
36
|
type WildPaths<T, S extends string = "."> = "*" | Paths<T, S>;
|
|
37
|
-
/** Child-path expansion for a path
|
|
38
|
-
type ChildPaths<
|
|
37
|
+
/** Child-path expansion for a path up to relative depth `D{x}`. */
|
|
38
|
+
type ChildPaths<
|
|
39
|
+
T,
|
|
40
|
+
P extends WildPaths<T>,
|
|
41
|
+
S extends string = ".",
|
|
42
|
+
D extends number = MaxDepth
|
|
43
|
+
> = P extends "*"
|
|
39
44
|
? Paths<T, S>
|
|
40
|
-
:
|
|
45
|
+
: [D] extends [AllDepth] // hardcoded since already at ts deep limits
|
|
46
|
+
? Extract<Paths<T, S, AddDepth<PathDepth<P, S>, D>>, `${P}${S}${string}`>
|
|
47
|
+
: Extract<Paths<T, S, AddDepth<PathDepth<P, S>, D>>, `${P}${S}${string}`>;
|
|
41
48
|
|
|
42
49
|
/** Leaf key name extracted from a path. */
|
|
43
50
|
type PathKey<T, P extends string = Paths<T>, S extends string = "."> = P extends "*"
|
|
@@ -86,7 +93,16 @@ type UnflattenKey<
|
|
|
86
93
|
? { [P in Head]: UnflattenKey<Tail, V, S> }
|
|
87
94
|
: { [P in K]: V };
|
|
88
95
|
|
|
89
|
-
// Helpers
|
|
96
|
+
// --- Helpers ---
|
|
97
|
+
|
|
98
|
+
/** Calculates the depth of a dot-separated path with a max of D{11}. */
|
|
99
|
+
type PathDepth<P extends string, S extends string = ".", D extends number = MaxDepth> = [
|
|
100
|
+
D
|
|
101
|
+
] extends [0]
|
|
102
|
+
? 0
|
|
103
|
+
: P extends `${infer _}${S}${infer Rest}`
|
|
104
|
+
? NextDepth[PathDepth<Rest, S, PrevDepth[D]>]
|
|
105
|
+
: 1;
|
|
90
106
|
|
|
91
107
|
/** Last segment of a path. */
|
|
92
108
|
type PathLeaf<
|
|
@@ -104,34 +120,49 @@ type PathBranch<
|
|
|
104
120
|
: Head
|
|
105
121
|
: never;
|
|
106
122
|
|
|
123
|
+
/** Converts a union of types into an intersection of types. */
|
|
107
124
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
108
125
|
k: infer I
|
|
109
126
|
) => void
|
|
110
127
|
? I
|
|
111
128
|
: never;
|
|
112
129
|
|
|
130
|
+
/** Adds two depths together, respecting the max depth{11}. */
|
|
131
|
+
type AddDepth<A extends number, B extends number> = [B] extends [0]
|
|
132
|
+
? A
|
|
133
|
+
: [A] extends [MaxDepth]
|
|
134
|
+
? MaxDepth
|
|
135
|
+
: AddDepth<NextDepth[A], PrevDepth[B]>;
|
|
136
|
+
|
|
137
|
+
/** Subtracts depth B from A, respecting the min depth{0}. */
|
|
138
|
+
type SubtractDepth<A extends number, B extends number> = [B] extends [0]
|
|
139
|
+
? A
|
|
140
|
+
: [A] extends [0]
|
|
141
|
+
? 0
|
|
142
|
+
: SubtractDepth<PrevDepth[A], PrevDepth[B]>;
|
|
143
|
+
|
|
113
144
|
// --- "It's not that deep" WARRIORS ---
|
|
114
145
|
|
|
115
|
-
/** Deep key union of `T` up to depth `D{
|
|
116
|
-
type DeepKeys<T, D extends number =
|
|
146
|
+
/** Deep key union of `T` up to depth `D{11}`. */
|
|
147
|
+
type DeepKeys<T, D extends number = MaxDepth> = [D] extends [0]
|
|
117
148
|
? never
|
|
118
149
|
: T extends NoTraverse
|
|
119
150
|
? never
|
|
120
151
|
: T extends readonly any[]
|
|
121
|
-
? DeepKeys<T[number],
|
|
152
|
+
? DeepKeys<T[number], PrevDepth[D]>
|
|
122
153
|
: {
|
|
123
|
-
[K in keyof T & (string | number)]: K | DeepKeys<T[K],
|
|
154
|
+
[K in keyof T & (string | number)]: K | DeepKeys<T[K], PrevDepth[D]>;
|
|
124
155
|
}[keyof T & (string | number)];
|
|
125
156
|
|
|
126
|
-
/** Recursive merge result type for `T1` and `T2` up to depth `D{
|
|
127
|
-
type DeepMerge<T1, T2, D extends number =
|
|
157
|
+
/** Recursive merge result type for `T1` and `T2` up to depth `D{11}`. */
|
|
158
|
+
type DeepMerge<T1, T2, D extends number = MaxDepth> = [D] extends [0]
|
|
128
159
|
? never
|
|
129
160
|
: T2 extends object
|
|
130
161
|
? T1 extends object
|
|
131
162
|
? {
|
|
132
163
|
[K in keyof T1 | keyof T2]: K extends keyof T2
|
|
133
164
|
? K extends keyof T1
|
|
134
|
-
? DeepMerge<T1[K], T2[K],
|
|
165
|
+
? DeepMerge<T1[K], T2[K], PrevDepth[D]>
|
|
135
166
|
: T2[K]
|
|
136
167
|
: K extends keyof T1
|
|
137
168
|
? T1[K]
|
|
@@ -140,39 +171,139 @@ type DeepMerge<T1, T2, D extends number = RDepth> = [D] extends [0]
|
|
|
140
171
|
: T2
|
|
141
172
|
: T2;
|
|
142
173
|
|
|
143
|
-
/** Recursive partial type up to depth `D{
|
|
144
|
-
type DeepPartial<T, D extends number =
|
|
174
|
+
/** Recursive partial type up to depth `D{11}`. */
|
|
175
|
+
type DeepPartial<T, D extends number = MaxDepth> = [D] extends [0]
|
|
145
176
|
? never
|
|
146
177
|
: T extends Function
|
|
147
178
|
? T
|
|
148
179
|
: T extends Array<infer U>
|
|
149
|
-
? Array<DeepPartial<U,
|
|
180
|
+
? Array<DeepPartial<U, PrevDepth[D]>>
|
|
150
181
|
: T extends ReadonlyArray<infer U>
|
|
151
|
-
? ReadonlyArray<DeepPartial<U,
|
|
182
|
+
? ReadonlyArray<DeepPartial<U, PrevDepth[D]>>
|
|
152
183
|
: T extends object
|
|
153
|
-
? { [P in keyof T]?: DeepPartial<T[P],
|
|
184
|
+
? { [P in keyof T]?: DeepPartial<T[P], PrevDepth[D]> }
|
|
154
185
|
: T;
|
|
155
186
|
|
|
156
|
-
/** Recursive required type up to depth `D{
|
|
157
|
-
type DeepRequired<T, D extends number =
|
|
187
|
+
/** Recursive required type up to depth `D{11}`. */
|
|
188
|
+
type DeepRequired<T, D extends number = MaxDepth> = [D] extends [0]
|
|
158
189
|
? never
|
|
159
190
|
: T extends Function
|
|
160
191
|
? T
|
|
161
192
|
: T extends Array<infer U>
|
|
162
|
-
? Array<DeepRequired<U,
|
|
193
|
+
? Array<DeepRequired<U, PrevDepth[D]>>
|
|
163
194
|
: T extends ReadonlyArray<infer U>
|
|
164
|
-
? ReadonlyArray<DeepRequired<U,
|
|
195
|
+
? ReadonlyArray<DeepRequired<U, PrevDepth[D]>>
|
|
165
196
|
: T extends object
|
|
166
|
-
? { [P in keyof T]-?: DeepRequired<T[P],
|
|
197
|
+
? { [P in keyof T]-?: DeepRequired<T[P], PrevDepth[D]> }
|
|
167
198
|
: T;
|
|
168
199
|
|
|
169
200
|
// --- RECURSION LIMITERS ---
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
201
|
+
|
|
202
|
+
/** Config for defining recursive limits for all parts of the application */
|
|
203
|
+
interface DepthConfig {
|
|
204
|
+
max: 11;
|
|
205
|
+
all: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19; // observed bundler recursive limit for state trees
|
|
206
|
+
prev: [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19];
|
|
207
|
+
next: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
|
|
208
|
+
}
|
|
209
|
+
/** Current recursive depth limit */
|
|
210
|
+
type MaxDepth = DepthConfig["max"];
|
|
211
|
+
type AllDepth = DepthConfig["all"];
|
|
212
|
+
type PrevDepth = DepthConfig["prev"];
|
|
213
|
+
type NextDepth = DepthConfig["next"];
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* - Runtime event payload used by Reactor listener waves.
|
|
217
|
+
* - Tracks phase and current path context during propagation, mimics native `Event` API.
|
|
218
|
+
* Exposes intent controls (`resolve`/`reject`), propagation controls, and `composedPath()`.
|
|
219
|
+
* @typeParam T Root state object type.
|
|
220
|
+
* @typeParam P Target path type.
|
|
221
|
+
*/
|
|
222
|
+
declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<T>> {
|
|
223
|
+
/** No active propagation phase. */
|
|
224
|
+
static readonly NONE = 0;
|
|
225
|
+
/** Capture phase: root to target parent. */
|
|
226
|
+
static readonly CAPTURING_PHASE = 1;
|
|
227
|
+
/** Target phase: target listeners run. */
|
|
228
|
+
static readonly AT_TARGET = 2;
|
|
229
|
+
/** Bubble phase: target parent to root. */
|
|
230
|
+
static readonly BUBBLING_PHASE = 3;
|
|
231
|
+
/** Current propagation phase for this event instance. */
|
|
232
|
+
eventPhase: number;
|
|
233
|
+
/** Current event type for the active propagation path, clone immediately if async */
|
|
234
|
+
type: Payload<T, P>["type"];
|
|
235
|
+
/**
|
|
236
|
+
* Current target context for the active propagation path, clone immediately if async.
|
|
237
|
+
* Also use to survive future object shape changes from nesting for a path callback.
|
|
238
|
+
*/
|
|
239
|
+
currentTarget: Payload<T, P>["currentTarget"];
|
|
240
|
+
/** Original event type before propagation remapping. */
|
|
241
|
+
readonly staticType: Exclude<Payload<T, P>["type"], "update">;
|
|
242
|
+
/** Original event target context. */
|
|
243
|
+
readonly target: Payload<T, P>["target"];
|
|
244
|
+
/** Root reactive object for this event instance wave. */
|
|
245
|
+
readonly root: Payload<T, P>["root"];
|
|
246
|
+
/** Original target path for this event instance wave. */
|
|
247
|
+
readonly path: Payload<T, P>["target"]["path"];
|
|
248
|
+
/** Current value at the event target path. */
|
|
249
|
+
readonly value: Payload<T, P>["target"]["value"];
|
|
250
|
+
/** Previous value at the event target path. */
|
|
251
|
+
readonly oldValue: Payload<T, P>["target"]["oldValue"];
|
|
252
|
+
/** Whether resolve/reject intent semantics are allowed for this event instance. */
|
|
253
|
+
readonly rejectable: boolean;
|
|
254
|
+
/** Whether this event instance wave can bubble back up to ancestors or just capture down. */
|
|
255
|
+
readonly bubbles: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* `DOMHighResTimeStamp` for this event instance payload for native event parity and accuracy.
|
|
258
|
+
* Enable `eventTimeStamps` option, then use this over custom timestamps in listeners for accuracy.
|
|
259
|
+
* */
|
|
260
|
+
readonly timestamp?: number;
|
|
261
|
+
/** The `Reactor` instance that dispatched this event instance. */
|
|
262
|
+
readonly reactor: Reactor<T>;
|
|
263
|
+
protected _resolved: string;
|
|
264
|
+
protected _rejected: string;
|
|
265
|
+
protected _propagationStopped: boolean;
|
|
266
|
+
protected _immediatePropagationStopped: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* @param payload Source payload for this event instance.
|
|
269
|
+
* @param reactor The `Reactor` instance creating this event instance.
|
|
270
|
+
*/
|
|
271
|
+
constructor(payload: Payload<T, P>, reactor: Reactor<T>);
|
|
272
|
+
/** Whether propagation has been stopped. */
|
|
273
|
+
get propagationStopped(): boolean;
|
|
274
|
+
/** Stops propagation to remaining listeners in later nodes/phases. */
|
|
275
|
+
stopPropagation(): void;
|
|
276
|
+
/** Whether immediate propagation has been stopped. */
|
|
277
|
+
get immediatePropagationStopped(): boolean;
|
|
278
|
+
/** Stops propagation immediately, including remaining listeners on current path. */
|
|
279
|
+
stopImmediatePropagation(): void;
|
|
280
|
+
/** Resolution message for rejectable events. */
|
|
281
|
+
get resolved(): string;
|
|
282
|
+
/**
|
|
283
|
+
* Marks a rejectable event as resolved.
|
|
284
|
+
* @param message Optional resolution message or identity.
|
|
285
|
+
* @example e.resolve("html5Tech"); // identity
|
|
286
|
+
* @example e.resolve("API Load successful"); // message
|
|
287
|
+
*/
|
|
288
|
+
resolve(message?: string): void;
|
|
289
|
+
/** Rejection reason for rejectable events. */
|
|
290
|
+
get rejected(): string;
|
|
291
|
+
/**
|
|
292
|
+
* Marks a rejectable event as rejected.
|
|
293
|
+
* @param reason Optional rejection reason or identity.
|
|
294
|
+
* @example e.resolve("html5Tech"); // identity
|
|
295
|
+
* @example e.resolve("User is not logged in"); // reason
|
|
296
|
+
*/
|
|
297
|
+
reject(reason?: string): void;
|
|
298
|
+
/**
|
|
299
|
+
* Returns event path values from target to root.
|
|
300
|
+
* @returns Composed path values in bubbling order.
|
|
301
|
+
*/
|
|
302
|
+
composedPath(): any[];
|
|
303
|
+
}
|
|
173
304
|
|
|
174
305
|
/** Reactor method names exposed on objects returned by {@link reactive}. */
|
|
175
|
-
declare const methods: readonly ["tick", "stall", "nostall", "get", "gonce", "noget", "set", "sonce", "noset", "delete", "donce", "nodelete", "watch", "wonce", "nowatch", "on", "once", "off", "snapshot", "
|
|
306
|
+
declare const methods: readonly ["tick", "stall", "nostall", "get", "gonce", "noget", "set", "sonce", "noset", "delete", "donce", "nodelete", "watch", "wonce", "nowatch", "on", "once", "off", "snapshot", "use", "reset", "destroy"];
|
|
176
307
|
type Method = (typeof methods)[number];
|
|
177
308
|
type Prefix<P extends ReactivePreferences | undefined> = P extends {
|
|
178
309
|
prefix?: infer X extends string;
|
|
@@ -202,14 +333,14 @@ type Reactive<T extends object, P extends ReactivePreferences | undefined = unde
|
|
|
202
333
|
__Reactor__: Reactor<T>;
|
|
203
334
|
};
|
|
204
335
|
/**
|
|
205
|
-
* Attaches Reactor APIs to a state object and returns its reactive proxy.
|
|
206
|
-
* If an existing `reactive()`
|
|
336
|
+
* Attaches `Reactor` APIs to a state object and returns its reactive proxy from the reactor's core.
|
|
337
|
+
* If an existing `reactive()` object is passed, it is re-returned ignoring change in preferences.
|
|
207
338
|
* @param target Source state object or an existing Reactor instance.
|
|
208
339
|
* @param build Reactor initial configuration.
|
|
209
340
|
* @param preferences Method naming preferences for exposed APIs.
|
|
210
341
|
* @returns Reactive object with mapped Reactor methods and `__Reactor__`.
|
|
211
342
|
* @example
|
|
212
|
-
* const state = reactive({ user: { name: "
|
|
343
|
+
* const state = reactive({ user: { name: "Kosi" } });
|
|
213
344
|
* state.set("user.name", (v) => v);
|
|
214
345
|
* @example
|
|
215
346
|
* const rtr = new Reactor({ count: 0 });
|
|
@@ -273,7 +404,7 @@ declare function isVolatile<T extends object>(target: T): target is Volatile<T>;
|
|
|
273
404
|
/**
|
|
274
405
|
* Gets the raw (unproxied) version of an object if it's proxied, otherwise returns the original object.
|
|
275
406
|
* @param target Object to unwrap.
|
|
276
|
-
* @returns Raw object if proxied, else the original object.
|
|
407
|
+
* @returns Raw object if proxied, else the original object. Use `Reactor.snapshot(true)` for deep unwrapping.
|
|
277
408
|
*/
|
|
278
409
|
declare function getRaw<T extends object>(target: T): T;
|
|
279
410
|
/**
|
|
@@ -333,9 +464,9 @@ interface Target<T, P extends WildPaths<T> = WildPaths<T>> {
|
|
|
333
464
|
}
|
|
334
465
|
|
|
335
466
|
/** Runtime payload union for mediated operations and update waves (Creates the IDE magic). */
|
|
336
|
-
type Payload<T, P extends WildPaths<T> = WildPaths<T
|
|
467
|
+
type Payload<T, P extends WildPaths<T> = WildPaths<T>, D extends number = MaxDepth> =
|
|
337
468
|
| DirectPayload<T, P>
|
|
338
|
-
| UpdatePayload<T, P>;
|
|
469
|
+
| UpdatePayload<T, P, D>;
|
|
339
470
|
|
|
340
471
|
interface BasePayload<T, P extends WildPaths<T> = WildPaths<T>> {
|
|
341
472
|
/**
|
|
@@ -356,24 +487,32 @@ interface DirectPayload<T, P extends WildPaths<T> = WildPaths<T>> extends BasePa
|
|
|
356
487
|
/** Target context for this payload. */
|
|
357
488
|
target: Target<T, P>;
|
|
358
489
|
}
|
|
359
|
-
interface UpdatePayload<
|
|
490
|
+
interface UpdatePayload<
|
|
491
|
+
T,
|
|
492
|
+
P extends WildPaths<T> = WildPaths<T>,
|
|
493
|
+
D extends number = MaxDepth
|
|
494
|
+
> extends BasePayload<T, P> {
|
|
360
495
|
/** Type of the operation that triggered this payload, i.e. "update" */
|
|
361
496
|
type: "update";
|
|
362
497
|
/** Target context for this payload. */
|
|
363
|
-
target: Target<T, ChildPaths<T, P>>; // Target is strictly one of the child paths!
|
|
498
|
+
target: Target<T, ChildPaths<T, P, ".", D>>; // Target is strictly one of the child paths!
|
|
364
499
|
}
|
|
365
500
|
|
|
366
501
|
/** Event union with payload-aware overrides for `type`, `path`, and value fields (Creates the IDE magic). */
|
|
367
|
-
type REvent<
|
|
502
|
+
type REvent<
|
|
503
|
+
T extends object,
|
|
504
|
+
P extends WildPaths<T> = WildPaths<T>,
|
|
505
|
+
D extends number = MaxDepth
|
|
506
|
+
> =
|
|
368
507
|
| (Omit<ReactorEvent<T, P>, OverrideEvtProp> &
|
|
369
508
|
DirectPayload<T, P> &
|
|
370
|
-
|
|
509
|
+
OverrideEvt<DirectPayload<T, P>>)
|
|
371
510
|
| (Omit<ReactorEvent<T, P>, OverrideEvtProp> &
|
|
372
|
-
UpdatePayload<T, P> &
|
|
373
|
-
|
|
511
|
+
UpdatePayload<T, P, D> &
|
|
512
|
+
OverrideEvt<UpdatePayload<T, P, D>>);
|
|
374
513
|
|
|
375
514
|
type OverrideEvtProp = "type" | "target" | "value" | "oldValue" | "path";
|
|
376
|
-
interface
|
|
515
|
+
interface OverrideEvt<PL extends { target: { path: any; value: any; oldValue?: any } }> {
|
|
377
516
|
path: PL["target"]["path"];
|
|
378
517
|
value: PL["target"]["value"];
|
|
379
518
|
oldValue: PL["target"]["oldValue"];
|
|
@@ -409,7 +548,9 @@ type Watcher<T, P extends WildPaths<T> = WildPaths<T>> = (
|
|
|
409
548
|
) => void;
|
|
410
549
|
|
|
411
550
|
/** Listener callback (batched/asynchronous by default). */
|
|
412
|
-
type Listener<T, P extends WildPaths<T> = WildPaths<T
|
|
551
|
+
type Listener<T, P extends WildPaths<T> = WildPaths<T>, D extends number = MaxDepth> = (
|
|
552
|
+
event: REvent<T, P, D>
|
|
553
|
+
) => void;
|
|
413
554
|
|
|
414
555
|
// ===========================================================================
|
|
415
556
|
// ENGINE RECORDS (Internal Storage)
|
|
@@ -417,35 +558,39 @@ type Listener<T, P extends WildPaths<T> = WildPaths<T>> = (event: REvent<T, P>)
|
|
|
417
558
|
|
|
418
559
|
type GetterRecord<T extends object, P extends WildPaths<T> = WildPaths<T>> = {
|
|
419
560
|
cb: Getter<T, P>;
|
|
420
|
-
clup: () =>
|
|
561
|
+
clup: () => boolean | undefined; // Registration Cleanup
|
|
421
562
|
sclup?: () => void; // AbortSignal Cleanup
|
|
422
563
|
} & SyncOptionsTuple;
|
|
423
564
|
|
|
424
565
|
/** Internal registry record for `set` mediators. */
|
|
425
566
|
type SetterRecord<T extends object, P extends WildPaths<T> = WildPaths<T>> = {
|
|
426
567
|
cb: Setter<T, P>;
|
|
427
|
-
clup: () =>
|
|
568
|
+
clup: () => boolean | undefined;
|
|
428
569
|
sclup?: () => void;
|
|
429
570
|
} & SyncOptionsTuple;
|
|
430
571
|
|
|
431
572
|
type DeleterRecord<T extends object, P extends WildPaths<T> = WildPaths<T>> = {
|
|
432
573
|
cb: Deleter<T, P>;
|
|
433
|
-
clup: () =>
|
|
574
|
+
clup: () => boolean | undefined;
|
|
434
575
|
sclup?: () => void;
|
|
435
576
|
} & SyncOptionsTuple;
|
|
436
577
|
|
|
437
578
|
type WatcherRecord<T extends object, P extends WildPaths<T> = WildPaths<T>> = {
|
|
438
579
|
cb: Watcher<T, P>;
|
|
439
|
-
clup: () =>
|
|
580
|
+
clup: () => boolean | undefined;
|
|
440
581
|
sclup?: () => void;
|
|
441
582
|
} & SyncOptionsTuple;
|
|
442
583
|
|
|
443
|
-
type ListenerRecord<
|
|
444
|
-
|
|
445
|
-
|
|
584
|
+
type ListenerRecord<
|
|
585
|
+
T extends object,
|
|
586
|
+
P extends WildPaths<T> = WildPaths<T>,
|
|
587
|
+
D extends number = MaxDepth
|
|
588
|
+
> = {
|
|
589
|
+
cb: Listener<T, P, D>;
|
|
590
|
+
clup: () => boolean | undefined;
|
|
446
591
|
sclup?: () => void;
|
|
447
592
|
lDepth?: number; // Listener Depth
|
|
448
|
-
} & ListenerOptionsTuple
|
|
593
|
+
} & ListenerOptionsTuple<D>;
|
|
449
594
|
|
|
450
595
|
// ===========================================================================
|
|
451
596
|
// CONFIGURATION OPTIONS
|
|
@@ -464,19 +609,20 @@ interface SyncOptionsTuple {
|
|
|
464
609
|
/** Tuple-form and shorthand boolean for mediator/watch registrations. */
|
|
465
610
|
type SyncOptions = boolean | SyncOptionsTuple;
|
|
466
611
|
|
|
467
|
-
interface ListenerOptionsTuple extends
|
|
612
|
+
interface ListenerOptionsTuple<D extends number = MaxDepth>
|
|
613
|
+
extends Omit<SyncOptionsTuple, "lazy"> {
|
|
468
614
|
/** Whether to listen on the capture phase against bubble. */
|
|
469
615
|
capture?: boolean;
|
|
470
616
|
/** Maximum path nested depth for event propagation, try `1` if listening to an array with nested objects. */
|
|
471
|
-
depth?:
|
|
617
|
+
depth?: D;
|
|
472
618
|
}
|
|
473
619
|
/** Tuple-form and shorthand boolean for listener registrations. */
|
|
474
|
-
type ListenerOptions = boolean | ListenerOptionsTuple
|
|
620
|
+
type ListenerOptions<D extends number = MaxDepth> = boolean | ListenerOptionsTuple<D>;
|
|
475
621
|
|
|
476
622
|
/** Options accepted by adapter effects (`sync: true` -> watch mode else listener mode). */
|
|
477
623
|
type EffectOptions =
|
|
478
|
-
| (SyncOptionsTuple & { sync: true })
|
|
479
|
-
| (ListenerOptionsTuple & { sync?: false });
|
|
624
|
+
| (Omit<SyncOptionsTuple, "immediate"> & { sync: true })
|
|
625
|
+
| (Omit<ListenerOptionsTuple, "immediate"> & { sync?: false });
|
|
480
626
|
|
|
481
627
|
/** Reactor bootstrap/build configuration. */
|
|
482
628
|
interface ReactorBuild<T extends object, P extends Paths<T> = Paths<T>> {
|
|
@@ -550,99 +696,6 @@ interface ReactorBuild<T extends object, P extends Paths<T> = Paths<T>> {
|
|
|
550
696
|
) => (string | symbol)[]; // "almighty" mediation
|
|
551
697
|
} // debating keeping use of the Reflect API opt-in
|
|
552
698
|
|
|
553
|
-
/**
|
|
554
|
-
* Runtime event payload used by Reactor listener waves.
|
|
555
|
-
*
|
|
556
|
-
* Tracks phase and current path context during propagation, mimics native `Event` API.
|
|
557
|
-
* Exposes intent controls (`resolve`/`reject`), propagation controls, and `composedPath()`.
|
|
558
|
-
* @typeParam T Root state object type.
|
|
559
|
-
* @typeParam P Target path type.
|
|
560
|
-
*/
|
|
561
|
-
declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<T>> {
|
|
562
|
-
/** No active propagation phase. */
|
|
563
|
-
static readonly NONE = 0;
|
|
564
|
-
/** Capture phase: root to target parent. */
|
|
565
|
-
static readonly CAPTURING_PHASE = 1;
|
|
566
|
-
/** Target phase: target listeners run. */
|
|
567
|
-
static readonly AT_TARGET = 2;
|
|
568
|
-
/** Bubble phase: target parent to root. */
|
|
569
|
-
static readonly BUBBLING_PHASE = 3;
|
|
570
|
-
/** Current propagation phase for this event instance. */
|
|
571
|
-
eventPhase: number;
|
|
572
|
-
/** Current event type for the active propagation path, clone immediately if async */
|
|
573
|
-
type: Payload<T, P>["type"];
|
|
574
|
-
/**
|
|
575
|
-
* Current target context for the active propagation path, clone immediately if async.
|
|
576
|
-
* Also use to survive future object shape changes from nesting for a path callback.
|
|
577
|
-
*/
|
|
578
|
-
currentTarget: Payload<T, P>["currentTarget"];
|
|
579
|
-
/** Original event type before propagation remapping. */
|
|
580
|
-
readonly staticType: Exclude<Payload<T, P>["type"], "update">;
|
|
581
|
-
/** Original event target context. */
|
|
582
|
-
readonly target: Payload<T, P>["target"];
|
|
583
|
-
/** Root reactive object for this event wave. */
|
|
584
|
-
readonly root: Payload<T, P>["root"];
|
|
585
|
-
/** Original target path for this event wave. */
|
|
586
|
-
readonly path: Payload<T, P>["target"]["path"];
|
|
587
|
-
/** Current value at the event target path. */
|
|
588
|
-
readonly value: Payload<T, P>["target"]["value"];
|
|
589
|
-
/** Previous value at the event target path. */
|
|
590
|
-
readonly oldValue: Payload<T, P>["target"]["oldValue"];
|
|
591
|
-
/** Whether resolve/reject intent semantics are allowed for this event. */
|
|
592
|
-
readonly rejectable: boolean;
|
|
593
|
-
/** Whether this event wave can bubble back up to ancestors or just capture down. */
|
|
594
|
-
readonly bubbles: boolean;
|
|
595
|
-
/**
|
|
596
|
-
* `DOMHighResTimeStamp` for this event payload for native event parity and accuracy.
|
|
597
|
-
* Enable `eventTimeStamps` option, then use this over custom timestamps in listeners for accuracy.
|
|
598
|
-
* */
|
|
599
|
-
readonly timestamp?: number;
|
|
600
|
-
protected _warn: (...args: any[]) => void;
|
|
601
|
-
protected _resolved: string;
|
|
602
|
-
protected _rejected: string;
|
|
603
|
-
protected _propagationStopped: boolean;
|
|
604
|
-
protected _immediatePropagationStopped: boolean;
|
|
605
|
-
/**
|
|
606
|
-
* @param payload Source payload for this event instance.
|
|
607
|
-
* @param bubbles Whether bubbling is enabled for this wave.
|
|
608
|
-
* @param canWarn Whether warning output is enabled.
|
|
609
|
-
* @param canStamp Whether timestamping is enabled.
|
|
610
|
-
*/
|
|
611
|
-
constructor(payload: Payload<T, P>, bubbles?: boolean, canStamp?: boolean, canWarn?: boolean);
|
|
612
|
-
/** Whether propagation has been stopped. */
|
|
613
|
-
get propagationStopped(): boolean;
|
|
614
|
-
/** Stops propagation to remaining listeners in later nodes/phases. */
|
|
615
|
-
stopPropagation(): void;
|
|
616
|
-
/** Whether immediate propagation has been stopped. */
|
|
617
|
-
get immediatePropagationStopped(): boolean;
|
|
618
|
-
/** Stops propagation immediately, including remaining listeners on current path. */
|
|
619
|
-
stopImmediatePropagation(): void;
|
|
620
|
-
/** Resolution message for rejectable events. */
|
|
621
|
-
get resolved(): string;
|
|
622
|
-
/**
|
|
623
|
-
* Marks a rejectable event as resolved.
|
|
624
|
-
* @param message Optional resolution message or identity.
|
|
625
|
-
* @example e.resolve("html5Tech"); // identity
|
|
626
|
-
* @example e.resolve("API Load successful"); // message
|
|
627
|
-
*/
|
|
628
|
-
resolve(message?: string): void;
|
|
629
|
-
/** Rejection reason for rejectable events. */
|
|
630
|
-
get rejected(): string;
|
|
631
|
-
/**
|
|
632
|
-
* Marks a rejectable event as rejected.
|
|
633
|
-
* @param reason Optional rejection reason or identity.
|
|
634
|
-
* @example e.resolve("html5Tech"); // identity
|
|
635
|
-
* @example e.resolve("User is not logged in"); // reason
|
|
636
|
-
*/
|
|
637
|
-
reject(reason?: string): void;
|
|
638
|
-
/**
|
|
639
|
-
* Returns event path values from target to root.
|
|
640
|
-
* @returns Composed path values in bubbling order.
|
|
641
|
-
*/
|
|
642
|
-
composedPath(): any[];
|
|
643
|
-
get canWarn(): boolean;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
699
|
/** Checks if a value type is an object for common use cases. */
|
|
647
700
|
declare function isObj<T extends object = object>(obj: any, arraycheck?: boolean): obj is T;
|
|
648
701
|
/** Checks if a value is a "Plain Old Javascript Object". */
|
|
@@ -657,47 +710,68 @@ declare function canHandle(obj: any, config?: {
|
|
|
657
710
|
/**
|
|
658
711
|
* Gets a value by path.
|
|
659
712
|
* @example
|
|
660
|
-
* const state = { user: { profile: { name: "
|
|
713
|
+
* const state = { user: { profile: { name: "Kosi" } } };
|
|
661
714
|
* const name = getAny(state, "user.profile.name");
|
|
662
715
|
*/
|
|
663
716
|
declare function getAny<T extends object, const S extends string = ".", P extends WildPaths<T, S> = WildPaths<T, S>>(source: T, key: P, separator?: S, keyFunc?: (p: string) => string): PathValue<T, P, S>;
|
|
664
717
|
/**
|
|
665
718
|
* Sets a value by path.
|
|
666
719
|
* @example
|
|
667
|
-
* const state = { user: { profile: { name: "
|
|
720
|
+
* const state = { user: { profile: { name: "Kosi" } } };
|
|
668
721
|
* setAny(state, "user.profile.name", "Grace");
|
|
669
722
|
* @example
|
|
670
723
|
* const state = { users: [] as Array<{ name?: string }> };
|
|
671
|
-
* setAny(state, "users[0].name" as any, "
|
|
724
|
+
* setAny(state, "users[0].name" as any, "Kosi");
|
|
672
725
|
*/
|
|
673
726
|
declare function setAny<T extends object, const S extends string = ".", P extends WildPaths<T, S> = WildPaths<T, S>>(target: T, key: P, value: PathValue<T, P, S>, separator?: S, keyFunc?: (p: string) => string): void;
|
|
674
727
|
/**
|
|
675
728
|
* Deletes a value by path.
|
|
676
729
|
* @example
|
|
677
|
-
* const state = { user: { profile: { name: "
|
|
730
|
+
* const state = { user: { profile: { name: "Kosi" } } };
|
|
678
731
|
* deleteAny(state, "user.profile.name");
|
|
679
732
|
*/
|
|
680
|
-
declare function deleteAny<T extends object, const S extends string = ".">(target: T, key:
|
|
733
|
+
declare function deleteAny<T extends object, const S extends string = ".", P extends WildPaths<T, S> = WildPaths<T, S>>(target: T, key: P, separator?: S, keyFunc?: (p: string) => string): void;
|
|
681
734
|
/**
|
|
682
735
|
* Checks whether a path exists.
|
|
683
736
|
* @example
|
|
684
|
-
* const state = { user: { profile: { name: "
|
|
685
|
-
* const ok = inAny(state, "user.profile.name");
|
|
737
|
+
* const state = { user: { profile: { name: "Kosi" } } };
|
|
738
|
+
* const ok = inAny(state, "user.profile.name"); // default loose typing due to it's usecase
|
|
686
739
|
*/
|
|
687
|
-
declare function inAny<T extends object, const S extends string = ".">(source: T, key:
|
|
740
|
+
declare function inAny<T extends object, const S extends string = ".", P extends string = string>(source: T, key: P, separator?: S, keyFunc?: (p: string) => string): boolean;
|
|
688
741
|
/**
|
|
689
742
|
* Converts flattened keys into nested object structure.
|
|
690
743
|
* @example
|
|
691
|
-
* const flat = { "user.name": "
|
|
744
|
+
* const flat = { "user.name": "Kosi", "user.role": "admin" };
|
|
692
745
|
* const obj = parseAnyObj(flat);
|
|
693
746
|
*/
|
|
694
747
|
declare function parseAnyObj<T extends Record<string, any>, const S extends string = ".">(obj: T, separator?: S, keyFunc?: (p: string) => string, seen?: WeakSet<WeakKey>): Unflatten<T, S>;
|
|
695
748
|
/** Normalizes boolean/object event options into a single options object. */
|
|
696
749
|
declare function parseEvtOpts<T extends object>(options: T | boolean | undefined, opts: (keyof T)[] | readonly (keyof T)[], boolOpt?: keyof T, result?: T): T;
|
|
750
|
+
/**
|
|
751
|
+
* Unified expansion utility.
|
|
752
|
+
* Bridges Coarse (Immutable replacement) writes into Fine-grained (Reactive) writes by
|
|
753
|
+
* surgically expanding a single object write into multiple granular child operations.
|
|
754
|
+
* @example
|
|
755
|
+
* // Event Mode (Cascading after-write)
|
|
756
|
+
* rtr.on("user", (e) => fanout(e, { depth: 1 })); // defaults to 1 level deep
|
|
757
|
+
* @example
|
|
758
|
+
* // Direct Mode (Patching before-write)
|
|
759
|
+
* fanout(state, "user", { session: { id: 1, name: "Kosi", role: "admin" } }, { depth: Infinity }); // use this or `true` to fanout all nested keys
|
|
760
|
+
*/
|
|
761
|
+
declare function fanout<T extends object>(event: ReactorEvent<T> | Payload<T>, options?: {
|
|
762
|
+
merge?: boolean;
|
|
763
|
+
depth?: number | boolean;
|
|
764
|
+
crossRealms?: boolean;
|
|
765
|
+
}): void;
|
|
766
|
+
declare function fanout<T extends object>(state: T, path: WildPaths<T>, value: any, options?: {
|
|
767
|
+
merge?: boolean;
|
|
768
|
+
depth?: number | boolean;
|
|
769
|
+
crossRealms?: boolean;
|
|
770
|
+
}): void;
|
|
697
771
|
/**
|
|
698
772
|
* Deep-merges object-like values.
|
|
699
773
|
* @example
|
|
700
|
-
* const next = mergeObjs({ user: { name: "
|
|
774
|
+
* const next = mergeObjs({ user: { name: "Kosi" } }, { user: { role: "admin" } });
|
|
701
775
|
*/
|
|
702
776
|
declare function mergeObjs<T1 extends object, T2 extends object>(o1: T1, o2: T2): DeepMerge<T1, T2>;
|
|
703
777
|
declare function mergeObjs<T1 extends object>(o1: T1): T1;
|
|
@@ -707,7 +781,7 @@ declare function getTrailRecords<T extends object>(obj: T, path: WildPaths<T>, r
|
|
|
707
781
|
/**
|
|
708
782
|
* Deep-clones supported object structures.
|
|
709
783
|
* @example
|
|
710
|
-
* const cloned = deepClone({ user: { name: "
|
|
784
|
+
* const cloned = deepClone({ user: { name: "Kosi" } });
|
|
711
785
|
*/
|
|
712
786
|
declare function deepClone<T>(obj: T, config?: {
|
|
713
787
|
crossRealms?: boolean;
|
|
@@ -716,27 +790,57 @@ declare function deepClone<T>(obj: T, config?: {
|
|
|
716
790
|
/** Nulls all non-function instance properties across the prototype chain. */
|
|
717
791
|
declare function nuke(target: any): void;
|
|
718
792
|
|
|
719
|
-
|
|
793
|
+
type ReactorModuleId = string | number;
|
|
794
|
+
interface ReactorModuleConstructor<P extends BaseReactorModule = BaseReactorModule, T extends object = any> {
|
|
720
795
|
new (rtr: Reactor<T>, config: any): P;
|
|
721
|
-
|
|
796
|
+
moduleName: string;
|
|
722
797
|
}
|
|
723
|
-
|
|
724
|
-
|
|
798
|
+
/**
|
|
799
|
+
* Base class, extend to create custom reactor modules that can be used with a `Reactor` instance
|
|
800
|
+
* Provides common functionalities like multi-reactor management, configuration handling, and error logging.
|
|
801
|
+
* @typeParam T Root state object type of the reactors this module will manage.
|
|
802
|
+
* @typeParam Config Configuration object type for the module.
|
|
803
|
+
* @typeParam State Optional local state object type for the module.
|
|
804
|
+
*/
|
|
805
|
+
declare abstract class BaseReactorModule<T extends object = any, Config = any, State = any> {
|
|
806
|
+
static readonly moduleName: string;
|
|
725
807
|
get name(): string;
|
|
726
808
|
protected ac: AbortController;
|
|
727
|
-
readonly signal: AbortSignal;
|
|
728
|
-
|
|
809
|
+
protected readonly signal: AbortSignal;
|
|
810
|
+
protected rtrs: Map<ReactorModuleId, Reactor<any>>;
|
|
811
|
+
protected rids: WeakMap<Reactor<any>, ReactorModuleId>;
|
|
812
|
+
protected wired: boolean;
|
|
729
813
|
config: Config extends object ? Reactive<Config> : Config;
|
|
730
814
|
readonly state: State extends object ? Reactive<State> : State;
|
|
731
815
|
constructor(config?: Config, rtr?: Reactor<T>, state?: State);
|
|
732
|
-
/**
|
|
733
|
-
|
|
734
|
-
|
|
816
|
+
/**
|
|
817
|
+
* Connect to a `Reactor` instance, allows managing multiple reactors if needed.
|
|
818
|
+
* @param target `Reactor` instance or `reactive()` object to connect to.
|
|
819
|
+
* @param id Optional custom id for the reactor, prefer over default implicit index id when managing multiple reactors, supports paths to merge into a single tree.
|
|
820
|
+
* @returns Current `ReactorModule` instance for fluent chaining.
|
|
821
|
+
* @example
|
|
822
|
+
* const mod = new MyModule().attach(state1).attach(state2); // implicit index-based ids by default, add a .setup() or `Reactor.use()` when ready for init.
|
|
823
|
+
* @example
|
|
824
|
+
* const persist = new PersistModule(config).attach(sessState, "session").attach(adminState, "session.admin"); // don't use "*", causes de-serialization issues.
|
|
825
|
+
*/
|
|
826
|
+
attach(target?: Reactor<any> | Reactive<any>, id?: ReactorModuleId): this;
|
|
827
|
+
protected onAttach(_rtr: Reactor<any>, _rid?: ReactorModuleId): void;
|
|
828
|
+
/**
|
|
829
|
+
* Entry point called to initialize module wiring, calls `.attach(target, id)` first, `Reactor.use()` calls this internally.
|
|
830
|
+
* Should run as last in `.attach()` chain or after all desired reactors if using multiple; so wiring is done safely after.
|
|
831
|
+
* @param target `Reactor` instance or `reactive()` object to connect to.
|
|
832
|
+
* @param id Optional id for the reactor, prefer over default implicit index id when managing multiple reactors.
|
|
833
|
+
* @returns Current `ReactorModule` instance for fluent chaining.
|
|
834
|
+
* @example
|
|
835
|
+
* const mod = new MyModule().attach(state1).setup(state2); // if using multiple, this should run last; with same params as `.attach()` for a shorter chain
|
|
836
|
+
*/
|
|
837
|
+
setup(target?: Reactor<any> | Reactive<any>, id?: ReactorModuleId): this;
|
|
838
|
+
/** set up listeners/subscriptions and module runtime wiring. */
|
|
735
839
|
abstract wire(): void;
|
|
736
840
|
destroy(): void;
|
|
737
841
|
protected onDestroy?(): void;
|
|
738
842
|
/**
|
|
739
|
-
* Wraps a function with
|
|
843
|
+
* Wraps a function with module-scoped error logging.
|
|
740
844
|
* Use this when creating functions dynamically (for example, before attaching an anonymous listener on the fly).
|
|
741
845
|
* @example
|
|
742
846
|
* window.addEventListener("resize", this.guard(() => this.syncLayout(true)), { signal: this.signal });
|
|
@@ -744,19 +848,23 @@ declare abstract class BaseReactorPlugin<T extends object = any, Config = any, S
|
|
|
744
848
|
guard: <Fn extends Function>(fn: Fn) => Fn;
|
|
745
849
|
}
|
|
746
850
|
|
|
747
|
-
/**
|
|
748
|
-
*
|
|
749
|
-
*
|
|
851
|
+
/**
|
|
852
|
+
* - Core S.I.A runtime for path mediation, observation, and event propagation.
|
|
853
|
+
* - Provides path-level mediators (`get|set|delete`), synchronous watchers (`watch`), and batched listeners (`on`).
|
|
854
|
+
* Supports wildcard/path-based subscriptions, optional reference tracking, and module-based extensions.
|
|
750
855
|
* @typeParam T Root state object type.
|
|
751
856
|
*/
|
|
752
857
|
declare class Reactor<T extends object> {
|
|
858
|
+
/** Logger function for this reactor instance, override if desired, `this.canLog = false` resets. */
|
|
753
859
|
log: (...args: any[]) => void;
|
|
860
|
+
/** The core state object for this reactor instance. */
|
|
754
861
|
core: T;
|
|
755
|
-
|
|
862
|
+
/** The modules being used by this reactor. */
|
|
863
|
+
modules?: Set<BaseReactorModule<T>>;
|
|
864
|
+
/** Configuration options for this reactor instance. */
|
|
756
865
|
config: Omit<ReactorBuild<T>, "debug">;
|
|
866
|
+
/** Whether this reactor instance is currently batching updates, a window view into the engine timing */
|
|
757
867
|
isBatching: boolean;
|
|
758
|
-
isCascading: boolean;
|
|
759
|
-
protected isLogging: boolean;
|
|
760
868
|
protected queue?: Set<() => void>;
|
|
761
869
|
protected batch?: Map<Paths<T>, Payload<T>>;
|
|
762
870
|
protected lineage?: WeakMap<object, (object | string)[]>;
|
|
@@ -813,7 +921,7 @@ declare class Reactor<T extends object> {
|
|
|
813
921
|
*/
|
|
814
922
|
nostall(task: () => any): boolean | undefined;
|
|
815
923
|
getDepth(path: string, depth?: number): number;
|
|
816
|
-
|
|
924
|
+
getContext<P extends WildPaths<T>>(path: P): Target<T, P>;
|
|
817
925
|
protected bindSignal<Cb>(cord: GetterRecord<T> | SetterRecord<T> | DeleterRecord<T> | WatcherRecord<T> | ListenerRecord<T>, sig?: AbortSignal): Cb;
|
|
818
926
|
protected cloned<O>(target: O, raw: boolean, seen?: WeakMap<WeakKey, any>): O;
|
|
819
927
|
protected syncAdd<P extends WildPaths<T>>(key: "get" | "set" | "delete" | "watch", path: P, cb: any, opts: SyncOptions | undefined, onImmediate?: (immediate: boolean | "auto") => void): () => boolean | undefined;
|
|
@@ -877,7 +985,7 @@ declare class Reactor<T extends object> {
|
|
|
877
985
|
nodelete<P extends WildPaths<T>>(path: P, callback: Deleter<T, P>): boolean | undefined;
|
|
878
986
|
/**
|
|
879
987
|
* Registers a watcher for a path.
|
|
880
|
-
* Watch callbacks run synchronously with the operation.
|
|
988
|
+
* Watch callbacks run synchronously with the operation, use leaf paths for reliability as it sees exact sets; no bubbling here.
|
|
881
989
|
* @param path Path or wildcard path.
|
|
882
990
|
* @param callback Watch callback.
|
|
883
991
|
* @param options Sync options.
|
|
@@ -905,9 +1013,9 @@ declare class Reactor<T extends object> {
|
|
|
905
1013
|
* @example
|
|
906
1014
|
* const cleanup = rtr.on("user.name", (e) => console.log(e.type, e.path));
|
|
907
1015
|
*/
|
|
908
|
-
on<P extends WildPaths<T
|
|
1016
|
+
on<P extends WildPaths<T>, const D extends number = MaxDepth>(path: P, callback: Listener<T, P, D>, options?: ListenerOptions<D>): ListenerRecord<T, P, D>["clup"];
|
|
909
1017
|
/** Registers an event listener for a path that only triggers once. */
|
|
910
|
-
once<P extends WildPaths<T
|
|
1018
|
+
once<P extends WildPaths<T>, const D extends number = MaxDepth>(path: P, callback: Listener<T, P, D>, options?: ListenerOptions<D>): ListenerRecord<T, P, D>["clup"];
|
|
911
1019
|
/**
|
|
912
1020
|
* Removes an event listener for a path.
|
|
913
1021
|
* @param path Path or wildcard path.
|
|
@@ -919,12 +1027,12 @@ declare class Reactor<T extends object> {
|
|
|
919
1027
|
* rtr.on("user.name", cb);
|
|
920
1028
|
* rtr.off("user.name", cb);
|
|
921
1029
|
*/
|
|
922
|
-
off<P extends WildPaths<T
|
|
1030
|
+
off<P extends WildPaths<T>, const D extends number = MaxDepth>(path: P, callback: Listener<T, P, D>, options?: ListenerOptions<D>): boolean | undefined;
|
|
923
1031
|
/**
|
|
924
1032
|
* Creates a snapshot; possibly clone of state (or a state branch).
|
|
925
1033
|
* You could alternatively use or serialize your proxied state "as is" except the environment demands no proxies or new references.
|
|
926
|
-
* @param raw Use raw (deep unproxied & uncloned) version of branch.
|
|
927
|
-
* @param branch
|
|
1034
|
+
* @param raw Use raw (deep unproxied & uncloned) version of branch, defaults to `true` if `config.smartCloning: false`.
|
|
1035
|
+
* @param branch Specific branch to clone.
|
|
928
1036
|
* @returns Snapshot deep or smart (structurally shared) clone.
|
|
929
1037
|
* @example
|
|
930
1038
|
* const snap = rtr.snapshot();
|
|
@@ -934,33 +1042,24 @@ declare class Reactor<T extends object> {
|
|
|
934
1042
|
snapshot(raw?: boolean): T;
|
|
935
1043
|
snapshot<B>(raw?: boolean, branch?: B): B;
|
|
936
1044
|
/**
|
|
937
|
-
*
|
|
938
|
-
* @param
|
|
939
|
-
* @param
|
|
940
|
-
* @
|
|
941
|
-
* rtr.on("user", (event) => rtr.cascade(event));
|
|
942
|
-
* @example
|
|
943
|
-
* rtr.watch("user", (_value, payload) => rtr.cascade(payload));
|
|
944
|
-
*/
|
|
945
|
-
cascade({ type, currentTarget: { path, value: news, oldValue: olds } }: ReactorEvent<T> | Payload<T>, objectSafe?: boolean): void;
|
|
946
|
-
/**
|
|
947
|
-
* Installs a plugin instance.
|
|
948
|
-
* @param plugin Plugin instance.
|
|
949
|
-
* @returns Current reactor for fluent chaining.
|
|
1045
|
+
* Installs a module instance.
|
|
1046
|
+
* @param target Module instance.
|
|
1047
|
+
* @param id Optional identification tag for this instance in the module.
|
|
1048
|
+
* @returns Current `Reactor` instance for fluent chaining.
|
|
950
1049
|
*/
|
|
951
|
-
|
|
952
|
-
/** Resets
|
|
1050
|
+
use(target: BaseReactorModule<T>, id?: ReactorModuleId): this;
|
|
1051
|
+
/** Resets this reactor instance to its initial state. */
|
|
953
1052
|
reset(): void;
|
|
954
1053
|
destroy(): void;
|
|
955
1054
|
get canLog(): boolean;
|
|
956
1055
|
set canLog(value: boolean);
|
|
957
|
-
get
|
|
1056
|
+
get canLineageTrace(): boolean | undefined;
|
|
958
1057
|
get canSmartClone(): boolean | undefined;
|
|
959
1058
|
}
|
|
960
1059
|
|
|
961
1060
|
/**
|
|
962
|
-
* Auto-dependency tracker used to subscribe only to accessed paths.
|
|
963
|
-
* `tracked(...)` wraps a snapshot in a read-tracking proxy, and `callback(...)`
|
|
1061
|
+
* - Auto-dependency tracker used to subscribe only to accessed paths.
|
|
1062
|
+
* - `tracked(...)` wraps a snapshot in a read-tracking proxy, and `callback(...)`
|
|
964
1063
|
* binds subscriptions for collected paths using `watch` (sync) or `on` (batched).
|
|
965
1064
|
* @typeParam T Root state object type.
|
|
966
1065
|
*/
|
|
@@ -1009,9 +1108,9 @@ declare class Autotracker<T extends object> {
|
|
|
1009
1108
|
* const stop = atrkr.callback(() => console.log("changed")); // re-run after when ".user.name" changes
|
|
1010
1109
|
* @example Packaged Customization
|
|
1011
1110
|
* const atrkr = new Autotracker(); // no reactor passed
|
|
1012
|
-
* withTracker(atrkr, () => state.user.name); // import `withTracker`
|
|
1111
|
+
* withTracker(atrkr, () => state.user.name); // import `withTracker` too
|
|
1013
1112
|
* const stop = atrkr.callback(() => console.log("sync"), { sync: true }); // re-run immediately when ".user.name" changes, works on any path used from any reactor state
|
|
1014
|
-
* @example Extensive
|
|
1113
|
+
* @example Extensive Customization
|
|
1015
1114
|
* atrkr.unblock();
|
|
1016
1115
|
* const prev = CTX.autotracker;
|
|
1017
1116
|
* CTX.autotracker = atrkr; // import CTX first
|
|
@@ -1036,7 +1135,9 @@ declare function withTracker<T>(tracker: Autotracker<any>, run: () => T, rtr?: R
|
|
|
1036
1135
|
declare const CTX: {
|
|
1037
1136
|
/** Flag indicating whether the application is running in development mode. */
|
|
1038
1137
|
isDevEnv: boolean;
|
|
1039
|
-
/**
|
|
1138
|
+
/** Flag indicating whether a cascade is currently ongoing so reactors can allow all writes. */
|
|
1139
|
+
isCascading: boolean;
|
|
1140
|
+
/** Active `Autotracker` instance, override for automatic dependency collection on `Reactor` traps. */
|
|
1040
1141
|
autotracker: Autotracker<any> | null;
|
|
1041
1142
|
};
|
|
1042
1143
|
/** Marker to access underlying raw object from a proxy. */
|
|
@@ -1057,8 +1158,6 @@ declare const SSVERSION: unique symbol;
|
|
|
1057
1158
|
declare const RTR_BATCH: (callback: Function, ...args: any[]) => void;
|
|
1058
1159
|
/** Default reactor logger prefix function. */
|
|
1059
1160
|
declare const RTR_LOG: (...args: any[]) => void;
|
|
1060
|
-
/** Default event warning logger prefix function. */
|
|
1061
|
-
declare const EVT_WARN: (...args: any[]) => void;
|
|
1062
1161
|
/** Canonical option keys parsed for listener and mediator registrations. */
|
|
1063
1162
|
declare const EVT_OPTS: {
|
|
1064
1163
|
readonly LISTENER: readonly ["capture", "depth", "once", "signal", "immediate"];
|
|
@@ -1253,6 +1352,7 @@ declare const utils_cleanKeyCombo: typeof cleanKeyCombo;
|
|
|
1253
1352
|
declare const utils_createEl: typeof createEl;
|
|
1254
1353
|
declare const utils_deepClone: typeof deepClone;
|
|
1255
1354
|
declare const utils_deleteAny: typeof deleteAny;
|
|
1355
|
+
declare const utils_fanout: typeof fanout;
|
|
1256
1356
|
declare const utils_formatKeyForDisplay: typeof formatKeyForDisplay;
|
|
1257
1357
|
declare const utils_formatKeyShortcutsForDisplay: typeof formatKeyShortcutsForDisplay;
|
|
1258
1358
|
declare const utils_getAny: typeof getAny;
|
|
@@ -1279,27 +1379,56 @@ declare const utils_setInterval: typeof setInterval;
|
|
|
1279
1379
|
declare const utils_setTimeout: typeof setTimeout;
|
|
1280
1380
|
declare const utils_stringifyKeyEvent: typeof stringifyKeyEvent;
|
|
1281
1381
|
declare namespace utils {
|
|
1282
|
-
export { type utils_KeyStruct as KeyStruct, utils_assignEl as assignEl, utils_bindAllMethods as bindAllMethods, utils_canHandle as canHandle, utils_clamp as clamp, utils_cleanKeyCombo as cleanKeyCombo, utils_createEl as createEl, utils_deepClone as deepClone, utils_deleteAny as deleteAny, utils_formatKeyForDisplay as formatKeyForDisplay, utils_formatKeyShortcutsForDisplay as formatKeyShortcutsForDisplay, utils_getAny as getAny, utils_getTermsForKey as getTermsForKey, utils_getTrailRecords as getTrailRecords, utils_guardAllMethods as guardAllMethods, utils_guardMethod as guardMethod, utils_inAny as inAny, utils_isObj as isObj, utils_isPOJO as isPOJO, utils_keyEventAllowed as keyEventAllowed, type utils_keysSettings as keysSettings, utils_matchKeys as matchKeys, utils_mergeObjs as mergeObjs, utils_nuke as nuke, utils_onAllMethods as onAllMethods, utils_parseAnyObj as parseAnyObj, utils_parseEvtOpts as parseEvtOpts, utils_parseForARIAKS as parseForARIAKS, utils_parseKeyCombo as parseKeyCombo, utils_requestAnimationFrame as requestAnimationFrame, utils_setAny as setAny, utils_setInterval as setInterval, utils_setTimeout as setTimeout, utils_stringifyKeyEvent as stringifyKeyEvent };
|
|
1382
|
+
export { type utils_KeyStruct as KeyStruct, utils_assignEl as assignEl, utils_bindAllMethods as bindAllMethods, utils_canHandle as canHandle, utils_clamp as clamp, utils_cleanKeyCombo as cleanKeyCombo, utils_createEl as createEl, utils_deepClone as deepClone, utils_deleteAny as deleteAny, utils_fanout as fanout, utils_formatKeyForDisplay as formatKeyForDisplay, utils_formatKeyShortcutsForDisplay as formatKeyShortcutsForDisplay, utils_getAny as getAny, utils_getTermsForKey as getTermsForKey, utils_getTrailRecords as getTrailRecords, utils_guardAllMethods as guardAllMethods, utils_guardMethod as guardMethod, utils_inAny as inAny, utils_isObj as isObj, utils_isPOJO as isPOJO, utils_keyEventAllowed as keyEventAllowed, type utils_keysSettings as keysSettings, utils_matchKeys as matchKeys, utils_mergeObjs as mergeObjs, utils_nuke as nuke, utils_onAllMethods as onAllMethods, utils_parseAnyObj as parseAnyObj, utils_parseEvtOpts as parseEvtOpts, utils_parseForARIAKS as parseForARIAKS, utils_parseKeyCombo as parseKeyCombo, utils_requestAnimationFrame as requestAnimationFrame, utils_setAny as setAny, utils_setInterval as setInterval, utils_setTimeout as setTimeout, utils_stringifyKeyEvent as stringifyKeyEvent };
|
|
1283
1383
|
}
|
|
1284
1384
|
|
|
1385
|
+
type JSONReplacer = ((this: any, key: string, value: any) => any) | (number | string)[] | null;
|
|
1386
|
+
type JSONReviver = ((this: any, key: string, value: any) => any) | undefined;
|
|
1285
1387
|
interface StorageAdapterConfig {
|
|
1286
1388
|
debug: boolean;
|
|
1389
|
+
/** Optional `JSON.stringify()` like replacer to be used where applicable. */
|
|
1390
|
+
replacer?: JSONReplacer;
|
|
1391
|
+
/** Optional `JSON.parse()` like reviver to be used where applicable. */
|
|
1392
|
+
reviver?: JSONReviver;
|
|
1393
|
+
}
|
|
1394
|
+
interface CookieOptions {
|
|
1395
|
+
/** Cookie path scope, defaults to root for maximum accessibility. */
|
|
1396
|
+
path: string;
|
|
1397
|
+
/** Optional cookie domain scope, e.g. ".example.com". */
|
|
1398
|
+
domain?: string;
|
|
1399
|
+
/** Cookie Secure attribute, defaults to `false` but should be `true` in production for HTTPS sites. */
|
|
1400
|
+
secure: boolean;
|
|
1401
|
+
/** Cookie SameSite attribute for CSRF protection, defaults to "Lax" for a balance of security and usability. */
|
|
1402
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
1403
|
+
/** Optional cookie lifetime in seconds, e.g. 604800 for a week. */
|
|
1404
|
+
maxAge?: number;
|
|
1405
|
+
/** Optional absolute cookie expiry date, e.g. (new Date()).setDate(new Date().getDate() + 7), "Wed, 21 Oct 2023 07:28:00 GMT" (UTC Format). */
|
|
1406
|
+
expires?: string | Date;
|
|
1407
|
+
}
|
|
1408
|
+
interface CookieAdapterConfig extends StorageAdapterConfig, CookieOptions {
|
|
1287
1409
|
}
|
|
1288
|
-
interface
|
|
1410
|
+
interface MemoryAdapterConfig extends StorageAdapterConfig {
|
|
1289
1411
|
/** stored as strings to mimic local constraints */
|
|
1290
1412
|
store: Map<string, string>;
|
|
1291
1413
|
}
|
|
1292
1414
|
interface IndexedDBAdapterConfig extends StorageAdapterConfig {
|
|
1415
|
+
/** The name of the IndexedDB database to be created or retrieved. */
|
|
1293
1416
|
dbName: string;
|
|
1417
|
+
/** Database version tag to use during creation or retrieval. */
|
|
1294
1418
|
version: number;
|
|
1295
1419
|
/** First store is default during operations if none provided */
|
|
1296
1420
|
stores: string[];
|
|
1297
1421
|
/** return a preffered instance or `throw` to prevent accessing the database */
|
|
1298
1422
|
onidb: () => any;
|
|
1423
|
+
/** Called when the database request needs to be upgraded */
|
|
1299
1424
|
onupgradeneeded: (database: IDBDatabase, event: IDBVersionChangeEvent) => void;
|
|
1425
|
+
/** Called when the database version changes */
|
|
1300
1426
|
onversionchange: (database: IDBDatabase, event: IDBVersionChangeEvent) => void;
|
|
1427
|
+
/** Called when the database request is successful */
|
|
1301
1428
|
onsuccess: (database: IDBDatabase, event: Event) => void;
|
|
1429
|
+
/** Called when the database request fails */
|
|
1302
1430
|
onerror: (error: DOMException | null, event: Event) => any;
|
|
1431
|
+
/** Called when the database request is blocked */
|
|
1303
1432
|
onblocked: (event: IDBVersionChangeEvent) => void;
|
|
1304
1433
|
}
|
|
1305
1434
|
interface StorageAdapterConstructor<Config extends StorageAdapterConfig = StorageAdapterConfig> {
|
|
@@ -1308,50 +1437,218 @@ interface StorageAdapterConstructor<Config extends StorageAdapterConfig = Storag
|
|
|
1308
1437
|
interface AsyncStorageAdapterConstructor<Config extends StorageAdapterConfig = StorageAdapterConfig> {
|
|
1309
1438
|
new (config?: Config): AsyncStorageAdapter<Config>;
|
|
1310
1439
|
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Abstract base class for storage adapters, defines the interface and common functionality.
|
|
1442
|
+
* @typeParam Config Configuration object type for the adapter.
|
|
1443
|
+
*/
|
|
1311
1444
|
declare abstract class BaseStorageAdapter<Config extends StorageAdapterConfig = StorageAdapterConfig> {
|
|
1312
|
-
|
|
1445
|
+
readonly name: string;
|
|
1313
1446
|
config: Config;
|
|
1314
1447
|
protected warn: (act?: string, mssg?: string, key?: string, store?: string) => false | void;
|
|
1315
1448
|
constructor(config?: Config);
|
|
1316
1449
|
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Abstract base class for storage adapters, defines the interface and common functionality.
|
|
1452
|
+
* Extend this class to implement specific synchronous storage mechanisms (e.g., LocalStorage).
|
|
1453
|
+
* @typeParam Config Configuration object type for the adapter.
|
|
1454
|
+
*/
|
|
1317
1455
|
declare abstract class StorageAdapter<Config extends StorageAdapterConfig = StorageAdapterConfig> extends BaseStorageAdapter<Config> {
|
|
1456
|
+
readonly name: string;
|
|
1318
1457
|
abstract get(key: string): any;
|
|
1319
1458
|
abstract set(key: string, value: any): boolean;
|
|
1320
1459
|
abstract remove(key: string): boolean;
|
|
1321
1460
|
abstract clear(): boolean;
|
|
1322
1461
|
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Abstract base class for asynchronous storage adapters, defines the interface and common functionality.
|
|
1464
|
+
* Extend this class to implement specific asynchronous storage mechanisms (e.g., IndexedDB).
|
|
1465
|
+
* @typeParam Config Configuration object type for the adapter.
|
|
1466
|
+
*/
|
|
1323
1467
|
declare abstract class AsyncStorageAdapter<Config extends StorageAdapterConfig = StorageAdapterConfig> extends BaseStorageAdapter<Config> {
|
|
1468
|
+
readonly name: string;
|
|
1324
1469
|
abstract get(key: string): Promise<any>;
|
|
1325
1470
|
abstract set(key: string, value: any): Promise<boolean>;
|
|
1326
1471
|
abstract remove(key: string): Promise<boolean>;
|
|
1327
1472
|
abstract clear(): Promise<boolean>;
|
|
1328
1473
|
}
|
|
1474
|
+
/**
|
|
1475
|
+
* - The LocalStorage Adapter (~5MB per origin, browser-dependent).
|
|
1476
|
+
* - Provides aN implementation of the `StorageAdapter` interface using the browser's `localStorage`.
|
|
1477
|
+
* Handles JSON serialization and deserialization, and includes error handling for unsupported environments.
|
|
1478
|
+
*/
|
|
1329
1479
|
declare class LocalStorageAdapter extends StorageAdapter {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1480
|
+
readonly name: string;
|
|
1481
|
+
/**
|
|
1482
|
+
* Reads and parses a value from localStorage.
|
|
1483
|
+
* @param key Storage key.
|
|
1484
|
+
* @returns Parsed value, or `undefined` when missing/unreadable.
|
|
1485
|
+
*/
|
|
1486
|
+
get(key: string, reviver?: JSONReviver): any;
|
|
1487
|
+
/**
|
|
1488
|
+
* Serializes and writes a value to localStorage.
|
|
1489
|
+
* @param key Storage key.
|
|
1490
|
+
* @param value Value to serialize.
|
|
1491
|
+
* @returns `true` when write succeeds, else `false`.
|
|
1492
|
+
*/
|
|
1493
|
+
set(key: string, value: any, replacer?: JSONReplacer | undefined): boolean;
|
|
1494
|
+
/**
|
|
1495
|
+
* Removes a single key from localStorage.
|
|
1496
|
+
* @param key Storage key.
|
|
1497
|
+
* @returns `true` when removal succeeds, else `false`.
|
|
1498
|
+
*/
|
|
1499
|
+
remove(key: string): boolean;
|
|
1500
|
+
/**
|
|
1501
|
+
* Clears all localStorage entries for the current origin.
|
|
1502
|
+
* @returns `true` when clear succeeds, else `false`.
|
|
1503
|
+
*/
|
|
1504
|
+
clear(): boolean;
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* - The SessionStorage Adapter (~5MB per origin per tab, browser-dependent).
|
|
1508
|
+
* - Provides an implementation of the `StorageAdapter` interface using the browser's `sessionStorage`.
|
|
1509
|
+
* Handles JSON serialization and deserialization, and includes error handling for unsupported environments.
|
|
1510
|
+
*/
|
|
1511
|
+
declare class SessionStorageAdapter extends StorageAdapter {
|
|
1512
|
+
readonly name: string;
|
|
1513
|
+
/**
|
|
1514
|
+
* Reads and parses a value from sessionStorage.
|
|
1515
|
+
* @param key Storage key.
|
|
1516
|
+
* @returns Parsed value, or `undefined` when missing/unreadable.
|
|
1517
|
+
*/
|
|
1518
|
+
get(key: string, reviver?: JSONReviver): any;
|
|
1519
|
+
/**
|
|
1520
|
+
* Serializes and writes a value to sessionStorage.
|
|
1521
|
+
* @param key Storage key.
|
|
1522
|
+
* @param value Value to serialize.
|
|
1523
|
+
* @returns `true` when write succeeds, else `false`.
|
|
1524
|
+
*/
|
|
1525
|
+
set(key: string, value: any, replacer?: JSONReplacer | undefined): boolean;
|
|
1526
|
+
/**
|
|
1527
|
+
* Removes a single key from sessionStorage.
|
|
1528
|
+
* @param key Storage key.
|
|
1529
|
+
* @returns `true` when removal succeeds, else `false`.
|
|
1530
|
+
*/
|
|
1333
1531
|
remove(key: string): boolean;
|
|
1532
|
+
/**
|
|
1533
|
+
* Clears all sessionStorage entries for the current tab session.
|
|
1534
|
+
* @returns `true` when clear succeeds, else `false`.
|
|
1535
|
+
*/
|
|
1334
1536
|
clear(): boolean;
|
|
1335
1537
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1538
|
+
/**
|
|
1539
|
+
* - The Memory Storage Adapter (RAM-bound; no fixed browser quota).
|
|
1540
|
+
* - Provides an implementation of the `StorageAdapter` interface using an in-memory `Map`.
|
|
1541
|
+
* Useful for testing or non-persistent storage needs, mimics the API and behavior of LocalStorage.
|
|
1542
|
+
*/
|
|
1543
|
+
declare class MemoryAdapter extends StorageAdapter<MemoryAdapterConfig> {
|
|
1544
|
+
readonly name: string;
|
|
1545
|
+
constructor(build?: Partial<MemoryAdapterConfig>);
|
|
1546
|
+
/**
|
|
1547
|
+
* Reads and parses a value from memory storage.
|
|
1548
|
+
* @param key Storage key.
|
|
1549
|
+
* @returns Parsed value, or `undefined` when missing/unreadable.
|
|
1550
|
+
*/
|
|
1551
|
+
get(key: string, reviver?: JSONReviver): any;
|
|
1552
|
+
/**
|
|
1553
|
+
* Serializes and writes a value to memory storage.
|
|
1554
|
+
* @param key Storage key.
|
|
1555
|
+
* @param value Value to serialize.
|
|
1556
|
+
* @returns `true` when write succeeds, else `false`.
|
|
1557
|
+
*/
|
|
1558
|
+
set(key: string, value: any, replacer?: JSONReplacer | undefined): boolean;
|
|
1559
|
+
/**
|
|
1560
|
+
* Removes a single key from memory storage.
|
|
1561
|
+
* @param key Storage key.
|
|
1562
|
+
* @returns `true` when removal succeeds, else `false`.
|
|
1563
|
+
*/
|
|
1342
1564
|
remove(key: string): boolean;
|
|
1565
|
+
/**
|
|
1566
|
+
* Clears all entries from memory storage.
|
|
1567
|
+
* @returns `true` when clear succeeds, else `false`.
|
|
1568
|
+
*/
|
|
1343
1569
|
clear(): boolean;
|
|
1344
1570
|
}
|
|
1571
|
+
/**
|
|
1572
|
+
* - The Cookie Storage Adapter (~4KB per cookie; practical total payload budget often ~30KB).
|
|
1573
|
+
* - Provides an implementation of the `StorageAdapter` interface using `document.cookie`.
|
|
1574
|
+
* Handles JSON serialization/deserialization and URL-safe key/value encoding.
|
|
1575
|
+
*/
|
|
1576
|
+
declare class CookieAdapter extends StorageAdapter<CookieAdapterConfig> {
|
|
1577
|
+
readonly name: string;
|
|
1578
|
+
protected deets: (opts?: Partial<CookieOptions>, _d?: string | undefined, _m?: number | undefined, _e?: string | Date | undefined) => string;
|
|
1579
|
+
constructor(build?: Partial<CookieAdapterConfig>);
|
|
1580
|
+
/**
|
|
1581
|
+
* Reads and parses a cookie visible to the current page scope.
|
|
1582
|
+
* @param key Cookie key.
|
|
1583
|
+
* @returns Parsed value, or `undefined` when missing/unreadable.
|
|
1584
|
+
*/
|
|
1585
|
+
get(key: string, reviver?: JSONReviver): any;
|
|
1586
|
+
/**
|
|
1587
|
+
* Writes a cookie with optional per-call scope/lifetime overrides.
|
|
1588
|
+
* @param key Cookie key.
|
|
1589
|
+
* @param value Value to serialize.
|
|
1590
|
+
* @param opts Optional per-call cookie options.
|
|
1591
|
+
* @returns `true` when write succeeds, else `false`.
|
|
1592
|
+
*/
|
|
1593
|
+
set(key: string, value: any, opts?: Partial<CookieOptions>, replacer?: JSONReplacer | undefined): boolean;
|
|
1594
|
+
/**
|
|
1595
|
+
* Removes a cookie key using matching scope attributes.
|
|
1596
|
+
* @param key Cookie key.
|
|
1597
|
+
* @param opts Optional per-call scope overrides.
|
|
1598
|
+
* @returns `true` when removal succeeds, else `false`.
|
|
1599
|
+
*/
|
|
1600
|
+
remove(key: string, opts?: Partial<CookieOptions>): boolean;
|
|
1601
|
+
/**
|
|
1602
|
+
* Attempts to remove all visible cookie keys for the given scope.
|
|
1603
|
+
* @param opts Optional per-call scope overrides.
|
|
1604
|
+
* @returns `true` when clear succeeds, else `false`.
|
|
1605
|
+
*/
|
|
1606
|
+
clear(opts?: Partial<CookieOptions>): boolean;
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* - The IndexedDB Adapter (quota-managed; typically tens of MB to GB).
|
|
1610
|
+
* - Provides an implementation of the `AsyncStorageAdapter` interface using the IndexedDB database.
|
|
1611
|
+
* Handles database connection management, object store setup, and includes error handling for unsupported environments and common issues, requires snapshots(non-proxies) for persistence.
|
|
1612
|
+
*/
|
|
1345
1613
|
declare class IndexedDBAdapter extends AsyncStorageAdapter<IndexedDBAdapterConfig> {
|
|
1614
|
+
readonly name: string;
|
|
1346
1615
|
protected db?: IDBDatabase;
|
|
1347
|
-
protected warn: (act?: string, mssg?: string, store?: string, key?: string) => void;
|
|
1348
1616
|
constructor(build?: Partial<IndexedDBAdapterConfig>);
|
|
1617
|
+
/**
|
|
1618
|
+
* Returns a connected IndexedDB instance, opening it when needed.
|
|
1619
|
+
* @returns Connected database handle.
|
|
1620
|
+
*/
|
|
1349
1621
|
idb(): Promise<IDBDatabase>;
|
|
1622
|
+
/**
|
|
1623
|
+
* Reads a value by key from an object store.
|
|
1624
|
+
* @param key Record key.
|
|
1625
|
+
* @param store Optional object-store override.
|
|
1626
|
+
* @returns Stored value, or `undefined` when missing/unreadable.
|
|
1627
|
+
*/
|
|
1350
1628
|
get(key: string, store?: string): Promise<any>;
|
|
1629
|
+
/**
|
|
1630
|
+
* Writes a value by key into an object store.
|
|
1631
|
+
* @param key Record key.
|
|
1632
|
+
* @param value Value to store.
|
|
1633
|
+
* @param store Optional object-store override.
|
|
1634
|
+
* @returns `true` when write succeeds, else `false`.
|
|
1635
|
+
*/
|
|
1351
1636
|
set(key: string, value: any, store?: string): Promise<boolean>;
|
|
1637
|
+
/**
|
|
1638
|
+
* Deletes a value by key from an object store.
|
|
1639
|
+
* @param key Record key.
|
|
1640
|
+
* @param store Optional object-store override.
|
|
1641
|
+
* @returns `true` when delete succeeds, else `false`.
|
|
1642
|
+
*/
|
|
1352
1643
|
remove(key: string, store?: string): Promise<boolean>;
|
|
1644
|
+
/**
|
|
1645
|
+
* Clears one or more object stores.
|
|
1646
|
+
* @param stores Store name or list of store names to clear.
|
|
1647
|
+
* @returns `true` when all clears succeed, else `false`.
|
|
1648
|
+
*/
|
|
1353
1649
|
clear(stores?: string | string[]): Promise<boolean>;
|
|
1354
1650
|
}
|
|
1651
|
+
declare const COOKIE_ADAPTER_BUILD: Partial<CookieAdapterConfig>;
|
|
1355
1652
|
declare const INDEXED_DB_ADAPTER_BUILD: Partial<IndexedDBAdapterConfig>;
|
|
1356
1653
|
|
|
1357
1654
|
interface PersistConfig<T extends object> {
|
|
@@ -1365,29 +1662,41 @@ interface PersistConfig<T extends object> {
|
|
|
1365
1662
|
adapter: Inert<StorageAdapter> | Inert<AsyncStorageAdapter> | Inert<StorageAdapterConstructor> | Inert<AsyncStorageAdapterConstructor>;
|
|
1366
1663
|
/** Throttle time for saving changes */
|
|
1367
1664
|
throttle: number;
|
|
1368
|
-
/** Whether
|
|
1369
|
-
|
|
1665
|
+
/** Whether hydration should fan out restored writes so listeners/effects catch up, defaults to `true` if async */
|
|
1666
|
+
fanout: boolean | number;
|
|
1667
|
+
/** - `false`: persist live proxied roots (fastest, adapter must handle proxies).
|
|
1668
|
+
* - `true`,`"auto"`: persist via `Reactor.snapshot()` but `true` force-enables `Reactor.config.referenceTracking`+`Reactor.config.smartCloning` for better performance.
|
|
1669
|
+
*/
|
|
1670
|
+
useSnapshot: boolean | "auto";
|
|
1671
|
+
}
|
|
1672
|
+
interface PersistState {
|
|
1673
|
+
/** Whether the persisted data has been loaded. */
|
|
1674
|
+
hydrated: boolean;
|
|
1370
1675
|
}
|
|
1371
1676
|
/**
|
|
1372
|
-
* The Storage Manager.
|
|
1677
|
+
* - The Storage Manager.
|
|
1373
1678
|
* - Configurable storage adapters for maximum flexibility (localStorage, sessionStorage, IndexedDB, cookies, custom server persisters, etc.)
|
|
1679
|
+
* Path-based persistence for fine-grained control over what gets persisted across single or multiple reactors, merges into a single serialized state tree.
|
|
1680
|
+
* When using async adapters, listen to `state.hydrated` (preferably `once`) before the setup of modules that should ignore hydration waves.
|
|
1374
1681
|
*/
|
|
1375
|
-
declare class
|
|
1376
|
-
static readonly
|
|
1682
|
+
declare class PersistModule<T extends object = any> extends BaseReactorModule<T, PersistConfig<T>, PersistState> {
|
|
1683
|
+
static readonly moduleName: string;
|
|
1377
1684
|
adapter: StorageAdapter | AsyncStorageAdapter;
|
|
1685
|
+
protected hydrateSeq: number;
|
|
1378
1686
|
protected saveTimeoutId: number;
|
|
1379
|
-
get payload():
|
|
1687
|
+
get payload(): Record<string, any> | undefined;
|
|
1380
1688
|
constructor(config?: Partial<PersistConfig<T>>, rtr?: Reactor<T>);
|
|
1381
1689
|
wire(): void;
|
|
1382
|
-
protected
|
|
1383
|
-
protected
|
|
1384
|
-
protected
|
|
1385
|
-
protected
|
|
1386
|
-
|
|
1690
|
+
protected onAttach(rtr: Reactor<any>): void;
|
|
1691
|
+
protected handleAdapter({ value }: REvent<PersistConfig<T>, "adapter">): Promise<void>;
|
|
1692
|
+
protected handleDisabled({ value }: REvent<PersistConfig<T>, "disabled">): void;
|
|
1693
|
+
protected handlePaths({ value: paths, oldValue: prevs }: REvent<PersistConfig<T>, "paths">): void;
|
|
1694
|
+
protected handleSave(e: REvent<any, any>): void;
|
|
1695
|
+
/** Clears persisted payload for this module instance and drops any pending save. */
|
|
1387
1696
|
clear(): void;
|
|
1388
1697
|
protected onDestroy(): void;
|
|
1389
1698
|
}
|
|
1390
|
-
declare const
|
|
1699
|
+
declare const PERSIST_MODULE_BUILD: Partial<PersistConfig<any>>;
|
|
1391
1700
|
|
|
1392
1701
|
/** The DNA of a specific moment in time, Records the 'Desire' (Intent) or the 'Fact' (State). */
|
|
1393
1702
|
interface HistoryEntry {
|
|
@@ -1400,15 +1709,17 @@ interface HistoryEntry {
|
|
|
1400
1709
|
/** Was it a 'set' or a 'delete' surgery? */
|
|
1401
1710
|
type: REvent<any, any>["staticType"];
|
|
1402
1711
|
/** Did the Power Line disapprove?; why? */
|
|
1403
|
-
rejected
|
|
1404
|
-
/** For chronological re-enactment */
|
|
1405
|
-
timedelta: number;
|
|
1712
|
+
rejected?: string;
|
|
1406
1713
|
/** Did the key for the value exist on its parent object? */
|
|
1407
1714
|
hadKey: boolean;
|
|
1715
|
+
/** For chronological re-enactment */
|
|
1716
|
+
deltat: number;
|
|
1717
|
+
/** For multi-reactor management, identifies who the entry belongs to */
|
|
1718
|
+
rid: ReactorModuleId;
|
|
1408
1719
|
}
|
|
1409
1720
|
interface TimeTravelConfig$1<T extends object = any> {
|
|
1410
1721
|
/** Specific paths only, no "*"; instead don't pass anything */
|
|
1411
|
-
paths
|
|
1722
|
+
paths: Paths<T>[];
|
|
1412
1723
|
/** Maximum number of history entries to keep (Memory Cap), you lose replaying Sessions or the Genesis */
|
|
1413
1724
|
maxHistoryLength: number;
|
|
1414
1725
|
/** Max delay between events during playback (ms) */
|
|
@@ -1416,7 +1727,9 @@ interface TimeTravelConfig$1<T extends object = any> {
|
|
|
1416
1727
|
}
|
|
1417
1728
|
interface TimeTravelState {
|
|
1418
1729
|
/** The "Genesis" snapshot (Raw Data) */
|
|
1419
|
-
initialState:
|
|
1730
|
+
initialState: {
|
|
1731
|
+
[rid: ReactorModuleId]: any;
|
|
1732
|
+
};
|
|
1420
1733
|
/** The "Timeline" of mutations (Chronological Log) */
|
|
1421
1734
|
history: HistoryEntry[];
|
|
1422
1735
|
/** The manual playhead (Index in the Timeline) */
|
|
@@ -1425,18 +1738,21 @@ interface TimeTravelState {
|
|
|
1425
1738
|
paused: boolean;
|
|
1426
1739
|
}
|
|
1427
1740
|
/**
|
|
1428
|
-
* The Flight Recorder (Black Box).
|
|
1741
|
+
* - The Flight Recorder (Black Box).
|
|
1429
1742
|
* - Implements S.I.A. logic to allow playback, teleportation, redos and undos.
|
|
1743
|
+
* Allows history from single or multiple reactors to be recorded and replayed in a synchronized manner, even if they have different shapes.
|
|
1744
|
+
* If paired with async persistence, `use()` or `setup()` this module after hydration where applicable to avoid recording restore waves.
|
|
1430
1745
|
*/
|
|
1431
|
-
declare class
|
|
1432
|
-
static readonly
|
|
1746
|
+
declare class TimeTravelModule<T extends object = any> extends BaseReactorModule<T, TimeTravelConfig$1<T>, TimeTravelState> {
|
|
1747
|
+
static readonly moduleName: string;
|
|
1433
1748
|
protected lastTimestamp: number;
|
|
1434
1749
|
protected playbackTimeoutId: number;
|
|
1435
1750
|
constructor(config?: Partial<TimeTravelConfig$1<T>>, rtr?: Reactor<T>);
|
|
1436
1751
|
wire(): void;
|
|
1437
|
-
protected
|
|
1752
|
+
protected onAttach(rtr: Reactor<any>, rid: ReactorModuleId): void;
|
|
1753
|
+
protected handlePaths({ value: paths, oldValue: prevs }: REvent<TimeTravelConfig$1<T>, "paths">): void;
|
|
1438
1754
|
/** Chronicling the lifecycle of the system, Captures the essence of every mutation wave that bubbles up. */
|
|
1439
|
-
protected record(e: REvent<
|
|
1755
|
+
protected record(e: REvent<any, any>, rid?: ReactorModuleId): void;
|
|
1440
1756
|
/** Clears timeline history and resets playhead/genesis to the current reactor state. */
|
|
1441
1757
|
clear(): void;
|
|
1442
1758
|
/** Instant state reconstruction (Teleport). Glides through deltas natively. */
|
|
@@ -1456,42 +1772,54 @@ declare class TimeTravelPlugin<T extends object = any> extends BaseReactorPlugin
|
|
|
1456
1772
|
/** Pauses the live VCR playback. */
|
|
1457
1773
|
pause: () => void;
|
|
1458
1774
|
/** Exports the current session as a JSON string. */
|
|
1459
|
-
export(replacer?:
|
|
1775
|
+
export(replacer?: JSONReplacer, space?: string | number): string;
|
|
1460
1776
|
/** Imports a session from a JSON string, allowing you to replay or analyze past states. */
|
|
1461
|
-
import(json: string): void;
|
|
1777
|
+
import(json: string, reviver?: JSONReviver): void;
|
|
1462
1778
|
}
|
|
1463
|
-
declare const
|
|
1779
|
+
declare const TIME_TRAVEL_MODULE_BUILD: Partial<TimeTravelConfig$1>;
|
|
1464
1780
|
|
|
1465
|
-
type
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
type
|
|
1469
|
-
declare const
|
|
1470
|
-
type
|
|
1471
|
-
declare const
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
type
|
|
1476
|
-
|
|
1477
|
-
type
|
|
1478
|
-
declare const
|
|
1479
|
-
type
|
|
1480
|
-
declare const
|
|
1481
|
-
type
|
|
1482
|
-
type
|
|
1483
|
-
|
|
1484
|
-
type
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
type
|
|
1489
|
-
declare const
|
|
1490
|
-
type
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1781
|
+
type modules_AsyncStorageAdapter<Config extends StorageAdapterConfig = StorageAdapterConfig> = AsyncStorageAdapter<Config>;
|
|
1782
|
+
declare const modules_AsyncStorageAdapter: typeof AsyncStorageAdapter;
|
|
1783
|
+
type modules_AsyncStorageAdapterConstructor<Config extends StorageAdapterConfig = StorageAdapterConfig> = AsyncStorageAdapterConstructor<Config>;
|
|
1784
|
+
type modules_BaseReactorModule<T extends object = any, Config = any, State = any> = BaseReactorModule<T, Config, State>;
|
|
1785
|
+
declare const modules_BaseReactorModule: typeof BaseReactorModule;
|
|
1786
|
+
type modules_BaseStorageAdapter<Config extends StorageAdapterConfig = StorageAdapterConfig> = BaseStorageAdapter<Config>;
|
|
1787
|
+
declare const modules_BaseStorageAdapter: typeof BaseStorageAdapter;
|
|
1788
|
+
declare const modules_COOKIE_ADAPTER_BUILD: typeof COOKIE_ADAPTER_BUILD;
|
|
1789
|
+
type modules_CookieAdapter = CookieAdapter;
|
|
1790
|
+
declare const modules_CookieAdapter: typeof CookieAdapter;
|
|
1791
|
+
type modules_CookieAdapterConfig = CookieAdapterConfig;
|
|
1792
|
+
type modules_CookieOptions = CookieOptions;
|
|
1793
|
+
type modules_HistoryEntry = HistoryEntry;
|
|
1794
|
+
declare const modules_INDEXED_DB_ADAPTER_BUILD: typeof INDEXED_DB_ADAPTER_BUILD;
|
|
1795
|
+
type modules_IndexedDBAdapter = IndexedDBAdapter;
|
|
1796
|
+
declare const modules_IndexedDBAdapter: typeof IndexedDBAdapter;
|
|
1797
|
+
type modules_IndexedDBAdapterConfig = IndexedDBAdapterConfig;
|
|
1798
|
+
type modules_JSONReplacer = JSONReplacer;
|
|
1799
|
+
type modules_JSONReviver = JSONReviver;
|
|
1800
|
+
type modules_LocalStorageAdapter = LocalStorageAdapter;
|
|
1801
|
+
declare const modules_LocalStorageAdapter: typeof LocalStorageAdapter;
|
|
1802
|
+
type modules_MemoryAdapter = MemoryAdapter;
|
|
1803
|
+
declare const modules_MemoryAdapter: typeof MemoryAdapter;
|
|
1804
|
+
type modules_MemoryAdapterConfig = MemoryAdapterConfig;
|
|
1805
|
+
declare const modules_PERSIST_MODULE_BUILD: typeof PERSIST_MODULE_BUILD;
|
|
1806
|
+
type modules_PersistConfig<T extends object> = PersistConfig<T>;
|
|
1807
|
+
type modules_PersistModule<T extends object = any> = PersistModule<T>;
|
|
1808
|
+
declare const modules_PersistModule: typeof PersistModule;
|
|
1809
|
+
type modules_ReactorModuleConstructor<P extends BaseReactorModule = BaseReactorModule, T extends object = any> = ReactorModuleConstructor<P, T>;
|
|
1810
|
+
type modules_ReactorModuleId = ReactorModuleId;
|
|
1811
|
+
type modules_SessionStorageAdapter = SessionStorageAdapter;
|
|
1812
|
+
declare const modules_SessionStorageAdapter: typeof SessionStorageAdapter;
|
|
1813
|
+
type modules_StorageAdapter<Config extends StorageAdapterConfig = StorageAdapterConfig> = StorageAdapter<Config>;
|
|
1814
|
+
declare const modules_StorageAdapter: typeof StorageAdapter;
|
|
1815
|
+
type modules_StorageAdapterConfig = StorageAdapterConfig;
|
|
1816
|
+
type modules_StorageAdapterConstructor<Config extends StorageAdapterConfig = StorageAdapterConfig> = StorageAdapterConstructor<Config>;
|
|
1817
|
+
declare const modules_TIME_TRAVEL_MODULE_BUILD: typeof TIME_TRAVEL_MODULE_BUILD;
|
|
1818
|
+
type modules_TimeTravelModule<T extends object = any> = TimeTravelModule<T>;
|
|
1819
|
+
declare const modules_TimeTravelModule: typeof TimeTravelModule;
|
|
1820
|
+
type modules_TimeTravelState = TimeTravelState;
|
|
1821
|
+
declare namespace modules {
|
|
1822
|
+
export { modules_AsyncStorageAdapter as AsyncStorageAdapter, type modules_AsyncStorageAdapterConstructor as AsyncStorageAdapterConstructor, modules_BaseReactorModule as BaseReactorModule, modules_BaseStorageAdapter as BaseStorageAdapter, modules_COOKIE_ADAPTER_BUILD as COOKIE_ADAPTER_BUILD, modules_CookieAdapter as CookieAdapter, type modules_CookieAdapterConfig as CookieAdapterConfig, type modules_CookieOptions as CookieOptions, type modules_HistoryEntry as HistoryEntry, modules_INDEXED_DB_ADAPTER_BUILD as INDEXED_DB_ADAPTER_BUILD, modules_IndexedDBAdapter as IndexedDBAdapter, type modules_IndexedDBAdapterConfig as IndexedDBAdapterConfig, type modules_JSONReplacer as JSONReplacer, type modules_JSONReviver as JSONReviver, modules_LocalStorageAdapter as LocalStorageAdapter, modules_MemoryAdapter as MemoryAdapter, type modules_MemoryAdapterConfig as MemoryAdapterConfig, modules_PERSIST_MODULE_BUILD as PERSIST_MODULE_BUILD, type modules_PersistConfig as PersistConfig, modules_PersistModule as PersistModule, type modules_ReactorModuleConstructor as ReactorModuleConstructor, type modules_ReactorModuleId as ReactorModuleId, modules_SessionStorageAdapter as SessionStorageAdapter, modules_StorageAdapter as StorageAdapter, type modules_StorageAdapterConfig as StorageAdapterConfig, type modules_StorageAdapterConstructor as StorageAdapterConstructor, modules_TIME_TRAVEL_MODULE_BUILD as TIME_TRAVEL_MODULE_BUILD, type TimeTravelConfig$1 as TimeTravelConfig, modules_TimeTravelModule as TimeTravelModule, type modules_TimeTravelState as TimeTravelState };
|
|
1495
1823
|
}
|
|
1496
1824
|
|
|
1497
1825
|
/**
|
|
@@ -1519,8 +1847,9 @@ interface TimeTravelConfig {
|
|
|
1519
1847
|
/** Container element that owns the overlay layer and dock. */
|
|
1520
1848
|
container: HTMLElement;
|
|
1521
1849
|
}
|
|
1522
|
-
/**
|
|
1523
|
-
*
|
|
1850
|
+
/**
|
|
1851
|
+
* - Vanilla overlay controller for visual time-travel controls and timeline I/O.
|
|
1852
|
+
* - Mounts a docked HUD into the configured container, syncs its UI with module state, and forwards keyboard/button actions to the TimeTravelModule.
|
|
1524
1853
|
* Supports reactive `config` updates (title/color/container/devOnly) and maintains local overlay UI state (`open` and `import` payload text).
|
|
1525
1854
|
*/
|
|
1526
1855
|
declare class TimeTravelOverlay {
|
|
@@ -1531,15 +1860,15 @@ declare class TimeTravelOverlay {
|
|
|
1531
1860
|
open: boolean;
|
|
1532
1861
|
import: string;
|
|
1533
1862
|
}, undefined>;
|
|
1534
|
-
readonly time:
|
|
1863
|
+
readonly time: TimeTravelModule;
|
|
1535
1864
|
readonly els: Record<string, HTMLElement>;
|
|
1536
1865
|
private clups;
|
|
1537
1866
|
private keyup?;
|
|
1538
|
-
/** Creates a docked TimeTravel overlay bound to a
|
|
1539
|
-
* @param time TimeTravel
|
|
1867
|
+
/** Creates a docked TimeTravel overlay bound to a module instance.
|
|
1868
|
+
* @param time TimeTravel module instance that owns timeline operations.
|
|
1540
1869
|
* @param build Optional initial overlay config overrides.
|
|
1541
1870
|
*/
|
|
1542
|
-
constructor(time:
|
|
1871
|
+
constructor(time: TimeTravelModule, build?: Partial<TimeTravelConfig>);
|
|
1543
1872
|
destroy(): void;
|
|
1544
1873
|
}
|
|
1545
1874
|
|
|
@@ -1558,4 +1887,4 @@ declare const adapters: {
|
|
|
1558
1887
|
vanilla: typeof vanilla;
|
|
1559
1888
|
};
|
|
1560
1889
|
|
|
1561
|
-
export { CTX, type ChildPaths, type DeepKeys, type DeepMerge, type DeepPartial, type DeepRequired, type Deleter, type DeleterRecord, type DirectPayload, EVT_OPTS,
|
|
1890
|
+
export { type AddDepth, type AllDepth, CTX, type ChildPaths, type DeepKeys, type DeepMerge, type DeepPartial, type DeepRequired, type Deleter, type DeleterRecord, type DepthConfig, type DirectPayload, EVT_OPTS, type EffectOptions, type Getter, type GetterRecord, INDIFFABLE, INERTIA, type Inert, type Intent, type Listener, type ListenerOptions, type ListenerOptionsTuple, type ListenerRecord, type Live, type MaxDepth, NIL, NOOP, type NextDepth, type NoTraverse, type PathBranch, type PathBranchValue, type PathDepth, type PathKey, type PathLeaf, type PathValue, type Paths, type Payload, type PrevDepth, type Primitive, RAW, REJECTABLE, type REvent, RTR_BATCH, RTR_LOG, type Reactive, type ReactivePreferences, Reactor, type ReactorBuild, ReactorEvent, SSVERSION, type Setter, type SetterRecord, type Stable, type State, type StrictPathKey, type SubtractDepth, type SyncOptions, type SyncOptionsTuple, TERMINATOR, type Target, type Unflatten, type UnionToIntersection, type UpdatePayload, VERSION, type Volatile, type Watcher, type WatcherRecord, type WildPaths, adapters, getRaw, getSnapshotVersion, getVersion, inert, intent, isInert, isIntent, isVolatile, live, methods, modules, reactive, stable, state, utils, volatile };
|