@vft/directives 0.0.9 → 0.0.11
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/cjs/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./click-out-side.cjs"),r=require("./scroll-fix.cjs"),c=require("./permission.cjs"),i=require("./repeat-click/index.cjs"),l=e=>{e.directive("scrollFix",r.default)},s=e=>{e.directive("ClickOutside",t.default)};exports.ClickOutside=t.default;exports.ScrollFix=r.default;exports.setupPermissionDirective=c.setupPermissionDirective;exports.REPEAT_DELAY=i.REPEAT_DELAY;exports.REPEAT_INTERVAL=i.REPEAT_INTERVAL;exports.vRepeatClick=i.vRepeatClick;exports.registerClickOut=s;exports.registerScrollFix=l;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@vft/utils"),r=100,a=600,v={beforeMount(c,s){const e=s.value,{interval:u=r,delay:d=a}=l.isFunction(e)?{}:e;let t,n;const o=()=>l.isFunction(e)?e():e.handler(),i=()=>{n&&(clearTimeout(n),n=void 0),t&&(clearInterval(t),t=void 0)};c.addEventListener("mousedown",E=>{E.button===0&&(i(),o(),document.addEventListener("mouseup",()=>i(),{once:!0}),n=setTimeout(()=>{t=setInterval(()=>{o()},u)},d))})}};exports.REPEAT_DELAY=a;exports.REPEAT_INTERVAL=r;exports.vRepeatClick=v;
|
package/dist/es/index.js
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
import r from "./click-out-side.js";
|
2
2
|
import e from "./scroll-fix.js";
|
3
3
|
import { setupPermissionDirective as p } from "./permission.js";
|
4
|
+
import { REPEAT_DELAY as E, REPEAT_INTERVAL as d, vRepeatClick as f } from "./repeat-click/index.js";
|
4
5
|
const c = (i) => {
|
5
6
|
i.directive("scrollFix", e);
|
6
|
-
},
|
7
|
+
}, l = (i) => {
|
7
8
|
i.directive("ClickOutside", r);
|
8
9
|
};
|
9
10
|
export {
|
10
|
-
|
11
|
+
r as ClickOutside,
|
12
|
+
E as REPEAT_DELAY,
|
13
|
+
d as REPEAT_INTERVAL,
|
14
|
+
e as ScrollFix,
|
15
|
+
l as registerClickOut,
|
11
16
|
c as registerScrollFix,
|
12
|
-
p as setupPermissionDirective
|
17
|
+
p as setupPermissionDirective,
|
18
|
+
f as vRepeatClick
|
13
19
|
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { isFunction as a } from "@vft/utils";
|
2
|
+
const u = 100, v = 600, m = {
|
3
|
+
beforeMount(l, i) {
|
4
|
+
const e = i.value, { interval: c = u, delay: d = v } = a(
|
5
|
+
e
|
6
|
+
) ? {} : e;
|
7
|
+
let t, n;
|
8
|
+
const o = () => a(e) ? e() : e.handler(), r = () => {
|
9
|
+
n && (clearTimeout(n), n = void 0), t && (clearInterval(t), t = void 0);
|
10
|
+
};
|
11
|
+
l.addEventListener("mousedown", (s) => {
|
12
|
+
s.button === 0 && (r(), o(), document.addEventListener("mouseup", () => r(), {
|
13
|
+
once: !0
|
14
|
+
}), n = setTimeout(() => {
|
15
|
+
t = setInterval(() => {
|
16
|
+
o();
|
17
|
+
}, c);
|
18
|
+
}, d));
|
19
|
+
});
|
20
|
+
}
|
21
|
+
};
|
22
|
+
export {
|
23
|
+
v as REPEAT_DELAY,
|
24
|
+
u as REPEAT_INTERVAL,
|
25
|
+
m as vRepeatClick
|
26
|
+
};
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
import type { App } from 'vue';
|
2
|
+
import ClickOutside from './click-out-side';
|
3
|
+
import ScrollFix from './scroll-fix';
|
2
4
|
export declare const registerScrollFix: (app: App) => void;
|
3
5
|
export declare const registerClickOut: (app: App) => void;
|
4
6
|
export * from './permission';
|
7
|
+
export * from './repeat-click';
|
8
|
+
export { ClickOutside, ScrollFix };
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { ObjectDirective } from 'vue';
|
2
|
+
export declare const REPEAT_INTERVAL = 100;
|
3
|
+
export declare const REPEAT_DELAY = 600;
|
4
|
+
export interface RepeatClickOptions {
|
5
|
+
interval?: number;
|
6
|
+
delay?: number;
|
7
|
+
handler: (...args: unknown[]) => unknown;
|
8
|
+
}
|
9
|
+
export declare const vRepeatClick: ObjectDirective<HTMLElement, RepeatClickOptions | RepeatClickOptions['handler']>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vft/directives",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.11",
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
5
5
|
"module": "./dist/es/index.js",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -14,13 +14,13 @@
|
|
14
14
|
"dist"
|
15
15
|
],
|
16
16
|
"devDependencies": {
|
17
|
-
"@vft/use": "0.0.
|
18
|
-
"@vft/utils": "0.0.
|
17
|
+
"@vft/use": "0.0.17",
|
18
|
+
"@vft/utils": "0.0.25"
|
19
19
|
},
|
20
20
|
"peerDependencies": {
|
21
21
|
"vue": ">=3.2.0",
|
22
|
-
"@vft/use": "0.0.
|
23
|
-
"@vft/utils": "0.0.
|
22
|
+
"@vft/use": "0.0.17",
|
23
|
+
"@vft/utils": "0.0.25"
|
24
24
|
},
|
25
25
|
"scripts": {
|
26
26
|
"stub-unbuild": "unbuild --stub && pnpm -F @vft/scripts stub-helper",
|