@reactive-vscode/reactivity 1.0.0-beta.2 → 1.0.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.cjs +1659 -2069
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -14
- package/dist/index.js +1660 -2123
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const ARRAY_ITERATE_KEY: unique symbol;
|
|
2
2
|
|
|
3
|
+
export declare type ArrayStringKey<T> = T extends readonly any[] ? number extends T['length'] ? `${number}` : never : never;
|
|
4
|
+
|
|
3
5
|
export declare interface BaseComputedRef<T, S = T> extends Ref<T, S> {
|
|
4
6
|
[ComputedRefSymbol]: true;
|
|
5
7
|
/**
|
|
@@ -79,11 +81,11 @@ export declare type ComputedSetter<T> = (newValue: T) => void;
|
|
|
79
81
|
* @param factory - The function that receives the `track` and `trigger` callbacks.
|
|
80
82
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#customref}
|
|
81
83
|
*/
|
|
82
|
-
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
|
84
|
+
export declare function customRef<T, S = T>(factory: CustomRefFactory<T, S>): Ref<T, S>;
|
|
83
85
|
|
|
84
|
-
export declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
|
86
|
+
export declare type CustomRefFactory<T, S = T> = (track: () => void, trigger: () => void) => {
|
|
85
87
|
get: () => T;
|
|
86
|
-
set: (value:
|
|
88
|
+
set: (value: S) => void;
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
export declare type DebuggerEvent = {
|
|
@@ -131,6 +133,7 @@ export declare type EffectScheduler = (...args: any[]) => any;
|
|
|
131
133
|
export declare class EffectScope {
|
|
132
134
|
detached: boolean;
|
|
133
135
|
private _isPaused;
|
|
136
|
+
readonly __v_skip = true;
|
|
134
137
|
constructor(detached?: boolean);
|
|
135
138
|
get active(): boolean;
|
|
136
139
|
pause(): void;
|
|
@@ -473,9 +476,7 @@ export declare interface RefUnwrapBailTypes {
|
|
|
473
476
|
*/
|
|
474
477
|
export declare function resetTracking(): void;
|
|
475
478
|
|
|
476
|
-
export declare type ShallowReactive<T> = T &
|
|
477
|
-
[ShallowReactiveMarker]?: true;
|
|
478
|
-
};
|
|
479
|
+
export declare type ShallowReactive<T> = T & ShallowReactiveBrand;
|
|
479
480
|
|
|
480
481
|
/**
|
|
481
482
|
* Shallow version of {@link reactive}.
|
|
@@ -509,7 +510,11 @@ export declare type ShallowReactive<T> = T & {
|
|
|
509
510
|
*/
|
|
510
511
|
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
|
|
511
512
|
|
|
512
|
-
export declare
|
|
513
|
+
export declare type ShallowReactiveBrand = ShallowReactiveBrandClass;
|
|
514
|
+
|
|
515
|
+
export declare class ShallowReactiveBrandClass {
|
|
516
|
+
private __shallowReactiveBrand?;
|
|
517
|
+
}
|
|
513
518
|
|
|
514
519
|
/**
|
|
515
520
|
* Track array iteration and return raw array
|
|
@@ -575,7 +580,7 @@ export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
|
|
|
575
580
|
|
|
576
581
|
export declare const ShallowRefMarker: unique symbol;
|
|
577
582
|
|
|
578
|
-
export declare type ShallowUnwrapRef<T> = {
|
|
583
|
+
export declare type ShallowUnwrapRef<T> = T extends ShallowReactiveBrand ? T : {
|
|
579
584
|
[K in keyof T]: DistributeRef<T[K]>;
|
|
580
585
|
};
|
|
581
586
|
|
|
@@ -682,9 +687,11 @@ export declare type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
|
|
|
682
687
|
*/
|
|
683
688
|
export declare function toRef<T>(value: T): T extends () => infer R ? Readonly<Ref<R>> : T extends Ref ? T : Ref<UnwrapRef<T>>;
|
|
684
689
|
|
|
685
|
-
export declare function toRef<T extends object, K extends
|
|
690
|
+
export declare function toRef<T extends object, K extends ToRefKey<T>>(object: T, key: K): ToRef<ToRefValue<T, K>>;
|
|
691
|
+
|
|
692
|
+
export declare function toRef<T extends object, K extends ToRefKey<T>>(object: T, key: K, defaultValue: ToRefValue<T, K>): ToRef<Exclude<ToRefValue<T, K>, undefined>>;
|
|
686
693
|
|
|
687
|
-
export declare
|
|
694
|
+
export declare type ToRefKey<T> = keyof T | ArrayStringKey<T>;
|
|
688
695
|
|
|
689
696
|
export declare type ToRefs<T = any> = {
|
|
690
697
|
[K in keyof T]: ToRef<T[K]>;
|
|
@@ -700,6 +707,8 @@ export declare type ToRefs<T = any> = {
|
|
|
700
707
|
*/
|
|
701
708
|
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
|
702
709
|
|
|
710
|
+
export declare type ToRefValue<T extends object, K extends ToRefKey<T>> = K extends keyof T ? T[K] : T extends readonly (infer V)[] ? K extends ArrayStringKey<T> ? V : never : never;
|
|
711
|
+
|
|
703
712
|
/**
|
|
704
713
|
* Normalizes values / refs / getters to values.
|
|
705
714
|
* This is similar to {@link unref}, except that it also normalizes getters.
|
|
@@ -806,11 +815,9 @@ export declare type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V :
|
|
|
806
815
|
|
|
807
816
|
export declare type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
808
817
|
[RawSymbol]?: true;
|
|
809
|
-
} ? 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> ? {
|
|
818
|
+
} ? T : T extends ShallowReactiveBrand ? 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> ? {
|
|
810
819
|
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
|
811
|
-
} : T extends object
|
|
812
|
-
[ShallowReactiveMarker]?: never;
|
|
813
|
-
} ? {
|
|
820
|
+
} : T extends object ? {
|
|
814
821
|
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
|
815
822
|
} : T;
|
|
816
823
|
|