@histoire/vendors 0.17.17 → 1.0.0-alpha.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/client/b-floating-vue.js +2175 -2150
- package/dist/client/b-iconify.js +751 -825
- package/dist/client/b-pinia.js +130 -68
- package/dist/client/b-scroll.js +3 -52
- package/dist/client/b-vue-router.js +385 -237
- package/dist/client/b-vue-use.js +3898 -2871
- package/dist/client/b-vue.js +1 -1
- package/dist/client/index.js +162 -20
- package/dist/client/node_modules/@babel/helper-string-parser/package.json +31 -0
- package/dist/client/node_modules/@babel/helper-validator-identifier/package.json +31 -0
- package/dist/client/node_modules/@babel/parser/package.json +10 -6
- package/dist/client/node_modules/@babel/parser/typings/babel-parser.d.ts +47 -31
- package/dist/client/node_modules/@babel/types/lib/index-legacy.d.ts +2776 -0
- package/dist/client/node_modules/@babel/types/lib/index.d.ts +3275 -0
- package/dist/client/node_modules/@babel/types/package.json +39 -0
- package/dist/client/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +525 -0
- package/dist/client/node_modules/@floating-ui/core/package.json +32 -39
- package/dist/client/node_modules/@floating-ui/dom/package.json +23 -24
- package/dist/client/node_modules/@floating-ui/dom/src/autoUpdate.d.ts +31 -0
- package/dist/client/node_modules/@floating-ui/dom/src/index.d.ts +11 -7
- package/dist/client/node_modules/@floating-ui/dom/src/platform.d.ts +1 -1
- package/dist/client/node_modules/@floating-ui/dom/src/types.d.ts +121 -20
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getBoundingClientRect.d.ts +1 -1
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getClippingRect.d.ts +12 -0
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getCssDimensions.d.ts +4 -0
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getDimensions.d.ts +1 -1
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getNearestOverflowAncestor.d.ts +1 -0
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts +3 -0
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getScale.d.ts +7 -0
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getViewportRect.d.ts +2 -2
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getWindowScrollBarX.d.ts +1 -1
- package/dist/client/node_modules/@floating-ui/dom/src/utils/is.d.ts +3 -1
- package/dist/client/node_modules/@floating-ui/dom/src/utils/unwrapElement.d.ts +2 -0
- package/dist/client/node_modules/@floating-ui/dom/src/utils/userAgent.d.ts +1 -0
- package/dist/client/node_modules/@floating-ui/dom/src/utils/window.d.ts +1 -2
- package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +103 -0
- package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
- package/dist/client/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
- package/dist/client/node_modules/@floating-ui/utils/dom/package.json +6 -0
- package/dist/client/node_modules/@floating-ui/utils/package.json +70 -0
- package/dist/client/node_modules/@iconify/types/package.json +23 -0
- package/dist/client/node_modules/@iconify/types/provider.d.ts +44 -0
- package/dist/client/node_modules/@iconify/types/types.d.ts +272 -0
- package/dist/client/node_modules/@iconify/vue/dist/iconify.d.ts +72 -330
- package/dist/client/node_modules/@iconify/vue/dist/offline.d.ts +28 -268
- package/dist/client/node_modules/@iconify/vue/package.json +64 -60
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts +49 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +2 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts +15 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts +6 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/package.json +3 -2
- package/dist/client/node_modules/@types/web-bluetooth/index.d.ts +33 -14
- package/dist/client/node_modules/@types/web-bluetooth/package.json +12 -12
- package/dist/client/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +218 -125
- package/dist/client/node_modules/@vue/compiler-core/package.json +20 -5
- package/dist/client/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +6 -3
- package/dist/client/node_modules/@vue/compiler-dom/package.json +17 -3
- package/dist/client/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +35 -25
- package/dist/client/node_modules/@vue/compiler-sfc/package.json +27 -18
- package/dist/client/node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts +2 -2
- package/dist/client/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/dist/client/node_modules/@vue/devtools-api/package.json +1 -1
- package/dist/client/node_modules/@vue/reactivity/dist/reactivity.d.ts +268 -166
- package/dist/client/node_modules/@vue/reactivity/package.json +16 -2
- package/dist/client/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +728 -529
- package/dist/client/node_modules/@vue/runtime-core/package.json +17 -3
- package/dist/client/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +195 -86
- package/dist/client/node_modules/@vue/runtime-dom/package.json +22 -4
- package/dist/client/node_modules/@vue/server-renderer/dist/server-renderer.d.ts +4 -8
- package/dist/client/node_modules/@vue/server-renderer/package.json +18 -4
- package/dist/client/node_modules/@vue/shared/dist/shared.d.ts +45 -30
- package/dist/client/node_modules/@vue/shared/package.json +15 -1
- package/dist/client/node_modules/@vueuse/core/index.d.ts +2040 -633
- package/dist/client/node_modules/@vueuse/core/package.json +10 -12
- package/dist/client/node_modules/@vueuse/metadata/index.d.ts +7 -5
- package/dist/client/node_modules/@vueuse/metadata/package.json +4 -4
- package/dist/client/node_modules/@vueuse/shared/index.d.ts +410 -273
- package/dist/client/node_modules/@vueuse/shared/package.json +5 -6
- package/dist/client/node_modules/compute-scroll-into-view/dist/index.d.ts +75 -0
- package/dist/client/node_modules/compute-scroll-into-view/package.json +35 -45
- package/dist/client/node_modules/entities/lib/decode.d.ts +211 -0
- package/dist/client/node_modules/entities/lib/decode_codepoint.d.ts +19 -0
- package/dist/client/node_modules/entities/lib/encode.d.ts +22 -0
- package/dist/client/node_modules/entities/lib/escape.d.ts +43 -0
- package/dist/client/node_modules/entities/lib/esm/decode.d.ts +211 -0
- package/dist/client/node_modules/entities/lib/esm/decode_codepoint.d.ts +19 -0
- package/dist/client/node_modules/entities/lib/esm/encode.d.ts +22 -0
- package/dist/client/node_modules/entities/lib/esm/escape.d.ts +43 -0
- package/dist/client/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +3 -0
- package/dist/client/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +3 -0
- package/dist/client/node_modules/entities/lib/esm/generated/encode-html.d.ts +8 -0
- package/dist/client/node_modules/entities/lib/esm/index.d.ts +96 -0
- package/dist/client/node_modules/entities/lib/esm/package.json +1 -0
- package/dist/client/node_modules/entities/lib/generated/decode-data-html.d.ts +3 -0
- package/dist/client/node_modules/entities/lib/generated/decode-data-xml.d.ts +3 -0
- package/dist/client/node_modules/entities/lib/generated/encode-html.d.ts +8 -0
- package/dist/client/node_modules/entities/lib/index.d.ts +96 -0
- package/dist/client/node_modules/entities/package.json +90 -0
- package/dist/client/node_modules/floating-vue/dist/components/Dropdown.d.ts +398 -0
- package/dist/client/node_modules/floating-vue/dist/components/Menu.d.ts +398 -0
- package/dist/client/node_modules/floating-vue/dist/components/Popper.d.ts +225 -105
- package/dist/client/node_modules/floating-vue/dist/components/Popper.vue.d.ts +471 -364
- package/dist/client/node_modules/floating-vue/dist/components/PopperContent.vue.d.ts +14 -25
- package/dist/client/node_modules/floating-vue/dist/components/PopperWrapper.vue.d.ts +392 -6
- package/dist/client/node_modules/floating-vue/dist/components/Tooltip.d.ts +398 -0
- package/dist/client/node_modules/floating-vue/dist/components/TooltipDirective.vue.d.ts +49 -10
- package/dist/client/node_modules/floating-vue/dist/config.d.ts +1 -1
- package/dist/client/node_modules/floating-vue/dist/index.d.ts +2071 -247
- package/dist/client/node_modules/floating-vue/dist/util/events.d.ts +2 -0
- package/dist/client/node_modules/floating-vue/dist/util/popper.d.ts +1 -1
- package/dist/client/node_modules/floating-vue/package.json +42 -33
- package/dist/client/node_modules/magic-string/dist/magic-string.cjs.d.ts +250 -229
- package/dist/client/node_modules/magic-string/package.json +24 -26
- package/dist/client/node_modules/nanoid/package.json +1 -1
- package/dist/client/node_modules/picocolors/package.json +2 -2
- package/dist/client/node_modules/picocolors/types.d.ts +51 -0
- package/dist/client/node_modules/pinia/dist/pinia.d.ts +116 -37
- package/dist/client/node_modules/pinia/package.json +7 -11
- package/dist/client/node_modules/postcss/lib/at-rule.d.ts +25 -22
- package/dist/client/node_modules/postcss/lib/comment.d.ts +10 -9
- package/dist/client/node_modules/postcss/lib/container.d.ts +47 -54
- package/dist/client/node_modules/postcss/lib/css-syntax-error.d.ts +1 -1
- package/dist/client/node_modules/postcss/lib/declaration.d.ts +20 -17
- package/dist/client/node_modules/postcss/lib/document.d.ts +4 -4
- package/dist/client/node_modules/postcss/lib/input.d.ts +14 -0
- package/dist/client/node_modules/postcss/lib/list.d.ts +5 -2
- package/dist/client/node_modules/postcss/lib/node.d.ts +19 -14
- package/dist/client/node_modules/postcss/lib/postcss.d.ts +25 -8
- package/dist/client/node_modules/postcss/lib/processor.d.ts +1 -1
- package/dist/client/node_modules/postcss/lib/result.d.ts +0 -1
- package/dist/client/node_modules/postcss/lib/root.d.ts +4 -4
- package/dist/client/node_modules/postcss/lib/rule.d.ts +27 -18
- package/dist/client/node_modules/postcss/package.json +4 -4
- package/dist/client/node_modules/scroll-into-view-if-needed/dist/index.d.ts +79 -0
- package/dist/client/node_modules/scroll-into-view-if-needed/package.json +28 -67
- package/dist/client/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
- package/dist/client/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
- package/dist/client/node_modules/source-map-js/lib/source-node.d.ts +1 -0
- package/dist/client/node_modules/source-map-js/package.json +1 -1
- package/dist/client/node_modules/source-map-js/source-map.d.ts +88 -99
- package/dist/client/node_modules/vue/dist/vue.d.ts +0 -4
- package/dist/client/node_modules/vue/jsx-runtime/index.d.ts +2 -1
- package/dist/client/node_modules/vue/jsx.d.ts +2 -1
- package/dist/client/node_modules/vue/package.json +13 -14
- package/dist/client/node_modules/{pinia/node_modules/vue-demi → vue-demi}/package.json +1 -1
- package/dist/client/node_modules/vue-router/dist/vue-router.d.ts +410 -81
- package/dist/client/node_modules/vue-router/package.json +66 -37
- package/dist/client/node_modules/vue-router/vue-router-auto-routes.d.ts +4 -0
- package/dist/client/node_modules/vue-router/vue-router-auto.d.ts +4 -0
- package/dist/client/vue.runtime.esm-bundler.js +6458 -4714
- package/package.json +17 -17
- package/rollup.config.mjs +6 -6
- package/dist/client/index2.js +0 -168
- package/dist/client/node_modules/@floating-ui/core/index.d.ts +0 -1
- package/dist/client/node_modules/@floating-ui/core/src/_babel.d.ts +0 -1
- package/dist/client/node_modules/@floating-ui/core/src/computeCoordsFromPlacement.d.ts +0 -4
- package/dist/client/node_modules/@floating-ui/core/src/computePosition.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/detectOverflow.d.ts +0 -9
- package/dist/client/node_modules/@floating-ui/core/src/enums.d.ts +0 -4
- package/dist/client/node_modules/@floating-ui/core/src/index.d.ts +0 -11
- package/dist/client/node_modules/@floating-ui/core/src/middleware/arrow.d.ts +0 -6
- package/dist/client/node_modules/@floating-ui/core/src/middleware/autoPlacement.d.ts +0 -9
- package/dist/client/node_modules/@floating-ui/core/src/middleware/flip.d.ts +0 -10
- package/dist/client/node_modules/@floating-ui/core/src/middleware/hide.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/middleware/inline.d.ts +0 -5
- package/dist/client/node_modules/@floating-ui/core/src/middleware/offset.d.ts +0 -21
- package/dist/client/node_modules/@floating-ui/core/src/middleware/shift.d.ts +0 -32
- package/dist/client/node_modules/@floating-ui/core/src/middleware/size.d.ts +0 -6
- package/dist/client/node_modules/@floating-ui/core/src/types.d.ts +0 -148
- package/dist/client/node_modules/@floating-ui/core/src/utils/expandPaddingObject.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getAlignment.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getAlignmentSides.d.ts +0 -5
- package/dist/client/node_modules/@floating-ui/core/src/utils/getBasePlacement.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getCrossAxis.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getExpandedPlacements.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getLengthFromAxis.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getMainAxisFromPlacement.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getOppositeAlignmentPlacement.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/getOppositePlacement.d.ts +0 -1
- package/dist/client/node_modules/@floating-ui/core/src/utils/getPaddingObject.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/math.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/rectToClientRect.d.ts +0 -2
- package/dist/client/node_modules/@floating-ui/core/src/utils/within.d.ts +0 -1
- package/dist/client/node_modules/@floating-ui/dom/src/utils/contains.d.ts +0 -1
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getClippingClientRect.d.ts +0 -6
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getScrollParent.d.ts +0 -1
- package/dist/client/node_modules/@floating-ui/dom/src/utils/getScrollParents.d.ts +0 -1
- package/dist/client/node_modules/@vue/reactivity-transform/dist/reactivity-transform.d.ts +0 -43
- package/dist/client/node_modules/@vue/reactivity-transform/package.json +0 -41
- package/dist/client/node_modules/@vueuse/core/node_modules/vue-demi/package.json +0 -47
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/index.d.ts +0 -22
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v2/index.d.ts +0 -33
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v2.7/index.d.ts +0 -38
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v3/index.d.ts +0 -22
- package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/package.json +0 -47
- package/dist/client/node_modules/compute-scroll-into-view/typings/index.d.ts +0 -19
- package/dist/client/node_modules/floating-vue/dist/components/Dropdown.vue.d.ts +0 -25
- package/dist/client/node_modules/floating-vue/dist/components/Menu.vue.d.ts +0 -25
- package/dist/client/node_modules/floating-vue/dist/components/Tooltip.vue.d.ts +0 -25
- package/dist/client/node_modules/floating-vue/src/global-shim.d.ts +0 -1
- package/dist/client/node_modules/floating-vue/src/vue-shim.d.ts +0 -5
- package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/index.d.ts +0 -22
- package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2/index.d.ts +0 -33
- package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2.7/index.d.ts +0 -38
- package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v3/index.d.ts +0 -22
- package/dist/client/node_modules/scroll-into-view-if-needed/typings/index.d.ts +0 -13
- package/dist/client/node_modules/scroll-into-view-if-needed/typings/types.d.ts +0 -19
- package/dist/client/node_modules/vue/macros-global.d.ts +0 -19
- package/dist/client/node_modules/vue/macros.d.ts +0 -112
- package/dist/client/node_modules/vue/ref-macros.d.ts +0 -2
- /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/index.d.ts +0 -0
- /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/v2/index.d.ts +0 -0
- /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/v2.7/index.d.ts +0 -0
- /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/v3/index.d.ts +0 -0
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, ShallowUnwrapRef as ShallowUnwrapRef$1,
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, MaybeRef, WatchOptions, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
|
+
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Note: If you are using Vue 3.4+, you can straight use computed instead.
|
|
7
|
+
* Because in Vue 3.4+, if computed new value does not change,
|
|
8
|
+
* computed, effect, watch, watchEffect, render dependencies will not be triggered.
|
|
9
|
+
* refer: https://github.com/vuejs/core/pull/5912
|
|
10
|
+
*
|
|
11
|
+
* @param fn effect function
|
|
12
|
+
* @param options WatchOptionsBase
|
|
13
|
+
* @returns readonly ref
|
|
14
|
+
*/
|
|
4
15
|
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
|
|
5
16
|
|
|
6
17
|
interface ComputedWithControlRefExtra {
|
|
7
18
|
/**
|
|
8
19
|
* Force update the computed value.
|
|
9
20
|
*/
|
|
10
|
-
trigger()
|
|
21
|
+
trigger: () => void;
|
|
11
22
|
}
|
|
12
23
|
interface ComputedRefWithControl<T> extends ComputedRef<T>, ComputedWithControlRefExtra {
|
|
13
24
|
}
|
|
@@ -16,87 +27,6 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
|
|
|
16
27
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
|
|
17
28
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
|
|
18
29
|
|
|
19
|
-
type EventHookOn<T = any> = (fn: (param: T) => void) => {
|
|
20
|
-
off: () => void;
|
|
21
|
-
};
|
|
22
|
-
type EventHookOff<T = any> = (fn: (param: T) => void) => void;
|
|
23
|
-
type EventHookTrigger<T = any> = (param: T) => void;
|
|
24
|
-
interface EventHook<T = any> {
|
|
25
|
-
on: EventHookOn<T>;
|
|
26
|
-
off: EventHookOff<T>;
|
|
27
|
-
trigger: EventHookTrigger<T>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Utility for creating event hooks
|
|
31
|
-
*
|
|
32
|
-
* @see https://vueuse.org/createEventHook
|
|
33
|
-
*/
|
|
34
|
-
declare function createEventHook<T = any>(): EventHook<T>;
|
|
35
|
-
|
|
36
|
-
type CreateGlobalStateReturn<T> = () => T;
|
|
37
|
-
/**
|
|
38
|
-
* Keep states in the global scope to be reusable across Vue instances.
|
|
39
|
-
*
|
|
40
|
-
* @see https://vueuse.org/createGlobalState
|
|
41
|
-
* @param stateFactory A factory function to create the state
|
|
42
|
-
*/
|
|
43
|
-
declare function createGlobalState<T>(stateFactory: () => T): CreateGlobalStateReturn<T>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Create global state that can be injected into components.
|
|
47
|
-
*
|
|
48
|
-
* @see https://vueuse.org/createInjectionState
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Make a composable function usable with multiple Vue instances.
|
|
55
|
-
*
|
|
56
|
-
* @see https://vueuse.org/createSharedComposable
|
|
57
|
-
*/
|
|
58
|
-
declare function createSharedComposable<Fn extends ((...args: any[]) => any)>(composable: Fn): Fn;
|
|
59
|
-
|
|
60
|
-
interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
61
|
-
/**
|
|
62
|
-
* Is the extends properties enumerable
|
|
63
|
-
*
|
|
64
|
-
* @default false
|
|
65
|
-
*/
|
|
66
|
-
enumerable?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Unwrap for Ref properties
|
|
69
|
-
*
|
|
70
|
-
* @default true
|
|
71
|
-
*/
|
|
72
|
-
unwrap?: Unwrap;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Overload 1: Unwrap set to false
|
|
76
|
-
*/
|
|
77
|
-
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
|
|
78
|
-
/**
|
|
79
|
-
* Overload 2: Unwrap unset or set to true
|
|
80
|
-
*/
|
|
81
|
-
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
82
|
-
|
|
83
|
-
declare const isClient: boolean;
|
|
84
|
-
declare const isDef: <T = any>(val?: T | undefined) => val is T;
|
|
85
|
-
declare const assert: (condition: boolean, ...infos: any[]) => void;
|
|
86
|
-
declare const isBoolean: (val: any) => val is boolean;
|
|
87
|
-
declare const isFunction: <T extends Function>(val: any) => val is T;
|
|
88
|
-
declare const isNumber: (val: any) => val is number;
|
|
89
|
-
declare const isString: (val: unknown) => val is string;
|
|
90
|
-
declare const isObject: (val: any) => val is object;
|
|
91
|
-
declare const isWindow: (val: any) => val is Window;
|
|
92
|
-
declare const now: () => number;
|
|
93
|
-
declare const timestamp: () => number;
|
|
94
|
-
declare const clamp: (n: number, min: number, max: number) => number;
|
|
95
|
-
declare const noop: () => void;
|
|
96
|
-
declare const rand: (min: number, max: number) => number;
|
|
97
|
-
declare const isIOS: boolean | "";
|
|
98
|
-
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
99
|
-
|
|
100
30
|
/**
|
|
101
31
|
* Void function
|
|
102
32
|
*/
|
|
@@ -113,33 +43,9 @@ type RemovableRef<T> = Omit<Ref<T>, 'value'> & {
|
|
|
113
43
|
set value(value: T | null | undefined);
|
|
114
44
|
};
|
|
115
45
|
/**
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
type RemoveableRef<T> = RemovableRef<T>;
|
|
119
|
-
/**
|
|
120
|
-
* Maybe it's a ref, or a plain value
|
|
121
|
-
*
|
|
122
|
-
* ```ts
|
|
123
|
-
* type MaybeRef<T> = T | Ref<T>
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
type MaybeRef<T> = T | Ref<T>;
|
|
127
|
-
/**
|
|
128
|
-
* Maybe it's a ref, or a plain value, or a getter function
|
|
129
|
-
*
|
|
130
|
-
* ```ts
|
|
131
|
-
* type MaybeComputedRef<T> = (() => T) | T | Ref<T> | ComputedRef<T>
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
type MaybeComputedRef<T> = MaybeReadonlyRef<T> | MaybeRef<T>;
|
|
135
|
-
/**
|
|
136
|
-
* Maybe it's a computed ref, or a getter function
|
|
137
|
-
*
|
|
138
|
-
* ```ts
|
|
139
|
-
* type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>
|
|
140
|
-
* ```
|
|
46
|
+
* Maybe it's a computed ref, or a readonly value, or a getter function
|
|
141
47
|
*/
|
|
142
|
-
type
|
|
48
|
+
type ReadonlyRefOrGetter<T> = ComputedRef<T> | (() => T);
|
|
143
49
|
/**
|
|
144
50
|
* Make all the nested attributes of an object or array to MaybeRef<T>
|
|
145
51
|
*
|
|
@@ -160,7 +66,14 @@ type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
|
160
66
|
type ShallowUnwrapRef<T> = T extends Ref<infer P> ? P : T;
|
|
161
67
|
type Awaitable<T> = Promise<T> | T;
|
|
162
68
|
type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
163
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Compatible with versions below TypeScript 4.5 Awaited
|
|
71
|
+
*/
|
|
72
|
+
type Awaited<T> = T extends null | undefined ? T : T extends object & {
|
|
73
|
+
then: (onfulfilled: infer F, ...args: infer _) => any;
|
|
74
|
+
} ? F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never : T;
|
|
75
|
+
type Promisify<T> = Promise<Awaited<T>>;
|
|
76
|
+
type PromisifyFn<T extends AnyFn> = (...args: ArgumentsType<T>) => Promisify<ReturnType<T>>;
|
|
164
77
|
interface Pausable {
|
|
165
78
|
/**
|
|
166
79
|
* A ref indicate whether a pausable instance is active
|
|
@@ -189,10 +102,6 @@ interface Stoppable<StartFnArgs extends any[] = any[]> {
|
|
|
189
102
|
*/
|
|
190
103
|
start: (...args: StartFnArgs) => void;
|
|
191
104
|
}
|
|
192
|
-
/**
|
|
193
|
-
* @deprecated Use `Stoppable`
|
|
194
|
-
*/
|
|
195
|
-
type Stopable = Stoppable;
|
|
196
105
|
interface ConfigurableFlush {
|
|
197
106
|
/**
|
|
198
107
|
* Timing for monitoring changes, refer to WatchOptions for more details
|
|
@@ -210,12 +119,46 @@ interface ConfigurableFlushSync {
|
|
|
210
119
|
*/
|
|
211
120
|
flush?: WatchOptions['flush'];
|
|
212
121
|
}
|
|
122
|
+
type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
213
123
|
type MapSources<T> = {
|
|
214
124
|
[K in keyof T]: T[K] extends WatchSource<infer V> ? V : never;
|
|
215
125
|
};
|
|
216
126
|
type MapOldSources<T, Immediate> = {
|
|
217
127
|
[K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never;
|
|
218
128
|
};
|
|
129
|
+
type Mutable<T> = {
|
|
130
|
+
-readonly [P in keyof T]: T[P];
|
|
131
|
+
};
|
|
132
|
+
type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
133
|
+
/**
|
|
134
|
+
* will return `true` if `T` is `any`, or `false` otherwise
|
|
135
|
+
*/
|
|
136
|
+
type IsAny<T> = IfAny<T, true, false>;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The source code for this function was inspired by vue-apollo's `useEventHook` util
|
|
140
|
+
* https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
type Callback<T> = IsAny<T> extends true ? (...param: any) => void : ([
|
|
144
|
+
T
|
|
145
|
+
] extends [void] ? (...param: unknown[]) => void : (...param: [T, ...unknown[]]) => void);
|
|
146
|
+
type EventHookOn<T = any> = (fn: Callback<T>) => {
|
|
147
|
+
off: () => void;
|
|
148
|
+
};
|
|
149
|
+
type EventHookOff<T = any> = (fn: Callback<T>) => void;
|
|
150
|
+
type EventHookTrigger<T = any> = (...param: IsAny<T> extends true ? unknown[] : [T, ...unknown[]]) => Promise<unknown[]>;
|
|
151
|
+
interface EventHook<T = any> {
|
|
152
|
+
on: EventHookOn<T>;
|
|
153
|
+
off: EventHookOff<T>;
|
|
154
|
+
trigger: EventHookTrigger<T>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Utility for creating event hooks
|
|
158
|
+
*
|
|
159
|
+
* @see https://vueuse.org/createEventHook
|
|
160
|
+
*/
|
|
161
|
+
declare function createEventHook<T = any>(): EventHook<T>;
|
|
219
162
|
|
|
220
163
|
type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
221
164
|
interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
@@ -223,7 +166,7 @@ interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
|
223
166
|
args: Args;
|
|
224
167
|
thisArg: This;
|
|
225
168
|
}
|
|
226
|
-
type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> |
|
|
169
|
+
type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promisify<ReturnType<Invoke>>;
|
|
227
170
|
interface ConfigurableEventFilter {
|
|
228
171
|
/**
|
|
229
172
|
* Filter for if events should to be received.
|
|
@@ -237,7 +180,7 @@ interface DebounceFilterOptions {
|
|
|
237
180
|
* The maximum time allowed to be delayed before it's invoked.
|
|
238
181
|
* In milliseconds.
|
|
239
182
|
*/
|
|
240
|
-
maxWait?:
|
|
183
|
+
maxWait?: MaybeRefOrGetter<number>;
|
|
241
184
|
/**
|
|
242
185
|
* Whether to reject the last call if it's been cancel.
|
|
243
186
|
*
|
|
@@ -248,24 +191,40 @@ interface DebounceFilterOptions {
|
|
|
248
191
|
/**
|
|
249
192
|
* @internal
|
|
250
193
|
*/
|
|
251
|
-
declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): (this: any, ...args: ArgumentsType<T>) => Promise<ReturnType<T
|
|
194
|
+
declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): (this: any, ...args: ArgumentsType<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
252
195
|
declare const bypassFilter: EventFilter;
|
|
253
196
|
/**
|
|
254
197
|
* Create an EventFilter that debounce the events
|
|
255
|
-
*
|
|
256
|
-
* @param ms
|
|
257
|
-
* @param options
|
|
258
198
|
*/
|
|
259
|
-
declare function debounceFilter(ms:
|
|
199
|
+
declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): EventFilter<any[], any, AnyFn>;
|
|
200
|
+
interface ThrottleFilterOptions {
|
|
201
|
+
/**
|
|
202
|
+
* The maximum time allowed to be delayed before it's invoked.
|
|
203
|
+
*/
|
|
204
|
+
delay: MaybeRefOrGetter<number>;
|
|
205
|
+
/**
|
|
206
|
+
* Whether to invoke on the trailing edge of the timeout.
|
|
207
|
+
*/
|
|
208
|
+
trailing?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Whether to invoke on the leading edge of the timeout.
|
|
211
|
+
*/
|
|
212
|
+
leading?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Whether to reject the last call if it's been cancel.
|
|
215
|
+
*/
|
|
216
|
+
rejectOnCancel?: boolean;
|
|
217
|
+
}
|
|
260
218
|
/**
|
|
261
219
|
* Create an EventFilter that throttle the events
|
|
262
220
|
*
|
|
263
221
|
* @param ms
|
|
264
|
-
* @param [trailing
|
|
265
|
-
* @param [leading
|
|
266
|
-
* @param [rejectOnCancel
|
|
222
|
+
* @param [trailing]
|
|
223
|
+
* @param [leading]
|
|
224
|
+
* @param [rejectOnCancel]
|
|
267
225
|
*/
|
|
268
|
-
declare function throttleFilter(ms:
|
|
226
|
+
declare function throttleFilter(ms: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): EventFilter;
|
|
227
|
+
declare function throttleFilter(options: ThrottleFilterOptions): EventFilter;
|
|
269
228
|
/**
|
|
270
229
|
* EventFilter that gives extra controls to pause and resume the filter
|
|
271
230
|
*
|
|
@@ -276,13 +235,22 @@ declare function pausableFilter(extendFilter?: EventFilter): Pausable & {
|
|
|
276
235
|
eventFilter: EventFilter;
|
|
277
236
|
};
|
|
278
237
|
|
|
279
|
-
declare
|
|
280
|
-
declare
|
|
281
|
-
declare const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
238
|
+
declare const isClient: boolean;
|
|
239
|
+
declare const isWorker: boolean;
|
|
240
|
+
declare const isDef: <T = any>(val?: T) => val is T;
|
|
241
|
+
declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
|
|
242
|
+
declare const assert: (condition: boolean, ...infos: any[]) => void;
|
|
243
|
+
declare const isObject: (val: any) => val is object;
|
|
244
|
+
declare const now: () => number;
|
|
245
|
+
declare const timestamp: () => number;
|
|
246
|
+
declare const clamp: (n: number, min: number, max: number) => number;
|
|
247
|
+
declare const noop: () => void;
|
|
248
|
+
declare const rand: (min: number, max: number) => number;
|
|
249
|
+
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
250
|
+
declare const isIOS: boolean | "";
|
|
251
|
+
|
|
252
|
+
declare const hyphenate: (str: string) => string;
|
|
253
|
+
declare const camelize: (str: string) => string;
|
|
286
254
|
|
|
287
255
|
declare function promiseTimeout(ms: number, throwOnTimeout?: boolean, reason?: string): Promise<void>;
|
|
288
256
|
declare function identity<T>(arg: T): T;
|
|
@@ -320,10 +288,70 @@ declare function increaseWithUnit(target: string, delta: number): string;
|
|
|
320
288
|
declare function increaseWithUnit(target: string | number, delta: number): string | number;
|
|
321
289
|
/**
|
|
322
290
|
* Create a new subset object by giving keys
|
|
323
|
-
*
|
|
324
|
-
* @category Object
|
|
325
291
|
*/
|
|
326
292
|
declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
|
|
293
|
+
/**
|
|
294
|
+
* Create a new subset object by omit giving keys
|
|
295
|
+
*/
|
|
296
|
+
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
297
|
+
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
298
|
+
declare function getLifeCycleTarget(target?: any): any;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Keep states in the global scope to be reusable across Vue instances.
|
|
302
|
+
*
|
|
303
|
+
* @see https://vueuse.org/createGlobalState
|
|
304
|
+
* @param stateFactory A factory function to create the state
|
|
305
|
+
*/
|
|
306
|
+
declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): Fn;
|
|
307
|
+
|
|
308
|
+
interface CreateInjectionStateOptions<Return> {
|
|
309
|
+
/**
|
|
310
|
+
* Custom injectionKey for InjectionState
|
|
311
|
+
*/
|
|
312
|
+
injectionKey?: string | InjectionKey<Return>;
|
|
313
|
+
/**
|
|
314
|
+
* Default value for the InjectionState
|
|
315
|
+
*/
|
|
316
|
+
defaultValue?: Return;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Create global state that can be injected into components.
|
|
320
|
+
*
|
|
321
|
+
* @see https://vueuse.org/createInjectionState
|
|
322
|
+
*
|
|
323
|
+
*/
|
|
324
|
+
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Make a composable function usable with multiple Vue instances.
|
|
328
|
+
*
|
|
329
|
+
* @see https://vueuse.org/createSharedComposable
|
|
330
|
+
*/
|
|
331
|
+
declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): Fn;
|
|
332
|
+
|
|
333
|
+
interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
334
|
+
/**
|
|
335
|
+
* Is the extends properties enumerable
|
|
336
|
+
*
|
|
337
|
+
* @default false
|
|
338
|
+
*/
|
|
339
|
+
enumerable?: boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Unwrap for Ref properties
|
|
342
|
+
*
|
|
343
|
+
* @default true
|
|
344
|
+
*/
|
|
345
|
+
unwrap?: Unwrap;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Overload 1: Unwrap set to false
|
|
349
|
+
*/
|
|
350
|
+
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
|
|
351
|
+
/**
|
|
352
|
+
* Overload 2: Unwrap unset or set to true
|
|
353
|
+
*/
|
|
354
|
+
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
327
355
|
|
|
328
356
|
/**
|
|
329
357
|
* Shorthand for accessing `ref.value`
|
|
@@ -331,14 +359,36 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
331
359
|
declare function get<T>(ref: MaybeRef<T>): T;
|
|
332
360
|
declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
|
|
333
361
|
|
|
334
|
-
|
|
362
|
+
/**
|
|
363
|
+
* On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* injectLocal('MyInjectionKey', 1)
|
|
368
|
+
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
declare const injectLocal: typeof inject;
|
|
372
|
+
|
|
335
373
|
declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
|
|
374
|
+
declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
|
|
336
375
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
337
376
|
|
|
338
377
|
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
339
378
|
|
|
379
|
+
/**
|
|
380
|
+
* On the basis of `provide`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```ts
|
|
384
|
+
* provideLocal('MyInjectionKey', 1)
|
|
385
|
+
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
declare const provideLocal: typeof provide;
|
|
389
|
+
|
|
340
390
|
type Reactified<T, Computed extends boolean> = T extends (...args: infer A) => infer R ? (...args: {
|
|
341
|
-
[K in keyof A]: Computed extends true ?
|
|
391
|
+
[K in keyof A]: Computed extends true ? MaybeRefOrGetter<A[K]> : MaybeRef<A[K]>;
|
|
342
392
|
}) => ComputedRef<R> : never;
|
|
343
393
|
interface ReactifyOptions<T extends boolean> {
|
|
344
394
|
/**
|
|
@@ -358,7 +408,7 @@ interface ReactifyOptions<T extends boolean> {
|
|
|
358
408
|
declare function reactify<T extends Function, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): Reactified<T, K>;
|
|
359
409
|
|
|
360
410
|
type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = {
|
|
361
|
-
[K in Keys]: T[K] extends
|
|
411
|
+
[K in Keys]: T[K] extends AnyFn ? Reactified<T[K], S> : T[K];
|
|
362
412
|
};
|
|
363
413
|
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
364
414
|
/**
|
|
@@ -377,23 +427,19 @@ declare function reactifyObject<T extends object, S extends boolean = true>(obj:
|
|
|
377
427
|
/**
|
|
378
428
|
* Computed reactive object.
|
|
379
429
|
*/
|
|
380
|
-
declare function reactiveComputed<T extends
|
|
430
|
+
declare function reactiveComputed<T extends object>(fn: () => T): UnwrapNestedRefs<T>;
|
|
381
431
|
|
|
382
|
-
|
|
383
|
-
* Reactively omit fields from a reactive object
|
|
384
|
-
*
|
|
385
|
-
* @see https://vueuse.org/reactiveOmit
|
|
386
|
-
*/
|
|
432
|
+
type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
387
433
|
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
434
|
+
declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>): Partial<T>;
|
|
388
435
|
|
|
389
|
-
|
|
390
|
-
* Reactively pick fields from a reactive object
|
|
391
|
-
*
|
|
392
|
-
* @see https://vueuse.org/reactivePick
|
|
393
|
-
*/
|
|
436
|
+
type ReactivePickPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
394
437
|
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): {
|
|
395
438
|
[S in K]: UnwrapRef<T[S]>;
|
|
396
439
|
};
|
|
440
|
+
declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickPredicate<T>): {
|
|
441
|
+
[S in keyof T]?: UnwrapRef<T[S]>;
|
|
442
|
+
};
|
|
397
443
|
|
|
398
444
|
/**
|
|
399
445
|
* Create a ref which will be reset to the default value after some time.
|
|
@@ -402,20 +448,17 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
|
|
|
402
448
|
* @param defaultValue The value which will be set.
|
|
403
449
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
404
450
|
*/
|
|
405
|
-
declare function refAutoReset<T>(defaultValue: T
|
|
451
|
+
declare function refAutoReset<T>(defaultValue: MaybeRefOrGetter<T>, afterMs?: MaybeRefOrGetter<number>): Ref<T>;
|
|
406
452
|
|
|
407
453
|
/**
|
|
408
454
|
* Debounce updates of a ref.
|
|
409
455
|
*
|
|
410
456
|
* @return A new debounced ref.
|
|
411
457
|
*/
|
|
412
|
-
declare function refDebounced<T>(value: Ref<T>, ms?:
|
|
458
|
+
declare function refDebounced<T>(value: Ref<T>, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): Readonly<Ref<T>>;
|
|
413
459
|
|
|
414
460
|
/**
|
|
415
461
|
* Apply default value to a ref.
|
|
416
|
-
*
|
|
417
|
-
* @param source source ref
|
|
418
|
-
* @param targets
|
|
419
462
|
*/
|
|
420
463
|
declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
|
|
421
464
|
|
|
@@ -425,10 +468,10 @@ declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue:
|
|
|
425
468
|
*
|
|
426
469
|
* @param value Ref value to be watched with throttle effect
|
|
427
470
|
* @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
428
|
-
* @param [trailing
|
|
429
|
-
* @param [leading
|
|
471
|
+
* @param [trailing] if true, update the value again after the delay time is up
|
|
472
|
+
* @param [leading] if true, update the value on the leading edge of the ms timeout
|
|
430
473
|
*/
|
|
431
|
-
declare function refThrottled<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): Ref<T>;
|
|
474
|
+
declare function refThrottled<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): Ref<T, T>;
|
|
432
475
|
|
|
433
476
|
interface ControlledRefOptions<T> {
|
|
434
477
|
/**
|
|
@@ -445,40 +488,65 @@ interface ControlledRefOptions<T> {
|
|
|
445
488
|
onChanged?: (value: T, oldValue: T) => void;
|
|
446
489
|
}
|
|
447
490
|
/**
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* @param source
|
|
451
|
-
* @param fn
|
|
491
|
+
* Fine-grained controls over ref and its reactivity.
|
|
452
492
|
*/
|
|
453
|
-
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>):
|
|
493
|
+
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): vue.ShallowUnwrapRef<{
|
|
454
494
|
get: (tracking?: boolean) => T;
|
|
455
495
|
set: (value: T, triggering?: boolean) => void;
|
|
456
496
|
untrackedGet: () => T;
|
|
457
497
|
silentSet: (v: T) => void;
|
|
458
498
|
peek: () => T;
|
|
459
499
|
lay: (v: T) => void;
|
|
460
|
-
}> &
|
|
500
|
+
}> & vue.Ref<T, T>;
|
|
461
501
|
/**
|
|
462
502
|
* Alias for `refWithControl`
|
|
463
503
|
*/
|
|
464
504
|
declare const controlledRef: typeof refWithControl;
|
|
465
505
|
|
|
506
|
+
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
507
|
+
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
508
|
+
|
|
509
|
+
type Direction = 'ltr' | 'rtl' | 'both';
|
|
510
|
+
type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
466
511
|
/**
|
|
467
|
-
*
|
|
512
|
+
* A = B
|
|
468
513
|
*/
|
|
469
|
-
|
|
470
|
-
declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>;
|
|
471
|
-
declare function resolveRef<T>(r: T): Ref<T>;
|
|
472
|
-
|
|
514
|
+
type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
|
|
473
515
|
/**
|
|
474
|
-
*
|
|
516
|
+
* A ∩ B ≠ ∅
|
|
475
517
|
*/
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
518
|
+
type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
|
|
519
|
+
/**
|
|
520
|
+
* A ⊆ B
|
|
521
|
+
*/
|
|
522
|
+
type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
|
|
523
|
+
/**
|
|
524
|
+
* A ∩ B = ∅
|
|
525
|
+
*/
|
|
526
|
+
type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
|
|
527
|
+
interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
|
|
528
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
|
|
529
|
+
}
|
|
530
|
+
type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R> = (Equal<[IncludeType, D], ['LR', 'ltr']> & Equal<[IncludeType, D], ['RL', 'rtl']>) extends true ? {
|
|
531
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
|
|
532
|
+
} : {
|
|
533
|
+
transform: Pick<Transform<L, R>, D>;
|
|
534
|
+
};
|
|
535
|
+
type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
|
|
536
|
+
transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
|
|
537
|
+
} : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
|
|
538
|
+
type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
|
|
539
|
+
transform: Transform<L, R>;
|
|
540
|
+
} : D extends Exclude<Direction, 'both'> ? {
|
|
541
|
+
transform: Pick<Transform<L, R>, D>;
|
|
542
|
+
} : never;
|
|
543
|
+
type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
|
|
544
|
+
interface Transform<L, R> {
|
|
545
|
+
ltr: (left: L) => R;
|
|
546
|
+
rtl: (right: R) => L;
|
|
547
|
+
}
|
|
548
|
+
type TransformType<D extends Direction, L, R> = Equal<L, R> extends true ? EqualType<D, L, R> : IncludeButNotEqual<L, R> extends true ? StrictIncludeType<'LR', D, L, R> : IncludeButNotEqual<R, L> extends true ? StrictIncludeType<'RL', D, L, R> : IntersectButNotEqual<L, R> extends true ? IntersectButNotEqualType<D, L, R> : NotIntersect<L, R> extends true ? NotIntersectType<D, L, R> : never;
|
|
549
|
+
type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
|
|
482
550
|
/**
|
|
483
551
|
* Watch deeply
|
|
484
552
|
*
|
|
@@ -496,22 +564,18 @@ interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
|
|
|
496
564
|
*
|
|
497
565
|
* @default 'both'
|
|
498
566
|
*/
|
|
499
|
-
direction?:
|
|
500
|
-
|
|
501
|
-
* Custom transform function
|
|
502
|
-
*/
|
|
503
|
-
transform?: {
|
|
504
|
-
ltr?: (left: L) => R;
|
|
505
|
-
rtl?: (right: R) => L;
|
|
506
|
-
};
|
|
507
|
-
}
|
|
567
|
+
direction?: D;
|
|
568
|
+
} & TransformType<D, L, R>;
|
|
508
569
|
/**
|
|
509
570
|
* Two-way refs synchronization.
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
571
|
+
* From the set theory perspective to restrict the option's type
|
|
572
|
+
* Check in the following order:
|
|
573
|
+
* 1. L = R
|
|
574
|
+
* 2. L ∩ R ≠ ∅
|
|
575
|
+
* 3. L ⊆ R
|
|
576
|
+
* 4. L ∩ R = ∅
|
|
513
577
|
*/
|
|
514
|
-
declare function syncRef<L, R =
|
|
578
|
+
declare function syncRef<L, R, D extends Direction = 'both'>(left: Ref<L>, right: Ref<R>, ...[options]: Equal<L, R> extends true ? [options?: SyncRefOptions<L, R, D>] : [options: SyncRefOptions<L, R, D>]): () => void;
|
|
515
579
|
|
|
516
580
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
517
581
|
/**
|
|
@@ -533,7 +597,7 @@ interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
|
533
597
|
* @param source source ref
|
|
534
598
|
* @param targets
|
|
535
599
|
*/
|
|
536
|
-
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions):
|
|
600
|
+
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): vue.WatchHandle;
|
|
537
601
|
|
|
538
602
|
/**
|
|
539
603
|
* Converts ref to reactive.
|
|
@@ -541,38 +605,72 @@ declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[],
|
|
|
541
605
|
* @see https://vueuse.org/toReactive
|
|
542
606
|
* @param objectRef A ref of object
|
|
543
607
|
*/
|
|
544
|
-
declare function toReactive<T extends object>(objectRef: MaybeRef<T>): T
|
|
608
|
+
declare function toReactive<T extends object>(objectRef: MaybeRef<T>): UnwrapNestedRefs<T>;
|
|
545
609
|
|
|
610
|
+
/**
|
|
611
|
+
* Normalize value/ref/getter to `ref` or `computed`.
|
|
612
|
+
*/
|
|
613
|
+
declare function toRef<T>(r: () => T): Readonly<Ref<T>>;
|
|
614
|
+
declare function toRef<T>(r: ComputedRef<T>): ComputedRef<T>;
|
|
615
|
+
declare function toRef<T>(r: MaybeRefOrGetter<T>): Ref<T>;
|
|
616
|
+
declare function toRef<T>(r: T): Ref<T>;
|
|
617
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
618
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
|
619
|
+
/**
|
|
620
|
+
* @deprecated use `toRef` instead
|
|
621
|
+
*/
|
|
622
|
+
declare const resolveRef: typeof toRef;
|
|
623
|
+
|
|
624
|
+
interface ToRefsOptions {
|
|
625
|
+
/**
|
|
626
|
+
* Replace the original ref with a copy on property update.
|
|
627
|
+
*
|
|
628
|
+
* @default true
|
|
629
|
+
*/
|
|
630
|
+
replaceRef?: MaybeRefOrGetter<boolean>;
|
|
631
|
+
}
|
|
546
632
|
/**
|
|
547
633
|
* Extended `toRefs` that also accepts refs of an object.
|
|
548
634
|
*
|
|
549
635
|
* @see https://vueuse.org/toRefs
|
|
550
636
|
* @param objectRef A ref or normal object or array.
|
|
551
637
|
*/
|
|
552
|
-
declare function toRefs<T extends object>(objectRef: MaybeRef<T
|
|
638
|
+
declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRefsOptions): ToRefs<T>;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Get the value of value/ref/getter.
|
|
642
|
+
*/
|
|
643
|
+
declare function toValue<T>(r: MaybeRefOrGetter<T>): T;
|
|
644
|
+
/**
|
|
645
|
+
* @deprecated use `toValue` instead
|
|
646
|
+
*/
|
|
647
|
+
declare const resolveUnref: typeof toValue;
|
|
553
648
|
|
|
554
649
|
/**
|
|
555
650
|
* Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
|
|
556
651
|
*
|
|
557
652
|
* @param fn
|
|
558
653
|
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
654
|
+
* @param target
|
|
559
655
|
*/
|
|
560
|
-
declare function tryOnBeforeMount(fn: Fn, sync?: boolean): void;
|
|
656
|
+
declare function tryOnBeforeMount(fn: Fn, sync?: boolean, target?: any): void;
|
|
561
657
|
|
|
562
658
|
/**
|
|
563
659
|
* Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
|
|
564
660
|
*
|
|
565
661
|
* @param fn
|
|
662
|
+
* @param target
|
|
566
663
|
*/
|
|
567
|
-
declare function tryOnBeforeUnmount(fn: Fn): void;
|
|
664
|
+
declare function tryOnBeforeUnmount(fn: Fn, target?: any): void;
|
|
568
665
|
|
|
569
666
|
/**
|
|
570
667
|
* Call onMounted() if it's inside a component lifecycle, if not, just call the function
|
|
571
668
|
*
|
|
572
669
|
* @param fn
|
|
573
670
|
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
671
|
+
* @param target
|
|
574
672
|
*/
|
|
575
|
-
declare function tryOnMounted(fn: Fn, sync?: boolean): void;
|
|
673
|
+
declare function tryOnMounted(fn: Fn, sync?: boolean, target?: any): void;
|
|
576
674
|
|
|
577
675
|
/**
|
|
578
676
|
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
@@ -585,8 +683,9 @@ declare function tryOnScopeDispose(fn: Fn): boolean;
|
|
|
585
683
|
* Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
|
|
586
684
|
*
|
|
587
685
|
* @param fn
|
|
686
|
+
* @param target
|
|
588
687
|
*/
|
|
589
|
-
declare function tryOnUnmounted(fn: Fn): void;
|
|
688
|
+
declare function tryOnUnmounted(fn: Fn, target?: any): void;
|
|
590
689
|
|
|
591
690
|
interface UntilToMatchOptions {
|
|
592
691
|
/**
|
|
@@ -616,23 +715,22 @@ interface UntilToMatchOptions {
|
|
|
616
715
|
deep?: WatchOptions['deep'];
|
|
617
716
|
}
|
|
618
717
|
interface UntilBaseInstance<T, Not extends boolean = false> {
|
|
619
|
-
toMatch<U extends T = T>(condition: (v: T) => v is U, options?: UntilToMatchOptions)
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
changedTimes(n?: number, options?: UntilToMatchOptions): Promise<T>;
|
|
718
|
+
toMatch: (<U extends T = T>(condition: (v: T) => v is U, options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, U>> : Promise<U>) & ((condition: (v: T) => boolean, options?: UntilToMatchOptions) => Promise<T>);
|
|
719
|
+
changed: (options?: UntilToMatchOptions) => Promise<T>;
|
|
720
|
+
changedTimes: (n?: number, options?: UntilToMatchOptions) => Promise<T>;
|
|
623
721
|
}
|
|
624
722
|
type Falsy = false | void | null | undefined | 0 | 0n | '';
|
|
625
723
|
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
|
|
626
724
|
readonly not: UntilValueInstance<T, Not extends true ? false : true>;
|
|
627
|
-
toBe<P = T>(value:
|
|
628
|
-
toBeTruthy(options?: UntilToMatchOptions)
|
|
629
|
-
toBeNull(options?: UntilToMatchOptions)
|
|
630
|
-
toBeUndefined(options?: UntilToMatchOptions)
|
|
631
|
-
toBeNaN(options?: UntilToMatchOptions)
|
|
725
|
+
toBe: <P = T>(value: MaybeRefOrGetter<P>, options?: UntilToMatchOptions) => Not extends true ? Promise<T> : Promise<P>;
|
|
726
|
+
toBeTruthy: (options?: UntilToMatchOptions) => Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
|
|
727
|
+
toBeNull: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
|
|
728
|
+
toBeUndefined: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
|
|
729
|
+
toBeNaN: (options?: UntilToMatchOptions) => Promise<T>;
|
|
632
730
|
}
|
|
633
731
|
interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
634
732
|
readonly not: UntilArrayInstance<T>;
|
|
635
|
-
toContains(value:
|
|
733
|
+
toContains: (value: MaybeRefOrGetter<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions) => Promise<T>;
|
|
636
734
|
}
|
|
637
735
|
/**
|
|
638
736
|
* Promised one-time watch for changes
|
|
@@ -647,127 +745,148 @@ interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
|
647
745
|
* alert('Counter is now larger than 7!')
|
|
648
746
|
* ```
|
|
649
747
|
*/
|
|
650
|
-
declare function until<T extends unknown[]>(r: WatchSource<T> |
|
|
651
|
-
declare function until<T>(r: WatchSource<T> |
|
|
748
|
+
declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilArrayInstance<T>;
|
|
749
|
+
declare function until<T>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilValueInstance<T>;
|
|
750
|
+
|
|
751
|
+
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, key?: keyof T): ComputedRef<T[]>;
|
|
752
|
+
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, compareFn?: (value: T, othVal: T) => boolean): ComputedRef<T[]>;
|
|
652
753
|
|
|
653
754
|
/**
|
|
654
755
|
* Reactive `Array.every`
|
|
655
756
|
*
|
|
656
757
|
* @see https://vueuse.org/useArrayEvery
|
|
657
|
-
* @param
|
|
758
|
+
* @param list - the array was called upon.
|
|
658
759
|
* @param fn - a function to test each element.
|
|
659
760
|
*
|
|
660
|
-
* @returns
|
|
761
|
+
* @returns **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
661
762
|
*/
|
|
662
|
-
declare function useArrayEvery<T>(list:
|
|
763
|
+
declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): ComputedRef<boolean>;
|
|
663
764
|
|
|
664
765
|
/**
|
|
665
766
|
* Reactive `Array.filter`
|
|
666
767
|
*
|
|
667
768
|
* @see https://vueuse.org/useArrayFilter
|
|
668
|
-
* @param
|
|
769
|
+
* @param list - the array was called upon.
|
|
669
770
|
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
670
771
|
*
|
|
671
|
-
* @returns
|
|
772
|
+
* @returns a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
|
|
672
773
|
*/
|
|
673
|
-
declare function useArrayFilter<T>(list:
|
|
774
|
+
declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): ComputedRef<S[]>;
|
|
775
|
+
declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): ComputedRef<T[]>;
|
|
674
776
|
|
|
675
777
|
/**
|
|
676
778
|
* Reactive `Array.find`
|
|
677
779
|
*
|
|
678
780
|
* @see https://vueuse.org/useArrayFind
|
|
679
|
-
* @param
|
|
781
|
+
* @param list - the array was called upon.
|
|
680
782
|
* @param fn - a function to test each element.
|
|
681
783
|
*
|
|
682
784
|
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
683
785
|
*/
|
|
684
|
-
declare function useArrayFind<T>(list:
|
|
786
|
+
declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
685
787
|
|
|
686
788
|
/**
|
|
687
789
|
* Reactive `Array.findIndex`
|
|
688
790
|
*
|
|
689
791
|
* @see https://vueuse.org/useArrayFindIndex
|
|
690
|
-
* @param
|
|
792
|
+
* @param list - the array was called upon.
|
|
691
793
|
* @param fn - a function to test each element.
|
|
692
794
|
*
|
|
693
|
-
* @returns
|
|
795
|
+
* @returns the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
694
796
|
*/
|
|
695
|
-
declare function useArrayFindIndex<T>(list:
|
|
797
|
+
declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): ComputedRef<number>;
|
|
696
798
|
|
|
697
799
|
/**
|
|
698
800
|
* Reactive `Array.findLast`
|
|
699
801
|
*
|
|
700
802
|
* @see https://vueuse.org/useArrayFindLast
|
|
701
|
-
* @param
|
|
803
|
+
* @param list - the array was called upon.
|
|
702
804
|
* @param fn - a function to test each element.
|
|
703
805
|
*
|
|
704
806
|
* @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
705
807
|
*/
|
|
706
|
-
declare function useArrayFindLast<T>(list:
|
|
808
|
+
declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
809
|
+
|
|
810
|
+
type UseArrayIncludesComparatorFn<T, V> = ((element: T, value: V, index: number, array: MaybeRefOrGetter<T>[]) => boolean);
|
|
811
|
+
interface UseArrayIncludesOptions<T, V> {
|
|
812
|
+
fromIndex?: number;
|
|
813
|
+
comparator?: UseArrayIncludesComparatorFn<T, V> | keyof T;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Reactive `Array.includes`
|
|
817
|
+
*
|
|
818
|
+
* @see https://vueuse.org/useArrayIncludes
|
|
819
|
+
*
|
|
820
|
+
* @returns true if the `value` is found in the array. Otherwise, false.
|
|
821
|
+
*/
|
|
822
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): ComputedRef<boolean>;
|
|
823
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): ComputedRef<boolean>;
|
|
824
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>): ComputedRef<boolean>;
|
|
707
825
|
|
|
708
826
|
/**
|
|
709
827
|
* Reactive `Array.join`
|
|
710
828
|
*
|
|
711
829
|
* @see https://vueuse.org/useArrayJoin
|
|
712
|
-
* @param
|
|
713
|
-
* @param
|
|
830
|
+
* @param list - the array was called upon.
|
|
831
|
+
* @param separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
|
|
714
832
|
*
|
|
715
|
-
* @returns
|
|
833
|
+
* @returns a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
716
834
|
*/
|
|
717
|
-
declare function useArrayJoin(list:
|
|
835
|
+
declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, separator?: MaybeRefOrGetter<string>): ComputedRef<string>;
|
|
718
836
|
|
|
719
837
|
/**
|
|
720
838
|
* Reactive `Array.map`
|
|
721
839
|
*
|
|
722
840
|
* @see https://vueuse.org/useArrayMap
|
|
723
|
-
* @param
|
|
841
|
+
* @param list - the array was called upon.
|
|
724
842
|
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
725
843
|
*
|
|
726
|
-
* @returns
|
|
844
|
+
* @returns a new array with each element being the result of the callback function.
|
|
727
845
|
*/
|
|
728
|
-
declare function useArrayMap<T, U = T>(list:
|
|
846
|
+
declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): ComputedRef<U[]>;
|
|
729
847
|
|
|
730
848
|
type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
731
849
|
/**
|
|
732
850
|
* Reactive `Array.reduce`
|
|
733
851
|
*
|
|
734
852
|
* @see https://vueuse.org/useArrayReduce
|
|
735
|
-
* @param
|
|
853
|
+
* @param list - the array was called upon.
|
|
736
854
|
* @param reducer - a "reducer" function.
|
|
737
855
|
*
|
|
738
856
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
739
857
|
*/
|
|
740
|
-
declare function useArrayReduce<T>(list:
|
|
858
|
+
declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
|
|
741
859
|
/**
|
|
742
860
|
* Reactive `Array.reduce`
|
|
743
861
|
*
|
|
744
862
|
* @see https://vueuse.org/useArrayReduce
|
|
745
|
-
* @param
|
|
863
|
+
* @param list - the array was called upon.
|
|
746
864
|
* @param reducer - a "reducer" function.
|
|
747
865
|
* @param initialValue - a value to be initialized the first time when the callback is called.
|
|
748
866
|
*
|
|
749
867
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
750
868
|
*/
|
|
751
|
-
declare function useArrayReduce<T, U>(list:
|
|
869
|
+
declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): ComputedRef<U>;
|
|
752
870
|
|
|
753
871
|
/**
|
|
754
872
|
* Reactive `Array.some`
|
|
755
873
|
*
|
|
756
874
|
* @see https://vueuse.org/useArraySome
|
|
757
|
-
* @param
|
|
875
|
+
* @param list - the array was called upon.
|
|
758
876
|
* @param fn - a function to test each element.
|
|
759
877
|
*
|
|
760
|
-
* @returns
|
|
878
|
+
* @returns **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
761
879
|
*/
|
|
762
|
-
declare function useArraySome<T>(list:
|
|
880
|
+
declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): ComputedRef<boolean>;
|
|
763
881
|
|
|
764
882
|
/**
|
|
765
883
|
* reactive unique array
|
|
766
884
|
* @see https://vueuse.org/useArrayUnique
|
|
767
|
-
* @param
|
|
768
|
-
* @
|
|
885
|
+
* @param list - the array was called upon.
|
|
886
|
+
* @param compareFn
|
|
887
|
+
* @returns A computed ref that returns a unique array of items.
|
|
769
888
|
*/
|
|
770
|
-
declare function useArrayUnique<T>(list:
|
|
889
|
+
declare function useArrayUnique<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, compareFn?: (a: T, b: T, array: T[]) => boolean): ComputedRef<T[]>;
|
|
771
890
|
|
|
772
891
|
interface UseCounterOptions {
|
|
773
892
|
min?: number;
|
|
@@ -777,11 +896,11 @@ interface UseCounterOptions {
|
|
|
777
896
|
* Basic counter with utility functions.
|
|
778
897
|
*
|
|
779
898
|
* @see https://vueuse.org/useCounter
|
|
780
|
-
* @param [initialValue
|
|
781
|
-
* @param
|
|
899
|
+
* @param [initialValue]
|
|
900
|
+
* @param options
|
|
782
901
|
*/
|
|
783
|
-
declare function useCounter(initialValue?: number
|
|
784
|
-
count:
|
|
902
|
+
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
903
|
+
count: vue.Ref<number, MaybeRef<number>>;
|
|
785
904
|
inc: (delta?: number) => number;
|
|
786
905
|
dec: (delta?: number) => number;
|
|
787
906
|
get: () => number;
|
|
@@ -796,15 +915,15 @@ interface UseDateFormatOptions {
|
|
|
796
915
|
*
|
|
797
916
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
|
|
798
917
|
*/
|
|
799
|
-
locales?: Intl.LocalesArgument
|
|
918
|
+
locales?: MaybeRefOrGetter<Intl.LocalesArgument>;
|
|
800
919
|
/**
|
|
801
920
|
* A custom function to re-modify the way to display meridiem
|
|
802
921
|
*
|
|
803
922
|
*/
|
|
804
923
|
customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
|
|
805
924
|
}
|
|
806
|
-
declare
|
|
807
|
-
declare
|
|
925
|
+
declare function formatDate(date: Date, formatStr: string, options?: UseDateFormatOptions): string;
|
|
926
|
+
declare function normalizeDate(date: DateLike): Date;
|
|
808
927
|
/**
|
|
809
928
|
* Get the formatted date according to the string of tokens passed in.
|
|
810
929
|
*
|
|
@@ -813,7 +932,7 @@ declare const normalizeDate: (date: DateLike) => Date;
|
|
|
813
932
|
* @param formatStr - The combination of tokens to format the date
|
|
814
933
|
* @param options - UseDateFormatOptions
|
|
815
934
|
*/
|
|
816
|
-
declare function useDateFormat(date:
|
|
935
|
+
declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions): vue.ComputedRef<string>;
|
|
817
936
|
type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
818
937
|
|
|
819
938
|
/**
|
|
@@ -822,11 +941,11 @@ type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
|
822
941
|
* @see https://vueuse.org/useDebounceFn
|
|
823
942
|
* @param fn A function to be executed after delay milliseconds debounced.
|
|
824
943
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
825
|
-
* @param
|
|
944
|
+
* @param options Options
|
|
826
945
|
*
|
|
827
946
|
* @return A new, debounce, function.
|
|
828
947
|
*/
|
|
829
|
-
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?:
|
|
948
|
+
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): PromisifyFn<T>;
|
|
830
949
|
|
|
831
950
|
interface UseIntervalOptions<Controls extends boolean> {
|
|
832
951
|
/**
|
|
@@ -857,8 +976,8 @@ interface UseIntervalControls {
|
|
|
857
976
|
* @param interval
|
|
858
977
|
* @param options
|
|
859
978
|
*/
|
|
860
|
-
declare function useInterval(interval?:
|
|
861
|
-
declare function useInterval(interval:
|
|
979
|
+
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
980
|
+
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls & Pausable;
|
|
862
981
|
|
|
863
982
|
interface UseIntervalFnOptions {
|
|
864
983
|
/**
|
|
@@ -868,7 +987,7 @@ interface UseIntervalFnOptions {
|
|
|
868
987
|
*/
|
|
869
988
|
immediate?: boolean;
|
|
870
989
|
/**
|
|
871
|
-
* Execute the callback
|
|
990
|
+
* Execute the callback immediately after calling `resume`
|
|
872
991
|
*
|
|
873
992
|
* @default false
|
|
874
993
|
*/
|
|
@@ -881,7 +1000,7 @@ interface UseIntervalFnOptions {
|
|
|
881
1000
|
* @param interval
|
|
882
1001
|
* @param options
|
|
883
1002
|
*/
|
|
884
|
-
declare function useIntervalFn(cb: Fn, interval?:
|
|
1003
|
+
declare function useIntervalFn(cb: Fn, interval?: MaybeRefOrGetter<number>, options?: UseIntervalFnOptions): Pausable;
|
|
885
1004
|
|
|
886
1005
|
interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
|
|
887
1006
|
initialValue?: InitialValue;
|
|
@@ -892,8 +1011,7 @@ interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends
|
|
|
892
1011
|
* @see https://vueuse.org/useLastChanged
|
|
893
1012
|
*/
|
|
894
1013
|
declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>): Ref<number | null>;
|
|
895
|
-
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true>): Ref<number>;
|
|
896
|
-
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<boolean, number>): Ref<number>;
|
|
1014
|
+
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>): Ref<number>;
|
|
897
1015
|
|
|
898
1016
|
/**
|
|
899
1017
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
@@ -902,16 +1020,17 @@ declare function useLastChanged(source: WatchSource, options: UseLastChangedOpti
|
|
|
902
1020
|
* @param fn A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
903
1021
|
* to `callback` when the throttled-function is executed.
|
|
904
1022
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
1023
|
+
* (default value: 200)
|
|
905
1024
|
*
|
|
906
|
-
* @param [trailing
|
|
1025
|
+
* @param [trailing] if true, call fn again after the time is up (default value: false)
|
|
907
1026
|
*
|
|
908
|
-
* @param [leading
|
|
1027
|
+
* @param [leading] if true, call fn on the leading edge of the ms timeout (default value: true)
|
|
909
1028
|
*
|
|
910
|
-
* @param [rejectOnCancel
|
|
1029
|
+
* @param [rejectOnCancel] if true, reject the last call if it's been cancel (default value: false)
|
|
911
1030
|
*
|
|
912
1031
|
* @return A new, throttled, function.
|
|
913
1032
|
*/
|
|
914
|
-
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?:
|
|
1033
|
+
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): PromisifyFn<T>;
|
|
915
1034
|
|
|
916
1035
|
interface UseTimeoutFnOptions {
|
|
917
1036
|
/**
|
|
@@ -928,7 +1047,7 @@ interface UseTimeoutFnOptions {
|
|
|
928
1047
|
* @param interval
|
|
929
1048
|
* @param options
|
|
930
1049
|
*/
|
|
931
|
-
declare function useTimeoutFn<CallbackFn extends
|
|
1050
|
+
declare function useTimeoutFn<CallbackFn extends AnyFn>(cb: CallbackFn, interval: MaybeRefOrGetter<number>, options?: UseTimeoutFnOptions): Stoppable<Parameters<CallbackFn> | []>;
|
|
932
1051
|
|
|
933
1052
|
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
934
1053
|
/**
|
|
@@ -949,8 +1068,8 @@ interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOption
|
|
|
949
1068
|
* @param interval
|
|
950
1069
|
* @param options
|
|
951
1070
|
*/
|
|
952
|
-
declare function useTimeout(interval?: number
|
|
953
|
-
declare function useTimeout(interval: number
|
|
1071
|
+
declare function useTimeout(interval?: MaybeRefOrGetter<number>, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
|
1072
|
+
declare function useTimeout(interval: MaybeRefOrGetter<number>, options: UseTimeoutOptions<true>): {
|
|
954
1073
|
ready: ComputedRef<boolean>;
|
|
955
1074
|
} & Stoppable;
|
|
956
1075
|
|
|
@@ -974,20 +1093,20 @@ interface UseToNumberOptions {
|
|
|
974
1093
|
nanToZero?: boolean;
|
|
975
1094
|
}
|
|
976
1095
|
/**
|
|
977
|
-
*
|
|
1096
|
+
* Reactively convert a string ref to number.
|
|
978
1097
|
*/
|
|
979
|
-
declare function useToNumber(value:
|
|
1098
|
+
declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
|
|
980
1099
|
|
|
981
1100
|
/**
|
|
982
1101
|
* Reactively convert a ref to string.
|
|
983
1102
|
*
|
|
984
1103
|
* @see https://vueuse.org/useToString
|
|
985
1104
|
*/
|
|
986
|
-
declare function useToString(value:
|
|
1105
|
+
declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<string>;
|
|
987
1106
|
|
|
988
1107
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
989
|
-
truthyValue?:
|
|
990
|
-
falsyValue?:
|
|
1108
|
+
truthyValue?: MaybeRefOrGetter<Truthy>;
|
|
1109
|
+
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
991
1110
|
}
|
|
992
1111
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
993
1112
|
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [Ref<T>, (value?: T) => T];
|
|
@@ -998,7 +1117,7 @@ declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, ad
|
|
|
998
1117
|
*
|
|
999
1118
|
* @see https://vueuse.org/watchArray
|
|
1000
1119
|
*/
|
|
1001
|
-
declare function watchArray<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T[]> | T[], cb: WatchArrayCallback<T[], Immediate extends true ? T[] | undefined : T[]>, options?: WatchOptions<Immediate>):
|
|
1120
|
+
declare function watchArray<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T[]> | T[], cb: WatchArrayCallback<T[], Immediate extends true ? T[] | undefined : T[]>, options?: WatchOptions<Immediate>): vue.WatchHandle;
|
|
1002
1121
|
|
|
1003
1122
|
interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {
|
|
1004
1123
|
}
|
|
@@ -1007,7 +1126,7 @@ declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>
|
|
|
1007
1126
|
declare function watchWithFilter<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle;
|
|
1008
1127
|
|
|
1009
1128
|
interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
|
|
1010
|
-
count:
|
|
1129
|
+
count: MaybeRefOrGetter<number>;
|
|
1011
1130
|
}
|
|
1012
1131
|
interface WatchAtMostReturn {
|
|
1013
1132
|
stop: WatchStopHandle;
|
|
@@ -1017,12 +1136,16 @@ declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immedia
|
|
|
1017
1136
|
declare function watchAtMost<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1018
1137
|
|
|
1019
1138
|
interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
|
|
1020
|
-
debounce?:
|
|
1139
|
+
debounce?: MaybeRefOrGetter<number>;
|
|
1021
1140
|
}
|
|
1022
1141
|
declare function watchDebounced<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
|
|
1023
1142
|
declare function watchDebounced<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
|
|
1024
1143
|
declare function watchDebounced<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle;
|
|
1025
1144
|
|
|
1145
|
+
declare function watchDeep<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchStopHandle;
|
|
1146
|
+
declare function watchDeep<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchStopHandle;
|
|
1147
|
+
declare function watchDeep<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: Omit<WatchOptions<Immediate>, 'deep'>): WatchStopHandle;
|
|
1148
|
+
|
|
1026
1149
|
type IgnoredUpdater = (updater: () => void) => void;
|
|
1027
1150
|
interface WatchIgnorableReturn {
|
|
1028
1151
|
ignoreUpdates: IgnoredUpdater;
|
|
@@ -1033,8 +1156,12 @@ declare function watchIgnorable<T extends Readonly<WatchSource<unknown>[]>, Imme
|
|
|
1033
1156
|
declare function watchIgnorable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
|
|
1034
1157
|
declare function watchIgnorable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn;
|
|
1035
1158
|
|
|
1036
|
-
declare function
|
|
1037
|
-
declare function
|
|
1159
|
+
declare function watchImmediate<T extends Readonly<WatchSource<unknown>[]>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1160
|
+
declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1161
|
+
declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1162
|
+
|
|
1163
|
+
declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
1164
|
+
declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
1038
1165
|
|
|
1039
1166
|
interface WatchPausableReturn extends Pausable {
|
|
1040
1167
|
stop: WatchStopHandle;
|
|
@@ -1044,7 +1171,7 @@ declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(s
|
|
|
1044
1171
|
declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn;
|
|
1045
1172
|
|
|
1046
1173
|
interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
1047
|
-
throttle?:
|
|
1174
|
+
throttle?: MaybeRefOrGetter<number>;
|
|
1048
1175
|
trailing?: boolean;
|
|
1049
1176
|
leading?: boolean;
|
|
1050
1177
|
}
|
|
@@ -1062,11 +1189,21 @@ declare function watchTriggerable<T extends Readonly<WatchSource<unknown>[]>, Fn
|
|
|
1062
1189
|
declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1063
1190
|
declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1064
1191
|
|
|
1192
|
+
interface WheneverOptions extends WatchOptions {
|
|
1193
|
+
/**
|
|
1194
|
+
* Only trigger once when the condition is met
|
|
1195
|
+
*
|
|
1196
|
+
* Override the `once` option in `WatchOptions`
|
|
1197
|
+
*
|
|
1198
|
+
* @default false
|
|
1199
|
+
*/
|
|
1200
|
+
once?: boolean;
|
|
1201
|
+
}
|
|
1065
1202
|
/**
|
|
1066
1203
|
* Shorthand for watching value to be truthy
|
|
1067
1204
|
*
|
|
1068
1205
|
* @see https://vueuse.org/whenever
|
|
1069
1206
|
*/
|
|
1070
|
-
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?:
|
|
1207
|
+
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1071
1208
|
|
|
1072
|
-
export { AnyFn, ArgumentsType, Arrayable, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions,
|
|
1209
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|