@v-c/trigger 1.0.6 → 1.0.7
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 +1 -1
- package/package.json +3 -3
- package/dist/Popup/Arrow.cjs +0 -63
- package/dist/Popup/Mask.cjs +0 -58
- package/dist/Popup/PopupContent.cjs +0 -27
- package/dist/Popup/index.cjs +0 -318
- package/dist/UniqueProvider/UniqueContainer.cjs +0 -134
- package/dist/UniqueProvider/index.cjs +0 -164
- package/dist/UniqueProvider/useTargetState.cjs +0 -44
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/context.cjs +0 -28
- package/dist/hooks/useAction.cjs +0 -29
- package/dist/hooks/useAlign.cjs +0 -378
- package/dist/hooks/useDelay.cjs +0 -27
- package/dist/hooks/useOffsetStyle.cjs +0 -39
- package/dist/hooks/useWatch.cjs +0 -44
- package/dist/hooks/useWinClick.cjs +0 -60
- package/dist/index.cjs +0 -590
- package/dist/interface.cjs +0 -1
- package/dist/util.cjs +0 -86
package/dist/hooks/useDelay.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useDelay() {
|
|
8
|
-
const delayRef = (0, vue.ref)(null);
|
|
9
|
-
const clearDelay = () => {
|
|
10
|
-
if (delayRef.value) {
|
|
11
|
-
clearTimeout(delayRef.value);
|
|
12
|
-
delayRef.value = null;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const delayInvoke = (callback, delay) => {
|
|
16
|
-
clearDelay();
|
|
17
|
-
if (delay === 0) callback();
|
|
18
|
-
else delayRef.value = setTimeout(() => {
|
|
19
|
-
callback();
|
|
20
|
-
}, delay * 1e3);
|
|
21
|
-
};
|
|
22
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
23
|
-
clearDelay();
|
|
24
|
-
});
|
|
25
|
-
return delayInvoke;
|
|
26
|
-
}
|
|
27
|
-
exports.default = useDelay;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useOffsetStyle(isMobile, ready, open, align, offsetR, offsetB, offsetX, offsetY) {
|
|
8
|
-
const AUTO = "auto";
|
|
9
|
-
return (0, vue.computed)(() => {
|
|
10
|
-
const offsetStyle = isMobile.value ? {} : {
|
|
11
|
-
left: "-1000vw",
|
|
12
|
-
top: "-1000vh",
|
|
13
|
-
right: AUTO,
|
|
14
|
-
bottom: AUTO
|
|
15
|
-
};
|
|
16
|
-
if (!isMobile.value && (ready.value || !open.value)) {
|
|
17
|
-
const { points } = align.value ?? {};
|
|
18
|
-
const dynamicInset = align.value?.dynamicInset || align.value?._experimental?.dynamicInset;
|
|
19
|
-
const alignRight = dynamicInset && points?.[0]?.[1] === "r";
|
|
20
|
-
const alignBottom = dynamicInset && points?.[0]?.[0] === "b";
|
|
21
|
-
if (alignRight) {
|
|
22
|
-
offsetStyle.right = `${offsetR.value}px`;
|
|
23
|
-
offsetStyle.left = AUTO;
|
|
24
|
-
} else {
|
|
25
|
-
offsetStyle.left = `${offsetX.value}px`;
|
|
26
|
-
offsetStyle.right = AUTO;
|
|
27
|
-
}
|
|
28
|
-
if (alignBottom) {
|
|
29
|
-
offsetStyle.bottom = `${offsetB.value}px`;
|
|
30
|
-
offsetStyle.top = AUTO;
|
|
31
|
-
} else {
|
|
32
|
-
offsetStyle.top = `${offsetY.value}px`;
|
|
33
|
-
offsetStyle.bottom = AUTO;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return offsetStyle;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
exports.default = useOffsetStyle;
|
package/dist/hooks/useWatch.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_util = require("../util.cjs");
|
|
7
|
-
let vue = require("vue");
|
|
8
|
-
function useWatch(open, target, popup, onAlign, onScroll) {
|
|
9
|
-
(0, vue.watch)([
|
|
10
|
-
open,
|
|
11
|
-
target,
|
|
12
|
-
popup
|
|
13
|
-
], async (_n, _o, onCleanup) => {
|
|
14
|
-
if (open.value && target.value && popup.value) {
|
|
15
|
-
await (0, vue.nextTick)();
|
|
16
|
-
const targetElement = target.value;
|
|
17
|
-
const popupElement = popup.value;
|
|
18
|
-
const targetScrollList = require_util.collectScroller(targetElement);
|
|
19
|
-
const popupScrollList = require_util.collectScroller(popupElement);
|
|
20
|
-
const win = require_util.getWin(popupElement);
|
|
21
|
-
const mergedList = new Set([
|
|
22
|
-
win,
|
|
23
|
-
...targetScrollList,
|
|
24
|
-
...popupScrollList
|
|
25
|
-
]);
|
|
26
|
-
function notifyScroll() {
|
|
27
|
-
onAlign();
|
|
28
|
-
onScroll();
|
|
29
|
-
}
|
|
30
|
-
mergedList.forEach((scroller) => {
|
|
31
|
-
scroller.addEventListener("scroll", notifyScroll, { passive: true });
|
|
32
|
-
});
|
|
33
|
-
win.addEventListener("resize", notifyScroll, { passive: true });
|
|
34
|
-
onAlign();
|
|
35
|
-
onCleanup(() => {
|
|
36
|
-
mergedList.forEach((scroller) => {
|
|
37
|
-
scroller.removeEventListener("scroll", notifyScroll);
|
|
38
|
-
win.removeEventListener("resize", notifyScroll);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}, { flush: "post" });
|
|
43
|
-
}
|
|
44
|
-
exports.default = useWatch;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_util = require("../util.cjs");
|
|
7
|
-
let vue = require("vue");
|
|
8
|
-
let _v_c_util = require("@v-c/util");
|
|
9
|
-
let _v_c_util_dist_Dom_shadow = require("@v-c/util/dist/Dom/shadow");
|
|
10
|
-
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
|
|
11
|
-
const openRef = (0, vue.shallowRef)(open.value);
|
|
12
|
-
(0, vue.watchEffect)(() => {
|
|
13
|
-
openRef.value = open.value;
|
|
14
|
-
});
|
|
15
|
-
const popupPointerDownRef = (0, vue.shallowRef)(false);
|
|
16
|
-
(0, vue.watch)([
|
|
17
|
-
clickToHide,
|
|
18
|
-
targetEle,
|
|
19
|
-
popupEle,
|
|
20
|
-
mask,
|
|
21
|
-
maskClosable
|
|
22
|
-
], ([clickToHide$1, targetEle$1, popupEle$1, mask$1, maskClosable$1], _o, onCleanup) => {
|
|
23
|
-
if (clickToHide$1 && popupEle$1 && (!mask$1 || maskClosable$1)) {
|
|
24
|
-
const onPointerDown = () => {
|
|
25
|
-
popupPointerDownRef.value = false;
|
|
26
|
-
};
|
|
27
|
-
const onTriggerClose = (e) => {
|
|
28
|
-
if (openRef.value && !inPopupOrChild(e.composedPath?.()?.[0] || e.target) && !popupPointerDownRef.value) triggerOpen(false);
|
|
29
|
-
};
|
|
30
|
-
const win = require_util.getWin(popupEle$1);
|
|
31
|
-
win.addEventListener("pointerdown", onPointerDown, true);
|
|
32
|
-
win.addEventListener("mousedown", onTriggerClose, true);
|
|
33
|
-
win.addEventListener("contextmenu", onTriggerClose, true);
|
|
34
|
-
const targetShadowRoot = (0, _v_c_util_dist_Dom_shadow.getShadowRoot)(targetEle$1);
|
|
35
|
-
if (targetShadowRoot) {
|
|
36
|
-
targetShadowRoot.addEventListener("mousedown", onTriggerClose, true);
|
|
37
|
-
targetShadowRoot.addEventListener("contextmenu", onTriggerClose, true);
|
|
38
|
-
}
|
|
39
|
-
if (process.env.NODE_ENV !== "production" && targetEle$1) {
|
|
40
|
-
const targetRoot = targetEle$1.getRootNode?.();
|
|
41
|
-
const popupRoot = popupEle$1.getRootNode?.();
|
|
42
|
-
(0, _v_c_util.warning)(targetRoot === popupRoot, `trigger element and popup element should in same shadow root.`);
|
|
43
|
-
}
|
|
44
|
-
onCleanup(() => {
|
|
45
|
-
win.removeEventListener("pointerdown", onPointerDown, true);
|
|
46
|
-
win.removeEventListener("mousedown", onTriggerClose, true);
|
|
47
|
-
win.removeEventListener("contextmenu", onTriggerClose, true);
|
|
48
|
-
if (targetShadowRoot) {
|
|
49
|
-
targetShadowRoot.removeEventListener("mousedown", onTriggerClose, true);
|
|
50
|
-
targetShadowRoot.removeEventListener("contextmenu", onTriggerClose, true);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
function onPopupPointerDown() {
|
|
56
|
-
popupPointerDownRef.value = true;
|
|
57
|
-
}
|
|
58
|
-
return onPopupPointerDown;
|
|
59
|
-
}
|
|
60
|
-
exports.default = useWinClick;
|