@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,21 @@
1
+ import "vue";
2
+ function t(e, a = {}) {
3
+ return e ? e ? {
4
+ name: e,
5
+ appear: !0,
6
+ // type: 'animation',
7
+ // appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
8
+ // appearActiveClass: `antdv-base-transtion`,
9
+ // appearToClass: `${transitionName}-appear ${transitionName}-appear-active`,
10
+ enterFromClass: `${e} ${e}-enter ${e}-enter-prepare ${e}-enter-start`,
11
+ enterActiveClass: `${e} ${e}-enter ${e}-enter-prepare`,
12
+ enterToClass: `${e} ${e}-enter ${e}-enter-active`,
13
+ leaveFromClass: `${e} ${e}-leave`,
14
+ leaveActiveClass: `${e} ${e}-leave ${e}-leave-active`,
15
+ leaveToClass: `${e} ${e}-leave ${e}-leave-active`,
16
+ ...a
17
+ } : { css: !1, ...a } : {};
18
+ }
19
+ export {
20
+ t as getTransitionProps
21
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let s={};const i=[];function a(e){i.push(e)}function l(e,n){if(process.env.NODE_ENV!=="production"&&!e&&console!==void 0){const o=i.reduce((c,r)=>r(c??"","warning"),n);o&&console.error(`Warning: ${o}`)}}function d(e,n){if(process.env.NODE_ENV!=="production"&&!e&&console!==void 0){const o=i.reduce((c,r)=>r(c??"","note"),n);o&&console.warn(`Note: ${o}`)}}function f(){s={}}function u(e,n,o){!n&&!s[o]&&(e(!1,o),s[o]=!0)}function t(e,n){u(l,e,n)}function p(e,n){u(d,e,n)}t.preMessage=a;t.resetWarned=f;t.noteOnce=p;exports.call=u;exports.default=t;exports.note=d;exports.noteOnce=p;exports.preMessage=a;exports.resetWarned=f;exports.warning=l;exports.warningOnce=t;
@@ -0,0 +1,48 @@
1
+ let t = {};
2
+ const r = [];
3
+ function u(n) {
4
+ r.push(n);
5
+ }
6
+ function f(n, e) {
7
+ if (process.env.NODE_ENV !== "production" && !n && console !== void 0) {
8
+ const o = r.reduce(
9
+ (s, c) => c(s ?? "", "warning"),
10
+ e
11
+ );
12
+ o && console.error(`Warning: ${o}`);
13
+ }
14
+ }
15
+ function d(n, e) {
16
+ if (process.env.NODE_ENV !== "production" && !n && console !== void 0) {
17
+ const o = r.reduce(
18
+ (s, c) => c(s ?? "", "note"),
19
+ e
20
+ );
21
+ o && console.warn(`Note: ${o}`);
22
+ }
23
+ }
24
+ function l() {
25
+ t = {};
26
+ }
27
+ function i(n, e, o) {
28
+ !e && !t[o] && (n(!1, o), t[o] = !0);
29
+ }
30
+ function a(n, e) {
31
+ i(f, n, e);
32
+ }
33
+ function p(n, e) {
34
+ i(d, n, e);
35
+ }
36
+ a.preMessage = u;
37
+ a.resetWarned = l;
38
+ a.noteOnce = p;
39
+ export {
40
+ i as call,
41
+ a as default,
42
+ d as note,
43
+ p as noteOnce,
44
+ u as preMessage,
45
+ l as resetWarned,
46
+ f as warning,
47
+ a as warningOnce
48
+ };
package/dist/util.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function j(e=[],o=[],t){return t?e[0]===o[0]:e[0]===o[0]&&e[1]===o[1]}function I(e,o,t,n){const{points:s}=t,i=Object.keys(e);for(let r=0;r<i.length;r+=1){const l=i[r];if(j(e[l]?.points,s,n))return`${o}-placement-${l}`}return""}function m(e){return e.ownerDocument.defaultView}function X(e){const o=[];let t=e?.parentElement;const n=["hidden","scroll","clip","auto"];for(;t;){const{overflowX:s,overflowY:i,overflow:r}=m(t).getComputedStyle(t);[s,i,r].some(l=>n.includes(l))&&o.push(t),t=t.parentElement}return o}function a(e,o=1){return Number.isNaN(e)?o:e}function d(e){return a(parseFloat(e),0)}function Y(e,o){const t={...e};return(o||[]).forEach(n=>{if(n instanceof HTMLBodyElement||n instanceof HTMLHtmlElement)return;const{overflow:s,overflowClipMargin:i,borderTopWidth:r,borderBottomWidth:l,borderLeftWidth:L,borderRightWidth:T}=m(n).getComputedStyle(n),c=n.getBoundingClientRect(),{offsetHeight:p,clientHeight:C,offsetWidth:b,clientWidth:E}=n,W=d(r),M=d(l),N=d(L),w=d(T),h=a(Math.round(c.width/b*1e3)/1e3),u=a(Math.round(c.height/p*1e3)/1e3),R=(b-E-N-w)*h,A=(p-C-W-M)*u,B=W*u,x=M*u,H=N*h,O=w*h;let f=0,g=0;if(s==="clip"){const v=d(i);f=v*h,g=v*u}const S=c.x+H-f,y=c.y+B-g,P=S+c.width+2*f-H-O-R,V=y+c.height+2*g-B-x-A;t.left=Math.max(t.left,S),t.top=Math.max(t.top,y),t.right=Math.min(t.right,P),t.bottom=Math.min(t.bottom,V)}),t}exports.collectScroller=X;exports.getAlignPopupClassName=I;exports.getVisibleArea=Y;exports.getWin=m;exports.toNum=a;
package/dist/util.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { AlignType, BuildInPlacements } from './interface';
2
+ export declare function getAlignPopupClassName(builtinPlacements: BuildInPlacements, prefixCls: string, align: AlignType, isAlignPoint: boolean): string;
3
+ export declare function getWin(ele: HTMLElement): (Window & typeof globalThis) | null;
4
+ /**
5
+ * Get all the scrollable parent elements of the element
6
+ * @param ele The element to be detected
7
+ * @param areaOnly Only return the parent which will cut visible area
8
+ */
9
+ export declare function collectScroller(ele: HTMLElement): HTMLElement[];
10
+ export declare function toNum(num: number, defaultValue?: number): number;
11
+ export interface VisibleArea {
12
+ left: number;
13
+ top: number;
14
+ right: number;
15
+ bottom: number;
16
+ }
17
+ /**
18
+ *
19
+ *
20
+ * **************************************
21
+ * Border *
22
+ * ************************** *
23
+ *
24
+ * B * * S * B *
25
+ * o * * c * o *
26
+ * r * Content * r * r *
27
+ * d * * o * d *
28
+ * e * * l * e *
29
+ * r ******************** l * r *
30
+ * Scroll * *
31
+ * ************************** *
32
+ * Border *
33
+ * **************************************
34
+ *
35
+ */
36
+ /**
37
+ * Get visible area of element
38
+ */
39
+ export declare function getVisibleArea(initArea: VisibleArea, scrollerList?: HTMLElement[]): {
40
+ left: number;
41
+ top: number;
42
+ right: number;
43
+ bottom: number;
44
+ };
package/dist/util.js ADDED
@@ -0,0 +1,69 @@
1
+ function P(e = [], o = [], t) {
2
+ return t ? e[0] === o[0] : e[0] === o[0] && e[1] === o[1];
3
+ }
4
+ function X(e, o, t, n) {
5
+ const { points: s } = t, i = Object.keys(e);
6
+ for (let r = 0; r < i.length; r += 1) {
7
+ const c = i[r];
8
+ if (P(e[c]?.points, s, n))
9
+ return `${o}-placement-${c}`;
10
+ }
11
+ return "";
12
+ }
13
+ function y(e) {
14
+ return e.ownerDocument.defaultView;
15
+ }
16
+ function Y(e) {
17
+ const o = [];
18
+ let t = e?.parentElement;
19
+ const n = ["hidden", "scroll", "clip", "auto"];
20
+ for (; t; ) {
21
+ const { overflowX: s, overflowY: i, overflow: r } = y(t).getComputedStyle(t);
22
+ [s, i, r].some((c) => n.includes(c)) && o.push(t), t = t.parentElement;
23
+ }
24
+ return o;
25
+ }
26
+ function m(e, o = 1) {
27
+ return Number.isNaN(e) ? o : e;
28
+ }
29
+ function h(e) {
30
+ return m(parseFloat(e), 0);
31
+ }
32
+ function $(e, o) {
33
+ const t = { ...e };
34
+ return (o || []).forEach((n) => {
35
+ if (n instanceof HTMLBodyElement || n instanceof HTMLHtmlElement)
36
+ return;
37
+ const {
38
+ overflow: s,
39
+ overflowClipMargin: i,
40
+ borderTopWidth: r,
41
+ borderBottomWidth: c,
42
+ borderLeftWidth: E,
43
+ borderRightWidth: R
44
+ } = y(n).getComputedStyle(n), l = n.getBoundingClientRect(), {
45
+ offsetHeight: g,
46
+ clientHeight: S,
47
+ offsetWidth: p,
48
+ clientWidth: T
49
+ } = n, W = h(r), b = h(c), M = h(E), w = h(R), d = m(
50
+ Math.round(l.width / p * 1e3) / 1e3
51
+ ), u = m(
52
+ Math.round(l.height / g * 1e3) / 1e3
53
+ ), x = (p - T - M - w) * d, C = (g - S - W - b) * u, B = W * u, A = b * u, N = M * d, O = w * d;
54
+ let f = 0, a = 0;
55
+ if (s === "clip") {
56
+ const v = h(i);
57
+ f = v * d, a = v * u;
58
+ }
59
+ const H = l.x + N - f, L = l.y + B - a, V = H + l.width + 2 * f - N - O - x, I = L + l.height + 2 * a - B - A - C;
60
+ t.left = Math.max(t.left, H), t.top = Math.max(t.top, L), t.right = Math.min(t.right, V), t.bottom = Math.min(t.bottom, I);
61
+ }), t;
62
+ }
63
+ export {
64
+ Y as collectScroller,
65
+ X as getAlignPopupClassName,
66
+ $ as getVisibleArea,
67
+ y as getWin,
68
+ m as toNum
69
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@v-c/trigger",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "author": "",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "trigger"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.cjs"
19
+ },
20
+ "./dist/*": "./dist/*",
21
+ "./package.json": "./package.json"
22
+ },
23
+ "main": "./dist/index.js",
24
+ "files": [
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "peerDependencies": {
29
+ "vue": "^3.0.0"
30
+ },
31
+ "dependencies": {
32
+ "@v-c/portal": "0.0.1",
33
+ "@v-c/resize-observer": "0.0.2",
34
+ "@v-c/util": "0.0.7"
35
+ },
36
+ "scripts": {
37
+ "build": "vite build",
38
+ "test": "vitest",
39
+ "prepublish": "pnpm build"
40
+ }
41
+ }