@reactive-vscode/reactivity 0.2.4 → 0.2.6-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/dist/index.d.ts +188 -95
- package/dist/index.js +1161 -580
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
declare
|
|
2
|
-
then(onfulfilled: infer F, ...args: infer _): any;
|
|
3
|
-
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited_2<V> : never : T;
|
|
1
|
+
export declare const ARRAY_ITERATE_KEY: unique symbol;
|
|
4
2
|
|
|
5
|
-
export declare
|
|
3
|
+
export declare interface BaseComputedRef<T, S = T> extends Ref<T, S> {
|
|
4
|
+
[ComputedRefSymbol]: true;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated computed no longer uses effect
|
|
7
|
+
*/
|
|
8
|
+
effect: ComputedRefImpl;
|
|
9
|
+
}
|
|
6
10
|
|
|
7
11
|
export declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
|
8
12
|
|
|
@@ -41,33 +45,27 @@ export declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
|
|
41
45
|
*/
|
|
42
46
|
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
|
43
47
|
|
|
44
|
-
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
|
48
|
+
export declare function computed<T, S = T>(options: WritableComputedOptions<T, S>, debugOptions?: DebuggerOptions): WritableComputedRef<T, S>;
|
|
45
49
|
|
|
46
50
|
export declare type ComputedGetter<T> = (oldValue?: T) => T;
|
|
47
51
|
|
|
48
|
-
export declare interface ComputedRef<T = any> extends
|
|
52
|
+
export declare interface ComputedRef<T = any> extends BaseComputedRef<T> {
|
|
49
53
|
readonly value: T;
|
|
50
|
-
[ComputedRefSymbol]: true;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
readonly
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
65
|
-
_warnRecursive?: boolean;
|
|
66
|
-
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
|
|
56
|
+
/**
|
|
57
|
+
* @private exported by @vue/reactivity for Vue core use, but not exported from
|
|
58
|
+
* the main vue package
|
|
59
|
+
*/
|
|
60
|
+
export declare class ComputedRefImpl<T = any> implements Subscriber {
|
|
61
|
+
fn: ComputedGetter<T>;
|
|
62
|
+
private readonly setter;
|
|
63
|
+
effect: this;
|
|
64
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
65
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
66
|
+
constructor(fn: ComputedGetter<T>, setter: ComputedSetter<T> | undefined, isSSR: boolean);
|
|
67
67
|
get value(): T;
|
|
68
68
|
set value(newValue: T);
|
|
69
|
-
get _dirty(): boolean;
|
|
70
|
-
set _dirty(v: boolean);
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
export declare const ComputedRefSymbol: unique symbol;
|
|
@@ -89,7 +87,7 @@ export declare type CustomRefFactory<T> = (track: () => void, trigger: () => voi
|
|
|
89
87
|
};
|
|
90
88
|
|
|
91
89
|
export declare type DebuggerEvent = {
|
|
92
|
-
effect:
|
|
90
|
+
effect: Subscriber;
|
|
93
91
|
} & DebuggerEventExtraInfo;
|
|
94
92
|
|
|
95
93
|
export declare type DebuggerEventExtraInfo = {
|
|
@@ -110,36 +108,35 @@ export declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infe
|
|
|
110
108
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
111
109
|
} : Readonly<T>;
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
* @deprecated use `computed` instead. See #5912
|
|
115
|
-
*/
|
|
116
|
-
export declare const deferredComputed: typeof computed;
|
|
117
|
-
|
|
118
|
-
export declare type Dep = Map<ReactiveEffect, number> & {
|
|
119
|
-
cleanup: () => void;
|
|
120
|
-
computed?: ComputedRefImpl<any>;
|
|
121
|
-
};
|
|
111
|
+
export declare type DistributeRef<T> = T extends Ref<infer V> ? V : T;
|
|
122
112
|
|
|
123
|
-
export declare
|
|
113
|
+
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner<T>;
|
|
124
114
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
115
|
+
export declare enum EffectFlags {
|
|
116
|
+
/**
|
|
117
|
+
* ReactiveEffect only
|
|
118
|
+
*/
|
|
119
|
+
ACTIVE = 1,
|
|
120
|
+
RUNNING = 2,
|
|
121
|
+
TRACKING = 4,
|
|
122
|
+
NOTIFIED = 8,
|
|
123
|
+
DIRTY = 16,
|
|
124
|
+
ALLOW_RECURSE = 32,
|
|
125
|
+
PAUSED = 64
|
|
126
|
+
}
|
|
136
127
|
|
|
137
128
|
export declare type EffectScheduler = (...args: any[]) => any;
|
|
138
129
|
|
|
139
130
|
export declare class EffectScope {
|
|
140
131
|
detached: boolean;
|
|
132
|
+
private _isPaused;
|
|
141
133
|
constructor(detached?: boolean);
|
|
142
134
|
get active(): boolean;
|
|
135
|
+
pause(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
138
|
+
*/
|
|
139
|
+
resume(): void;
|
|
143
140
|
run<T>(fn: () => T): T | undefined;
|
|
144
141
|
stop(fromParent?: boolean): void;
|
|
145
142
|
}
|
|
@@ -167,6 +164,11 @@ export declare function enableTracking(): void;
|
|
|
167
164
|
*/
|
|
168
165
|
export declare function getCurrentScope(): EffectScope | undefined;
|
|
169
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Returns the current active effect if there is one.
|
|
169
|
+
*/
|
|
170
|
+
export declare function getCurrentWatcher(): ReactiveEffect<any> | undefined;
|
|
171
|
+
|
|
170
172
|
declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
171
173
|
|
|
172
174
|
/**
|
|
@@ -223,8 +225,10 @@ export declare function isShallow(value: unknown): boolean;
|
|
|
223
225
|
|
|
224
226
|
export declare const ITERATE_KEY: unique symbol;
|
|
225
227
|
|
|
228
|
+
export declare const MAP_KEY_ITERATE_KEY: unique symbol;
|
|
229
|
+
|
|
226
230
|
declare type MapSources<T, Immediate> = {
|
|
227
|
-
[K in keyof T]: T[K] extends WatchSource<infer V> ?
|
|
231
|
+
[K in keyof T]: T[K] extends WatchSource<infer V> ? MaybeUndefined<V, Immediate> : T[K] extends object ? MaybeUndefined<T[K], Immediate> : never;
|
|
228
232
|
};
|
|
229
233
|
|
|
230
234
|
/**
|
|
@@ -251,15 +255,31 @@ declare type MapSources<T, Immediate> = {
|
|
|
251
255
|
*/
|
|
252
256
|
export declare function markRaw<T extends object>(value: T): Raw<T>;
|
|
253
257
|
|
|
254
|
-
export declare type MaybeRef<T = any> = T | Ref<T>;
|
|
258
|
+
export declare type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
|
|
255
259
|
|
|
256
|
-
export declare type MaybeRefOrGetter<T = any> = MaybeRef<T> | (() => T);
|
|
260
|
+
export declare type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);
|
|
261
|
+
|
|
262
|
+
declare type MaybeUndefined<T, I> = I extends true ? T | undefined : T;
|
|
257
263
|
|
|
258
264
|
declare type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
259
265
|
|
|
260
|
-
export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<
|
|
266
|
+
export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
|
|
267
|
+
|
|
268
|
+
export declare type OnCleanup = (cleanupFn: () => void) => void;
|
|
261
269
|
|
|
262
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Registers a cleanup function for the current active effect.
|
|
272
|
+
* The cleanup function is called right before the next effect run, or when the
|
|
273
|
+
* effect is stopped.
|
|
274
|
+
*
|
|
275
|
+
* Throws a warning if there is no current active effect. The warning can be
|
|
276
|
+
* suppressed by passing `true` to the second argument.
|
|
277
|
+
*
|
|
278
|
+
* @param fn - the cleanup function to be registered
|
|
279
|
+
* @param failSilently - if `true`, will not throw warning when called without
|
|
280
|
+
* an active effect.
|
|
281
|
+
*/
|
|
282
|
+
export declare function onEffectCleanup(fn: () => void, failSilently?: boolean): void;
|
|
263
283
|
|
|
264
284
|
/**
|
|
265
285
|
* Registers a dispose callback on the current active effect scope. The
|
|
@@ -268,9 +288,20 @@ declare type OnCleanup = (cleanupFn: () => void) => void;
|
|
|
268
288
|
* @param fn - The callback function to attach to the scope's cleanup.
|
|
269
289
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
|
|
270
290
|
*/
|
|
271
|
-
export declare function onScopeDispose(fn: () => void): void;
|
|
291
|
+
export declare function onScopeDispose(fn: () => void, failSilently?: boolean): void;
|
|
272
292
|
|
|
273
|
-
|
|
293
|
+
/**
|
|
294
|
+
* Registers a cleanup callback on the current active effect. This
|
|
295
|
+
* registered cleanup callback will be invoked right before the
|
|
296
|
+
* associated effect re-runs.
|
|
297
|
+
*
|
|
298
|
+
* @param cleanupFn - The callback function to attach to the effect's cleanup.
|
|
299
|
+
* @param failSilently - if `true`, will not throw warning when called without
|
|
300
|
+
* an active effect.
|
|
301
|
+
* @param owner - The effect that this cleanup function should be attached to.
|
|
302
|
+
* By default, the current active effect.
|
|
303
|
+
*/
|
|
304
|
+
export declare function onWatcherCleanup(cleanupFn: () => void, failSilently?: boolean, owner?: ReactiveEffect | undefined): void;
|
|
274
305
|
|
|
275
306
|
/**
|
|
276
307
|
* Temporarily pauses tracking.
|
|
@@ -280,11 +311,9 @@ export declare function pauseTracking(): void;
|
|
|
280
311
|
export declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
281
312
|
|
|
282
313
|
/**
|
|
283
|
-
* Returns a
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
* reactive proxy is created. Direct child properties that are refs are properly
|
|
287
|
-
* handled, as well.
|
|
314
|
+
* Returns a proxy for the given object that shallowly unwraps properties that
|
|
315
|
+
* are refs. If the object already is reactive, it's returned as-is. If not, a
|
|
316
|
+
* new reactive proxy is created.
|
|
288
317
|
*
|
|
289
318
|
* @param objectWithRefs - Either an already-reactive object or a simple object
|
|
290
319
|
* that contains refs.
|
|
@@ -297,6 +326,8 @@ export declare type Raw<T> = T & {
|
|
|
297
326
|
|
|
298
327
|
export declare const RawSymbol: unique symbol;
|
|
299
328
|
|
|
329
|
+
export declare type Reactive<T> = UnwrapNestedRefs<T> & (T extends readonly any[] ? ReactiveMarker : {});
|
|
330
|
+
|
|
300
331
|
/**
|
|
301
332
|
* Returns a reactive proxy of the object.
|
|
302
333
|
*
|
|
@@ -312,28 +343,25 @@ export declare const RawSymbol: unique symbol;
|
|
|
312
343
|
* @param target - The source object.
|
|
313
344
|
* @see {@link https://vuejs.org/api/reactivity-core.html#reactive}
|
|
314
345
|
*/
|
|
315
|
-
export declare function reactive<T extends object>(target: T):
|
|
346
|
+
export declare function reactive<T extends object>(target: T): Reactive<T>;
|
|
316
347
|
|
|
317
|
-
export declare class ReactiveEffect<T = any> {
|
|
348
|
+
export declare class ReactiveEffect<T = any> implements Subscriber, ReactiveEffectOptions {
|
|
318
349
|
fn: () => T;
|
|
319
|
-
|
|
320
|
-
scheduler?: EffectScheduler | undefined;
|
|
321
|
-
active: boolean;
|
|
322
|
-
deps: Dep[];
|
|
350
|
+
scheduler?: EffectScheduler;
|
|
323
351
|
onStop?: () => void;
|
|
324
352
|
onTrack?: (event: DebuggerEvent) => void;
|
|
325
353
|
onTrigger?: (event: DebuggerEvent) => void;
|
|
326
|
-
constructor(fn: () => T
|
|
327
|
-
|
|
328
|
-
|
|
354
|
+
constructor(fn: () => T);
|
|
355
|
+
pause(): void;
|
|
356
|
+
resume(): void;
|
|
329
357
|
run(): T;
|
|
330
358
|
stop(): void;
|
|
359
|
+
trigger(): void;
|
|
360
|
+
get dirty(): boolean;
|
|
331
361
|
}
|
|
332
362
|
|
|
333
363
|
export declare interface ReactiveEffectOptions extends DebuggerOptions {
|
|
334
|
-
lazy?: boolean;
|
|
335
364
|
scheduler?: EffectScheduler;
|
|
336
|
-
scope?: EffectScope;
|
|
337
365
|
allowRecurse?: boolean;
|
|
338
366
|
onStop?: () => void;
|
|
339
367
|
}
|
|
@@ -343,14 +371,33 @@ export declare interface ReactiveEffectRunner<T = any> {
|
|
|
343
371
|
effect: ReactiveEffect;
|
|
344
372
|
}
|
|
345
373
|
|
|
374
|
+
export declare interface ReactiveEffectRunner<T = any> {
|
|
375
|
+
(): T;
|
|
376
|
+
effect: ReactiveEffect;
|
|
377
|
+
}
|
|
378
|
+
|
|
346
379
|
export declare enum ReactiveFlags {
|
|
347
380
|
SKIP = "__v_skip",
|
|
348
381
|
IS_REACTIVE = "__v_isReactive",
|
|
349
382
|
IS_READONLY = "__v_isReadonly",
|
|
350
383
|
IS_SHALLOW = "__v_isShallow",
|
|
351
|
-
RAW = "__v_raw"
|
|
384
|
+
RAW = "__v_raw",
|
|
385
|
+
IS_REF = "__v_isRef"
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export declare interface ReactiveMarker {
|
|
389
|
+
[ReactiveMarkerSymbol]?: void;
|
|
352
390
|
}
|
|
353
391
|
|
|
392
|
+
export declare const ReactiveMarkerSymbol: unique symbol;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Track array iteration and return:
|
|
396
|
+
* - if input is reactive: a cloned raw array with reactive values
|
|
397
|
+
* - if input is non-reactive or shallowReactive: the original raw array
|
|
398
|
+
*/
|
|
399
|
+
export declare function reactiveReadArray<T>(array: T[]): T[];
|
|
400
|
+
|
|
354
401
|
/**
|
|
355
402
|
* Takes an object (reactive or plain) or a ref and returns a readonly proxy to
|
|
356
403
|
* the original.
|
|
@@ -382,8 +429,9 @@ export declare enum ReactiveFlags {
|
|
|
382
429
|
*/
|
|
383
430
|
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
|
|
384
431
|
|
|
385
|
-
export declare interface Ref<T = any> {
|
|
386
|
-
value: T;
|
|
432
|
+
export declare interface Ref<T = any, S = T> {
|
|
433
|
+
get value(): T;
|
|
434
|
+
set value(_: S);
|
|
387
435
|
/**
|
|
388
436
|
* Type differentiator only.
|
|
389
437
|
* We need this to be in public d.ts but don't want it to show up in IDE
|
|
@@ -399,7 +447,7 @@ export declare interface Ref<T = any> {
|
|
|
399
447
|
* @param value - The object to wrap in the ref.
|
|
400
448
|
* @see {@link https://vuejs.org/api/reactivity-core.html#ref}
|
|
401
449
|
*/
|
|
402
|
-
export declare function ref<T>(value: T): Ref<UnwrapRef<T
|
|
450
|
+
export declare function ref<T>(value: T): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : Ref<UnwrapRef<T>, UnwrapRef<T> | T>;
|
|
403
451
|
|
|
404
452
|
export declare function ref<T = any>(): Ref<T | undefined>;
|
|
405
453
|
|
|
@@ -421,8 +469,6 @@ export declare const RefSymbol: unique symbol;
|
|
|
421
469
|
export declare interface RefUnwrapBailTypes {
|
|
422
470
|
}
|
|
423
471
|
|
|
424
|
-
export declare function resetScheduling(): void;
|
|
425
|
-
|
|
426
472
|
/**
|
|
427
473
|
* Resets the previous global effect tracking state.
|
|
428
474
|
*/
|
|
@@ -466,6 +512,11 @@ export declare function shallowReactive<T extends object>(target: T): ShallowRea
|
|
|
466
512
|
|
|
467
513
|
export declare const ShallowReactiveMarker: unique symbol;
|
|
468
514
|
|
|
515
|
+
/**
|
|
516
|
+
* Track array iteration and return raw array
|
|
517
|
+
*/
|
|
518
|
+
export declare function shallowReadArray<T>(arr: T[]): T[];
|
|
519
|
+
|
|
469
520
|
/**
|
|
470
521
|
* Shallow version of {@link readonly()}.
|
|
471
522
|
*
|
|
@@ -498,7 +549,7 @@ export declare const ShallowReactiveMarker: unique symbol;
|
|
|
498
549
|
*/
|
|
499
550
|
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
|
500
551
|
|
|
501
|
-
export declare type ShallowRef<T = any> = Ref<T> & {
|
|
552
|
+
export declare type ShallowRef<T = any, S = T> = Ref<T, S> & {
|
|
502
553
|
[ShallowRefMarker]?: true;
|
|
503
554
|
};
|
|
504
555
|
|
|
@@ -526,7 +577,7 @@ export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
|
|
|
526
577
|
export declare const ShallowRefMarker: unique symbol;
|
|
527
578
|
|
|
528
579
|
export declare type ShallowUnwrapRef<T> = {
|
|
529
|
-
[K in keyof T]:
|
|
580
|
+
[K in keyof T]: DistributeRef<T[K]>;
|
|
530
581
|
};
|
|
531
582
|
|
|
532
583
|
/**
|
|
@@ -536,6 +587,12 @@ export declare type ShallowUnwrapRef<T> = {
|
|
|
536
587
|
*/
|
|
537
588
|
export declare function stop(runner: ReactiveEffectRunner): void;
|
|
538
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Subscriber is a type that tracks (or subscribes to) a list of deps.
|
|
592
|
+
*/
|
|
593
|
+
export declare interface Subscriber extends DebuggerOptions {
|
|
594
|
+
}
|
|
595
|
+
|
|
539
596
|
/**
|
|
540
597
|
* Returns the raw, original object of a Vue-created proxy.
|
|
541
598
|
*
|
|
@@ -561,6 +618,24 @@ export declare function stop(runner: ReactiveEffectRunner): void;
|
|
|
561
618
|
*/
|
|
562
619
|
export declare function toRaw<T>(observed: T): T;
|
|
563
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Returns a reactive proxy of the given value (if possible).
|
|
623
|
+
*
|
|
624
|
+
* If the given value is not an object, the original value itself is returned.
|
|
625
|
+
*
|
|
626
|
+
* @param value - The value for which a reactive proxy shall be created.
|
|
627
|
+
*/
|
|
628
|
+
export declare const toReactive: <T extends unknown>(value: T) => T;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Returns a readonly proxy of the given value (if possible).
|
|
632
|
+
*
|
|
633
|
+
* If the given value is not an object, the original value itself is returned.
|
|
634
|
+
*
|
|
635
|
+
* @param value - The value for which a readonly proxy shall be created.
|
|
636
|
+
*/
|
|
637
|
+
export declare const toReadonly: <T extends unknown>(value: T) => DeepReadonly<T>;
|
|
638
|
+
|
|
564
639
|
export declare type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
|
|
565
640
|
|
|
566
641
|
/**
|
|
@@ -642,7 +717,7 @@ export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
|
|
642
717
|
* @param source - A getter, an existing ref, or a non-function value.
|
|
643
718
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue}
|
|
644
719
|
*/
|
|
645
|
-
export declare function toValue<T>(source: MaybeRefOrGetter<T>
|
|
720
|
+
export declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
|
|
646
721
|
|
|
647
722
|
/**
|
|
648
723
|
* Tracks access to a reactive property.
|
|
@@ -662,6 +737,8 @@ export declare enum TrackOpTypes {
|
|
|
662
737
|
ITERATE = "iterate"
|
|
663
738
|
}
|
|
664
739
|
|
|
740
|
+
export declare function traverse(value: unknown, depth?: number, seen?: Set<unknown>): unknown;
|
|
741
|
+
|
|
665
742
|
/**
|
|
666
743
|
* Finds all deps associated with the target (or a specific property) and
|
|
667
744
|
* triggers the effects stored within.
|
|
@@ -726,9 +803,9 @@ export declare function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T;
|
|
|
726
803
|
|
|
727
804
|
export declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
|
728
805
|
|
|
729
|
-
export declare type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
806
|
+
export declare type UnwrapRef<T> = T extends ShallowRef<infer V, infer _> ? V : T extends Ref<infer V, infer _> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
730
807
|
|
|
731
|
-
export declare type UnwrapRefSimple<T> = T extends
|
|
808
|
+
export declare type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
732
809
|
[RawSymbol]?: true;
|
|
733
810
|
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? {
|
|
734
811
|
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
|
@@ -738,43 +815,59 @@ export declare type UnwrapRefSimple<T> = T extends Function | BaseTypes | Ref |
|
|
|
738
815
|
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
|
739
816
|
} : T;
|
|
740
817
|
|
|
741
|
-
export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T,
|
|
818
|
+
export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
742
819
|
|
|
743
|
-
export declare function watch<T extends MultiWatchSources
|
|
820
|
+
export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: readonly [...T] | T, cb: [T] extends [ReactiveMarker] ? WatchCallback<T, MaybeUndefined<T, Immediate>> : WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
744
821
|
|
|
745
|
-
export declare function watch<T extends
|
|
822
|
+
export declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
746
823
|
|
|
747
|
-
export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T,
|
|
824
|
+
export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchHandle;
|
|
748
825
|
|
|
749
826
|
export declare type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
|
|
750
827
|
|
|
751
828
|
export declare type WatchEffect = (onCleanup: OnCleanup) => void;
|
|
752
829
|
|
|
753
|
-
export declare function watchEffect(effect: WatchEffect, options?:
|
|
830
|
+
export declare function watchEffect(effect: WatchEffect, options?: WatchEffectOptions): WatchHandle;
|
|
831
|
+
|
|
832
|
+
declare interface WatchEffectOptions extends DebuggerOptions {
|
|
833
|
+
flush?: 'pre' | 'sync';
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export declare enum WatchErrorCodes {
|
|
837
|
+
WATCH_GETTER = 2,
|
|
838
|
+
WATCH_CALLBACK = 3,
|
|
839
|
+
WATCH_CLEANUP = 4
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export declare interface WatchHandle extends WatchStopHandle {
|
|
843
|
+
pause: () => void;
|
|
844
|
+
resume: () => void;
|
|
845
|
+
stop: () => void;
|
|
846
|
+
}
|
|
754
847
|
|
|
755
|
-
export declare interface WatchOptions<Immediate = boolean> extends
|
|
848
|
+
export declare interface WatchOptions<Immediate = boolean> extends WatchEffectOptions {
|
|
756
849
|
immediate?: Immediate;
|
|
757
|
-
deep?: boolean;
|
|
850
|
+
deep?: boolean | number;
|
|
758
851
|
once?: boolean;
|
|
759
852
|
}
|
|
760
853
|
|
|
761
|
-
export declare
|
|
762
|
-
flush?: 'pre' | 'post' | 'sync';
|
|
763
|
-
}
|
|
854
|
+
export declare type WatchScheduler = (job: () => void, isFirstRun: boolean) => void;
|
|
764
855
|
|
|
765
|
-
export declare type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
|
|
856
|
+
export declare type WatchSource<T = any> = Ref<T, any> | ComputedRef<T> | (() => T);
|
|
766
857
|
|
|
767
858
|
export declare type WatchStopHandle = () => void;
|
|
768
859
|
|
|
769
|
-
export declare function watchSyncEffect(effect: WatchEffect, options?: DebuggerOptions):
|
|
860
|
+
export declare function watchSyncEffect(effect: WatchEffect, options?: DebuggerOptions): WatchHandle;
|
|
770
861
|
|
|
771
|
-
export declare interface WritableComputedOptions<T> {
|
|
862
|
+
export declare interface WritableComputedOptions<T, S = T> {
|
|
772
863
|
get: ComputedGetter<T>;
|
|
773
|
-
set: ComputedSetter<
|
|
864
|
+
set: ComputedSetter<S>;
|
|
774
865
|
}
|
|
775
866
|
|
|
776
|
-
export declare interface WritableComputedRef<T> extends
|
|
777
|
-
|
|
867
|
+
export declare interface WritableComputedRef<T, S = T> extends BaseComputedRef<T, S> {
|
|
868
|
+
[WritableComputedRefSymbol]: true;
|
|
778
869
|
}
|
|
779
870
|
|
|
871
|
+
export declare const WritableComputedRefSymbol: unique symbol;
|
|
872
|
+
|
|
780
873
|
export { }
|