@vueuse/integrations 12.8.1 → 13.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +21 -72
- package/index.cjs +0 -703
- package/index.d.cts +0 -447
- package/index.d.ts +0 -447
- package/useAsyncValidator/component.cjs +0 -89
- package/useAsyncValidator/component.d.cts +0 -27
- package/useAsyncValidator/component.d.ts +0 -27
- package/useAsyncValidator.cjs +0 -74
- package/useAsyncValidator.d.cts +0 -47
- package/useAsyncValidator.d.ts +0 -47
- package/useAxios.cjs +0 -125
- package/useAxios.d.cts +0 -106
- package/useAxios.d.ts +0 -106
- package/useChangeCase.cjs +0 -49
- package/useChangeCase.d.cts +0 -14
- package/useChangeCase.d.ts +0 -14
- package/useCookies.cjs +0 -64
- package/useCookies.d.cts +0 -54
- package/useCookies.d.ts +0 -54
- package/useDrauu.cjs +0 -116
- package/useDrauu.d.cts +0 -32
- package/useDrauu.d.ts +0 -32
- package/useFocusTrap/component.cjs +0 -33
- package/useFocusTrap/component.d.cts +0 -17
- package/useFocusTrap/component.d.ts +0 -17
- package/useFocusTrap.cjs +0 -68
- package/useFocusTrap.d.cts +0 -54
- package/useFocusTrap.d.ts +0 -54
- package/useFuse.cjs +0 -45
- package/useFuse.d.cts +0 -32
- package/useFuse.d.ts +0 -32
- package/useIDBKeyval.cjs +0 -63
- package/useIDBKeyval.d.cts +0 -43
- package/useIDBKeyval.d.ts +0 -43
- package/useJwt.cjs +0 -27
- package/useJwt.d.cts +0 -27
- package/useJwt.d.ts +0 -27
- package/useNProgress.cjs +0 -37
- package/useNProgress.d.cts +0 -20
- package/useNProgress.d.ts +0 -20
- package/useQRCode.cjs +0 -21
- package/useQRCode.d.cts +0 -14
- package/useQRCode.d.ts +0 -14
- package/useSortable/component.cjs +0 -91
- package/useSortable/component.d.cts +0 -40
- package/useSortable/component.d.ts +0 -40
- package/useSortable.cjs +0 -67
- package/useSortable.d.cts +0 -40
- package/useSortable.d.ts +0 -40
package/useCookies.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as universal_cookie from 'universal-cookie';
|
|
2
|
-
import universal_cookie__default from 'universal-cookie';
|
|
3
|
-
import { IncomingMessage } from 'node:http';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a new {@link useCookies} function
|
|
7
|
-
* @param req - incoming http request (for SSR)
|
|
8
|
-
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
|
9
|
-
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
|
10
|
-
*/
|
|
11
|
-
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
12
|
-
doNotParse?: boolean | undefined;
|
|
13
|
-
autoUpdateDependencies?: boolean | undefined;
|
|
14
|
-
}) => {
|
|
15
|
-
/**
|
|
16
|
-
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
17
|
-
*/
|
|
18
|
-
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
19
|
-
/**
|
|
20
|
-
* Reactive get all cookies
|
|
21
|
-
*/
|
|
22
|
-
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
23
|
-
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
24
|
-
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
25
|
-
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
26
|
-
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
|
30
|
-
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
|
31
|
-
* @param options
|
|
32
|
-
* @param options.doNotParse - don't try parse value as JSON
|
|
33
|
-
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
|
34
|
-
* @param cookies - universal-cookie instance
|
|
35
|
-
*/
|
|
36
|
-
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
37
|
-
doNotParse?: boolean | undefined;
|
|
38
|
-
autoUpdateDependencies?: boolean | undefined;
|
|
39
|
-
}, cookies?: universal_cookie__default): {
|
|
40
|
-
/**
|
|
41
|
-
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
42
|
-
*/
|
|
43
|
-
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
44
|
-
/**
|
|
45
|
-
* Reactive get all cookies
|
|
46
|
-
*/
|
|
47
|
-
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
48
|
-
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
49
|
-
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
50
|
-
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
51
|
-
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { createCookies, useCookies };
|
package/useDrauu.cjs
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@vueuse/core');
|
|
4
|
-
var shared = require('@vueuse/shared');
|
|
5
|
-
var drauu = require('drauu');
|
|
6
|
-
var vue = require('vue');
|
|
7
|
-
|
|
8
|
-
function useDrauu(target, options) {
|
|
9
|
-
const drauuInstance = vue.ref();
|
|
10
|
-
let disposables = [];
|
|
11
|
-
const onChangedHook = core.createEventHook();
|
|
12
|
-
const onCanceledHook = core.createEventHook();
|
|
13
|
-
const onCommittedHook = core.createEventHook();
|
|
14
|
-
const onStartHook = core.createEventHook();
|
|
15
|
-
const onEndHook = core.createEventHook();
|
|
16
|
-
const canUndo = vue.shallowRef(false);
|
|
17
|
-
const canRedo = vue.shallowRef(false);
|
|
18
|
-
const altPressed = vue.shallowRef(false);
|
|
19
|
-
const shiftPressed = vue.shallowRef(false);
|
|
20
|
-
const brush = vue.ref({
|
|
21
|
-
color: "black",
|
|
22
|
-
size: 3,
|
|
23
|
-
arrowEnd: false,
|
|
24
|
-
cornerRadius: 0,
|
|
25
|
-
dasharray: void 0,
|
|
26
|
-
fill: "transparent",
|
|
27
|
-
mode: "draw",
|
|
28
|
-
...options == null ? void 0 : options.brush
|
|
29
|
-
});
|
|
30
|
-
vue.watch(brush, () => {
|
|
31
|
-
const instance = drauuInstance.value;
|
|
32
|
-
if (instance) {
|
|
33
|
-
instance.brush = brush.value;
|
|
34
|
-
instance.mode = brush.value.mode;
|
|
35
|
-
}
|
|
36
|
-
}, { deep: true });
|
|
37
|
-
const undo = () => {
|
|
38
|
-
var _a;
|
|
39
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
|
|
40
|
-
};
|
|
41
|
-
const redo = () => {
|
|
42
|
-
var _a;
|
|
43
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
44
|
-
};
|
|
45
|
-
const clear = () => {
|
|
46
|
-
var _a;
|
|
47
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
48
|
-
};
|
|
49
|
-
const cancel = () => {
|
|
50
|
-
var _a;
|
|
51
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
52
|
-
};
|
|
53
|
-
const load = (svg) => {
|
|
54
|
-
var _a;
|
|
55
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
56
|
-
};
|
|
57
|
-
const dump = () => {
|
|
58
|
-
var _a;
|
|
59
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
60
|
-
};
|
|
61
|
-
const cleanup = () => {
|
|
62
|
-
var _a;
|
|
63
|
-
disposables.forEach((dispose) => dispose());
|
|
64
|
-
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
|
|
65
|
-
};
|
|
66
|
-
const syncStatus = () => {
|
|
67
|
-
if (drauuInstance.value) {
|
|
68
|
-
canUndo.value = drauuInstance.value.canUndo();
|
|
69
|
-
canRedo.value = drauuInstance.value.canRedo();
|
|
70
|
-
altPressed.value = drauuInstance.value.altPressed;
|
|
71
|
-
shiftPressed.value = drauuInstance.value.shiftPressed;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
vue.watch(
|
|
75
|
-
() => core.unrefElement(target),
|
|
76
|
-
(el) => {
|
|
77
|
-
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
|
|
78
|
-
return;
|
|
79
|
-
if (drauuInstance.value)
|
|
80
|
-
cleanup();
|
|
81
|
-
drauuInstance.value = drauu.createDrauu({ el, ...options });
|
|
82
|
-
syncStatus();
|
|
83
|
-
disposables = [
|
|
84
|
-
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
|
|
85
|
-
drauuInstance.value.on("committed", (node) => onCommittedHook.trigger(node)),
|
|
86
|
-
drauuInstance.value.on("start", () => onStartHook.trigger()),
|
|
87
|
-
drauuInstance.value.on("end", () => onEndHook.trigger()),
|
|
88
|
-
drauuInstance.value.on("changed", () => {
|
|
89
|
-
syncStatus();
|
|
90
|
-
onChangedHook.trigger();
|
|
91
|
-
})
|
|
92
|
-
];
|
|
93
|
-
},
|
|
94
|
-
{ flush: "post" }
|
|
95
|
-
);
|
|
96
|
-
shared.tryOnScopeDispose(() => cleanup());
|
|
97
|
-
return {
|
|
98
|
-
drauuInstance,
|
|
99
|
-
load,
|
|
100
|
-
dump,
|
|
101
|
-
clear,
|
|
102
|
-
cancel,
|
|
103
|
-
undo,
|
|
104
|
-
redo,
|
|
105
|
-
canUndo,
|
|
106
|
-
canRedo,
|
|
107
|
-
brush,
|
|
108
|
-
onChanged: onChangedHook.on,
|
|
109
|
-
onCommitted: onCommittedHook.on,
|
|
110
|
-
onStart: onStartHook.on,
|
|
111
|
-
onEnd: onEndHook.on,
|
|
112
|
-
onCanceled: onCanceledHook.on
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
exports.useDrauu = useDrauu;
|
package/useDrauu.d.cts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
|
|
2
|
-
import { Options, Drauu, Brush } from 'drauu';
|
|
3
|
-
import { Ref, ShallowRef } from 'vue';
|
|
4
|
-
|
|
5
|
-
type UseDrauuOptions = Omit<Options, 'el'>;
|
|
6
|
-
interface UseDrauuReturn {
|
|
7
|
-
drauuInstance: Ref<Drauu | undefined>;
|
|
8
|
-
load: (svg: string) => void;
|
|
9
|
-
dump: () => string | undefined;
|
|
10
|
-
clear: () => void;
|
|
11
|
-
cancel: () => void;
|
|
12
|
-
undo: () => boolean | undefined;
|
|
13
|
-
redo: () => boolean | undefined;
|
|
14
|
-
canUndo: ShallowRef<boolean>;
|
|
15
|
-
canRedo: ShallowRef<boolean>;
|
|
16
|
-
brush: Ref<Brush>;
|
|
17
|
-
onChanged: EventHookOn;
|
|
18
|
-
onCommitted: EventHookOn;
|
|
19
|
-
onStart: EventHookOn;
|
|
20
|
-
onEnd: EventHookOn;
|
|
21
|
-
onCanceled: EventHookOn;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Reactive drauu
|
|
25
|
-
*
|
|
26
|
-
* @see https://vueuse.org/useDrauu
|
|
27
|
-
* @param target The target svg element
|
|
28
|
-
* @param options Drauu Options
|
|
29
|
-
*/
|
|
30
|
-
declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
|
|
31
|
-
|
|
32
|
-
export { type UseDrauuOptions, type UseDrauuReturn, useDrauu };
|
package/useDrauu.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
|
|
2
|
-
import { Options, Drauu, Brush } from 'drauu';
|
|
3
|
-
import { Ref, ShallowRef } from 'vue';
|
|
4
|
-
|
|
5
|
-
type UseDrauuOptions = Omit<Options, 'el'>;
|
|
6
|
-
interface UseDrauuReturn {
|
|
7
|
-
drauuInstance: Ref<Drauu | undefined>;
|
|
8
|
-
load: (svg: string) => void;
|
|
9
|
-
dump: () => string | undefined;
|
|
10
|
-
clear: () => void;
|
|
11
|
-
cancel: () => void;
|
|
12
|
-
undo: () => boolean | undefined;
|
|
13
|
-
redo: () => boolean | undefined;
|
|
14
|
-
canUndo: ShallowRef<boolean>;
|
|
15
|
-
canRedo: ShallowRef<boolean>;
|
|
16
|
-
brush: Ref<Brush>;
|
|
17
|
-
onChanged: EventHookOn;
|
|
18
|
-
onCommitted: EventHookOn;
|
|
19
|
-
onStart: EventHookOn;
|
|
20
|
-
onEnd: EventHookOn;
|
|
21
|
-
onCanceled: EventHookOn;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Reactive drauu
|
|
25
|
-
*
|
|
26
|
-
* @see https://vueuse.org/useDrauu
|
|
27
|
-
* @param target The target svg element
|
|
28
|
-
* @param options Drauu Options
|
|
29
|
-
*/
|
|
30
|
-
declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
|
|
31
|
-
|
|
32
|
-
export { type UseDrauuOptions, type UseDrauuReturn, useDrauu };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@vueuse/core');
|
|
4
|
-
var focusTrap = require('focus-trap');
|
|
5
|
-
var vue = require('vue');
|
|
6
|
-
|
|
7
|
-
const UseFocusTrap = /* @__PURE__ */ /*@__PURE__*/ vue.defineComponent({
|
|
8
|
-
name: "UseFocusTrap",
|
|
9
|
-
props: ["as", "options"],
|
|
10
|
-
setup(props, { slots }) {
|
|
11
|
-
let trap;
|
|
12
|
-
const target = vue.ref();
|
|
13
|
-
const activate = () => trap && trap.activate();
|
|
14
|
-
const deactivate = () => trap && trap.deactivate();
|
|
15
|
-
vue.watch(
|
|
16
|
-
() => core.unrefElement(target),
|
|
17
|
-
(el) => {
|
|
18
|
-
if (!el)
|
|
19
|
-
return;
|
|
20
|
-
trap = focusTrap.createFocusTrap(el, props.options || {});
|
|
21
|
-
activate();
|
|
22
|
-
},
|
|
23
|
-
{ flush: "post" }
|
|
24
|
-
);
|
|
25
|
-
vue.onScopeDispose(() => deactivate());
|
|
26
|
-
return () => {
|
|
27
|
-
if (slots.default)
|
|
28
|
-
return vue.h(props.as || "div", { ref: target }, slots.default());
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
exports.UseFocusTrap = UseFocusTrap;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue';
|
|
2
|
-
import { RenderableComponent } from '@vueuse/core';
|
|
3
|
-
import { Options } from 'focus-trap';
|
|
4
|
-
|
|
5
|
-
interface UseFocusTrapOptions extends Options {
|
|
6
|
-
/**
|
|
7
|
-
* Immediately activate the trap
|
|
8
|
-
*/
|
|
9
|
-
immediate?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface ComponentUseFocusTrapOptions extends RenderableComponent {
|
|
13
|
-
options?: UseFocusTrapOptions;
|
|
14
|
-
}
|
|
15
|
-
declare const UseFocusTrap: vue.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ComponentUseFocusTrapOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
16
|
-
|
|
17
|
-
export { type ComponentUseFocusTrapOptions, UseFocusTrap };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue';
|
|
2
|
-
import { RenderableComponent } from '@vueuse/core';
|
|
3
|
-
import { Options } from 'focus-trap';
|
|
4
|
-
|
|
5
|
-
interface UseFocusTrapOptions extends Options {
|
|
6
|
-
/**
|
|
7
|
-
* Immediately activate the trap
|
|
8
|
-
*/
|
|
9
|
-
immediate?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface ComponentUseFocusTrapOptions extends RenderableComponent {
|
|
13
|
-
options?: UseFocusTrapOptions;
|
|
14
|
-
}
|
|
15
|
-
declare const UseFocusTrap: vue.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ComponentUseFocusTrapOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
16
|
-
|
|
17
|
-
export { type ComponentUseFocusTrapOptions, UseFocusTrap };
|
package/useFocusTrap.cjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@vueuse/core');
|
|
4
|
-
var shared = require('@vueuse/shared');
|
|
5
|
-
var focusTrap = require('focus-trap');
|
|
6
|
-
var vue = require('vue');
|
|
7
|
-
|
|
8
|
-
function useFocusTrap(target, options = {}) {
|
|
9
|
-
let trap;
|
|
10
|
-
const { immediate, ...focusTrapOptions } = options;
|
|
11
|
-
const hasFocus = vue.shallowRef(false);
|
|
12
|
-
const isPaused = vue.shallowRef(false);
|
|
13
|
-
const activate = (opts) => trap && trap.activate(opts);
|
|
14
|
-
const deactivate = (opts) => trap && trap.deactivate(opts);
|
|
15
|
-
const pause = () => {
|
|
16
|
-
if (trap) {
|
|
17
|
-
trap.pause();
|
|
18
|
-
isPaused.value = true;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const unpause = () => {
|
|
22
|
-
if (trap) {
|
|
23
|
-
trap.unpause();
|
|
24
|
-
isPaused.value = false;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const targets = vue.computed(() => {
|
|
28
|
-
const _targets = vue.toValue(target);
|
|
29
|
-
return core.toArray(_targets).map((el) => {
|
|
30
|
-
const _el = vue.toValue(el);
|
|
31
|
-
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
|
32
|
-
}).filter(shared.notNullish);
|
|
33
|
-
});
|
|
34
|
-
vue.watch(
|
|
35
|
-
targets,
|
|
36
|
-
(els) => {
|
|
37
|
-
if (!els.length)
|
|
38
|
-
return;
|
|
39
|
-
trap = focusTrap.createFocusTrap(els, {
|
|
40
|
-
...focusTrapOptions,
|
|
41
|
-
onActivate() {
|
|
42
|
-
hasFocus.value = true;
|
|
43
|
-
if (options.onActivate)
|
|
44
|
-
options.onActivate();
|
|
45
|
-
},
|
|
46
|
-
onDeactivate() {
|
|
47
|
-
hasFocus.value = false;
|
|
48
|
-
if (options.onDeactivate)
|
|
49
|
-
options.onDeactivate();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
if (immediate)
|
|
53
|
-
activate();
|
|
54
|
-
},
|
|
55
|
-
{ flush: "post" }
|
|
56
|
-
);
|
|
57
|
-
core.tryOnScopeDispose(() => deactivate());
|
|
58
|
-
return {
|
|
59
|
-
hasFocus,
|
|
60
|
-
isPaused,
|
|
61
|
-
activate,
|
|
62
|
-
deactivate,
|
|
63
|
-
pause,
|
|
64
|
-
unpause
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
exports.useFocusTrap = useFocusTrap;
|
package/useFocusTrap.d.cts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
|
|
2
|
-
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
|
3
|
-
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
|
4
|
-
|
|
5
|
-
interface UseFocusTrapOptions extends Options {
|
|
6
|
-
/**
|
|
7
|
-
* Immediately activate the trap
|
|
8
|
-
*/
|
|
9
|
-
immediate?: boolean;
|
|
10
|
-
}
|
|
11
|
-
interface UseFocusTrapReturn {
|
|
12
|
-
/**
|
|
13
|
-
* Indicates if the focus trap is currently active
|
|
14
|
-
*/
|
|
15
|
-
hasFocus: ShallowRef<boolean>;
|
|
16
|
-
/**
|
|
17
|
-
* Indicates if the focus trap is currently paused
|
|
18
|
-
*/
|
|
19
|
-
isPaused: ShallowRef<boolean>;
|
|
20
|
-
/**
|
|
21
|
-
* Activate the focus trap
|
|
22
|
-
*
|
|
23
|
-
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
|
24
|
-
* @param opts Activate focus trap options
|
|
25
|
-
*/
|
|
26
|
-
activate: (opts?: ActivateOptions) => void;
|
|
27
|
-
/**
|
|
28
|
-
* Deactivate the focus trap
|
|
29
|
-
*
|
|
30
|
-
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
|
31
|
-
* @param opts Deactivate focus trap options
|
|
32
|
-
*/
|
|
33
|
-
deactivate: (opts?: DeactivateOptions) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Pause the focus trap
|
|
36
|
-
*
|
|
37
|
-
* @see https://github.com/focus-trap/focus-trap#trappause
|
|
38
|
-
*/
|
|
39
|
-
pause: Fn;
|
|
40
|
-
/**
|
|
41
|
-
* Unpauses the focus trap
|
|
42
|
-
*
|
|
43
|
-
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
|
44
|
-
*/
|
|
45
|
-
unpause: Fn;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Reactive focus-trap
|
|
49
|
-
*
|
|
50
|
-
* @see https://vueuse.org/useFocusTrap
|
|
51
|
-
*/
|
|
52
|
-
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
|
53
|
-
|
|
54
|
-
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };
|
package/useFocusTrap.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
|
|
2
|
-
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
|
3
|
-
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
|
4
|
-
|
|
5
|
-
interface UseFocusTrapOptions extends Options {
|
|
6
|
-
/**
|
|
7
|
-
* Immediately activate the trap
|
|
8
|
-
*/
|
|
9
|
-
immediate?: boolean;
|
|
10
|
-
}
|
|
11
|
-
interface UseFocusTrapReturn {
|
|
12
|
-
/**
|
|
13
|
-
* Indicates if the focus trap is currently active
|
|
14
|
-
*/
|
|
15
|
-
hasFocus: ShallowRef<boolean>;
|
|
16
|
-
/**
|
|
17
|
-
* Indicates if the focus trap is currently paused
|
|
18
|
-
*/
|
|
19
|
-
isPaused: ShallowRef<boolean>;
|
|
20
|
-
/**
|
|
21
|
-
* Activate the focus trap
|
|
22
|
-
*
|
|
23
|
-
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
|
24
|
-
* @param opts Activate focus trap options
|
|
25
|
-
*/
|
|
26
|
-
activate: (opts?: ActivateOptions) => void;
|
|
27
|
-
/**
|
|
28
|
-
* Deactivate the focus trap
|
|
29
|
-
*
|
|
30
|
-
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
|
31
|
-
* @param opts Deactivate focus trap options
|
|
32
|
-
*/
|
|
33
|
-
deactivate: (opts?: DeactivateOptions) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Pause the focus trap
|
|
36
|
-
*
|
|
37
|
-
* @see https://github.com/focus-trap/focus-trap#trappause
|
|
38
|
-
*/
|
|
39
|
-
pause: Fn;
|
|
40
|
-
/**
|
|
41
|
-
* Unpauses the focus trap
|
|
42
|
-
*
|
|
43
|
-
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
|
44
|
-
*/
|
|
45
|
-
unpause: Fn;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Reactive focus-trap
|
|
49
|
-
*
|
|
50
|
-
* @see https://vueuse.org/useFocusTrap
|
|
51
|
-
*/
|
|
52
|
-
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
|
53
|
-
|
|
54
|
-
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };
|
package/useFuse.cjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var Fuse = require('fuse.js');
|
|
4
|
-
var vue = require('vue');
|
|
5
|
-
|
|
6
|
-
function useFuse(search, data, options) {
|
|
7
|
-
const createFuse = () => {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
return new Fuse(
|
|
10
|
-
(_a = vue.toValue(data)) != null ? _a : [],
|
|
11
|
-
(_b = vue.toValue(options)) == null ? void 0 : _b.fuseOptions
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
const fuse = vue.ref(createFuse());
|
|
15
|
-
vue.watch(
|
|
16
|
-
() => {
|
|
17
|
-
var _a;
|
|
18
|
-
return (_a = vue.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
|
19
|
-
},
|
|
20
|
-
() => {
|
|
21
|
-
fuse.value = createFuse();
|
|
22
|
-
},
|
|
23
|
-
{ deep: true }
|
|
24
|
-
);
|
|
25
|
-
vue.watch(
|
|
26
|
-
() => vue.toValue(data),
|
|
27
|
-
(newData) => {
|
|
28
|
-
fuse.value.setCollection(newData);
|
|
29
|
-
},
|
|
30
|
-
{ deep: true }
|
|
31
|
-
);
|
|
32
|
-
const results = vue.computed(() => {
|
|
33
|
-
const resolved = vue.toValue(options);
|
|
34
|
-
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vue.toValue(search))
|
|
35
|
-
return vue.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
36
|
-
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
|
37
|
-
return fuse.value.search(vue.toValue(search), limit ? { limit } : void 0);
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
fuse,
|
|
41
|
-
results
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
exports.useFuse = useFuse;
|
package/useFuse.d.cts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue';
|
|
2
|
-
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
3
|
-
import * as fuse_js from 'fuse.js';
|
|
4
|
-
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
|
5
|
-
|
|
6
|
-
type FuseOptions<T> = IFuseOptions<T>;
|
|
7
|
-
interface UseFuseOptions<T> {
|
|
8
|
-
fuseOptions?: FuseOptions<T>;
|
|
9
|
-
resultLimit?: number;
|
|
10
|
-
matchAllWhenSearchEmpty?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
|
13
|
-
fuse: vue.Ref<{
|
|
14
|
-
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
|
15
|
-
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
|
16
|
-
add: (doc: DataItem) => void;
|
|
17
|
-
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
|
18
|
-
removeAt: (idx: number) => void;
|
|
19
|
-
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
|
20
|
-
}, fuse_js__default<DataItem> | {
|
|
21
|
-
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
|
22
|
-
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
|
23
|
-
add: (doc: DataItem) => void;
|
|
24
|
-
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
|
25
|
-
removeAt: (idx: number) => void;
|
|
26
|
-
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
|
27
|
-
}>;
|
|
28
|
-
results: ComputedRef<FuseResult<DataItem>[]>;
|
|
29
|
-
};
|
|
30
|
-
type UseFuseReturn = ReturnType<typeof useFuse>;
|
|
31
|
-
|
|
32
|
-
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };
|
package/useFuse.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue';
|
|
2
|
-
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
3
|
-
import * as fuse_js from 'fuse.js';
|
|
4
|
-
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
|
5
|
-
|
|
6
|
-
type FuseOptions<T> = IFuseOptions<T>;
|
|
7
|
-
interface UseFuseOptions<T> {
|
|
8
|
-
fuseOptions?: FuseOptions<T>;
|
|
9
|
-
resultLimit?: number;
|
|
10
|
-
matchAllWhenSearchEmpty?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
|
13
|
-
fuse: vue.Ref<{
|
|
14
|
-
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
|
15
|
-
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
|
16
|
-
add: (doc: DataItem) => void;
|
|
17
|
-
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
|
18
|
-
removeAt: (idx: number) => void;
|
|
19
|
-
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
|
20
|
-
}, fuse_js__default<DataItem> | {
|
|
21
|
-
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
|
22
|
-
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
|
23
|
-
add: (doc: DataItem) => void;
|
|
24
|
-
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
|
25
|
-
removeAt: (idx: number) => void;
|
|
26
|
-
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
|
27
|
-
}>;
|
|
28
|
-
results: ComputedRef<FuseResult<DataItem>[]>;
|
|
29
|
-
};
|
|
30
|
-
type UseFuseReturn = ReturnType<typeof useFuse>;
|
|
31
|
-
|
|
32
|
-
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };
|
package/useIDBKeyval.cjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@vueuse/core');
|
|
4
|
-
var idbKeyval = require('idb-keyval');
|
|
5
|
-
var vue = require('vue');
|
|
6
|
-
|
|
7
|
-
function useIDBKeyval(key, initialValue, options = {}) {
|
|
8
|
-
const {
|
|
9
|
-
flush = "pre",
|
|
10
|
-
deep = true,
|
|
11
|
-
shallow = false,
|
|
12
|
-
onError = (e) => {
|
|
13
|
-
console.error(e);
|
|
14
|
-
},
|
|
15
|
-
writeDefaults = true
|
|
16
|
-
} = options;
|
|
17
|
-
const isFinished = vue.shallowRef(false);
|
|
18
|
-
const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
|
|
19
|
-
const rawInit = vue.toValue(initialValue);
|
|
20
|
-
async function read() {
|
|
21
|
-
try {
|
|
22
|
-
const rawValue = await idbKeyval.get(key);
|
|
23
|
-
if (rawValue === void 0) {
|
|
24
|
-
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
|
|
25
|
-
await idbKeyval.set(key, rawInit);
|
|
26
|
-
} else {
|
|
27
|
-
data.value = rawValue;
|
|
28
|
-
}
|
|
29
|
-
} catch (e) {
|
|
30
|
-
onError(e);
|
|
31
|
-
}
|
|
32
|
-
isFinished.value = true;
|
|
33
|
-
}
|
|
34
|
-
read();
|
|
35
|
-
async function write() {
|
|
36
|
-
try {
|
|
37
|
-
if (data.value == null) {
|
|
38
|
-
await idbKeyval.del(key);
|
|
39
|
-
} else {
|
|
40
|
-
await idbKeyval.update(key, () => vue.toRaw(data.value));
|
|
41
|
-
}
|
|
42
|
-
} catch (e) {
|
|
43
|
-
onError(e);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const {
|
|
47
|
-
pause: pauseWatch,
|
|
48
|
-
resume: resumeWatch
|
|
49
|
-
} = core.watchPausable(data, () => write(), { flush, deep });
|
|
50
|
-
async function setData(value) {
|
|
51
|
-
pauseWatch();
|
|
52
|
-
data.value = value;
|
|
53
|
-
await write();
|
|
54
|
-
resumeWatch();
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
set: setData,
|
|
58
|
-
isFinished,
|
|
59
|
-
data
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
exports.useIDBKeyval = useIDBKeyval;
|