@v-c/trigger 0.0.13 → 0.0.14
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/Popup/Arrow.cjs +60 -89
- package/dist/Popup/Arrow.js +58 -88
- package/dist/Popup/Mask.cjs +53 -64
- package/dist/Popup/Mask.js +49 -63
- package/dist/Popup/PopupContent.cjs +22 -27
- package/dist/Popup/PopupContent.js +18 -26
- package/dist/Popup/index.cjs +312 -366
- package/dist/Popup/index.js +304 -362
- package/dist/UniqueProvider/UniqueContainer.cjs +133 -150
- package/dist/UniqueProvider/UniqueContainer.js +128 -148
- package/dist/UniqueProvider/index.cjs +151 -216
- package/dist/UniqueProvider/index.js +144 -213
- package/dist/UniqueProvider/useTargetState.cjs +39 -39
- package/dist/UniqueProvider/useTargetState.js +37 -39
- package/dist/_virtual/rolldown_runtime.cjs +21 -0
- package/dist/context.cjs +17 -28
- package/dist/context.js +17 -33
- package/dist/hooks/useAction.cjs +19 -25
- package/dist/hooks/useAction.js +17 -25
- package/dist/hooks/useAlign.cjs +388 -592
- package/dist/hooks/useAlign.js +383 -590
- package/dist/hooks/useDelay.cjs +21 -24
- package/dist/hooks/useDelay.js +20 -25
- package/dist/hooks/useOffsetStyle.cjs +34 -37
- package/dist/hooks/useOffsetStyle.js +32 -37
- package/dist/hooks/useWatch.cjs +38 -34
- package/dist/hooks/useWatch.js +36 -34
- package/dist/hooks/useWinClick.cjs +54 -64
- package/dist/hooks/useWinClick.js +51 -63
- package/dist/index.cjs +605 -694
- package/dist/index.js +593 -689
- package/dist/interface.cjs +0 -1
- package/dist/interface.js +0 -1
- package/dist/util.cjs +65 -82
- package/dist/util.js +66 -87
- package/package.json +2 -2
package/dist/context.js
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { computed, defineComponent, inject, provide } from "vue";
|
|
2
|
+
var TriggerContextKey = Symbol("TriggerContextKey");
|
|
3
3
|
function useTriggerContext() {
|
|
4
|
-
|
|
4
|
+
return inject(TriggerContextKey, void 0);
|
|
5
5
|
}
|
|
6
|
-
const TriggerContextProvider = defineComponent(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
props: ["registerSubPopup"]
|
|
15
|
-
}
|
|
16
|
-
);
|
|
6
|
+
const TriggerContextProvider = defineComponent((props, { slots }) => {
|
|
7
|
+
provide(TriggerContextKey, computed(() => props));
|
|
8
|
+
return () => {
|
|
9
|
+
return slots?.default?.();
|
|
10
|
+
};
|
|
11
|
+
}, { props: ["registerSubPopup"] });
|
|
17
12
|
const UniqueContextKey = Symbol("UniqueContextKey");
|
|
18
13
|
function useUniqueContext() {
|
|
19
|
-
|
|
14
|
+
return inject(UniqueContextKey, void 0);
|
|
20
15
|
}
|
|
21
|
-
const UniqueContextProvider = defineComponent(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
props: ["show", "hide"]
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
export {
|
|
33
|
-
TriggerContextProvider,
|
|
34
|
-
UniqueContextKey,
|
|
35
|
-
UniqueContextProvider,
|
|
36
|
-
useTriggerContext,
|
|
37
|
-
useUniqueContext
|
|
38
|
-
};
|
|
16
|
+
const UniqueContextProvider = defineComponent((props, { slots }) => {
|
|
17
|
+
provide(UniqueContextKey, props);
|
|
18
|
+
return () => {
|
|
19
|
+
return slots?.default?.();
|
|
20
|
+
};
|
|
21
|
+
}, { props: ["show", "hide"] });
|
|
22
|
+
export { TriggerContextProvider, UniqueContextKey, UniqueContextProvider, useTriggerContext, useUniqueContext };
|
package/dist/hooks/useAction.cjs
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
4
|
function toArray(val) {
|
|
5
|
-
|
|
5
|
+
return val ? Array.isArray(val) ? val : [val] : [];
|
|
6
6
|
}
|
|
7
7
|
function normalizeAction(action) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return action;
|
|
8
|
+
if (typeof action === "string") return action.toLowerCase();
|
|
9
|
+
return action;
|
|
12
10
|
}
|
|
13
11
|
function useAction(action, showAction, hideAction) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_showAction.value = showActionSet;
|
|
28
|
-
_hideAction.value = hideActionSet;
|
|
29
|
-
});
|
|
30
|
-
return [_showAction, _hideAction];
|
|
12
|
+
const _showAction = (0, vue.shallowRef)(/* @__PURE__ */ new Set());
|
|
13
|
+
const _hideAction = (0, vue.shallowRef)(/* @__PURE__ */ new Set());
|
|
14
|
+
(0, vue.watchEffect)(() => {
|
|
15
|
+
const mergedShowAction = toArray(showAction?.value ?? action.value).map(normalizeAction);
|
|
16
|
+
const mergedHideAction = toArray(hideAction?.value ?? action.value).map(normalizeAction);
|
|
17
|
+
const showActionSet = new Set(mergedShowAction);
|
|
18
|
+
const hideActionSet = new Set(mergedHideAction);
|
|
19
|
+
if (showActionSet.has("hover") && !showActionSet.has("click")) showActionSet.add("touch");
|
|
20
|
+
if (hideActionSet.has("hover") && !hideActionSet.has("click")) hideActionSet.add("touch");
|
|
21
|
+
_showAction.value = showActionSet;
|
|
22
|
+
_hideAction.value = hideActionSet;
|
|
23
|
+
});
|
|
24
|
+
return [_showAction, _hideAction];
|
|
31
25
|
}
|
|
32
26
|
exports.default = useAction;
|
package/dist/hooks/useAction.js
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import { shallowRef, watchEffect } from "vue";
|
|
2
2
|
function toArray(val) {
|
|
3
|
-
|
|
3
|
+
return val ? Array.isArray(val) ? val : [val] : [];
|
|
4
4
|
}
|
|
5
5
|
function normalizeAction(action) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return action;
|
|
6
|
+
if (typeof action === "string") return action.toLowerCase();
|
|
7
|
+
return action;
|
|
10
8
|
}
|
|
11
9
|
function useAction(action, showAction, hideAction) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_showAction.value = showActionSet;
|
|
26
|
-
_hideAction.value = hideActionSet;
|
|
27
|
-
});
|
|
28
|
-
return [_showAction, _hideAction];
|
|
10
|
+
const _showAction = shallowRef(/* @__PURE__ */ new Set());
|
|
11
|
+
const _hideAction = shallowRef(/* @__PURE__ */ new Set());
|
|
12
|
+
watchEffect(() => {
|
|
13
|
+
const mergedShowAction = toArray(showAction?.value ?? action.value).map(normalizeAction);
|
|
14
|
+
const mergedHideAction = toArray(hideAction?.value ?? action.value).map(normalizeAction);
|
|
15
|
+
const showActionSet = new Set(mergedShowAction);
|
|
16
|
+
const hideActionSet = new Set(mergedHideAction);
|
|
17
|
+
if (showActionSet.has("hover") && !showActionSet.has("click")) showActionSet.add("touch");
|
|
18
|
+
if (hideActionSet.has("hover") && !hideActionSet.has("click")) hideActionSet.add("touch");
|
|
19
|
+
_showAction.value = showActionSet;
|
|
20
|
+
_hideAction.value = hideActionSet;
|
|
21
|
+
});
|
|
22
|
+
return [_showAction, _hideAction];
|
|
29
23
|
}
|
|
30
|
-
export {
|
|
31
|
-
useAction as default
|
|
32
|
-
};
|
|
24
|
+
export { useAction as default };
|