@histoire/vendors 0.17.17 → 1.0.0-alpha.2
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 +663 -850
- 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 +4578 -3115
- 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 +167 -188
- package/dist/client/node_modules/@babel/types/lib/index-legacy.d.ts +2786 -0
- package/dist/client/node_modules/@babel/types/lib/index.d.ts +3286 -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 +122 -327
- package/dist/client/node_modules/@iconify/vue/dist/offline.d.ts +36 -269
- 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 +2323 -666
- package/dist/client/node_modules/@vueuse/core/package.json +22 -12
- package/dist/client/node_modules/@vueuse/metadata/index.d.ts +7 -5
- package/dist/client/node_modules/@vueuse/metadata/package.json +14 -7
- package/dist/client/node_modules/@vueuse/shared/index.d.ts +451 -280
- package/dist/client/node_modules/@vueuse/shared/package.json +17 -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 +22 -19
- package/dist/client/node_modules/postcss/lib/comment.d.ts +6 -5
- package/dist/client/node_modules/postcss/lib/container.d.ts +72 -82
- package/dist/client/node_modules/postcss/lib/css-syntax-error.d.ts +1 -1
- package/dist/client/node_modules/postcss/lib/declaration.d.ts +16 -13
- package/dist/client/node_modules/postcss/lib/document.d.ts +4 -4
- package/dist/client/node_modules/postcss/lib/input.d.ts +28 -16
- package/dist/client/node_modules/postcss/lib/lazy-result.d.ts +40 -40
- package/dist/client/node_modules/postcss/lib/list.d.ts +5 -2
- package/dist/client/node_modules/postcss/lib/no-work-result.d.ts +5 -5
- 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 +10 -11
- package/dist/client/node_modules/postcss/lib/root.d.ts +4 -4
- package/dist/client/node_modules/postcss/lib/rule.d.ts +22 -13
- 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,
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { WatchOptionsBase, Ref, WatchSource, ComputedGetter, ComputedRef, WritableComputedOptions, WritableComputedRef, WatchOptions, MaybeRef, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, 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
|
-
*
|
|
46
|
+
* Maybe it's a computed ref, or a readonly value, or a getter function
|
|
117
47
|
*/
|
|
118
|
-
type
|
|
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
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
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,47 @@ 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 : [T] extends [any[]] ? (...param: T) => 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: Parameters<Callback<T>>) => Promise<unknown[]>;
|
|
151
|
+
interface EventHook<T = any> {
|
|
152
|
+
on: EventHookOn<T>;
|
|
153
|
+
off: EventHookOff<T>;
|
|
154
|
+
trigger: EventHookTrigger<T>;
|
|
155
|
+
clear: () => void;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Utility for creating event hooks
|
|
159
|
+
*
|
|
160
|
+
* @see https://vueuse.org/createEventHook
|
|
161
|
+
*/
|
|
162
|
+
declare function createEventHook<T = any>(): EventHook<T>;
|
|
219
163
|
|
|
220
164
|
type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
221
165
|
interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
@@ -223,7 +167,7 @@ interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
|
223
167
|
args: Args;
|
|
224
168
|
thisArg: This;
|
|
225
169
|
}
|
|
226
|
-
type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> |
|
|
170
|
+
type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promisify<ReturnType<Invoke>>;
|
|
227
171
|
interface ConfigurableEventFilter {
|
|
228
172
|
/**
|
|
229
173
|
* Filter for if events should to be received.
|
|
@@ -237,7 +181,7 @@ interface DebounceFilterOptions {
|
|
|
237
181
|
* The maximum time allowed to be delayed before it's invoked.
|
|
238
182
|
* In milliseconds.
|
|
239
183
|
*/
|
|
240
|
-
maxWait?:
|
|
184
|
+
maxWait?: MaybeRefOrGetter<number>;
|
|
241
185
|
/**
|
|
242
186
|
* Whether to reject the last call if it's been cancel.
|
|
243
187
|
*
|
|
@@ -248,41 +192,74 @@ interface DebounceFilterOptions {
|
|
|
248
192
|
/**
|
|
249
193
|
* @internal
|
|
250
194
|
*/
|
|
251
|
-
declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): (this: any, ...args: ArgumentsType<T>) => Promise<ReturnType<T
|
|
195
|
+
declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): (this: any, ...args: ArgumentsType<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
252
196
|
declare const bypassFilter: EventFilter;
|
|
253
197
|
/**
|
|
254
198
|
* Create an EventFilter that debounce the events
|
|
255
|
-
*
|
|
256
|
-
* @param ms
|
|
257
|
-
* @param options
|
|
258
199
|
*/
|
|
259
|
-
declare function debounceFilter(ms:
|
|
200
|
+
declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): EventFilter<any[], any, AnyFn>;
|
|
201
|
+
interface ThrottleFilterOptions {
|
|
202
|
+
/**
|
|
203
|
+
* The maximum time allowed to be delayed before it's invoked.
|
|
204
|
+
*/
|
|
205
|
+
delay: MaybeRefOrGetter<number>;
|
|
206
|
+
/**
|
|
207
|
+
* Whether to invoke on the trailing edge of the timeout.
|
|
208
|
+
*/
|
|
209
|
+
trailing?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Whether to invoke on the leading edge of the timeout.
|
|
212
|
+
*/
|
|
213
|
+
leading?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Whether to reject the last call if it's been cancel.
|
|
216
|
+
*/
|
|
217
|
+
rejectOnCancel?: boolean;
|
|
218
|
+
}
|
|
260
219
|
/**
|
|
261
220
|
* Create an EventFilter that throttle the events
|
|
262
221
|
*
|
|
263
222
|
* @param ms
|
|
264
|
-
* @param [trailing
|
|
265
|
-
* @param [leading
|
|
266
|
-
* @param [rejectOnCancel
|
|
223
|
+
* @param [trailing]
|
|
224
|
+
* @param [leading]
|
|
225
|
+
* @param [rejectOnCancel]
|
|
267
226
|
*/
|
|
268
|
-
declare function throttleFilter(ms:
|
|
227
|
+
declare function throttleFilter(ms: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): EventFilter;
|
|
228
|
+
declare function throttleFilter(options: ThrottleFilterOptions): EventFilter;
|
|
229
|
+
interface PausableFilterOptions {
|
|
230
|
+
/**
|
|
231
|
+
* The initial state
|
|
232
|
+
*
|
|
233
|
+
* @default 'active'
|
|
234
|
+
*/
|
|
235
|
+
initialState?: 'active' | 'paused';
|
|
236
|
+
}
|
|
269
237
|
/**
|
|
270
238
|
* EventFilter that gives extra controls to pause and resume the filter
|
|
271
239
|
*
|
|
272
240
|
* @param extendFilter Extra filter to apply when the PausableFilter is active, default to none
|
|
273
|
-
*
|
|
241
|
+
* @param options Options to configure the filter
|
|
274
242
|
*/
|
|
275
|
-
declare function pausableFilter(extendFilter?: EventFilter): Pausable & {
|
|
243
|
+
declare function pausableFilter(extendFilter?: EventFilter, options?: PausableFilterOptions): Pausable & {
|
|
276
244
|
eventFilter: EventFilter;
|
|
277
245
|
};
|
|
278
246
|
|
|
279
|
-
declare
|
|
280
|
-
declare
|
|
281
|
-
declare const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
247
|
+
declare const isClient: boolean;
|
|
248
|
+
declare const isWorker: boolean;
|
|
249
|
+
declare const isDef: <T = any>(val?: T) => val is T;
|
|
250
|
+
declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
|
|
251
|
+
declare const assert: (condition: boolean, ...infos: any[]) => void;
|
|
252
|
+
declare const isObject: (val: any) => val is object;
|
|
253
|
+
declare const now: () => number;
|
|
254
|
+
declare const timestamp: () => number;
|
|
255
|
+
declare const clamp: (n: number, min: number, max: number) => number;
|
|
256
|
+
declare const noop: () => void;
|
|
257
|
+
declare const rand: (min: number, max: number) => number;
|
|
258
|
+
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
259
|
+
declare const isIOS: boolean | "";
|
|
260
|
+
|
|
261
|
+
declare const hyphenate: (str: string) => string;
|
|
262
|
+
declare const camelize: (str: string) => string;
|
|
286
263
|
|
|
287
264
|
declare function promiseTimeout(ms: number, throwOnTimeout?: boolean, reason?: string): Promise<void>;
|
|
288
265
|
declare function identity<T>(arg: T): T;
|
|
@@ -318,12 +295,77 @@ declare function containsProp(obj: object, ...props: string[]): boolean;
|
|
|
318
295
|
declare function increaseWithUnit(target: number, delta: number): number;
|
|
319
296
|
declare function increaseWithUnit(target: string, delta: number): string;
|
|
320
297
|
declare function increaseWithUnit(target: string | number, delta: number): string | number;
|
|
298
|
+
/**
|
|
299
|
+
* Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
|
|
300
|
+
*/
|
|
301
|
+
declare function pxValue(px: string): number;
|
|
321
302
|
/**
|
|
322
303
|
* Create a new subset object by giving keys
|
|
323
|
-
*
|
|
324
|
-
* @category Object
|
|
325
304
|
*/
|
|
326
305
|
declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
|
|
306
|
+
/**
|
|
307
|
+
* Create a new subset object by omit giving keys
|
|
308
|
+
*/
|
|
309
|
+
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
310
|
+
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
311
|
+
declare function getLifeCycleTarget(target?: any): any;
|
|
312
|
+
declare function toArray<T>(value: T): T extends readonly any[] ? T : [T];
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Keep states in the global scope to be reusable across Vue instances.
|
|
316
|
+
*
|
|
317
|
+
* @see https://vueuse.org/createGlobalState
|
|
318
|
+
* @param stateFactory A factory function to create the state
|
|
319
|
+
*/
|
|
320
|
+
declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): Fn;
|
|
321
|
+
|
|
322
|
+
interface CreateInjectionStateOptions<Return> {
|
|
323
|
+
/**
|
|
324
|
+
* Custom injectionKey for InjectionState
|
|
325
|
+
*/
|
|
326
|
+
injectionKey?: string | InjectionKey<Return>;
|
|
327
|
+
/**
|
|
328
|
+
* Default value for the InjectionState
|
|
329
|
+
*/
|
|
330
|
+
defaultValue?: Return;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Create global state that can be injected into components.
|
|
334
|
+
*
|
|
335
|
+
* @see https://vueuse.org/createInjectionState
|
|
336
|
+
*
|
|
337
|
+
*/
|
|
338
|
+
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Make a composable function usable with multiple Vue instances.
|
|
342
|
+
*
|
|
343
|
+
* @see https://vueuse.org/createSharedComposable
|
|
344
|
+
*/
|
|
345
|
+
declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): Fn;
|
|
346
|
+
|
|
347
|
+
interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
348
|
+
/**
|
|
349
|
+
* Is the extends properties enumerable
|
|
350
|
+
*
|
|
351
|
+
* @default false
|
|
352
|
+
*/
|
|
353
|
+
enumerable?: boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Unwrap for Ref properties
|
|
356
|
+
*
|
|
357
|
+
* @default true
|
|
358
|
+
*/
|
|
359
|
+
unwrap?: Unwrap;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Overload 1: Unwrap set to false
|
|
363
|
+
*/
|
|
364
|
+
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
|
|
365
|
+
/**
|
|
366
|
+
* Overload 2: Unwrap unset or set to true
|
|
367
|
+
*/
|
|
368
|
+
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
327
369
|
|
|
328
370
|
/**
|
|
329
371
|
* Shorthand for accessing `ref.value`
|
|
@@ -331,14 +373,36 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
331
373
|
declare function get<T>(ref: MaybeRef<T>): T;
|
|
332
374
|
declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
|
|
333
375
|
|
|
334
|
-
|
|
376
|
+
/**
|
|
377
|
+
* On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```ts
|
|
381
|
+
* injectLocal('MyInjectionKey', 1)
|
|
382
|
+
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
declare const injectLocal: typeof inject;
|
|
386
|
+
|
|
335
387
|
declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
|
|
388
|
+
declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
|
|
336
389
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
337
390
|
|
|
338
391
|
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
339
392
|
|
|
393
|
+
/**
|
|
394
|
+
* On the basis of `provide`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```ts
|
|
398
|
+
* provideLocal('MyInjectionKey', 1)
|
|
399
|
+
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
declare const provideLocal: typeof provide;
|
|
403
|
+
|
|
340
404
|
type Reactified<T, Computed extends boolean> = T extends (...args: infer A) => infer R ? (...args: {
|
|
341
|
-
[K in keyof A]: Computed extends true ?
|
|
405
|
+
[K in keyof A]: Computed extends true ? MaybeRefOrGetter<A[K]> : MaybeRef<A[K]>;
|
|
342
406
|
}) => ComputedRef<R> : never;
|
|
343
407
|
interface ReactifyOptions<T extends boolean> {
|
|
344
408
|
/**
|
|
@@ -358,7 +422,7 @@ interface ReactifyOptions<T extends boolean> {
|
|
|
358
422
|
declare function reactify<T extends Function, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): Reactified<T, K>;
|
|
359
423
|
|
|
360
424
|
type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = {
|
|
361
|
-
[K in Keys]: T[K] extends
|
|
425
|
+
[K in Keys]: T[K] extends AnyFn ? Reactified<T[K], S> : T[K];
|
|
362
426
|
};
|
|
363
427
|
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
364
428
|
/**
|
|
@@ -377,23 +441,19 @@ declare function reactifyObject<T extends object, S extends boolean = true>(obj:
|
|
|
377
441
|
/**
|
|
378
442
|
* Computed reactive object.
|
|
379
443
|
*/
|
|
380
|
-
declare function reactiveComputed<T extends
|
|
444
|
+
declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>): UnwrapNestedRefs<T>;
|
|
381
445
|
|
|
382
|
-
|
|
383
|
-
* Reactively omit fields from a reactive object
|
|
384
|
-
*
|
|
385
|
-
* @see https://vueuse.org/reactiveOmit
|
|
386
|
-
*/
|
|
446
|
+
type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
387
447
|
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
448
|
+
declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>): Partial<T>;
|
|
388
449
|
|
|
389
|
-
|
|
390
|
-
* Reactively pick fields from a reactive object
|
|
391
|
-
*
|
|
392
|
-
* @see https://vueuse.org/reactivePick
|
|
393
|
-
*/
|
|
450
|
+
type ReactivePickPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
394
451
|
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): {
|
|
395
452
|
[S in K]: UnwrapRef<T[S]>;
|
|
396
453
|
};
|
|
454
|
+
declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickPredicate<T>): {
|
|
455
|
+
[S in keyof T]?: UnwrapRef<T[S]>;
|
|
456
|
+
};
|
|
397
457
|
|
|
398
458
|
/**
|
|
399
459
|
* Create a ref which will be reset to the default value after some time.
|
|
@@ -402,20 +462,17 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
|
|
|
402
462
|
* @param defaultValue The value which will be set.
|
|
403
463
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
404
464
|
*/
|
|
405
|
-
declare function refAutoReset<T>(defaultValue: T
|
|
465
|
+
declare function refAutoReset<T>(defaultValue: MaybeRefOrGetter<T>, afterMs?: MaybeRefOrGetter<number>): Ref<T>;
|
|
406
466
|
|
|
407
467
|
/**
|
|
408
468
|
* Debounce updates of a ref.
|
|
409
469
|
*
|
|
410
470
|
* @return A new debounced ref.
|
|
411
471
|
*/
|
|
412
|
-
declare function refDebounced<T>(value: Ref<T>, ms?:
|
|
472
|
+
declare function refDebounced<T>(value: Ref<T>, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): Readonly<Ref<T>>;
|
|
413
473
|
|
|
414
474
|
/**
|
|
415
475
|
* Apply default value to a ref.
|
|
416
|
-
*
|
|
417
|
-
* @param source source ref
|
|
418
|
-
* @param targets
|
|
419
476
|
*/
|
|
420
477
|
declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
|
|
421
478
|
|
|
@@ -425,10 +482,10 @@ declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue:
|
|
|
425
482
|
*
|
|
426
483
|
* @param value Ref value to be watched with throttle effect
|
|
427
484
|
* @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
|
|
485
|
+
* @param [trailing] if true, update the value again after the delay time is up
|
|
486
|
+
* @param [leading] if true, update the value on the leading edge of the ms timeout
|
|
430
487
|
*/
|
|
431
|
-
declare function refThrottled<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): Ref<T>;
|
|
488
|
+
declare function refThrottled<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): Ref<T, T>;
|
|
432
489
|
|
|
433
490
|
interface ControlledRefOptions<T> {
|
|
434
491
|
/**
|
|
@@ -445,40 +502,65 @@ interface ControlledRefOptions<T> {
|
|
|
445
502
|
onChanged?: (value: T, oldValue: T) => void;
|
|
446
503
|
}
|
|
447
504
|
/**
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* @param source
|
|
451
|
-
* @param fn
|
|
505
|
+
* Fine-grained controls over ref and its reactivity.
|
|
452
506
|
*/
|
|
453
|
-
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>):
|
|
507
|
+
declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): vue.ShallowUnwrapRef<{
|
|
454
508
|
get: (tracking?: boolean) => T;
|
|
455
509
|
set: (value: T, triggering?: boolean) => void;
|
|
456
510
|
untrackedGet: () => T;
|
|
457
511
|
silentSet: (v: T) => void;
|
|
458
512
|
peek: () => T;
|
|
459
513
|
lay: (v: T) => void;
|
|
460
|
-
}> &
|
|
514
|
+
}> & vue.Ref<T, T>;
|
|
461
515
|
/**
|
|
462
516
|
* Alias for `refWithControl`
|
|
463
517
|
*/
|
|
464
518
|
declare const controlledRef: typeof refWithControl;
|
|
465
519
|
|
|
520
|
+
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
521
|
+
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
522
|
+
|
|
523
|
+
type Direction = 'ltr' | 'rtl' | 'both';
|
|
524
|
+
type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
466
525
|
/**
|
|
467
|
-
*
|
|
526
|
+
* A = B
|
|
468
527
|
*/
|
|
469
|
-
|
|
470
|
-
declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>;
|
|
471
|
-
declare function resolveRef<T>(r: T): Ref<T>;
|
|
472
|
-
|
|
528
|
+
type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
|
|
473
529
|
/**
|
|
474
|
-
*
|
|
530
|
+
* A ∩ B ≠ ∅
|
|
475
531
|
*/
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
532
|
+
type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
|
|
533
|
+
/**
|
|
534
|
+
* A ⊆ B
|
|
535
|
+
*/
|
|
536
|
+
type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
|
|
537
|
+
/**
|
|
538
|
+
* A ∩ B = ∅
|
|
539
|
+
*/
|
|
540
|
+
type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
|
|
541
|
+
interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
|
|
542
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
|
|
543
|
+
}
|
|
544
|
+
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 ? {
|
|
545
|
+
transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
|
|
546
|
+
} : {
|
|
547
|
+
transform: Pick<Transform<L, R>, D>;
|
|
548
|
+
};
|
|
549
|
+
type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
|
|
550
|
+
transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
|
|
551
|
+
} : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
|
|
552
|
+
type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
|
|
553
|
+
transform: Transform<L, R>;
|
|
554
|
+
} : D extends Exclude<Direction, 'both'> ? {
|
|
555
|
+
transform: Pick<Transform<L, R>, D>;
|
|
556
|
+
} : never;
|
|
557
|
+
type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
|
|
558
|
+
interface Transform<L, R> {
|
|
559
|
+
ltr: (left: L) => R;
|
|
560
|
+
rtl: (right: R) => L;
|
|
561
|
+
}
|
|
562
|
+
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;
|
|
563
|
+
type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
|
|
482
564
|
/**
|
|
483
565
|
* Watch deeply
|
|
484
566
|
*
|
|
@@ -496,22 +578,18 @@ interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
|
|
|
496
578
|
*
|
|
497
579
|
* @default 'both'
|
|
498
580
|
*/
|
|
499
|
-
direction?:
|
|
500
|
-
|
|
501
|
-
* Custom transform function
|
|
502
|
-
*/
|
|
503
|
-
transform?: {
|
|
504
|
-
ltr?: (left: L) => R;
|
|
505
|
-
rtl?: (right: R) => L;
|
|
506
|
-
};
|
|
507
|
-
}
|
|
581
|
+
direction?: D;
|
|
582
|
+
} & TransformType<D, L, R>;
|
|
508
583
|
/**
|
|
509
584
|
* Two-way refs synchronization.
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
585
|
+
* From the set theory perspective to restrict the option's type
|
|
586
|
+
* Check in the following order:
|
|
587
|
+
* 1. L = R
|
|
588
|
+
* 2. L ∩ R ≠ ∅
|
|
589
|
+
* 3. L ⊆ R
|
|
590
|
+
* 4. L ∩ R = ∅
|
|
513
591
|
*/
|
|
514
|
-
declare function syncRef<L, R =
|
|
592
|
+
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
593
|
|
|
516
594
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
517
595
|
/**
|
|
@@ -533,7 +611,7 @@ interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
|
533
611
|
* @param source source ref
|
|
534
612
|
* @param targets
|
|
535
613
|
*/
|
|
536
|
-
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions):
|
|
614
|
+
declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[], options?: SyncRefsOptions): vue.WatchHandle;
|
|
537
615
|
|
|
538
616
|
/**
|
|
539
617
|
* Converts ref to reactive.
|
|
@@ -541,38 +619,74 @@ declare function syncRefs<T>(source: WatchSource<T>, targets: Ref<T> | Ref<T>[],
|
|
|
541
619
|
* @see https://vueuse.org/toReactive
|
|
542
620
|
* @param objectRef A ref of object
|
|
543
621
|
*/
|
|
544
|
-
declare function toReactive<T extends object>(objectRef: MaybeRef<T>): T
|
|
622
|
+
declare function toReactive<T extends object>(objectRef: MaybeRef<T>): UnwrapNestedRefs<T>;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Normalize value/ref/getter to `ref` or `computed`.
|
|
626
|
+
*/
|
|
627
|
+
declare function toRef<T>(r: () => T): Readonly<Ref<T>>;
|
|
628
|
+
declare function toRef<T>(r: ComputedRef<T>): ComputedRef<T>;
|
|
629
|
+
declare function toRef<T>(r: MaybeRefOrGetter<T>): Ref<T>;
|
|
630
|
+
declare function toRef<T>(r: T): Ref<T>;
|
|
631
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
632
|
+
declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
|
633
|
+
/**
|
|
634
|
+
* @deprecated use `toRef` instead
|
|
635
|
+
*/
|
|
636
|
+
declare const resolveRef: typeof toRef;
|
|
545
637
|
|
|
638
|
+
interface ToRefsOptions {
|
|
639
|
+
/**
|
|
640
|
+
* Replace the original ref with a copy on property update.
|
|
641
|
+
*
|
|
642
|
+
* @default true
|
|
643
|
+
*/
|
|
644
|
+
replaceRef?: MaybeRefOrGetter<boolean>;
|
|
645
|
+
}
|
|
546
646
|
/**
|
|
547
647
|
* Extended `toRefs` that also accepts refs of an object.
|
|
548
648
|
*
|
|
549
649
|
* @see https://vueuse.org/toRefs
|
|
550
650
|
* @param objectRef A ref or normal object or array.
|
|
551
651
|
*/
|
|
552
|
-
declare function toRefs<T extends object>(objectRef: MaybeRef<T
|
|
652
|
+
declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRefsOptions): ToRefs<T>;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Get the value of value/ref/getter.
|
|
656
|
+
*
|
|
657
|
+
* @deprecated use `toValue` from `vue` instead
|
|
658
|
+
*/
|
|
659
|
+
declare const toValue: typeof toValue$1;
|
|
660
|
+
/**
|
|
661
|
+
* @deprecated use `toValue` instead
|
|
662
|
+
*/
|
|
663
|
+
declare const resolveUnref: typeof toValue$1;
|
|
553
664
|
|
|
554
665
|
/**
|
|
555
666
|
* Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
|
|
556
667
|
*
|
|
557
668
|
* @param fn
|
|
558
669
|
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
670
|
+
* @param target
|
|
559
671
|
*/
|
|
560
|
-
declare function tryOnBeforeMount(fn: Fn, sync?: boolean): void;
|
|
672
|
+
declare function tryOnBeforeMount(fn: Fn, sync?: boolean, target?: any): void;
|
|
561
673
|
|
|
562
674
|
/**
|
|
563
675
|
* Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
|
|
564
676
|
*
|
|
565
677
|
* @param fn
|
|
678
|
+
* @param target
|
|
566
679
|
*/
|
|
567
|
-
declare function tryOnBeforeUnmount(fn: Fn): void;
|
|
680
|
+
declare function tryOnBeforeUnmount(fn: Fn, target?: any): void;
|
|
568
681
|
|
|
569
682
|
/**
|
|
570
683
|
* Call onMounted() if it's inside a component lifecycle, if not, just call the function
|
|
571
684
|
*
|
|
572
685
|
* @param fn
|
|
573
686
|
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
687
|
+
* @param target
|
|
574
688
|
*/
|
|
575
|
-
declare function tryOnMounted(fn: Fn, sync?: boolean): void;
|
|
689
|
+
declare function tryOnMounted(fn: Fn, sync?: boolean, target?: any): void;
|
|
576
690
|
|
|
577
691
|
/**
|
|
578
692
|
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
@@ -585,8 +699,9 @@ declare function tryOnScopeDispose(fn: Fn): boolean;
|
|
|
585
699
|
* Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
|
|
586
700
|
*
|
|
587
701
|
* @param fn
|
|
702
|
+
* @param target
|
|
588
703
|
*/
|
|
589
|
-
declare function tryOnUnmounted(fn: Fn): void;
|
|
704
|
+
declare function tryOnUnmounted(fn: Fn, target?: any): void;
|
|
590
705
|
|
|
591
706
|
interface UntilToMatchOptions {
|
|
592
707
|
/**
|
|
@@ -616,23 +731,22 @@ interface UntilToMatchOptions {
|
|
|
616
731
|
deep?: WatchOptions['deep'];
|
|
617
732
|
}
|
|
618
733
|
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>;
|
|
734
|
+
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>);
|
|
735
|
+
changed: (options?: UntilToMatchOptions) => Promise<T>;
|
|
736
|
+
changedTimes: (n?: number, options?: UntilToMatchOptions) => Promise<T>;
|
|
623
737
|
}
|
|
624
738
|
type Falsy = false | void | null | undefined | 0 | 0n | '';
|
|
625
739
|
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> {
|
|
626
740
|
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)
|
|
741
|
+
toBe: <P = T>(value: MaybeRefOrGetter<P>, options?: UntilToMatchOptions) => Not extends true ? Promise<T> : Promise<P>;
|
|
742
|
+
toBeTruthy: (options?: UntilToMatchOptions) => Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>;
|
|
743
|
+
toBeNull: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, null>> : Promise<null>;
|
|
744
|
+
toBeUndefined: (options?: UntilToMatchOptions) => Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>;
|
|
745
|
+
toBeNaN: (options?: UntilToMatchOptions) => Promise<T>;
|
|
632
746
|
}
|
|
633
747
|
interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
634
748
|
readonly not: UntilArrayInstance<T>;
|
|
635
|
-
toContains(value:
|
|
749
|
+
toContains: (value: MaybeRefOrGetter<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions) => Promise<T>;
|
|
636
750
|
}
|
|
637
751
|
/**
|
|
638
752
|
* Promised one-time watch for changes
|
|
@@ -647,127 +761,157 @@ interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
|
647
761
|
* alert('Counter is now larger than 7!')
|
|
648
762
|
* ```
|
|
649
763
|
*/
|
|
650
|
-
declare function until<T extends unknown[]>(r: WatchSource<T> |
|
|
651
|
-
declare function until<T>(r: WatchSource<T> |
|
|
764
|
+
declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilArrayInstance<T>;
|
|
765
|
+
declare function until<T>(r: WatchSource<T> | MaybeRefOrGetter<T>): UntilValueInstance<T>;
|
|
766
|
+
|
|
767
|
+
interface UseArrayDifferenceOptions {
|
|
768
|
+
/**
|
|
769
|
+
* Returns asymmetric difference
|
|
770
|
+
*
|
|
771
|
+
* @see https://en.wikipedia.org/wiki/Symmetric_difference
|
|
772
|
+
* @default false
|
|
773
|
+
*/
|
|
774
|
+
symmetric?: boolean;
|
|
775
|
+
}
|
|
776
|
+
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, key?: keyof T, options?: UseArrayDifferenceOptions): ComputedRef<T[]>;
|
|
777
|
+
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, compareFn?: (value: T, othVal: T) => boolean, options?: UseArrayDifferenceOptions): ComputedRef<T[]>;
|
|
652
778
|
|
|
653
779
|
/**
|
|
654
780
|
* Reactive `Array.every`
|
|
655
781
|
*
|
|
656
782
|
* @see https://vueuse.org/useArrayEvery
|
|
657
|
-
* @param
|
|
783
|
+
* @param list - the array was called upon.
|
|
658
784
|
* @param fn - a function to test each element.
|
|
659
785
|
*
|
|
660
|
-
* @returns
|
|
786
|
+
* @returns **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
661
787
|
*/
|
|
662
|
-
declare function useArrayEvery<T>(list:
|
|
788
|
+
declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): ComputedRef<boolean>;
|
|
663
789
|
|
|
664
790
|
/**
|
|
665
791
|
* Reactive `Array.filter`
|
|
666
792
|
*
|
|
667
793
|
* @see https://vueuse.org/useArrayFilter
|
|
668
|
-
* @param
|
|
794
|
+
* @param list - the array was called upon.
|
|
669
795
|
* @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
796
|
*
|
|
671
|
-
* @returns
|
|
797
|
+
* @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
798
|
*/
|
|
673
|
-
declare function useArrayFilter<T>(list:
|
|
799
|
+
declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): ComputedRef<S[]>;
|
|
800
|
+
declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): ComputedRef<T[]>;
|
|
674
801
|
|
|
675
802
|
/**
|
|
676
803
|
* Reactive `Array.find`
|
|
677
804
|
*
|
|
678
805
|
* @see https://vueuse.org/useArrayFind
|
|
679
|
-
* @param
|
|
806
|
+
* @param list - the array was called upon.
|
|
680
807
|
* @param fn - a function to test each element.
|
|
681
808
|
*
|
|
682
809
|
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
683
810
|
*/
|
|
684
|
-
declare function useArrayFind<T>(list:
|
|
811
|
+
declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
685
812
|
|
|
686
813
|
/**
|
|
687
814
|
* Reactive `Array.findIndex`
|
|
688
815
|
*
|
|
689
816
|
* @see https://vueuse.org/useArrayFindIndex
|
|
690
|
-
* @param
|
|
817
|
+
* @param list - the array was called upon.
|
|
691
818
|
* @param fn - a function to test each element.
|
|
692
819
|
*
|
|
693
|
-
* @returns
|
|
820
|
+
* @returns the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
694
821
|
*/
|
|
695
|
-
declare function useArrayFindIndex<T>(list:
|
|
822
|
+
declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): ComputedRef<number>;
|
|
696
823
|
|
|
697
824
|
/**
|
|
698
825
|
* Reactive `Array.findLast`
|
|
699
826
|
*
|
|
700
827
|
* @see https://vueuse.org/useArrayFindLast
|
|
701
|
-
* @param
|
|
828
|
+
* @param list - the array was called upon.
|
|
702
829
|
* @param fn - a function to test each element.
|
|
703
830
|
*
|
|
704
831
|
* @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
705
832
|
*/
|
|
706
|
-
declare function useArrayFindLast<T>(list:
|
|
833
|
+
declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
834
|
+
|
|
835
|
+
type UseArrayIncludesComparatorFn<T, V> = ((element: T, value: V, index: number, array: MaybeRefOrGetter<T>[]) => boolean);
|
|
836
|
+
interface UseArrayIncludesOptions<T, V> {
|
|
837
|
+
fromIndex?: number;
|
|
838
|
+
comparator?: UseArrayIncludesComparatorFn<T, V> | keyof T;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Reactive `Array.includes`
|
|
842
|
+
*
|
|
843
|
+
* @see https://vueuse.org/useArrayIncludes
|
|
844
|
+
*
|
|
845
|
+
* @returns true if the `value` is found in the array. Otherwise, false.
|
|
846
|
+
*/
|
|
847
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): ComputedRef<boolean>;
|
|
848
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): ComputedRef<boolean>;
|
|
849
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>): ComputedRef<boolean>;
|
|
707
850
|
|
|
708
851
|
/**
|
|
709
852
|
* Reactive `Array.join`
|
|
710
853
|
*
|
|
711
854
|
* @see https://vueuse.org/useArrayJoin
|
|
712
|
-
* @param
|
|
713
|
-
* @param
|
|
855
|
+
* @param list - the array was called upon.
|
|
856
|
+
* @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
857
|
*
|
|
715
|
-
* @returns
|
|
858
|
+
* @returns a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
716
859
|
*/
|
|
717
|
-
declare function useArrayJoin(list:
|
|
860
|
+
declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, separator?: MaybeRefOrGetter<string>): ComputedRef<string>;
|
|
718
861
|
|
|
719
862
|
/**
|
|
720
863
|
* Reactive `Array.map`
|
|
721
864
|
*
|
|
722
865
|
* @see https://vueuse.org/useArrayMap
|
|
723
|
-
* @param
|
|
866
|
+
* @param list - the array was called upon.
|
|
724
867
|
* @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
868
|
*
|
|
726
|
-
* @returns
|
|
869
|
+
* @returns a new array with each element being the result of the callback function.
|
|
727
870
|
*/
|
|
728
|
-
declare function useArrayMap<T, U = T>(list:
|
|
871
|
+
declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): ComputedRef<U[]>;
|
|
729
872
|
|
|
730
873
|
type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
731
874
|
/**
|
|
732
875
|
* Reactive `Array.reduce`
|
|
733
876
|
*
|
|
734
877
|
* @see https://vueuse.org/useArrayReduce
|
|
735
|
-
* @param
|
|
878
|
+
* @param list - the array was called upon.
|
|
736
879
|
* @param reducer - a "reducer" function.
|
|
737
880
|
*
|
|
738
881
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
739
882
|
*/
|
|
740
|
-
declare function useArrayReduce<T>(list:
|
|
883
|
+
declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
|
|
741
884
|
/**
|
|
742
885
|
* Reactive `Array.reduce`
|
|
743
886
|
*
|
|
744
887
|
* @see https://vueuse.org/useArrayReduce
|
|
745
|
-
* @param
|
|
888
|
+
* @param list - the array was called upon.
|
|
746
889
|
* @param reducer - a "reducer" function.
|
|
747
890
|
* @param initialValue - a value to be initialized the first time when the callback is called.
|
|
748
891
|
*
|
|
749
892
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
750
893
|
*/
|
|
751
|
-
declare function useArrayReduce<T, U>(list:
|
|
894
|
+
declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): ComputedRef<U>;
|
|
752
895
|
|
|
753
896
|
/**
|
|
754
897
|
* Reactive `Array.some`
|
|
755
898
|
*
|
|
756
899
|
* @see https://vueuse.org/useArraySome
|
|
757
|
-
* @param
|
|
900
|
+
* @param list - the array was called upon.
|
|
758
901
|
* @param fn - a function to test each element.
|
|
759
902
|
*
|
|
760
|
-
* @returns
|
|
903
|
+
* @returns **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
761
904
|
*/
|
|
762
|
-
declare function useArraySome<T>(list:
|
|
905
|
+
declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): ComputedRef<boolean>;
|
|
763
906
|
|
|
764
907
|
/**
|
|
765
908
|
* reactive unique array
|
|
766
909
|
* @see https://vueuse.org/useArrayUnique
|
|
767
|
-
* @param
|
|
768
|
-
* @
|
|
910
|
+
* @param list - the array was called upon.
|
|
911
|
+
* @param compareFn
|
|
912
|
+
* @returns A computed ref that returns a unique array of items.
|
|
769
913
|
*/
|
|
770
|
-
declare function useArrayUnique<T>(list:
|
|
914
|
+
declare function useArrayUnique<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, compareFn?: (a: T, b: T, array: T[]) => boolean): ComputedRef<T[]>;
|
|
771
915
|
|
|
772
916
|
interface UseCounterOptions {
|
|
773
917
|
min?: number;
|
|
@@ -777,11 +921,11 @@ interface UseCounterOptions {
|
|
|
777
921
|
* Basic counter with utility functions.
|
|
778
922
|
*
|
|
779
923
|
* @see https://vueuse.org/useCounter
|
|
780
|
-
* @param [initialValue
|
|
781
|
-
* @param
|
|
924
|
+
* @param [initialValue]
|
|
925
|
+
* @param options
|
|
782
926
|
*/
|
|
783
|
-
declare function useCounter(initialValue?: number
|
|
784
|
-
count:
|
|
927
|
+
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
928
|
+
count: vue.Ref<number, MaybeRef<number>>;
|
|
785
929
|
inc: (delta?: number) => number;
|
|
786
930
|
dec: (delta?: number) => number;
|
|
787
931
|
get: () => number;
|
|
@@ -796,15 +940,15 @@ interface UseDateFormatOptions {
|
|
|
796
940
|
*
|
|
797
941
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
|
|
798
942
|
*/
|
|
799
|
-
locales?: Intl.LocalesArgument
|
|
943
|
+
locales?: MaybeRefOrGetter<Intl.LocalesArgument>;
|
|
800
944
|
/**
|
|
801
945
|
* A custom function to re-modify the way to display meridiem
|
|
802
946
|
*
|
|
803
947
|
*/
|
|
804
948
|
customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
|
|
805
949
|
}
|
|
806
|
-
declare
|
|
807
|
-
declare
|
|
950
|
+
declare function formatDate(date: Date, formatStr: string, options?: UseDateFormatOptions): string;
|
|
951
|
+
declare function normalizeDate(date: DateLike): Date;
|
|
808
952
|
/**
|
|
809
953
|
* Get the formatted date according to the string of tokens passed in.
|
|
810
954
|
*
|
|
@@ -813,7 +957,7 @@ declare const normalizeDate: (date: DateLike) => Date;
|
|
|
813
957
|
* @param formatStr - The combination of tokens to format the date
|
|
814
958
|
* @param options - UseDateFormatOptions
|
|
815
959
|
*/
|
|
816
|
-
declare function useDateFormat(date:
|
|
960
|
+
declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions): vue.ComputedRef<string>;
|
|
817
961
|
type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
818
962
|
|
|
819
963
|
/**
|
|
@@ -822,11 +966,11 @@ type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
|
822
966
|
* @see https://vueuse.org/useDebounceFn
|
|
823
967
|
* @param fn A function to be executed after delay milliseconds debounced.
|
|
824
968
|
* @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
|
|
969
|
+
* @param options Options
|
|
826
970
|
*
|
|
827
971
|
* @return A new, debounce, function.
|
|
828
972
|
*/
|
|
829
|
-
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?:
|
|
973
|
+
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): PromisifyFn<T>;
|
|
830
974
|
|
|
831
975
|
interface UseIntervalOptions<Controls extends boolean> {
|
|
832
976
|
/**
|
|
@@ -857,8 +1001,8 @@ interface UseIntervalControls {
|
|
|
857
1001
|
* @param interval
|
|
858
1002
|
* @param options
|
|
859
1003
|
*/
|
|
860
|
-
declare function useInterval(interval?:
|
|
861
|
-
declare function useInterval(interval:
|
|
1004
|
+
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
1005
|
+
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls & Pausable;
|
|
862
1006
|
|
|
863
1007
|
interface UseIntervalFnOptions {
|
|
864
1008
|
/**
|
|
@@ -868,7 +1012,7 @@ interface UseIntervalFnOptions {
|
|
|
868
1012
|
*/
|
|
869
1013
|
immediate?: boolean;
|
|
870
1014
|
/**
|
|
871
|
-
* Execute the callback
|
|
1015
|
+
* Execute the callback immediately after calling `resume`
|
|
872
1016
|
*
|
|
873
1017
|
* @default false
|
|
874
1018
|
*/
|
|
@@ -881,7 +1025,7 @@ interface UseIntervalFnOptions {
|
|
|
881
1025
|
* @param interval
|
|
882
1026
|
* @param options
|
|
883
1027
|
*/
|
|
884
|
-
declare function useIntervalFn(cb: Fn, interval?:
|
|
1028
|
+
declare function useIntervalFn(cb: Fn, interval?: MaybeRefOrGetter<number>, options?: UseIntervalFnOptions): Pausable;
|
|
885
1029
|
|
|
886
1030
|
interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
|
|
887
1031
|
initialValue?: InitialValue;
|
|
@@ -892,8 +1036,7 @@ interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends
|
|
|
892
1036
|
* @see https://vueuse.org/useLastChanged
|
|
893
1037
|
*/
|
|
894
1038
|
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>;
|
|
1039
|
+
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>): Ref<number>;
|
|
897
1040
|
|
|
898
1041
|
/**
|
|
899
1042
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
@@ -902,24 +1045,31 @@ declare function useLastChanged(source: WatchSource, options: UseLastChangedOpti
|
|
|
902
1045
|
* @param fn A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
903
1046
|
* to `callback` when the throttled-function is executed.
|
|
904
1047
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
1048
|
+
* (default value: 200)
|
|
905
1049
|
*
|
|
906
|
-
* @param [trailing
|
|
1050
|
+
* @param [trailing] if true, call fn again after the time is up (default value: false)
|
|
907
1051
|
*
|
|
908
|
-
* @param [leading
|
|
1052
|
+
* @param [leading] if true, call fn on the leading edge of the ms timeout (default value: true)
|
|
909
1053
|
*
|
|
910
|
-
* @param [rejectOnCancel
|
|
1054
|
+
* @param [rejectOnCancel] if true, reject the last call if it's been cancel (default value: false)
|
|
911
1055
|
*
|
|
912
1056
|
* @return A new, throttled, function.
|
|
913
1057
|
*/
|
|
914
|
-
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?:
|
|
1058
|
+
declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): PromisifyFn<T>;
|
|
915
1059
|
|
|
916
1060
|
interface UseTimeoutFnOptions {
|
|
917
1061
|
/**
|
|
918
|
-
* Start the timer
|
|
1062
|
+
* Start the timer immediately
|
|
919
1063
|
*
|
|
920
1064
|
* @default true
|
|
921
1065
|
*/
|
|
922
1066
|
immediate?: boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* Execute the callback immediately after calling `start`
|
|
1069
|
+
*
|
|
1070
|
+
* @default false
|
|
1071
|
+
*/
|
|
1072
|
+
immediateCallback?: boolean;
|
|
923
1073
|
}
|
|
924
1074
|
/**
|
|
925
1075
|
* Wrapper for `setTimeout` with controls.
|
|
@@ -928,7 +1078,7 @@ interface UseTimeoutFnOptions {
|
|
|
928
1078
|
* @param interval
|
|
929
1079
|
* @param options
|
|
930
1080
|
*/
|
|
931
|
-
declare function useTimeoutFn<CallbackFn extends
|
|
1081
|
+
declare function useTimeoutFn<CallbackFn extends AnyFn>(cb: CallbackFn, interval: MaybeRefOrGetter<number>, options?: UseTimeoutFnOptions): Stoppable<Parameters<CallbackFn> | []>;
|
|
932
1082
|
|
|
933
1083
|
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
934
1084
|
/**
|
|
@@ -949,8 +1099,8 @@ interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOption
|
|
|
949
1099
|
* @param interval
|
|
950
1100
|
* @param options
|
|
951
1101
|
*/
|
|
952
|
-
declare function useTimeout(interval?: number
|
|
953
|
-
declare function useTimeout(interval: number
|
|
1102
|
+
declare function useTimeout(interval?: MaybeRefOrGetter<number>, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
|
1103
|
+
declare function useTimeout(interval: MaybeRefOrGetter<number>, options: UseTimeoutOptions<true>): {
|
|
954
1104
|
ready: ComputedRef<boolean>;
|
|
955
1105
|
} & Stoppable;
|
|
956
1106
|
|
|
@@ -958,9 +1108,11 @@ interface UseToNumberOptions {
|
|
|
958
1108
|
/**
|
|
959
1109
|
* Method to use to convert the value to a number.
|
|
960
1110
|
*
|
|
1111
|
+
* Or a custom function for the conversion.
|
|
1112
|
+
*
|
|
961
1113
|
* @default 'parseFloat'
|
|
962
1114
|
*/
|
|
963
|
-
method?: 'parseFloat' | 'parseInt';
|
|
1115
|
+
method?: 'parseFloat' | 'parseInt' | ((value: string | number) => number);
|
|
964
1116
|
/**
|
|
965
1117
|
* The base in mathematical numeral systems passed to `parseInt`.
|
|
966
1118
|
* Only works with `method: 'parseInt'`
|
|
@@ -974,20 +1126,20 @@ interface UseToNumberOptions {
|
|
|
974
1126
|
nanToZero?: boolean;
|
|
975
1127
|
}
|
|
976
1128
|
/**
|
|
977
|
-
*
|
|
1129
|
+
* Reactively convert a string ref to number.
|
|
978
1130
|
*/
|
|
979
|
-
declare function useToNumber(value:
|
|
1131
|
+
declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
|
|
980
1132
|
|
|
981
1133
|
/**
|
|
982
1134
|
* Reactively convert a ref to string.
|
|
983
1135
|
*
|
|
984
1136
|
* @see https://vueuse.org/useToString
|
|
985
1137
|
*/
|
|
986
|
-
declare function useToString(value:
|
|
1138
|
+
declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<string>;
|
|
987
1139
|
|
|
988
1140
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
989
|
-
truthyValue?:
|
|
990
|
-
falsyValue?:
|
|
1141
|
+
truthyValue?: MaybeRefOrGetter<Truthy>;
|
|
1142
|
+
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
991
1143
|
}
|
|
992
1144
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
993
1145
|
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [Ref<T>, (value?: T) => T];
|
|
@@ -998,7 +1150,7 @@ declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, ad
|
|
|
998
1150
|
*
|
|
999
1151
|
* @see https://vueuse.org/watchArray
|
|
1000
1152
|
*/
|
|
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>):
|
|
1153
|
+
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
1154
|
|
|
1003
1155
|
interface WatchWithFilterOptions<Immediate> extends WatchOptions<Immediate>, ConfigurableEventFilter {
|
|
1004
1156
|
}
|
|
@@ -1007,7 +1159,7 @@ declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>
|
|
|
1007
1159
|
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
1160
|
|
|
1009
1161
|
interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate> {
|
|
1010
|
-
count:
|
|
1162
|
+
count: MaybeRefOrGetter<number>;
|
|
1011
1163
|
}
|
|
1012
1164
|
interface WatchAtMostReturn {
|
|
1013
1165
|
stop: WatchStopHandle;
|
|
@@ -1017,12 +1169,16 @@ declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immedia
|
|
|
1017
1169
|
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
1170
|
|
|
1019
1171
|
interface WatchDebouncedOptions<Immediate> extends WatchOptions<Immediate>, DebounceFilterOptions {
|
|
1020
|
-
debounce?:
|
|
1172
|
+
debounce?: MaybeRefOrGetter<number>;
|
|
1021
1173
|
}
|
|
1022
1174
|
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
1175
|
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
1176
|
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
1177
|
|
|
1178
|
+
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;
|
|
1179
|
+
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;
|
|
1180
|
+
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;
|
|
1181
|
+
|
|
1026
1182
|
type IgnoredUpdater = (updater: () => void) => void;
|
|
1027
1183
|
interface WatchIgnorableReturn {
|
|
1028
1184
|
ignoreUpdates: IgnoredUpdater;
|
|
@@ -1033,18 +1189,23 @@ declare function watchIgnorable<T extends Readonly<WatchSource<unknown>[]>, Imme
|
|
|
1033
1189
|
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
1190
|
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
1191
|
|
|
1036
|
-
declare function
|
|
1037
|
-
declare function
|
|
1192
|
+
declare function watchImmediate<T extends Readonly<WatchSource<unknown>[]>>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1193
|
+
declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1194
|
+
declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
|
|
1195
|
+
|
|
1196
|
+
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;
|
|
1197
|
+
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
1198
|
|
|
1039
1199
|
interface WatchPausableReturn extends Pausable {
|
|
1040
1200
|
stop: WatchStopHandle;
|
|
1041
1201
|
}
|
|
1042
|
-
|
|
1043
|
-
declare function watchPausable<T
|
|
1044
|
-
declare function watchPausable<T
|
|
1202
|
+
type WatchPausableOptions<Immediate> = WatchWithFilterOptions<Immediate> & PausableFilterOptions;
|
|
1203
|
+
declare function watchPausable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1204
|
+
declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1205
|
+
declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1045
1206
|
|
|
1046
1207
|
interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
1047
|
-
throttle?:
|
|
1208
|
+
throttle?: MaybeRefOrGetter<number>;
|
|
1048
1209
|
trailing?: boolean;
|
|
1049
1210
|
leading?: boolean;
|
|
1050
1211
|
}
|
|
@@ -1062,11 +1223,21 @@ declare function watchTriggerable<T extends Readonly<WatchSource<unknown>[]>, Fn
|
|
|
1062
1223
|
declare function watchTriggerable<T, FnReturnT>(source: WatchSource<T>, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1063
1224
|
declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: WatchTriggerableCallback<T, T | undefined, FnReturnT>, options?: WatchWithFilterOptions<boolean>): WatchTriggerableReturn<FnReturnT>;
|
|
1064
1225
|
|
|
1226
|
+
interface WheneverOptions extends WatchOptions {
|
|
1227
|
+
/**
|
|
1228
|
+
* Only trigger once when the condition is met
|
|
1229
|
+
*
|
|
1230
|
+
* Override the `once` option in `WatchOptions`
|
|
1231
|
+
*
|
|
1232
|
+
* @default false
|
|
1233
|
+
*/
|
|
1234
|
+
once?: boolean;
|
|
1235
|
+
}
|
|
1065
1236
|
/**
|
|
1066
1237
|
* Shorthand for watching value to be truthy
|
|
1067
1238
|
*
|
|
1068
1239
|
* @see https://vueuse.org/whenever
|
|
1069
1240
|
*/
|
|
1070
|
-
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?:
|
|
1241
|
+
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1071
1242
|
|
|
1072
|
-
export { AnyFn, ArgumentsType, Arrayable, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions,
|
|
1243
|
+
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 PausableFilterOptions, 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 UseArrayDifferenceOptions, 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 WatchPausableOptions, 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, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, 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 };
|