@reactive-vscode/vueuse 0.2.9 → 0.2.10
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 +207 -141
- package/dist/index.d.ts +69 -24
- package/dist/index.js +208 -142
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { ShallowRef } from '@reactive-vscode/reactivity';
|
|
|
7
7
|
import { ShallowUnwrapRef as ShallowUnwrapRef_2 } from '@reactive-vscode/reactivity';
|
|
8
8
|
import { ToRef } from '@reactive-vscode/reactivity';
|
|
9
9
|
import { ToRefs } from '@reactive-vscode/reactivity';
|
|
10
|
+
import { toValue as toValue_2 } from '@reactive-vscode/reactivity';
|
|
10
11
|
import { UnwrapNestedRefs } from '@reactive-vscode/reactivity';
|
|
11
12
|
import { UnwrapRef } from '@reactive-vscode/reactivity';
|
|
12
13
|
import * as vue from '@reactive-vscode/reactivity';
|
|
@@ -20,6 +21,8 @@ import { WritableComputedRef } from '@reactive-vscode/reactivity';
|
|
|
20
21
|
export declare interface AfterFetchContext<T = any> {
|
|
21
22
|
response: Response;
|
|
22
23
|
data: T | null;
|
|
24
|
+
context: BeforeFetchContext;
|
|
25
|
+
execute: (throwOnFailed?: boolean) => Promise<any>;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
/**
|
|
@@ -349,6 +352,7 @@ export declare interface EventHook<T = any> {
|
|
|
349
352
|
on: EventHookOn<T>;
|
|
350
353
|
off: EventHookOff<T>;
|
|
351
354
|
trigger: EventHookTrigger<T>;
|
|
355
|
+
clear: () => void;
|
|
352
356
|
}
|
|
353
357
|
|
|
354
358
|
export declare type EventHookOff<T = any> = (fn: Callback<T>) => void;
|
|
@@ -556,6 +560,9 @@ declare type OnCleanup = (cleanupFn: () => void) => void;
|
|
|
556
560
|
export declare interface OnFetchErrorContext<T = any, E = any> {
|
|
557
561
|
error: E;
|
|
558
562
|
data: T | null;
|
|
563
|
+
response: Response | null;
|
|
564
|
+
context: BeforeFetchContext;
|
|
565
|
+
execute: (throwOnFailed?: boolean) => Promise<any>;
|
|
559
566
|
}
|
|
560
567
|
|
|
561
568
|
export declare interface Pausable {
|
|
@@ -731,7 +738,7 @@ export declare const resolveRef: typeof toRef;
|
|
|
731
738
|
/**
|
|
732
739
|
* @deprecated use `toValue` instead
|
|
733
740
|
*/
|
|
734
|
-
export declare const resolveUnref: typeof
|
|
741
|
+
export declare const resolveUnref: typeof toValue_2;
|
|
735
742
|
|
|
736
743
|
export declare interface Serializer<T> {
|
|
737
744
|
read: (raw: string) => T;
|
|
@@ -871,7 +878,7 @@ export declare interface ThrottleFilterOptions {
|
|
|
871
878
|
rejectOnCancel?: boolean;
|
|
872
879
|
}
|
|
873
880
|
|
|
874
|
-
export declare interface ToDataURLOptions {
|
|
881
|
+
export declare interface ToDataURLOptions extends UseBase64Options {
|
|
875
882
|
/**
|
|
876
883
|
* MIME type
|
|
877
884
|
*/
|
|
@@ -924,8 +931,10 @@ export declare interface ToRefsOptions {
|
|
|
924
931
|
|
|
925
932
|
/**
|
|
926
933
|
* Get the value of value/ref/getter.
|
|
934
|
+
*
|
|
935
|
+
* @deprecated use `toValue` from `vue` instead
|
|
927
936
|
*/
|
|
928
|
-
export declare
|
|
937
|
+
export declare const toValue: typeof toValue_2;
|
|
929
938
|
|
|
930
939
|
declare interface Transform<L, R> {
|
|
931
940
|
ltr: (left: L) => R;
|
|
@@ -1012,9 +1021,19 @@ export declare interface UntilValueInstance<T, Not extends boolean = false> exte
|
|
|
1012
1021
|
|
|
1013
1022
|
export declare type UrlParams = Record<string, string[] | string>;
|
|
1014
1023
|
|
|
1015
|
-
export declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, key?: keyof T): ComputedRef<T[]>;
|
|
1024
|
+
export declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, key?: keyof T, options?: UseArrayDifferenceOptions): ComputedRef<T[]>;
|
|
1016
1025
|
|
|
1017
|
-
export declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, compareFn?: (value: T, othVal: T) => boolean): ComputedRef<T[]>;
|
|
1026
|
+
export declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, compareFn?: (value: T, othVal: T) => boolean, options?: UseArrayDifferenceOptions): ComputedRef<T[]>;
|
|
1027
|
+
|
|
1028
|
+
declare interface UseArrayDifferenceOptions {
|
|
1029
|
+
/**
|
|
1030
|
+
* Returns asymmetric difference
|
|
1031
|
+
*
|
|
1032
|
+
* @see https://en.wikipedia.org/wiki/Symmetric_difference
|
|
1033
|
+
* @default false
|
|
1034
|
+
*/
|
|
1035
|
+
symmetric?: boolean;
|
|
1036
|
+
}
|
|
1018
1037
|
|
|
1019
1038
|
/**
|
|
1020
1039
|
* Reactive `Array.every`
|
|
@@ -1215,7 +1234,7 @@ export declare type UseAsyncQueueTask<T> = (...args: any[]) => T | Promise<T>;
|
|
|
1215
1234
|
* @param initialState The initial state, used until the first evaluation finishes
|
|
1216
1235
|
* @param options
|
|
1217
1236
|
*/
|
|
1218
|
-
export declare function useAsyncState<Data, Params extends any[] = [], Shallow extends boolean = true>(promise: Promise<Data> | ((...args: Params) => Promise<Data>), initialState: Data, options?: UseAsyncStateOptions<Shallow, Data>): UseAsyncStateReturn<Data, Params, Shallow>;
|
|
1237
|
+
export declare function useAsyncState<Data, Params extends any[] = any[], Shallow extends boolean = true>(promise: Promise<Data> | ((...args: Params) => Promise<Data>), initialState: Data, options?: UseAsyncStateOptions<Shallow, Data>): UseAsyncStateReturn<Data, Params, Shallow>;
|
|
1219
1238
|
|
|
1220
1239
|
export declare interface UseAsyncStateOptions<Shallow extends boolean, D = any> {
|
|
1221
1240
|
/**
|
|
@@ -1277,11 +1296,11 @@ export declare interface UseAsyncStateReturnBase<Data, Params extends any[], Sha
|
|
|
1277
1296
|
execute: (delay?: number, ...args: Params) => Promise<Data>;
|
|
1278
1297
|
}
|
|
1279
1298
|
|
|
1280
|
-
export declare function useBase64(target: MaybeRefOrGetter<string
|
|
1299
|
+
export declare function useBase64(target: MaybeRefOrGetter<string>, options?: UseBase64Options): UseBase64Return;
|
|
1281
1300
|
|
|
1282
|
-
export declare function useBase64(target: MaybeRefOrGetter<Blob
|
|
1301
|
+
export declare function useBase64(target: MaybeRefOrGetter<Blob>, options?: UseBase64Options): UseBase64Return;
|
|
1283
1302
|
|
|
1284
|
-
export declare function useBase64(target: MaybeRefOrGetter<ArrayBuffer
|
|
1303
|
+
export declare function useBase64(target: MaybeRefOrGetter<ArrayBuffer>, options?: UseBase64Options): UseBase64Return;
|
|
1285
1304
|
|
|
1286
1305
|
export declare function useBase64(target: MaybeRefOrGetter<HTMLCanvasElement>, options?: ToDataURLOptions): UseBase64Return;
|
|
1287
1306
|
|
|
@@ -1295,8 +1314,17 @@ export declare function useBase64<T extends Set<unknown>>(target: MaybeRefOrGett
|
|
|
1295
1314
|
|
|
1296
1315
|
export declare function useBase64<T>(target: MaybeRefOrGetter<T[]>, options?: UseBase64ObjectOptions<T[]>): UseBase64Return;
|
|
1297
1316
|
|
|
1298
|
-
export declare interface UseBase64ObjectOptions<T> {
|
|
1299
|
-
serializer
|
|
1317
|
+
export declare interface UseBase64ObjectOptions<T> extends UseBase64Options {
|
|
1318
|
+
serializer?: (v: T) => string;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
declare interface UseBase64Options {
|
|
1322
|
+
/**
|
|
1323
|
+
* Output as Data URL format
|
|
1324
|
+
*
|
|
1325
|
+
* @default true
|
|
1326
|
+
*/
|
|
1327
|
+
dataUrl?: boolean;
|
|
1300
1328
|
}
|
|
1301
1329
|
|
|
1302
1330
|
export declare interface UseBase64Return {
|
|
@@ -1323,7 +1351,7 @@ export declare interface UseBroadcastChannelOptions extends ConfigurableWindow {
|
|
|
1323
1351
|
}
|
|
1324
1352
|
|
|
1325
1353
|
export declare interface UseBroadcastChannelReturn<D, P> {
|
|
1326
|
-
isSupported:
|
|
1354
|
+
isSupported: ComputedRef<boolean>;
|
|
1327
1355
|
channel: Ref<BroadcastChannel | undefined>;
|
|
1328
1356
|
data: Ref<D>;
|
|
1329
1357
|
post: (data: P) => void;
|
|
@@ -1391,6 +1419,10 @@ export declare interface UseClonedReturn<T> {
|
|
|
1391
1419
|
* Cloned ref
|
|
1392
1420
|
*/
|
|
1393
1421
|
cloned: Ref<T>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Ref indicates whether the cloned data is modified
|
|
1424
|
+
*/
|
|
1425
|
+
isModified: Ref<boolean>;
|
|
1394
1426
|
/**
|
|
1395
1427
|
* Sync cloned data with source manually
|
|
1396
1428
|
*/
|
|
@@ -1589,11 +1621,7 @@ export declare interface UseFetchOptions {
|
|
|
1589
1621
|
* Will run immediately after the fetch request is returned.
|
|
1590
1622
|
* Runs after any 4xx and 5xx response
|
|
1591
1623
|
*/
|
|
1592
|
-
onFetchError?: (ctx:
|
|
1593
|
-
data: any;
|
|
1594
|
-
response: Response | null;
|
|
1595
|
-
error: any;
|
|
1596
|
-
}) => Promise<Partial<OnFetchErrorContext>> | Partial<OnFetchErrorContext>;
|
|
1624
|
+
onFetchError?: (ctx: OnFetchErrorContext) => Promise<Partial<OnFetchErrorContext>> | Partial<OnFetchErrorContext>;
|
|
1597
1625
|
}
|
|
1598
1626
|
|
|
1599
1627
|
export declare interface UseFetchReturn<T> {
|
|
@@ -2127,7 +2155,7 @@ export declare interface UseStepperReturn<StepName, Steps, Step> {
|
|
|
2127
2155
|
}
|
|
2128
2156
|
|
|
2129
2157
|
declare function useTextareaAutosize(options?: UseTextareaAutosizeOptions): {
|
|
2130
|
-
textarea: vue.Ref<HTMLTextAreaElement, HTMLTextAreaElement>;
|
|
2158
|
+
textarea: vue.Ref<HTMLTextAreaElement | undefined, HTMLTextAreaElement | undefined>;
|
|
2131
2159
|
input: vue.Ref<string, string>;
|
|
2132
2160
|
triggerResize: () => void;
|
|
2133
2161
|
};
|
|
@@ -2136,7 +2164,7 @@ export declare interface UseTextareaAutosizeOptions {
|
|
|
2136
2164
|
/** Textarea element to autosize. */
|
|
2137
2165
|
element?: MaybeRef<HTMLTextAreaElement | undefined>;
|
|
2138
2166
|
/** Textarea content. */
|
|
2139
|
-
input?: MaybeRef<string
|
|
2167
|
+
input?: MaybeRef<string>;
|
|
2140
2168
|
/** Watch sources that should trigger a textarea resize. */
|
|
2141
2169
|
watch?: WatchSource | Array<WatchSource>;
|
|
2142
2170
|
/** Function called when the textarea size changes. */
|
|
@@ -2275,7 +2303,7 @@ export declare interface UseTimeoutOptions<Controls extends boolean> extends Use
|
|
|
2275
2303
|
callback?: Fn;
|
|
2276
2304
|
}
|
|
2277
2305
|
|
|
2278
|
-
export declare function useTimeoutPoll(fn: () => Awaitable<void>, interval: MaybeRefOrGetter<number>,
|
|
2306
|
+
export declare function useTimeoutPoll(fn: () => Awaitable<void>, interval: MaybeRefOrGetter<number>, options?: UseTimeoutFnOptions): Pausable;
|
|
2279
2307
|
|
|
2280
2308
|
/**
|
|
2281
2309
|
* Reactive current timestamp.
|
|
@@ -2340,9 +2368,11 @@ export declare interface UseToNumberOptions {
|
|
|
2340
2368
|
/**
|
|
2341
2369
|
* Method to use to convert the value to a number.
|
|
2342
2370
|
*
|
|
2371
|
+
* Or a custom function for the conversion.
|
|
2372
|
+
*
|
|
2343
2373
|
* @default 'parseFloat'
|
|
2344
2374
|
*/
|
|
2345
|
-
method?: 'parseFloat' | 'parseInt';
|
|
2375
|
+
method?: 'parseFloat' | 'parseInt' | ((value: string | number) => number);
|
|
2346
2376
|
/**
|
|
2347
2377
|
* The base in mathematical numeral systems passed to `parseInt`.
|
|
2348
2378
|
* Only works with `method: 'parseInt'`
|
|
@@ -2391,6 +2421,13 @@ export declare interface UseUrlSearchParamsOptions<T> extends ConfigurableWindow
|
|
|
2391
2421
|
* @default true
|
|
2392
2422
|
*/
|
|
2393
2423
|
write?: boolean;
|
|
2424
|
+
/**
|
|
2425
|
+
* Write mode for `window.history` when `write` is enabled
|
|
2426
|
+
* - `replace`: replace the current history entry
|
|
2427
|
+
* - `push`: push a new history entry
|
|
2428
|
+
* @default 'replace'
|
|
2429
|
+
*/
|
|
2430
|
+
writeMode?: 'replace' | 'push';
|
|
2394
2431
|
}
|
|
2395
2432
|
|
|
2396
2433
|
/**
|
|
@@ -2417,11 +2454,11 @@ export declare interface UseWebSocketOptions {
|
|
|
2417
2454
|
*
|
|
2418
2455
|
* @default 'ping'
|
|
2419
2456
|
*/
|
|
2420
|
-
message?:
|
|
2457
|
+
message?: MaybeRefOrGetter<WebSocketHeartbeatMessage>;
|
|
2421
2458
|
/**
|
|
2422
2459
|
* Response message for the heartbeat, if undefined the message will be used
|
|
2423
2460
|
*/
|
|
2424
|
-
responseMessage?:
|
|
2461
|
+
responseMessage?: MaybeRefOrGetter<WebSocketHeartbeatMessage>;
|
|
2425
2462
|
/**
|
|
2426
2463
|
* Interval, in milliseconds
|
|
2427
2464
|
*
|
|
@@ -2461,11 +2498,17 @@ export declare interface UseWebSocketOptions {
|
|
|
2461
2498
|
onFailed?: Fn;
|
|
2462
2499
|
};
|
|
2463
2500
|
/**
|
|
2464
|
-
*
|
|
2501
|
+
* Immediately open the connection when calling this composable
|
|
2465
2502
|
*
|
|
2466
2503
|
* @default true
|
|
2467
2504
|
*/
|
|
2468
2505
|
immediate?: boolean;
|
|
2506
|
+
/**
|
|
2507
|
+
* Automatically connect to the websocket when URL changes
|
|
2508
|
+
*
|
|
2509
|
+
* @default true
|
|
2510
|
+
*/
|
|
2511
|
+
autoConnect?: boolean;
|
|
2469
2512
|
/**
|
|
2470
2513
|
* Automatically close a connection
|
|
2471
2514
|
*
|
|
@@ -2664,6 +2707,8 @@ export declare function watchWithFilter<T extends object, Immediate extends Read
|
|
|
2664
2707
|
declare interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {
|
|
2665
2708
|
}
|
|
2666
2709
|
|
|
2710
|
+
declare type WebSocketHeartbeatMessage = string | ArrayBuffer | Blob;
|
|
2711
|
+
|
|
2667
2712
|
export declare type WebSocketStatus = 'OPEN' | 'CONNECTING' | 'CLOSED';
|
|
2668
2713
|
|
|
2669
2714
|
export declare type WebWorkerStatus = 'PENDING' | 'SUCCESS' | 'RUNNING' | 'ERROR' | 'TIMEOUT_EXPIRED';
|