@v-c/trigger 0.0.1

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 (101) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Popup/Arrow.cjs +1 -0
  3. package/dist/Popup/Arrow.d.ts +8 -0
  4. package/dist/Popup/Arrow.js +66 -0
  5. package/dist/Popup/Mask.cjs +1 -0
  6. package/dist/Popup/Mask.d.ts +11 -0
  7. package/dist/Popup/Mask.js +57 -0
  8. package/dist/Popup/PopupContent.cjs +1 -0
  9. package/dist/Popup/PopupContent.d.ts +5 -0
  10. package/dist/Popup/PopupContent.js +21 -0
  11. package/dist/Popup/index.cjs +1 -0
  12. package/dist/Popup/index.d.ts +54 -0
  13. package/dist/Popup/index.js +295 -0
  14. package/dist/UniqueProvider/UniqueContainer.cjs +1 -0
  15. package/dist/UniqueProvider/UniqueContainer.d.ts +24 -0
  16. package/dist/UniqueProvider/UniqueContainer.js +125 -0
  17. package/dist/UniqueProvider/index.cjs +1 -0
  18. package/dist/UniqueProvider/index.d.ts +7 -0
  19. package/dist/UniqueProvider/index.js +167 -0
  20. package/dist/UniqueProvider/useTargetState.cjs +1 -0
  21. package/dist/UniqueProvider/useTargetState.d.ts +11 -0
  22. package/dist/UniqueProvider/useTargetState.js +13 -0
  23. package/dist/context.cjs +1 -0
  24. package/dist/context.d.ts +48 -0
  25. package/dist/context.js +27 -0
  26. package/dist/hooks/useAction.cjs +1 -0
  27. package/dist/hooks/useAction.d.ts +6 -0
  28. package/dist/hooks/useAction.js +17 -0
  29. package/dist/hooks/useAlign.cjs +1 -0
  30. package/dist/hooks/useAlign.d.ts +4 -0
  31. package/dist/hooks/useAlign.js +257 -0
  32. package/dist/hooks/useDelay.cjs +1 -0
  33. package/dist/hooks/useDelay.d.ts +1 -0
  34. package/dist/hooks/useDelay.js +16 -0
  35. package/dist/hooks/useOffsetStyle.cjs +1 -0
  36. package/dist/hooks/useOffsetStyle.d.ts +3 -0
  37. package/dist/hooks/useOffsetStyle.js +20 -0
  38. package/dist/hooks/useWatch.cjs +1 -0
  39. package/dist/hooks/useWatch.d.ts +2 -0
  40. package/dist/hooks/useWatch.js +26 -0
  41. package/dist/hooks/useWinClick.cjs +1 -0
  42. package/dist/hooks/useWinClick.d.ts +6 -0
  43. package/dist/hooks/useWinClick.js +50 -0
  44. package/dist/index.cjs +1 -0
  45. package/dist/index.d.ts +78 -0
  46. package/dist/index.js +470 -0
  47. package/dist/interface.cjs +1 -0
  48. package/dist/interface.d.ts +94 -0
  49. package/dist/interface.js +1 -0
  50. package/dist/portal/dist/Context.cjs +1 -0
  51. package/dist/portal/dist/Context.js +14 -0
  52. package/dist/portal/dist/Portal.cjs +1 -0
  53. package/dist/portal/dist/Portal.js +73 -0
  54. package/dist/portal/dist/useDom.cjs +1 -0
  55. package/dist/portal/dist/useDom.js +34 -0
  56. package/dist/portal/dist/useScrollLocker.cjs +5 -0
  57. package/dist/portal/dist/useScrollLocker.js +28 -0
  58. package/dist/portal/dist/util.cjs +1 -0
  59. package/dist/portal/dist/util.js +6 -0
  60. package/dist/resize-observer/dist/Collection.cjs +1 -0
  61. package/dist/resize-observer/dist/Collection.js +32 -0
  62. package/dist/resize-observer/dist/SingleObserver/DomWrapper.cjs +1 -0
  63. package/dist/resize-observer/dist/SingleObserver/DomWrapper.js +11 -0
  64. package/dist/resize-observer/dist/SingleObserver/index.cjs +1 -0
  65. package/dist/resize-observer/dist/SingleObserver/index.js +81 -0
  66. package/dist/resize-observer/dist/index.cjs +1 -0
  67. package/dist/resize-observer/dist/index.js +44 -0
  68. package/dist/resize-observer/dist/utils/observerUtil.cjs +1 -0
  69. package/dist/resize-observer/dist/utils/observerUtil.js +21 -0
  70. package/dist/util/dist/Children/isFragment.cjs +1 -0
  71. package/dist/util/dist/Children/isFragment.js +7 -0
  72. package/dist/util/dist/Children/toArray.cjs +1 -0
  73. package/dist/util/dist/Children/toArray.js +11 -0
  74. package/dist/util/dist/Dom/canUseDom.cjs +1 -0
  75. package/dist/util/dist/Dom/canUseDom.js +6 -0
  76. package/dist/util/dist/Dom/contains.cjs +1 -0
  77. package/dist/util/dist/Dom/contains.js +16 -0
  78. package/dist/util/dist/Dom/dynamicCSS.cjs +1 -0
  79. package/dist/util/dist/Dom/dynamicCSS.js +73 -0
  80. package/dist/util/dist/Dom/findDOMNode.cjs +1 -0
  81. package/dist/util/dist/Dom/findDOMNode.js +12 -0
  82. package/dist/util/dist/Dom/isVisible.cjs +1 -0
  83. package/dist/util/dist/Dom/isVisible.js +22 -0
  84. package/dist/util/dist/Dom/shadow.cjs +1 -0
  85. package/dist/util/dist/Dom/shadow.js +13 -0
  86. package/dist/util/dist/classnames.cjs +1 -0
  87. package/dist/util/dist/classnames.js +30 -0
  88. package/dist/util/dist/getScrollBarSize.cjs +1 -0
  89. package/dist/util/dist/getScrollBarSize.js +37 -0
  90. package/dist/util/dist/props-util/index.cjs +1 -0
  91. package/dist/util/dist/props-util/index.js +21 -0
  92. package/dist/util/dist/raf.cjs +1 -0
  93. package/dist/util/dist/raf.js +37 -0
  94. package/dist/util/dist/utils/transition.cjs +1 -0
  95. package/dist/util/dist/utils/transition.js +21 -0
  96. package/dist/util/dist/warning.cjs +1 -0
  97. package/dist/util/dist/warning.js +48 -0
  98. package/dist/util.cjs +1 -0
  99. package/dist/util.d.ts +44 -0
  100. package/dist/util.js +69 -0
  101. package/package.json +41 -0
@@ -0,0 +1,125 @@
1
+ import { defineComponent as B, shallowRef as y, watchEffect as g, watch as N, createVNode as c, Transition as $, withDirectives as O, vShow as P } from "vue";
2
+ import { toPropsRefs as R } from "../util/dist/props-util/index.js";
3
+ import { getTransitionProps as E } from "../util/dist/utils/transition.js";
4
+ import j from "../hooks/useOffsetStyle.js";
5
+ const Y = /* @__PURE__ */ B((u) => {
6
+ const t = y(!1), {
7
+ open: i,
8
+ isMobile: m,
9
+ align: q,
10
+ ready: s,
11
+ offsetR: v,
12
+ offsetB: b,
13
+ offsetX: h,
14
+ offsetY: w
15
+ } = R(u, "open", "isMobile", "align", "ready", "offsetR", "offsetB", "offsetX", "offsetY"), f = j(m, s, i, q, v, b, h, w), l = y(f.value);
16
+ return g(() => {
17
+ s.value && (l.value = f.value);
18
+ }), N(i, (o) => {
19
+ o && (t.value = !0);
20
+ }, {
21
+ immediate: !0
22
+ }), () => {
23
+ const {
24
+ popupSize: o,
25
+ motion: p,
26
+ prefixCls: C,
27
+ uniqueContainerClassName: S,
28
+ arrowPos: d,
29
+ uniqueContainerStyle: x
30
+ } = u, n = {};
31
+ o && (n.width = `${o.width}px`, n.height = `${o.height}px`);
32
+ const r = E(p?.name, p), A = {
33
+ ...r,
34
+ onBeforeAppear: (e) => {
35
+ t.value = !0, r.onBeforeAppear?.(e);
36
+ },
37
+ onBeforeEnter: (e) => {
38
+ t.value = !0, r.onBeforeEnter?.(e);
39
+ },
40
+ onAfterAppear: (e) => {
41
+ t.value = !0, r.onAfterAppear?.(e);
42
+ },
43
+ onAfterEnter: (e) => {
44
+ t.value = !0, r.onAfterEnter?.(e);
45
+ },
46
+ onAfterLeave: (e) => {
47
+ t.value = !1, r.onAfterLeave?.(e);
48
+ }
49
+ }, a = `${C}-unique-container`;
50
+ return c($, A, {
51
+ default: () => [O(c("div", {
52
+ class: [a, S, {
53
+ [`${a}-visible`]: t.value,
54
+ [`${a}-hidden`]: !t.value
55
+ }],
56
+ style: [{
57
+ "--arrow-x": `${d?.x || 0}px`,
58
+ "--arrow-y": `${d?.y || 0}px`
59
+ }, l.value, n, x]
60
+ }, null), [[P, i.value]])]
61
+ });
62
+ };
63
+ }, {
64
+ props: {
65
+ prefixCls: {
66
+ type: String,
67
+ required: !0
68
+ },
69
+ isMobile: {
70
+ type: Boolean,
71
+ required: !0
72
+ },
73
+ ready: {
74
+ type: Boolean,
75
+ required: !0
76
+ },
77
+ open: {
78
+ type: Boolean,
79
+ required: !0
80
+ },
81
+ align: {
82
+ type: Object,
83
+ required: !0
84
+ },
85
+ offsetR: {
86
+ type: Number,
87
+ required: !0
88
+ },
89
+ offsetB: {
90
+ type: Number,
91
+ required: !0
92
+ },
93
+ offsetX: {
94
+ type: Number,
95
+ required: !0
96
+ },
97
+ offsetY: {
98
+ type: Number,
99
+ required: !0
100
+ },
101
+ arrowPos: {
102
+ type: Object,
103
+ required: !1
104
+ },
105
+ popupSize: {
106
+ type: Object,
107
+ required: !1
108
+ },
109
+ motion: {
110
+ type: Object,
111
+ required: !1
112
+ },
113
+ uniqueContainerClassName: {
114
+ type: String,
115
+ required: !1
116
+ },
117
+ uniqueContainerStyle: {
118
+ type: null,
119
+ required: !1
120
+ }
121
+ }
122
+ });
123
+ export {
124
+ Y as default
125
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),B=require("../portal/dist/Portal.cjs");require("../util/dist/warning.cjs");const p=require("../util/dist/classnames.cjs"),a=require("../util/dist/Dom/findDOMNode.cjs"),v=require("../context.cjs"),U=require("../hooks/useAlign.cjs"),$=require("../hooks/useDelay.cjs"),F=require("../Popup/index.cjs"),_=require("../util.cjs"),j=require("./UniqueContainer.cjs"),H=require("./useTargetState.cjs"),W=u.defineComponent((c,{slots:S})=>{const[d,r,s,D]=H.default(),e=u.computed(()=>!s.value||!c.postTriggerProps?s.value:c.postTriggerProps(s.value)),i=u.shallowRef(null),g=u.ref(null),T=u.shallowRef(null),V=t=>{if(!t)return null;if(a.isDOM(t))return t;const l=t;if(a.isDOM(l?.$el))return l.$el;const n=l?.nativeElement;if(a.isDOM(n?.value))return n.value;if(a.isDOM(n))return n;if(typeof l?.getElement=="function"){const R=l.getElement();if(a.isDOM(R))return R}return null},O=t=>{const l=V(t);T.value=l,i.value!==l&&(i.value=l)},m=u.shallowRef(),C=$.default(),k=(t,l)=>{m.value=l,C(()=>{d(t)},t.delay)},A=t=>{C(()=>{m.value?.()||d(!1)},t)},E=t=>{D(t)},[P,q,x,y,h,M,N,,,o,f]=U.default(r,i,u.computed(()=>e.value?.target),u.computed(()=>e.value?.popupPlacement),u.computed(()=>e.value?.builtinPlacements||{}),u.computed(()=>e.value?.popupAlign),void 0,u.ref(!1)),w=u.computed(()=>{if(!e.value)return"";const t=_.getAlignPopupClassName(e.value?.builtinPlacements||{},e.value.prefixCls||"",o.value,!1);return p.default(t,e.value?.getPopupClassNameFromAlign?.(o.value))}),z={show:k,hide:A};u.watch(()=>e.value?.target,()=>{f()},{immediate:!0});const I=()=>(f(),Promise.resolve()),b=u.ref({}),X=v.useTriggerContext(),Y=u.computed(()=>({registerSubPopup:(t,l)=>{l?b.value[t]=l:delete b.value[t],X?.value?.registerSubPopup(t,l)}}));return()=>{const t=e?.value?.prefixCls;return u.createVNode(v.UniqueContextProvider,z,{default:()=>[S?.default?.(),!!e.value&&u.createVNode(v.TriggerContextProvider,Y.value,{default:()=>[u.createVNode(F.default,{ref:O,portal:B.default,prefixCls:t,popup:e.value?.popup,className:p.default(e.value?.popupClassName,w.value,`${t}-unique-controlled`),style:e.value?.popupStyle,target:e.value?.target,open:r.value,keepDom:!0,fresh:!0,autoDestroy:!1,onVisibleChanged:E,ready:P.value,offsetX:q.value,offsetY:x.value,offsetR:y.value,offsetB:h.value,onAlign:f,onPrepare:I,onResize:l=>{g.value={width:l.offsetWidth,height:l.offsetHeight}},arrowPos:{x:M.value,y:N.value},align:o.value,zIndex:e.value?.zIndex,mask:e.value?.mask,arrow:e.value?.arrow,motion:e.value?.popupMotion,maskMotion:e.value?.maskMotion,getPopupContainer:e.value.getPopupContainer},{default:()=>[u.createVNode(j.default,{prefixCls:t,isMobile:!1,ready:P.value,open:r.value,align:o.value,offsetX:q.value,offsetY:x.value,offsetR:y.value,offsetB:h.value,arrowPos:{x:M.value,y:N.value},popupSize:g.value,motion:e.value?.popupMotion,uniqueContainerClassName:p.default(e.value?.uniqueContainerClassName,w.value),uniqueContainerStyle:e?.value?.uniqueContainerStyle},null)]})]})]})}},{props:{postTriggerProps:{type:Function,required:!1}}});exports.default=W;
@@ -0,0 +1,7 @@
1
+ import { UniqueShowOptions } from '../context';
2
+ export interface UniqueProviderProps {
3
+ /** Additional handle options data to do the customize info */
4
+ postTriggerProps?: (options: UniqueShowOptions) => UniqueShowOptions;
5
+ }
6
+ declare const UniqueProvider: import('vue').DefineSetupFnComponent<UniqueProviderProps, {}, {}, UniqueProviderProps & {}, import('vue').PublicProps>;
7
+ export default UniqueProvider;
@@ -0,0 +1,167 @@
1
+ import { defineComponent as F, computed as a, shallowRef as v, ref as m, watch as O, createVNode as n } from "vue";
2
+ import H from "../portal/dist/Portal.js";
3
+ import "../util/dist/warning.js";
4
+ import g from "../util/dist/classnames.js";
5
+ import { isDOM as l } from "../util/dist/Dom/findDOMNode.js";
6
+ import { useTriggerContext as W, UniqueContextProvider as j, TriggerContextProvider as G } from "../context.js";
7
+ import J from "../hooks/useAlign.js";
8
+ import K from "../hooks/useDelay.js";
9
+ import L from "../Popup/index.js";
10
+ import { getAlignPopupClassName as Q } from "../util.js";
11
+ import Z from "./UniqueContainer.js";
12
+ import _ from "./useTargetState.js";
13
+ const ve = /* @__PURE__ */ F((c, {
14
+ slots: A
15
+ }) => {
16
+ const [d, s, i, M] = _(), e = a(() => !i.value || !c.postTriggerProps ? i.value : c.postTriggerProps(i.value)), p = v(null), C = m(null), V = v(null), E = (t) => {
17
+ if (!t)
18
+ return null;
19
+ if (l(t))
20
+ return t;
21
+ const o = t;
22
+ if (l(o?.$el))
23
+ return o.$el;
24
+ const u = o?.nativeElement;
25
+ if (l(u?.value))
26
+ return u.value;
27
+ if (l(u))
28
+ return u;
29
+ if (typeof o?.getElement == "function") {
30
+ const k = o.getElement();
31
+ if (l(k))
32
+ return k;
33
+ }
34
+ return null;
35
+ }, z = (t) => {
36
+ const o = E(t);
37
+ V.value = o, p.value !== o && (p.value = o);
38
+ }, P = v(), x = K(), D = (t, o) => {
39
+ P.value = o, x(() => {
40
+ d(t);
41
+ }, t.delay);
42
+ }, I = (t) => {
43
+ x(() => {
44
+ P.value?.() || d(!1);
45
+ }, t);
46
+ }, X = (t) => {
47
+ M(t);
48
+ }, [
49
+ y,
50
+ h,
51
+ q,
52
+ w,
53
+ N,
54
+ b,
55
+ R,
56
+ // scaleX - not used in UniqueProvider
57
+ ,
58
+ ,
59
+ // scaleY - not used in UniqueProvider
60
+ r,
61
+ f
62
+ ] = J(
63
+ s,
64
+ p,
65
+ a(() => e.value?.target),
66
+ a(() => e.value?.popupPlacement),
67
+ a(() => e.value?.builtinPlacements || {}),
68
+ a(() => e.value?.popupAlign),
69
+ void 0,
70
+ // onPopupAlign
71
+ m(!1)
72
+ // isMobile
73
+ ), S = a(() => {
74
+ if (!e.value)
75
+ return "";
76
+ const t = Q(e.value?.builtinPlacements || {}, e.value.prefixCls || "", r.value, !1);
77
+ return g(t, e.value?.getPopupClassNameFromAlign?.(r.value));
78
+ }), Y = {
79
+ show: D,
80
+ hide: I
81
+ };
82
+ O(() => e.value?.target, () => {
83
+ f();
84
+ }, {
85
+ immediate: !0
86
+ });
87
+ const B = () => (f(), Promise.resolve()), T = m({}), U = W(), $ = a(() => ({
88
+ registerSubPopup: (t, o) => {
89
+ o ? T.value[t] = o : delete T.value[t], U?.value?.registerSubPopup(t, o);
90
+ }
91
+ }));
92
+ return () => {
93
+ const t = e?.value?.prefixCls;
94
+ return n(j, Y, {
95
+ default: () => [A?.default?.(), !!e.value && n(G, $.value, {
96
+ default: () => [n(L, {
97
+ ref: z,
98
+ portal: H,
99
+ prefixCls: t,
100
+ popup: e.value?.popup,
101
+ className: g(e.value?.popupClassName, S.value, `${t}-unique-controlled`),
102
+ style: e.value?.popupStyle,
103
+ target: e.value?.target,
104
+ open: s.value,
105
+ keepDom: !0,
106
+ fresh: !0,
107
+ autoDestroy: !1,
108
+ onVisibleChanged: X,
109
+ ready: y.value,
110
+ offsetX: h.value,
111
+ offsetY: q.value,
112
+ offsetR: w.value,
113
+ offsetB: N.value,
114
+ onAlign: f,
115
+ onPrepare: B,
116
+ onResize: (o) => {
117
+ C.value = {
118
+ width: o.offsetWidth,
119
+ height: o.offsetHeight
120
+ };
121
+ },
122
+ arrowPos: {
123
+ x: b.value,
124
+ y: R.value
125
+ },
126
+ align: r.value,
127
+ zIndex: e.value?.zIndex,
128
+ mask: e.value?.mask,
129
+ arrow: e.value?.arrow,
130
+ motion: e.value?.popupMotion,
131
+ maskMotion: e.value?.maskMotion,
132
+ getPopupContainer: e.value.getPopupContainer
133
+ }, {
134
+ default: () => [n(Z, {
135
+ prefixCls: t,
136
+ isMobile: !1,
137
+ ready: y.value,
138
+ open: s.value,
139
+ align: r.value,
140
+ offsetX: h.value,
141
+ offsetY: q.value,
142
+ offsetR: w.value,
143
+ offsetB: N.value,
144
+ arrowPos: {
145
+ x: b.value,
146
+ y: R.value
147
+ },
148
+ popupSize: C.value,
149
+ motion: e.value?.popupMotion,
150
+ uniqueContainerClassName: g(e.value?.uniqueContainerClassName, S.value),
151
+ uniqueContainerStyle: e?.value?.uniqueContainerStyle
152
+ }, null)]
153
+ })]
154
+ })]
155
+ });
156
+ };
157
+ }, {
158
+ props: {
159
+ postTriggerProps: {
160
+ type: Function,
161
+ required: !1
162
+ }
163
+ }
164
+ });
165
+ export {
166
+ ve as default
167
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue");function i(){const n=s.ref(),a=s.ref(!1),l=s.ref(!1),e=s.ref();return[u=>{const t=a.value;u===!1?(e.value=null,a.value=!1,l.value=!1):l.value&&t?e.value=u:(a.value=!0,n.value=u,e.value=null,t||(l.value=!0))},a,n,u=>{u?(l.value=!1,e.value&&(n.value=e.value,e.value=null)):(l.value=!1,e.value=null)}]}exports.default=i;
@@ -0,0 +1,11 @@
1
+ import { UniqueShowOptions } from '../context.ts';
2
+ /**
3
+ * Control the state of popup bind target:
4
+ * 1. When set `target`. Do show the popup.
5
+ * 2. When `target` is removed. Do hide the popup.
6
+ * 3. When `target` change to another one:
7
+ * a. We wait motion finish of previous popup.
8
+ * b. Then we set new target and show the popup.
9
+ * 4. During appear/enter animation, cache new options and apply after animation completes.
10
+ */
11
+ export default function useTargetState(): readonly [(nextOptions: UniqueShowOptions | false) => void, import('vue').Ref<boolean, boolean>, import('vue').Ref<UniqueShowOptions | undefined, UniqueShowOptions | undefined>, (visible: boolean) => void];
@@ -0,0 +1,13 @@
1
+ import { ref as s } from "vue";
2
+ function o() {
3
+ const n = s(), u = s(!1), l = s(!1), e = s();
4
+ return [(a) => {
5
+ const t = u.value;
6
+ a === !1 ? (e.value = null, u.value = !1, l.value = !1) : l.value && t ? e.value = a : (u.value = !0, n.value = a, e.value = null, t || (l.value = !0));
7
+ }, u, n, (a) => {
8
+ a ? (l.value = !1, e.value && (n.value = e.value, e.value = null)) : (l.value = !1, e.value = null);
9
+ }];
10
+ }
11
+ export {
12
+ o as default
13
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=Symbol("TriggerContextKey");function i(){return e.inject(o,void 0)}const u=e.defineComponent((t,{slots:n})=>(e.provide(o,e.computed(()=>t)),()=>n?.default?.()),{props:["registerSubPopup"]}),r=Symbol("UniqueContextKey");function d(){return e.inject(r,void 0)}const g=e.defineComponent((t,{slots:n})=>(e.provide(r,t),()=>n?.default?.()),{props:["show","hide"]});exports.TriggerContextProvider=u;exports.UniqueContextKey=r;exports.UniqueContextProvider=g;exports.useTriggerContext=i;exports.useUniqueContext=d;
@@ -0,0 +1,48 @@
1
+ import { CSSMotionProps } from '../../util/src/utils/transition';
2
+ import { CSSProperties, InjectionKey, Ref } from 'vue';
3
+ import { TriggerProps } from './index';
4
+ import { AlignType, ArrowTypeOuter, BuildInPlacements } from './interface';
5
+ export interface TriggerContextProps {
6
+ registerSubPopup: (id: string, node: HTMLElement | null) => void;
7
+ }
8
+ export declare function useTriggerContext(): Ref<TriggerContextProps, TriggerContextProps> | undefined;
9
+ export declare const TriggerContextProvider: import('vue').DefineSetupFnComponent<{
10
+ registerSubPopup: any;
11
+ }, {}, {}, {
12
+ registerSubPopup: any;
13
+ } & {}, import('vue').PublicProps>;
14
+ export interface UniqueShowOptions {
15
+ id: string;
16
+ popup: TriggerProps['popup'];
17
+ target: HTMLElement;
18
+ delay: number;
19
+ prefixCls?: string;
20
+ popupClassName?: string;
21
+ uniqueContainerClassName?: string;
22
+ uniqueContainerStyle?: CSSProperties;
23
+ popupStyle?: CSSProperties;
24
+ popupPlacement?: string;
25
+ builtinPlacements?: BuildInPlacements;
26
+ popupAlign?: AlignType;
27
+ zIndex?: number;
28
+ mask?: boolean;
29
+ maskClosable?: boolean;
30
+ popupMotion?: CSSMotionProps;
31
+ maskMotion?: CSSMotionProps;
32
+ arrow?: ArrowTypeOuter;
33
+ getPopupContainer?: TriggerProps['getPopupContainer'];
34
+ getPopupClassNameFromAlign?: (align: AlignType) => string;
35
+ }
36
+ export interface UniqueContextProps {
37
+ show: (options: UniqueShowOptions, isOpen: () => boolean) => void;
38
+ hide: (delay: number) => void;
39
+ }
40
+ export declare const UniqueContextKey: InjectionKey<UniqueContextProps>;
41
+ export declare function useUniqueContext(): UniqueContextProps | undefined;
42
+ export declare const UniqueContextProvider: import('vue').DefineSetupFnComponent<{
43
+ hide: any;
44
+ show: any;
45
+ }, {}, {}, {
46
+ hide: any;
47
+ show: any;
48
+ } & {}, import('vue').PublicProps>;
@@ -0,0 +1,27 @@
1
+ import { defineComponent as r, provide as o, computed as p, inject as n } from "vue";
2
+ const i = Symbol("TriggerContextKey");
3
+ function s() {
4
+ return n(i, void 0);
5
+ }
6
+ const g = r(
7
+ (e, { slots: t }) => (o(i, p(() => e)), () => t?.default?.()),
8
+ {
9
+ props: ["registerSubPopup"]
10
+ }
11
+ ), u = Symbol("UniqueContextKey");
12
+ function x() {
13
+ return n(u, void 0);
14
+ }
15
+ const C = r(
16
+ (e, { slots: t }) => (o(u, e), () => t?.default?.()),
17
+ {
18
+ props: ["show", "hide"]
19
+ }
20
+ );
21
+ export {
22
+ g as TriggerContextProvider,
23
+ u as UniqueContextKey,
24
+ C as UniqueContextProvider,
25
+ s as useTriggerContext,
26
+ x as useUniqueContext
27
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue");function u(e){return e?Array.isArray(e)?e:[e]:[]}function i(e){return typeof e=="string"?e.toLowerCase():e}function d(e,s,a){const r=n.shallowRef(new Set),c=n.shallowRef(new Set);return n.watchEffect(()=>{const h=u(s?.value??e.value).map(i),l=u(a?.value??e.value).map(i),t=new Set(h),o=new Set(l);t.has("hover")&&!t.has("click")&&t.add("touch"),o.has("hover")&&!o.has("click")&&o.add("touch"),r.value=t,c.value=o}),[r,c]}exports.default=d;
@@ -0,0 +1,6 @@
1
+ import { Ref } from 'vue';
2
+ type InternalActionType = 'hover' | 'focus' | 'click' | 'contextmenu' | 'touch';
3
+ type ExternalActionType = InternalActionType | Uppercase<InternalActionType> | 'contextMenu';
4
+ type ActionTypes = ExternalActionType | ExternalActionType[];
5
+ export default function useAction(action: Ref<ActionTypes>, showAction?: Ref<ActionTypes | undefined>, hideAction?: Ref<ActionTypes | undefined>): readonly [import('vue').ShallowRef<Set<InternalActionType>, Set<InternalActionType>>, import('vue').ShallowRef<Set<InternalActionType>, Set<InternalActionType>>];
6
+ export {};
@@ -0,0 +1,17 @@
1
+ import { shallowRef as c, watchEffect as A } from "vue";
2
+ function i(e) {
3
+ return e ? Array.isArray(e) ? e : [e] : [];
4
+ }
5
+ function s(e) {
6
+ return typeof e == "string" ? e.toLowerCase() : e;
7
+ }
8
+ function w(e, a, u) {
9
+ const n = c(/* @__PURE__ */ new Set()), r = c(/* @__PURE__ */ new Set());
10
+ return A(() => {
11
+ const h = i(a?.value ?? e.value).map(s), f = i(u?.value ?? e.value).map(s), t = new Set(h), o = new Set(f);
12
+ t.has("hover") && !t.has("click") && t.add("touch"), o.has("hover") && !o.has("click") && o.add("touch"), n.value = t, r.value = o;
13
+ }), [n, r];
14
+ }
15
+ export {
16
+ w as default
17
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Ce=require("../util/dist/Dom/findDOMNode.cjs"),Te=require("../util/dist/Dom/isVisible.cjs"),Le=require("../util/dist/raf.cjs"),x=require("vue"),V=require("../util.cjs");function Mt(o,c=0){const f=`${c}`,a=f.match(/^(.*)\%$/);return a?o*(parseFloat(a[1])/100):parseFloat(f)}function Pt(o,c){const[f,a]=c||[];return[Mt(o.width,f),Mt(o.height,a)]}function Bt(o=""){return[o[0],o[1]]}function C(o,c){const f=c[0],a=c[1];let y,X;return f==="t"?X=o.y:f==="b"?X=o.y+o.height:X=o.y+o.height/2,a==="l"?y=o.x:a==="r"?y=o.x+o.width:y=o.x+o.width/2,{x:y,y:X}}function w(o,c){const f={t:"b",b:"t",l:"r",r:"l"};return o.map((a,y)=>y===c?f[a]||"c":a).join("")}function Ie(o,c,f,a,y,X,Ot,K){const _=x.reactive({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:y.value[a.value]||{}}),k=x.shallowRef(0),Q=x.computed(()=>!c.value||K?.value?[]:V.collectScroller(c.value)),u=x.ref({}),Vt=()=>{u.value={}},Ct=()=>{if(c.value&&f.value&&o.value&&!K?.value){let h=function(t,p,g=rt){const Xt=n.x+t,Yt=n.y+p,Ye=Xt+M,Me=Yt+Y,Pe=Math.max(Xt,g.left),Be=Math.max(Yt,g.top),Oe=Math.min(Ye,g.right),Ve=Math.min(Me,g.bottom);return Math.max(0,(Oe-Pe)*(Ve-Be))},tt=function(){F=n.y+r,H=F+Y,N=n.x+l,D=N+M};const e=c.value,et=e.ownerDocument,ot=V.getWin(e),{position:Dt}=ot.getComputedStyle(e),_t=e.style.left,kt=e.style.top,Ut=e.style.right,zt=e.style.bottom,Gt=e.style.overflow,T={...y.value[a.value],...X?.value},A=et.createElement("div");e.parentElement?.appendChild(A),A.style.left=`${e.offsetLeft}px`,A.style.top=`${e.offsetTop}px`,A.style.position=Dt,A.style.height=`${e.offsetHeight}px`,A.style.width=`${e.offsetWidth}px`,e.style.left="0",e.style.top="0",e.style.right="auto",e.style.bottom="auto",e.style.overflow="hidden";let i;if(Array.isArray(f.value))i={x:f.value[0],y:f.value[1],width:0,height:0};else{const t=f.value.getBoundingClientRect();t.x=t.x??t.left,t.y=t.y??t.top,i={x:t.x,y:t.y,width:t.width,height:t.height}}const n=e.getBoundingClientRect(),{height:Jt,width:Kt}=ot.getComputedStyle(e);n.x=n.x??n.left,n.y=n.y??n.top;const{clientWidth:Qt,clientHeight:Zt,scrollWidth:te,scrollHeight:ee,scrollTop:st,scrollLeft:nt}=et.documentElement,Y=n.height,M=n.width,L=i.height,I=i.width,oe={left:0,top:0,right:Qt,bottom:Zt},se={left:-nt,top:-st,right:te-nt,bottom:ee-st};let{htmlRegion:S}=T;const it="visible",lt="visibleFirst";S!=="scroll"&&S!==lt&&(S=it);const j=S===lt,ne=V.getVisibleArea(se,Q.value),s=V.getVisibleArea(oe,Q.value),rt=S===it?s:ne,q=j?s:rt;e.style.left="auto",e.style.top="auto",e.style.right="0",e.style.bottom="0";const ft=e.getBoundingClientRect();e.style.left=_t,e.style.top=kt,e.style.right=Ut,e.style.bottom=zt,e.style.overflow=Gt,e.parentElement?.removeChild(A);const P=V.toNum(Math.round(M/parseFloat(Kt)*1e3)/1e3),B=V.toNum(Math.round(Y/parseFloat(Jt)*1e3)/1e3);if(P===0||B===0||Ce.isDOM(f)&&!Te.default(f))return;const{offset:ie,targetOffset:le}=T;let[d,v]=Pt(n,ie);const[re,fe]=Pt(i,le);i.x-=re,i.y-=fe;const[ce,ae]=T.points||[],R=Bt(ae),m=Bt(ce),ct=C(i,R),at=C(n,m),O={...T};let l=ct.x-at.x+d,r=ct.y-at.y+v;const b=h(l,r),E=h(l,r,s),ut=C(i,["t","l"]),pt=C(n,["t","l"]),ht=C(i,["b","r"]),gt=C(n,["b","r"]),ue=T.overflow||{},{adjustX:pe,adjustY:he,shiftX:mt,shiftY:yt}=ue,dt=t=>typeof t=="boolean"?t:t>=0;let F,H,N,D;tt();const vt=dt(he),xt=m[0]===R[0];if(vt&&m[0]==="t"&&(H>q.bottom||u.value.bt)){let t=r;xt?t-=Y-L:t=ut.y-gt.y-v;const p=h(l,t),g=h(l,t,s);p>b||p===b&&(!j||g>=E)?(u.value.bt=!0,r=t,v=-v,O.points=[w(m,0),w(R,0)]):u.value.bt=!1}if(vt&&m[0]==="b"&&(F<q.top||u.value.tb)){let t=r;xt?t+=Y-L:t=ht.y-pt.y-v;const p=h(l,t),g=h(l,t,s);p>b||p===b&&(!j||g>=E)?(u.value.tb=!0,r=t,v=-v,O.points=[w(m,0),w(R,0)]):u.value.tb=!1}const bt=dt(pe),wt=m[1]===R[1];if(bt&&m[1]==="l"&&(D>q.right||u.value.rl)){let t=l;wt?t-=M-I:t=ut.x-gt.x-d;const p=h(t,r),g=h(t,r,s);p>b||p===b&&(!j||g>=E)?(u.value.rl=!0,l=t,d=-d,O.points=[w(m,1),w(R,1)]):u.value.rl=!1}if(bt&&m[1]==="r"&&(N<q.left||u.value.lr)){let t=l;wt?t+=M-I:t=ht.x-pt.x-d;const p=h(t,r),g=h(t,r,s);p>b||p===b&&(!j||g>=E)?(u.value.lr=!0,l=t,d=-d,O.points=[w(m,1),w(R,1)]):u.value.lr=!1}tt();const W=mt===!0?0:mt;typeof W=="number"&&(N<s.left&&(l-=N-s.left-d,i.x+I<s.left+W&&(l+=i.x-s.left+I-W)),D>s.right&&(l-=D-s.right-d,i.x>s.right-W&&(l+=i.x-s.right+W)));const $=yt===!0?0:yt;typeof $=="number"&&(F<s.top&&(r-=F-s.top-v,i.y+L<s.top+$&&(r+=i.y-s.top+L-$)),H>s.bottom&&(r-=H-s.bottom-v,i.y>s.bottom-$&&(r+=i.y-s.bottom+$)));const U=n.x+l,ge=U+M,z=n.y+r,me=z+Y,At=i.x,ye=At+I,Rt=i.y,de=Rt+L,ve=Math.max(U,At),xe=Math.min(ge,ye),be=(ve+xe)/2-U,we=Math.max(z,Rt),Ae=Math.min(me,de),Re=(we+Ae)/2-z;Ot?.(c.value,O);let G=ft.right-n.x-(l+n.width),J=ft.bottom-n.y-(r+n.height);P===1&&(l=Math.round(l),G=Math.round(G)),B===1&&(r=Math.round(r),J=Math.round(J));const Xe={ready:!0,offsetX:l/P,offsetY:r/B,offsetR:G/P,offsetB:J/B,arrowX:be/P,arrowY:Re/B,scaleX:P,scaleY:B,align:O};Object.assign(_,Xe)}},Tt=Le.rafDebounce(Ct),Lt=()=>{k.value+=1;const h=k.value;Promise.resolve().then(()=>{k.value===h&&Tt()})},Z=()=>{_.ready=!1};x.watch(a,async()=>{await x.nextTick(),Z()}),x.watchEffect(async()=>{await x.nextTick(),o.value||(Vt(),Z())});const{ready:It,offsetX:St,offsetR:jt,offsetY:Ft,offsetB:Nt,align:Wt,arrowY:$t,arrowX:qt,scaleY:Et,scaleX:Ht}=x.toRefs(_);return[It,St,Ft,jt,Nt,qt,$t,Ht,Et,Wt,Lt]}exports.default=Ie;
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { TriggerProps } from '../index.tsx';
3
+ import { AlignType } from '../interface';
4
+ export default function useAlign(open: Ref<boolean>, popupEle: Ref<HTMLElement>, target: Ref<HTMLElement | [x: number, y: number]>, placement: Ref<string>, builtinPlacements: Ref<any>, popupAlign?: Ref<AlignType | undefined>, onPopupAlign?: TriggerProps['onPopupAlign'], mobile?: Ref<boolean | undefined>): readonly [Ref<boolean, boolean>, Ref<number, number>, Ref<number, number>, Ref<number, number>, Ref<number, number>, Ref<number, number>, Ref<number, number>, Ref<number, number>, Ref<number, number>, Ref<any, any>, () => void];