@v-c/trigger 0.0.13 → 0.0.15

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/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 };