@vueuse/integrations 13.9.0 → 14.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +473 -0
- package/dist/index.iife.js +772 -0
- package/dist/index.iife.min.js +1 -0
- package/dist/index.js +731 -0
- package/dist/useAsyncValidator/component.d.ts +19 -0
- package/dist/useAsyncValidator/component.js +20 -0
- package/dist/useAsyncValidator.d.ts +48 -0
- package/dist/useAsyncValidator.iife.js +99 -0
- package/dist/useAsyncValidator.iife.min.js +1 -0
- package/dist/useAsyncValidator.js +73 -0
- package/{useAxios.d.mts → dist/useAxios.d.ts} +86 -86
- package/dist/useAxios.iife.js +150 -0
- package/dist/useAxios.iife.min.js +1 -0
- package/dist/useAxios.js +124 -0
- package/{useChangeCase.d.mts → dist/useChangeCase.d.ts} +7 -9
- package/dist/useChangeCase.iife.js +61 -0
- package/dist/useChangeCase.iife.min.js +1 -0
- package/dist/useChangeCase.js +35 -0
- package/dist/useCookies.d.ts +64 -0
- package/dist/useCookies.iife.js +104 -0
- package/dist/useCookies.iife.min.js +1 -0
- package/dist/useCookies.js +77 -0
- package/dist/useDrauu.d.ts +33 -0
- package/dist/useDrauu.iife.js +146 -0
- package/dist/useDrauu.iife.min.js +1 -0
- package/dist/useDrauu.js +120 -0
- package/dist/useFocusTrap/component.d.ts +21 -0
- package/dist/useFocusTrap/component.js +17 -0
- package/dist/useFocusTrap.d.ts +55 -0
- package/dist/useFocusTrap.iife.js +97 -0
- package/dist/useFocusTrap.iife.min.js +1 -0
- package/dist/useFocusTrap.js +71 -0
- package/dist/useFuse.d.ts +33 -0
- package/dist/useFuse.iife.js +62 -0
- package/dist/useFuse.iife.min.js +1 -0
- package/dist/useFuse.js +36 -0
- package/dist/useIDBKeyval.d.ts +52 -0
- package/dist/useIDBKeyval.iife.js +93 -0
- package/dist/useIDBKeyval.iife.min.js +1 -0
- package/dist/useIDBKeyval.js +67 -0
- package/dist/useJwt.d.ts +28 -0
- package/dist/useJwt.iife.js +55 -0
- package/dist/useJwt.iife.min.js +1 -0
- package/dist/useJwt.js +29 -0
- package/dist/useNProgress.d.ts +21 -0
- package/dist/useNProgress.iife.js +66 -0
- package/dist/useNProgress.iife.min.js +1 -0
- package/dist/useNProgress.js +40 -0
- package/dist/useQRCode.d.ts +16 -0
- package/dist/useQRCode.iife.js +49 -0
- package/dist/useQRCode.iife.min.js +1 -0
- package/dist/useQRCode.js +23 -0
- package/dist/useSortable/component.d.ts +18 -0
- package/dist/useSortable/component.js +23 -0
- package/{useSortable.d.mts → dist/useSortable.d.ts} +20 -20
- package/dist/useSortable.iife.js +107 -0
- package/dist/useSortable.iife.min.js +1 -0
- package/dist/useSortable.js +78 -0
- package/package.json +27 -29
- package/index.d.mts +0 -458
- package/index.iife.js +0 -708
- package/index.iife.min.js +0 -1
- package/index.mjs +0 -685
- package/useAsyncValidator/component.d.mts +0 -27
- package/useAsyncValidator/component.mjs +0 -87
- package/useAsyncValidator.d.mts +0 -48
- package/useAsyncValidator.iife.js +0 -73
- package/useAsyncValidator.iife.min.js +0 -1
- package/useAsyncValidator.mjs +0 -72
- package/useAxios.iife.js +0 -124
- package/useAxios.iife.min.js +0 -1
- package/useAxios.mjs +0 -123
- package/useChangeCase.iife.js +0 -50
- package/useChangeCase.iife.min.js +0 -1
- package/useChangeCase.mjs +0 -29
- package/useCookies.d.mts +0 -56
- package/useCookies.iife.js +0 -64
- package/useCookies.iife.min.js +0 -1
- package/useCookies.mjs +0 -62
- package/useDrauu.d.mts +0 -33
- package/useDrauu.iife.js +0 -114
- package/useDrauu.iife.min.js +0 -1
- package/useDrauu.mjs +0 -114
- package/useFocusTrap/component.d.mts +0 -18
- package/useFocusTrap/component.mjs +0 -31
- package/useFocusTrap.d.mts +0 -55
- package/useFocusTrap.iife.js +0 -74
- package/useFocusTrap.iife.min.js +0 -1
- package/useFocusTrap.mjs +0 -74
- package/useFuse.d.mts +0 -33
- package/useFuse.iife.js +0 -45
- package/useFuse.iife.min.js +0 -1
- package/useFuse.mjs +0 -43
- package/useIDBKeyval.d.mts +0 -52
- package/useIDBKeyval.iife.js +0 -70
- package/useIDBKeyval.iife.min.js +0 -1
- package/useIDBKeyval.mjs +0 -69
- package/useJwt.d.mts +0 -28
- package/useJwt.iife.js +0 -27
- package/useJwt.iife.min.js +0 -1
- package/useJwt.mjs +0 -25
- package/useNProgress.d.mts +0 -21
- package/useNProgress.iife.js +0 -36
- package/useNProgress.iife.min.js +0 -1
- package/useNProgress.mjs +0 -35
- package/useQRCode.d.mts +0 -14
- package/useQRCode.iife.js +0 -20
- package/useQRCode.iife.min.js +0 -1
- package/useQRCode.mjs +0 -19
- package/useSortable/component.d.mts +0 -40
- package/useSortable/component.mjs +0 -89
- package/useSortable.iife.js +0 -66
- package/useSortable.iife.min.js +0 -1
- package/useSortable.mjs +0 -62
package/useCookies.d.mts
DELETED
|
@@ -1,56 +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
|
-
* @__NO_SIDE_EFFECTS__
|
|
37
|
-
*/
|
|
38
|
-
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
39
|
-
doNotParse?: boolean | undefined;
|
|
40
|
-
autoUpdateDependencies?: boolean | undefined;
|
|
41
|
-
}, cookies?: universal_cookie__default): {
|
|
42
|
-
/**
|
|
43
|
-
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
44
|
-
*/
|
|
45
|
-
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
46
|
-
/**
|
|
47
|
-
* Reactive get all cookies
|
|
48
|
-
*/
|
|
49
|
-
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
50
|
-
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
51
|
-
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
52
|
-
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
53
|
-
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { createCookies, useCookies };
|
package/useCookies.iife.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
(function (exports, shared, Cookie, vue) {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
function createCookies(req) {
|
|
5
|
-
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
6
|
-
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => /* @__PURE__ */ useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
7
|
-
}
|
|
8
|
-
// @__NO_SIDE_EFFECTS__
|
|
9
|
-
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
|
|
10
|
-
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
|
11
|
-
let previousCookies = cookies.getAll({ doNotParse: true });
|
|
12
|
-
const touches = vue.shallowRef(0);
|
|
13
|
-
const onChange = () => {
|
|
14
|
-
const newCookies = cookies.getAll({ doNotParse: true });
|
|
15
|
-
if (shouldUpdate(
|
|
16
|
-
watchingDependencies || null,
|
|
17
|
-
newCookies,
|
|
18
|
-
previousCookies
|
|
19
|
-
)) {
|
|
20
|
-
touches.value++;
|
|
21
|
-
}
|
|
22
|
-
previousCookies = newCookies;
|
|
23
|
-
};
|
|
24
|
-
cookies.addChangeListener(onChange);
|
|
25
|
-
shared.tryOnScopeDispose(() => {
|
|
26
|
-
cookies.removeChangeListener(onChange);
|
|
27
|
-
});
|
|
28
|
-
return {
|
|
29
|
-
/**
|
|
30
|
-
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
31
|
-
*/
|
|
32
|
-
get: (...args) => {
|
|
33
|
-
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
34
|
-
watchingDependencies.push(args[0]);
|
|
35
|
-
touches.value;
|
|
36
|
-
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* Reactive get all cookies
|
|
40
|
-
*/
|
|
41
|
-
getAll: (...args) => {
|
|
42
|
-
touches.value;
|
|
43
|
-
return cookies.getAll({ doNotParse, ...args[0] });
|
|
44
|
-
},
|
|
45
|
-
set: (...args) => cookies.set(...args),
|
|
46
|
-
remove: (...args) => cookies.remove(...args),
|
|
47
|
-
addChangeListener: (...args) => cookies.addChangeListener(...args),
|
|
48
|
-
removeChangeListener: (...args) => cookies.removeChangeListener(...args)
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
52
|
-
if (!dependencies)
|
|
53
|
-
return true;
|
|
54
|
-
for (const dependency of dependencies) {
|
|
55
|
-
if (newCookies[dependency] !== oldCookies[dependency])
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
exports.createCookies = createCookies;
|
|
62
|
-
exports.useCookies = useCookies;
|
|
63
|
-
|
|
64
|
-
})(this.VueUse = this.VueUse || {}, VueUse, UniversalCookie, Vue);
|
package/useCookies.iife.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(a,C,o,g){"use strict";function v(n){const r=new o(n?n.headers.cookie:null);return(u,{doNotParse:t=!1,autoUpdateDependencies:s=!1}={})=>i(u,{doNotParse:t,autoUpdateDependencies:s},r)}function i(n,{doNotParse:r=!1,autoUpdateDependencies:u=!1}={},t=new o){const s=u?[...n||[]]:n;let f=t.getAll({doNotParse:!0});const l=g.shallowRef(0),h=()=>{const e=t.getAll({doNotParse:!0});c(s||null,e,f)&&l.value++,f=e};return t.addChangeListener(h),C.tryOnScopeDispose(()=>{t.removeChangeListener(h)}),{get:(...e)=>(u&&s&&!s.includes(e[0])&&s.push(e[0]),l.value,t.get(e[0],{doNotParse:r,...e[1]})),getAll:(...e)=>(l.value,t.getAll({doNotParse:r,...e[0]})),set:(...e)=>t.set(...e),remove:(...e)=>t.remove(...e),addChangeListener:(...e)=>t.addChangeListener(...e),removeChangeListener:(...e)=>t.removeChangeListener(...e)}}function c(n,r,u){if(!n)return!0;for(const t of n)if(r[t]!==u[t])return!0;return!1}a.createCookies=v,a.useCookies=i})(this.VueUse=this.VueUse||{},VueUse,UniversalCookie,Vue);
|
package/useCookies.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { tryOnScopeDispose } from '@vueuse/shared';
|
|
2
|
-
import Cookie from 'universal-cookie';
|
|
3
|
-
import { shallowRef } from 'vue';
|
|
4
|
-
|
|
5
|
-
function createCookies(req) {
|
|
6
|
-
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
7
|
-
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => /* @__PURE__ */ useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
8
|
-
}
|
|
9
|
-
// @__NO_SIDE_EFFECTS__
|
|
10
|
-
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
|
|
11
|
-
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
|
12
|
-
let previousCookies = cookies.getAll({ doNotParse: true });
|
|
13
|
-
const touches = shallowRef(0);
|
|
14
|
-
const onChange = () => {
|
|
15
|
-
const newCookies = cookies.getAll({ doNotParse: true });
|
|
16
|
-
if (shouldUpdate(
|
|
17
|
-
watchingDependencies || null,
|
|
18
|
-
newCookies,
|
|
19
|
-
previousCookies
|
|
20
|
-
)) {
|
|
21
|
-
touches.value++;
|
|
22
|
-
}
|
|
23
|
-
previousCookies = newCookies;
|
|
24
|
-
};
|
|
25
|
-
cookies.addChangeListener(onChange);
|
|
26
|
-
tryOnScopeDispose(() => {
|
|
27
|
-
cookies.removeChangeListener(onChange);
|
|
28
|
-
});
|
|
29
|
-
return {
|
|
30
|
-
/**
|
|
31
|
-
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
32
|
-
*/
|
|
33
|
-
get: (...args) => {
|
|
34
|
-
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
35
|
-
watchingDependencies.push(args[0]);
|
|
36
|
-
touches.value;
|
|
37
|
-
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* Reactive get all cookies
|
|
41
|
-
*/
|
|
42
|
-
getAll: (...args) => {
|
|
43
|
-
touches.value;
|
|
44
|
-
return cookies.getAll({ doNotParse, ...args[0] });
|
|
45
|
-
},
|
|
46
|
-
set: (...args) => cookies.set(...args),
|
|
47
|
-
remove: (...args) => cookies.remove(...args),
|
|
48
|
-
addChangeListener: (...args) => cookies.addChangeListener(...args),
|
|
49
|
-
removeChangeListener: (...args) => cookies.removeChangeListener(...args)
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
53
|
-
if (!dependencies)
|
|
54
|
-
return true;
|
|
55
|
-
for (const dependency of dependencies) {
|
|
56
|
-
if (newCookies[dependency] !== oldCookies[dependency])
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { createCookies, useCookies };
|
package/useDrauu.d.mts
DELETED
|
@@ -1,33 +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 { useDrauu };
|
|
33
|
-
export type { UseDrauuOptions, UseDrauuReturn };
|
package/useDrauu.iife.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
(function (exports, core, shared, drauu, vue) {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
function useDrauu(target, options) {
|
|
5
|
-
const drauuInstance = vue.ref();
|
|
6
|
-
let disposables = [];
|
|
7
|
-
const onChangedHook = core.createEventHook();
|
|
8
|
-
const onCanceledHook = core.createEventHook();
|
|
9
|
-
const onCommittedHook = core.createEventHook();
|
|
10
|
-
const onStartHook = core.createEventHook();
|
|
11
|
-
const onEndHook = core.createEventHook();
|
|
12
|
-
const canUndo = vue.shallowRef(false);
|
|
13
|
-
const canRedo = vue.shallowRef(false);
|
|
14
|
-
const altPressed = vue.shallowRef(false);
|
|
15
|
-
const shiftPressed = vue.shallowRef(false);
|
|
16
|
-
const brush = vue.ref({
|
|
17
|
-
color: "black",
|
|
18
|
-
size: 3,
|
|
19
|
-
arrowEnd: false,
|
|
20
|
-
cornerRadius: 0,
|
|
21
|
-
dasharray: void 0,
|
|
22
|
-
fill: "transparent",
|
|
23
|
-
mode: "draw",
|
|
24
|
-
...options == null ? void 0 : options.brush
|
|
25
|
-
});
|
|
26
|
-
vue.watch(brush, () => {
|
|
27
|
-
const instance = drauuInstance.value;
|
|
28
|
-
if (instance) {
|
|
29
|
-
instance.brush = brush.value;
|
|
30
|
-
instance.mode = brush.value.mode;
|
|
31
|
-
}
|
|
32
|
-
}, { deep: true });
|
|
33
|
-
const undo = () => {
|
|
34
|
-
var _a;
|
|
35
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
|
|
36
|
-
};
|
|
37
|
-
const redo = () => {
|
|
38
|
-
var _a;
|
|
39
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
40
|
-
};
|
|
41
|
-
const clear = () => {
|
|
42
|
-
var _a;
|
|
43
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
44
|
-
};
|
|
45
|
-
const cancel = () => {
|
|
46
|
-
var _a;
|
|
47
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
48
|
-
};
|
|
49
|
-
const load = (svg) => {
|
|
50
|
-
var _a;
|
|
51
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
52
|
-
};
|
|
53
|
-
const dump = () => {
|
|
54
|
-
var _a;
|
|
55
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
56
|
-
};
|
|
57
|
-
const cleanup = () => {
|
|
58
|
-
var _a;
|
|
59
|
-
disposables.forEach((dispose) => dispose());
|
|
60
|
-
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
|
|
61
|
-
};
|
|
62
|
-
const syncStatus = () => {
|
|
63
|
-
if (drauuInstance.value) {
|
|
64
|
-
canUndo.value = drauuInstance.value.canUndo();
|
|
65
|
-
canRedo.value = drauuInstance.value.canRedo();
|
|
66
|
-
altPressed.value = drauuInstance.value.altPressed;
|
|
67
|
-
shiftPressed.value = drauuInstance.value.shiftPressed;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
vue.watch(
|
|
71
|
-
() => core.unrefElement(target),
|
|
72
|
-
(el) => {
|
|
73
|
-
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
|
|
74
|
-
return;
|
|
75
|
-
if (drauuInstance.value)
|
|
76
|
-
cleanup();
|
|
77
|
-
drauuInstance.value = drauu.createDrauu({ el, ...options });
|
|
78
|
-
syncStatus();
|
|
79
|
-
disposables = [
|
|
80
|
-
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
|
|
81
|
-
drauuInstance.value.on("committed", (node) => onCommittedHook.trigger(node)),
|
|
82
|
-
drauuInstance.value.on("start", () => onStartHook.trigger()),
|
|
83
|
-
drauuInstance.value.on("end", () => onEndHook.trigger()),
|
|
84
|
-
drauuInstance.value.on("changed", () => {
|
|
85
|
-
syncStatus();
|
|
86
|
-
onChangedHook.trigger();
|
|
87
|
-
})
|
|
88
|
-
];
|
|
89
|
-
},
|
|
90
|
-
{ flush: "post" }
|
|
91
|
-
);
|
|
92
|
-
shared.tryOnScopeDispose(() => cleanup());
|
|
93
|
-
return {
|
|
94
|
-
drauuInstance,
|
|
95
|
-
load,
|
|
96
|
-
dump,
|
|
97
|
-
clear,
|
|
98
|
-
cancel,
|
|
99
|
-
undo,
|
|
100
|
-
redo,
|
|
101
|
-
canUndo,
|
|
102
|
-
canRedo,
|
|
103
|
-
brush,
|
|
104
|
-
onChanged: onChangedHook.on,
|
|
105
|
-
onCommitted: onCommittedHook.on,
|
|
106
|
-
onStart: onStartHook.on,
|
|
107
|
-
onEnd: onEndHook.on,
|
|
108
|
-
onCanceled: onCanceledHook.on
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
exports.useDrauu = useDrauu;
|
|
113
|
-
|
|
114
|
-
})(this.VueUse = this.VueUse || {}, VueUse, VueUse, Drauu, Vue);
|
package/useDrauu.iife.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(E,o,k,H,a){"use strict";function V(p,u){const n=a.ref();let r=[];const s=o.createEventHook(),c=o.createEventHook(),d=o.createEventHook(),v=o.createEventHook(),i=o.createEventHook(),f=a.shallowRef(!1),h=a.shallowRef(!1),w=a.shallowRef(!1),S=a.shallowRef(!1),l=a.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...u?.brush});a.watch(l,()=>{const e=n.value;e&&(e.brush=l.value,e.mode=l.value.mode)},{deep:!0});const R=()=>{var e;return(e=n.value)==null?void 0:e.undo()},_=()=>{var e;return(e=n.value)==null?void 0:e.redo()},C=()=>{var e;return(e=n.value)==null?void 0:e.clear()},U=()=>{var e;return(e=n.value)==null?void 0:e.cancel()},b=e=>{var t;return(t=n.value)==null?void 0:t.load(e)},D=()=>{var e;return(e=n.value)==null?void 0:e.dump()},m=()=>{var e;r.forEach(t=>t()),(e=n.value)==null||e.unmount()},g=()=>{n.value&&(f.value=n.value.canUndo(),h.value=n.value.canRedo(),w.value=n.value.altPressed,S.value=n.value.shiftPressed)};return a.watch(()=>o.unrefElement(p),e=>{!e||typeof SVGSVGElement>"u"||!(e instanceof SVGSVGElement)||(n.value&&m(),n.value=H.createDrauu({el:e,...u}),g(),r=[n.value.on("canceled",()=>c.trigger()),n.value.on("committed",t=>d.trigger(t)),n.value.on("start",()=>v.trigger()),n.value.on("end",()=>i.trigger()),n.value.on("changed",()=>{g(),s.trigger()})])},{flush:"post"}),k.tryOnScopeDispose(()=>m()),{drauuInstance:n,load:b,dump:D,clear:C,cancel:U,undo:R,redo:_,canUndo:f,canRedo:h,brush:l,onChanged:s.on,onCommitted:d.on,onStart:v.on,onEnd:i.on,onCanceled:c.on}}E.useDrauu=V})(this.VueUse=this.VueUse||{},VueUse,VueUse,Drauu,Vue);
|
package/useDrauu.mjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { createEventHook, unrefElement } from '@vueuse/core';
|
|
2
|
-
import { tryOnScopeDispose } from '@vueuse/shared';
|
|
3
|
-
import { createDrauu } from 'drauu';
|
|
4
|
-
import { ref, shallowRef, watch } from 'vue';
|
|
5
|
-
|
|
6
|
-
function useDrauu(target, options) {
|
|
7
|
-
const drauuInstance = ref();
|
|
8
|
-
let disposables = [];
|
|
9
|
-
const onChangedHook = createEventHook();
|
|
10
|
-
const onCanceledHook = createEventHook();
|
|
11
|
-
const onCommittedHook = createEventHook();
|
|
12
|
-
const onStartHook = createEventHook();
|
|
13
|
-
const onEndHook = createEventHook();
|
|
14
|
-
const canUndo = shallowRef(false);
|
|
15
|
-
const canRedo = shallowRef(false);
|
|
16
|
-
const altPressed = shallowRef(false);
|
|
17
|
-
const shiftPressed = shallowRef(false);
|
|
18
|
-
const brush = ref({
|
|
19
|
-
color: "black",
|
|
20
|
-
size: 3,
|
|
21
|
-
arrowEnd: false,
|
|
22
|
-
cornerRadius: 0,
|
|
23
|
-
dasharray: void 0,
|
|
24
|
-
fill: "transparent",
|
|
25
|
-
mode: "draw",
|
|
26
|
-
...options == null ? void 0 : options.brush
|
|
27
|
-
});
|
|
28
|
-
watch(brush, () => {
|
|
29
|
-
const instance = drauuInstance.value;
|
|
30
|
-
if (instance) {
|
|
31
|
-
instance.brush = brush.value;
|
|
32
|
-
instance.mode = brush.value.mode;
|
|
33
|
-
}
|
|
34
|
-
}, { deep: true });
|
|
35
|
-
const undo = () => {
|
|
36
|
-
var _a;
|
|
37
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
|
|
38
|
-
};
|
|
39
|
-
const redo = () => {
|
|
40
|
-
var _a;
|
|
41
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
42
|
-
};
|
|
43
|
-
const clear = () => {
|
|
44
|
-
var _a;
|
|
45
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
46
|
-
};
|
|
47
|
-
const cancel = () => {
|
|
48
|
-
var _a;
|
|
49
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
50
|
-
};
|
|
51
|
-
const load = (svg) => {
|
|
52
|
-
var _a;
|
|
53
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
54
|
-
};
|
|
55
|
-
const dump = () => {
|
|
56
|
-
var _a;
|
|
57
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
58
|
-
};
|
|
59
|
-
const cleanup = () => {
|
|
60
|
-
var _a;
|
|
61
|
-
disposables.forEach((dispose) => dispose());
|
|
62
|
-
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
|
|
63
|
-
};
|
|
64
|
-
const syncStatus = () => {
|
|
65
|
-
if (drauuInstance.value) {
|
|
66
|
-
canUndo.value = drauuInstance.value.canUndo();
|
|
67
|
-
canRedo.value = drauuInstance.value.canRedo();
|
|
68
|
-
altPressed.value = drauuInstance.value.altPressed;
|
|
69
|
-
shiftPressed.value = drauuInstance.value.shiftPressed;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
watch(
|
|
73
|
-
() => unrefElement(target),
|
|
74
|
-
(el) => {
|
|
75
|
-
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
|
|
76
|
-
return;
|
|
77
|
-
if (drauuInstance.value)
|
|
78
|
-
cleanup();
|
|
79
|
-
drauuInstance.value = createDrauu({ el, ...options });
|
|
80
|
-
syncStatus();
|
|
81
|
-
disposables = [
|
|
82
|
-
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
|
|
83
|
-
drauuInstance.value.on("committed", (node) => onCommittedHook.trigger(node)),
|
|
84
|
-
drauuInstance.value.on("start", () => onStartHook.trigger()),
|
|
85
|
-
drauuInstance.value.on("end", () => onEndHook.trigger()),
|
|
86
|
-
drauuInstance.value.on("changed", () => {
|
|
87
|
-
syncStatus();
|
|
88
|
-
onChangedHook.trigger();
|
|
89
|
-
})
|
|
90
|
-
];
|
|
91
|
-
},
|
|
92
|
-
{ flush: "post" }
|
|
93
|
-
);
|
|
94
|
-
tryOnScopeDispose(() => cleanup());
|
|
95
|
-
return {
|
|
96
|
-
drauuInstance,
|
|
97
|
-
load,
|
|
98
|
-
dump,
|
|
99
|
-
clear,
|
|
100
|
-
cancel,
|
|
101
|
-
undo,
|
|
102
|
-
redo,
|
|
103
|
-
canUndo,
|
|
104
|
-
canRedo,
|
|
105
|
-
brush,
|
|
106
|
-
onChanged: onChangedHook.on,
|
|
107
|
-
onCommitted: onCommittedHook.on,
|
|
108
|
-
onStart: onStartHook.on,
|
|
109
|
-
onEnd: onEndHook.on,
|
|
110
|
-
onCanceled: onCanceledHook.on
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { useDrauu };
|
|
@@ -1,18 +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 { UseFocusTrap };
|
|
18
|
-
export type { ComponentUseFocusTrapOptions };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { unrefElement } from '@vueuse/core';
|
|
2
|
-
import { createFocusTrap } from 'focus-trap';
|
|
3
|
-
import { defineComponent, ref, watch, onScopeDispose, h } from 'vue';
|
|
4
|
-
|
|
5
|
-
const UseFocusTrap = /* @__PURE__ */ defineComponent({
|
|
6
|
-
name: "UseFocusTrap",
|
|
7
|
-
props: ["as", "options"],
|
|
8
|
-
setup(props, { slots }) {
|
|
9
|
-
let trap;
|
|
10
|
-
const target = ref();
|
|
11
|
-
const activate = () => trap && trap.activate();
|
|
12
|
-
const deactivate = () => trap && trap.deactivate();
|
|
13
|
-
watch(
|
|
14
|
-
() => unrefElement(target),
|
|
15
|
-
(el) => {
|
|
16
|
-
if (!el)
|
|
17
|
-
return;
|
|
18
|
-
trap = createFocusTrap(el, props.options || {});
|
|
19
|
-
activate();
|
|
20
|
-
},
|
|
21
|
-
{ flush: "post" }
|
|
22
|
-
);
|
|
23
|
-
onScopeDispose(() => deactivate());
|
|
24
|
-
return () => {
|
|
25
|
-
if (slots.default)
|
|
26
|
-
return h(props.as || "div", { ref: target }, slots.default());
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export { UseFocusTrap };
|
package/useFocusTrap.d.mts
DELETED
|
@@ -1,55 +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: MaybeRefOrGetter<Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
|
53
|
-
|
|
54
|
-
export { useFocusTrap };
|
|
55
|
-
export type { UseFocusTrapOptions, UseFocusTrapReturn };
|
package/useFocusTrap.iife.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
(function (exports, core, shared, focusTrap, vue) {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
function useFocusTrap(target, options = {}) {
|
|
5
|
-
let trap;
|
|
6
|
-
const { immediate, ...focusTrapOptions } = options;
|
|
7
|
-
const hasFocus = vue.shallowRef(false);
|
|
8
|
-
const isPaused = vue.shallowRef(false);
|
|
9
|
-
const activate = (opts) => trap && trap.activate(opts);
|
|
10
|
-
const deactivate = (opts) => trap && trap.deactivate(opts);
|
|
11
|
-
const pause = () => {
|
|
12
|
-
if (trap) {
|
|
13
|
-
trap.pause();
|
|
14
|
-
isPaused.value = true;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const unpause = () => {
|
|
18
|
-
if (trap) {
|
|
19
|
-
trap.unpause();
|
|
20
|
-
isPaused.value = false;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const targets = vue.computed(() => {
|
|
24
|
-
const _targets = vue.toValue(target);
|
|
25
|
-
return core.toArray(_targets).map((el) => {
|
|
26
|
-
const _el = vue.toValue(el);
|
|
27
|
-
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
|
28
|
-
}).filter(shared.notNullish);
|
|
29
|
-
});
|
|
30
|
-
vue.watch(
|
|
31
|
-
targets,
|
|
32
|
-
(els) => {
|
|
33
|
-
if (!els.length)
|
|
34
|
-
return;
|
|
35
|
-
if (!trap) {
|
|
36
|
-
trap = focusTrap.createFocusTrap(els, {
|
|
37
|
-
...focusTrapOptions,
|
|
38
|
-
onActivate() {
|
|
39
|
-
hasFocus.value = true;
|
|
40
|
-
if (options.onActivate)
|
|
41
|
-
options.onActivate();
|
|
42
|
-
},
|
|
43
|
-
onDeactivate() {
|
|
44
|
-
hasFocus.value = false;
|
|
45
|
-
if (options.onDeactivate)
|
|
46
|
-
options.onDeactivate();
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
if (immediate)
|
|
50
|
-
activate();
|
|
51
|
-
} else {
|
|
52
|
-
const isActive = trap == null ? void 0 : trap.active;
|
|
53
|
-
trap == null ? void 0 : trap.updateContainerElements(els);
|
|
54
|
-
if (!isActive && immediate) {
|
|
55
|
-
activate();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{ flush: "post" }
|
|
60
|
-
);
|
|
61
|
-
core.tryOnScopeDispose(() => deactivate());
|
|
62
|
-
return {
|
|
63
|
-
hasFocus,
|
|
64
|
-
isPaused,
|
|
65
|
-
activate,
|
|
66
|
-
deactivate,
|
|
67
|
-
pause,
|
|
68
|
-
unpause
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
exports.useFocusTrap = useFocusTrap;
|
|
73
|
-
|
|
74
|
-
})(this.VueUse = this.VueUse || {}, VueUse, VueUse, focusTrap, Vue);
|
package/useFocusTrap.iife.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(p,u,v,h,a){"use strict";function d(V,s={}){let e;const{immediate:r,...m}=s,n=a.shallowRef(!1),c=a.shallowRef(!1),i=t=>e&&e.activate(t),f=t=>e&&e.deactivate(t),A=()=>{e&&(e.pause(),c.value=!0)},T=()=>{e&&(e.unpause(),c.value=!1)},g=a.computed(()=>{const t=a.toValue(V);return u.toArray(t).map(o=>{const l=a.toValue(o);return typeof l=="string"?l:u.unrefElement(l)}).filter(v.notNullish)});return a.watch(g,t=>{if(t.length)if(!e)e=h.createFocusTrap(t,{...m,onActivate(){n.value=!0,s.onActivate&&s.onActivate()},onDeactivate(){n.value=!1,s.onDeactivate&&s.onDeactivate()}}),r&&i();else{const o=e?.active;e?.updateContainerElements(t),!o&&r&&i()}},{flush:"post"}),u.tryOnScopeDispose(()=>f()),{hasFocus:n,isPaused:c,activate:i,deactivate:f,pause:A,unpause:T}}p.useFocusTrap=d})(this.VueUse=this.VueUse||{},VueUse,VueUse,focusTrap,Vue);
|