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