zero-tooltip 1.0.7 → 1.0.9

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/README.md CHANGED
@@ -10,23 +10,26 @@ The component is designed to enhance user interactions by providing informative
10
10
  ```bash
11
11
  # npm
12
12
  npm install zero-tooltip
13
+
13
14
  # yarn
14
15
  yarn add zero-tooltip
16
+
17
+ # pnpm
18
+ pnpm install zero-tooltip
15
19
  ```
16
20
 
17
- Add globally in `main.ts`:
21
+ Register plugin in `main.ts`:
18
22
  ```ts
19
23
  import ZeroTooltip from 'zero-tooltip'
20
- // import default styles
21
- import '../node_modules/zero-tooltip/dist/styles.css'
22
- // register directive
24
+
23
25
  const app = createApp(App)
24
- app.directive('tooltip', ZeroTooltip())
26
+
27
+ app.use(ZeroTooltip())
25
28
  ```
26
29
 
27
30
  ## Usage
28
31
 
29
- Use it just like any other Vue.js directive on elements.
32
+ Tooltip can be used with directive `v-tooltip` added on elements.
30
33
  The given value is displayed as tooltip's text:
31
34
 
32
35
  ```html
@@ -43,17 +46,17 @@ Default position for tooltip is above/on top of the element that is being hovere
43
46
  <button v-tooltip:right="'Submits this form'">Submit</button>
44
47
  ```
45
48
 
46
- Acceptable arguments are: `left` | `top` | `right` | `bottom`. Passing this argument locally, it overrides default tooltip position given as `defaultPosition` when registering directive at the app level.
49
+ Acceptable arguments are: `left` | `top` | `right` | `bottom`. This will override tooltip default position that was set during plugin registering process.
47
50
 
48
- You can also define default position globally when registering directive at the app level:
51
+ You can also define default position globally when registering plugin:
49
52
 
50
53
  ```ts
51
- app.directive('tooltip', ZeroTooltip({
54
+ app.use(ZeroTooltip({
52
55
  defaultPosition: 'right'
53
56
  }))
54
57
  ```
55
58
 
56
- Tooltip component is fully customizable by giving config object when declaring global tooltip directive:
59
+ Tooltip component is fully customizable by giving config object as options when registering tooltip plugin:
57
60
  ```ts
58
61
  import ZeroTooltipConfig from 'zero-tooltip'
59
62
 
@@ -73,7 +76,7 @@ const tooltipConfig: ZeroTooltipConfig = {
73
76
  zIndex: ...
74
77
  }
75
78
 
76
- app.directive('tooltip', ZeroTooltip(tooltipConfig))
79
+ app.use(ZeroTooltip(tooltipConfig))
77
80
  ```
78
81
 
79
82
  All above settings are optional.
@@ -87,8 +90,8 @@ Tooltip can be customizable also for each usage (locally) using same config as f
87
90
  <script setup lang="ts">
88
91
  import ZeroTooltipLocalConfig from 'zero-tooltip'
89
92
 
90
- const tooltipConfig: ZeroTooltipLocalConfig = {
91
- content: 'This is tooltip'
93
+ const tooltipConfig: ZeroTooltipLocalConfig = reactive({
94
+ content: 'This is tooltip',
92
95
  defaultPosition: ... ,
93
96
  positions: ... ,
94
97
  offsetFromSource: ... ,
@@ -103,7 +106,7 @@ const tooltipConfig: ZeroTooltipLocalConfig = {
103
106
  arrowMinOffsetFromTooltipCorner: ... ,
104
107
  zIndex: ... ,
105
108
  show: ...
106
- }
109
+ })
107
110
  </script>
108
111
  ```
109
112
 
@@ -0,0 +1,4 @@
1
+ export default function useHideOnResize(): {
2
+ handleHideOnResize: (anchorElement: HTMLElement, hideOverlay: () => void) => void;
3
+ resetResizeReferences: () => void;
4
+ };
@@ -0,0 +1,3 @@
1
+ export default function useHideOnScroll(): {
2
+ handleHideOnScroll: (anchorElement: HTMLElement, hideOverlay: () => void) => void;
3
+ };
package/dist/index.d.ts CHANGED
@@ -1,36 +1,11 @@
1
- import { Directive } from 'vue';
2
-
3
- declare const ZeroTooltip: (globalConfig?: ZeroTooltipConfig) => Directive;
4
- export default ZeroTooltip;
5
-
6
- export declare type ZeroTooltipConfig = {
7
- defaultPosition?: ZeroTooltipPosition;
8
- positions?: Partial<ZeroTooltipPositions>;
9
- offsetFromSource?: number;
10
- offsetFromViewport?: number;
11
- minWidth?: number;
12
- maxWidth?: number;
13
- tooltipBorderWidth?: number;
14
- tooltipClasses?: string;
15
- textClasses?: string;
16
- arrowSize?: number;
17
- arrowClasses?: string;
18
- arrowMinOffsetFromTooltipCorner?: number;
19
- zIndex?: number;
20
- };
21
-
22
- export declare type ZeroTooltipLocalConfig = {
23
- content: string;
24
- show?: boolean;
25
- } & ZeroTooltipConfig;
26
-
27
- export declare type ZeroTooltipPosition = 'left' | 'top' | 'right' | 'bottom';
28
-
29
- export declare type ZeroTooltipPositions = {
30
- left: [ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition];
31
- top: [ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition];
32
- right: [ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition];
33
- bottom: [ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition, ZeroTooltipPosition];
34
- };
35
-
36
- export { }
1
+ import './style.css';
2
+ import { App } from 'vue';
3
+ import TooltipConfig from "./types/tooltipConfig";
4
+ import TooltipLocalConfig from "./types/tooltipLocalConfig";
5
+ import TooltipPosition from "./types/tooltipPosition";
6
+ import TooltipPositions from "./types/tooltipPositions";
7
+ declare const _default: {
8
+ install: (app: App, options?: TooltipConfig) => void;
9
+ };
10
+ export default _default;
11
+ export type { TooltipConfig as ZeroTooltipConfig, TooltipPosition as ZeroTooltipPosition, TooltipPositions as ZeroTooltipPositions, TooltipLocalConfig as ZeroTooltipLocalConfig };
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ /*! tailwindcss v3.3.3 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.zt-fixed{position:fixed}.zt-absolute{position:absolute}.zt-box-border{box-sizing:border-box}.zt-inline-block{display:inline-block}.zt-h-\[2000px\]{height:2000px}.zt-w-fit{width:-moz-fit-content;width:fit-content}.zt-w-full{width:100%}.zt-whitespace-pre-wrap{white-space:pre-wrap}.zt-break-words{overflow-wrap:break-word}.zt-rounded-md{border-radius:.375rem}.zt-border-solid{border-style:solid}.zt-border-\[\#495057\]{--tw-border-opacity:1;border-color:rgb(73 80 87/var(--tw-border-opacity))}.\!zt-border-x-transparent{border-left-color:#0000!important;border-right-color:#0000!important}.\!zt-border-y-transparent{border-top-color:#0000!important}.\!zt-border-b-transparent,.\!zt-border-y-transparent{border-bottom-color:#0000!important}.\!zt-border-l-transparent{border-left-color:#0000!important}.\!zt-border-r-transparent{border-right-color:#0000!important}.\!zt-border-t-transparent{border-top-color:#0000!important}.zt-bg-\[\#495057\]{--tw-bg-opacity:1;background-color:rgb(73 80 87/var(--tw-bg-opacity))}.zt-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.zt-px-2{padding-left:.5rem;padding-right:.5rem}.zt-px-2\.5{padding-left:.625rem;padding-right:.625rem}.zt-py-1{padding-top:.25rem;padding-bottom:.25rem}.zt-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.zt-text-sm{font-size:.875rem;line-height:1.25rem}.zt-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.zt-opacity-0{opacity:0}.zt-shadow-\[0_2px_12px_0_rgba\(0\,0\,0\,0\.1\)\]{--tw-shadow:0 2px 12px 0 #0000001a;--tw-shadow-colored:0 2px 12px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}
@@ -0,0 +1,4 @@
1
+ import { Directive } from "vue";
2
+ import TooltipConfig from "./types/tooltipConfig";
3
+ declare const ZeroTooltip: (globalConfig?: TooltipConfig) => Directive;
4
+ export default ZeroTooltip;
@@ -0,0 +1,18 @@
1
+ import TooltipPosition from "./tooltipPosition";
2
+ import TooltipPositions from "./tooltipPositions";
3
+ type TooltipConfig = {
4
+ defaultPosition?: TooltipPosition;
5
+ positions?: Partial<TooltipPositions>;
6
+ offsetFromSource?: number;
7
+ offsetFromViewport?: number;
8
+ minWidth?: number;
9
+ maxWidth?: number;
10
+ tooltipBorderWidth?: number;
11
+ tooltipClasses?: string;
12
+ textClasses?: string;
13
+ arrowSize?: number;
14
+ arrowClasses?: string;
15
+ arrowMinOffsetFromTooltipCorner?: number;
16
+ zIndex?: number;
17
+ };
18
+ export default TooltipConfig;
@@ -0,0 +1,6 @@
1
+ import TooltipConfig from "./tooltipConfig";
2
+ type TooltipLocalConfig = {
3
+ content: string;
4
+ show?: boolean;
5
+ } & TooltipConfig;
6
+ export default TooltipLocalConfig;
@@ -0,0 +1,2 @@
1
+ type TooltipPosition = 'left' | 'top' | 'right' | 'bottom';
2
+ export default TooltipPosition;
@@ -0,0 +1,8 @@
1
+ import TooltipPosition from "./tooltipPosition";
2
+ type TooltipPositions = {
3
+ left: [TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition];
4
+ top: [TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition];
5
+ right: [TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition];
6
+ bottom: [TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition];
7
+ };
8
+ export default TooltipPositions;
@@ -1,34 +1,34 @@
1
- import { watch as et } from "vue";
1
+ import { isReactive as et, watch as rt } from "vue";
2
2
  let M;
3
- const rt = new Uint8Array(16);
4
- function st() {
3
+ const st = new Uint8Array(16);
4
+ function dt() {
5
5
  if (!M && (M = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !M))
6
6
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
7
- return M(rt);
7
+ return M(st);
8
8
  }
9
- const h = [];
9
+ const w = [];
10
10
  for (let e = 0; e < 256; ++e)
11
- h.push((e + 256).toString(16).slice(1));
12
- function dt(e, t = 0) {
13
- return h[e[t + 0]] + h[e[t + 1]] + h[e[t + 2]] + h[e[t + 3]] + "-" + h[e[t + 4]] + h[e[t + 5]] + "-" + h[e[t + 6]] + h[e[t + 7]] + "-" + h[e[t + 8]] + h[e[t + 9]] + "-" + h[e[t + 10]] + h[e[t + 11]] + h[e[t + 12]] + h[e[t + 13]] + h[e[t + 14]] + h[e[t + 15]];
11
+ w.push((e + 256).toString(16).slice(1));
12
+ function it(e, t = 0) {
13
+ return w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]];
14
14
  }
15
- const it = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), q = {
16
- randomUUID: it
15
+ const ot = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), q = {
16
+ randomUUID: ot
17
17
  };
18
- function ot(e, t, r) {
18
+ function pt(e, t, r) {
19
19
  if (q.randomUUID && !t && !e)
20
20
  return q.randomUUID();
21
21
  e = e || {};
22
- const s = e.random || (e.rng || st)();
22
+ const s = e.random || (e.rng || dt)();
23
23
  if (s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, t) {
24
24
  r = r || 0;
25
25
  for (let d = 0; d < 16; ++d)
26
26
  t[r + d] = s[d];
27
27
  return t;
28
28
  }
29
- return dt(s);
29
+ return it(s);
30
30
  }
31
- function pt() {
31
+ function ht() {
32
32
  let e = [];
33
33
  const t = (d, i) => {
34
34
  if (r(d), e.length > 0)
@@ -56,7 +56,7 @@ function pt() {
56
56
  };
57
57
  return { handleHideOnScroll: t };
58
58
  }
59
- function ut() {
59
+ function wt() {
60
60
  let e = null, t = null;
61
61
  return { handleHideOnResize: (d, i) => {
62
62
  e = new ResizeObserver((o) => {
@@ -64,84 +64,82 @@ function ut() {
64
64
  if (t === null)
65
65
  t = d.getBoundingClientRect();
66
66
  else {
67
- const u = p.getBoundingClientRect();
68
- (u.left !== t.left || u.top !== t.top || u.width !== t.width || u.height !== t.height) && i();
67
+ const h = p.getBoundingClientRect();
68
+ (h.left !== t.left || h.top !== t.top || h.width !== t.width || h.height !== t.height) && i();
69
69
  }
70
70
  }), e.observe(d);
71
71
  }, resetResizeReferences: () => {
72
72
  e !== null && e.disconnect(), e = null, t = null;
73
73
  } };
74
74
  }
75
- const { handleHideOnScroll: ht } = pt(), { handleHideOnResize: wt, resetResizeReferences: mt } = ut(), y = "zero-tooltip__container", j = "zero-tooltip__text", tt = "zero-tooltip__arrow", n = {
75
+ const { handleHideOnScroll: ut } = ht(), { handleHideOnResize: mt, resetResizeReferences: nt } = wt(), y = "zero-tooltip__container", j = "zero-tooltip__text", tt = "zero-tooltip__arrow", c = {
76
76
  left: ["left", "right", "top", "bottom"],
77
77
  top: ["top", "bottom", "right", "left"],
78
78
  right: ["right", "left", "top", "bottom"],
79
79
  bottom: ["bottom", "top", "right", "left"]
80
- }, N = "top", R = 10, Z = 20, G = 100, J = 250, K = 0, Q = "zt-fixed zt-opacity-0 zt-inline-block zt-w-fit zt-py-1.5 zt-px-2.5 zt-rounded-md zt-bg-[#495057] zt-shadow-[0_2px_12px_0_rgba(0,0,0,0.1)] zt-box-border", X = "zt-text-sm zt-text-white zt-whitespace-pre-wrap zt-break-words", Y = 5, nt = "zt-absolute zt-border-solid zt-border-[#495057]", E = 6, l = 1, b = !0, c = {}, at = (e) => ({
80
+ }, R = "top", N = 10, Z = 20, G = 100, J = 250, K = 0, Q = "zt-fixed zt-opacity-0 zt-inline-block zt-w-fit zt-py-1.5 zt-px-2.5 zt-rounded-md zt-bg-[#495057] zt-shadow-[0_2px_12px_0_rgba(0,0,0,0.1)] zt-box-border", X = "zt-text-sm zt-text-white zt-whitespace-pre-wrap zt-break-words", Y = 5, ct = "zt-absolute zt-border-solid zt-border-[#495057]", E = 6, l = 1, b = !0, n = {}, Ot = (e) => ({
81
81
  created: (t, r, s) => {
82
- const d = ot();
83
- s.el.$_tooltip = { uuid: d }, V(r.value, e, r.arg, t, d), typeof r.value != "string" && et(r.value, (i) => {
84
- c[d] && B(c[d]), V(i, e, r.arg, t, d);
82
+ const d = pt();
83
+ s.el.$_tooltip = { uuid: d }, V(r.value, e, r.arg, t, d), typeof r.value != "string" && et(r.value) && rt(r.value, (i) => {
84
+ n[d] && B(n[d]), V(i, e, r.arg, t, d);
85
85
  });
86
86
  },
87
87
  updated: (t, r, s) => {
88
- if (typeof r.value == "string") {
89
- const d = s.el.$_tooltip.uuid;
90
- c[d] && B(c[d]), V(r.value, e, r.arg, t, d);
91
- }
88
+ const d = s.el.$_tooltip.uuid;
89
+ n[d] && B(n[d]), V(r.value, e, r.arg, t, d);
92
90
  },
93
91
  beforeUnmount: (t, r, s) => {
94
92
  const d = s.el.$_tooltip.uuid;
95
- c[d] && B(c[d]);
93
+ n[d] && B(n[d]);
96
94
  }
97
95
  });
98
96
  function V(e, t, r, s, d) {
99
- let i = ct(e, t, r);
100
- const o = xt(s, i, d);
101
- s.matches(":hover") && s.dispatchEvent(new Event("mouseenter")), c[d] = o;
97
+ let i = xt(e, t, r);
98
+ const o = Tt(s, i, d);
99
+ n[d] = o, s.matches(":hover") && s.dispatchEvent(new Event("mouseenter"));
102
100
  }
103
- function ct(e, t, r) {
104
- var a, L, H, $, A, _, I, f, U, k, D, P;
105
- let s, d, i, o, p, u, w, m, x, O, F, T, W, z, v;
106
- return s = Ot(e), typeof e != "string" && (d = r ?? e.defaultPosition ?? (t == null ? void 0 : t.defaultPosition) ?? N, i = {
107
- left: ((a = e.positions) == null ? void 0 : a.left) ?? ((L = t == null ? void 0 : t.positions) == null ? void 0 : L.left) ?? n.left,
108
- top: ((H = e.positions) == null ? void 0 : H.top) ?? (($ = t == null ? void 0 : t.positions) == null ? void 0 : $.top) ?? n.top,
109
- right: ((A = e.positions) == null ? void 0 : A.right) ?? ((_ = t == null ? void 0 : t.positions) == null ? void 0 : _.right) ?? n.right,
110
- bottom: ((I = e.positions) == null ? void 0 : I.bottom) ?? ((f = t == null ? void 0 : t.positions) == null ? void 0 : f.bottom) ?? n.bottom
111
- }, o = e.offsetFromSource ?? (t == null ? void 0 : t.offsetFromSource) ?? R, p = e.offsetFromViewport ?? (t == null ? void 0 : t.offsetFromViewport) ?? Z, u = e.minWidth ?? (t == null ? void 0 : t.minWidth) ?? G, w = e.maxWidth ?? (t == null ? void 0 : t.maxWidth) ?? J, m = e.tooltipBorderWidth ?? (t == null ? void 0 : t.tooltipBorderWidth) ?? K, x = y + " " + Q + " " + (e.tooltipClasses ?? (t == null ? void 0 : t.tooltipClasses) ?? ""), O = j + " " + X + " " + (e.textClasses ?? (t == null ? void 0 : t.textClasses) ?? ""), F = e.arrowSize ?? (t == null ? void 0 : t.arrowSize) ?? Y, T = e.arrowClasses ?? (t == null ? void 0 : t.arrowClasses) ?? "", W = e.arrowMinOffsetFromTooltipCorner ?? (t == null ? void 0 : t.arrowMinOffsetFromTooltipCorner) ?? E, z = e.zIndex ?? (t == null ? void 0 : t.zIndex) ?? l, v = e.show ?? b), d === void 0 && (d = r ?? (t == null ? void 0 : t.defaultPosition) ?? N), i === void 0 && (i = {
112
- left: ((U = t == null ? void 0 : t.positions) == null ? void 0 : U.left) ?? n.left,
113
- top: ((k = t == null ? void 0 : t.positions) == null ? void 0 : k.top) ?? n.top,
114
- right: ((D = t == null ? void 0 : t.positions) == null ? void 0 : D.right) ?? n.right,
115
- bottom: ((P = t == null ? void 0 : t.positions) == null ? void 0 : P.bottom) ?? n.bottom
116
- }), o === void 0 && (o = (t == null ? void 0 : t.offsetFromSource) ?? R), p === void 0 && (p = (t == null ? void 0 : t.offsetFromViewport) ?? Z), u === void 0 && (u = (t == null ? void 0 : t.minWidth) ?? G), w === void 0 && (w = (t == null ? void 0 : t.maxWidth) ?? J), m === void 0 && (m = (t == null ? void 0 : t.tooltipBorderWidth) ?? K), x === void 0 && (x = y + " " + Q + " " + ((t == null ? void 0 : t.tooltipClasses) ?? "")), O === void 0 && (O = j + " " + X + " " + ((t == null ? void 0 : t.textClasses) ?? "")), F === void 0 && (F = (t == null ? void 0 : t.arrowSize) ?? Y), T === void 0 && (T = (t == null ? void 0 : t.arrowClasses) ?? ""), W === void 0 && (W = (t == null ? void 0 : t.arrowMinOffsetFromTooltipCorner) ?? E), z === void 0 && (z = (t == null ? void 0 : t.zIndex) ?? l), v === void 0 && (v = b), {
101
+ function xt(e, t, r) {
102
+ var a, L, H, $, A, _, I, U, f, k, D, P;
103
+ let s, d, i, o, p, h, u, m, x, O, F, T, W, v, z;
104
+ return s = Ft(e), typeof e != "string" && (d = r ?? e.defaultPosition ?? (t == null ? void 0 : t.defaultPosition) ?? R, i = {
105
+ left: ((a = e.positions) == null ? void 0 : a.left) ?? ((L = t == null ? void 0 : t.positions) == null ? void 0 : L.left) ?? c.left,
106
+ top: ((H = e.positions) == null ? void 0 : H.top) ?? (($ = t == null ? void 0 : t.positions) == null ? void 0 : $.top) ?? c.top,
107
+ right: ((A = e.positions) == null ? void 0 : A.right) ?? ((_ = t == null ? void 0 : t.positions) == null ? void 0 : _.right) ?? c.right,
108
+ bottom: ((I = e.positions) == null ? void 0 : I.bottom) ?? ((U = t == null ? void 0 : t.positions) == null ? void 0 : U.bottom) ?? c.bottom
109
+ }, o = e.offsetFromSource ?? (t == null ? void 0 : t.offsetFromSource) ?? N, p = e.offsetFromViewport ?? (t == null ? void 0 : t.offsetFromViewport) ?? Z, h = e.minWidth ?? (t == null ? void 0 : t.minWidth) ?? G, u = e.maxWidth ?? (t == null ? void 0 : t.maxWidth) ?? J, m = e.tooltipBorderWidth ?? (t == null ? void 0 : t.tooltipBorderWidth) ?? K, x = y + " " + Q + " " + (e.tooltipClasses ?? (t == null ? void 0 : t.tooltipClasses) ?? ""), O = j + " " + X + " " + (e.textClasses ?? (t == null ? void 0 : t.textClasses) ?? ""), F = e.arrowSize ?? (t == null ? void 0 : t.arrowSize) ?? Y, T = e.arrowClasses ?? (t == null ? void 0 : t.arrowClasses) ?? "", W = e.arrowMinOffsetFromTooltipCorner ?? (t == null ? void 0 : t.arrowMinOffsetFromTooltipCorner) ?? E, v = e.zIndex ?? (t == null ? void 0 : t.zIndex) ?? l, z = e.show ?? b), d === void 0 && (d = r ?? (t == null ? void 0 : t.defaultPosition) ?? R), i === void 0 && (i = {
110
+ left: ((f = t == null ? void 0 : t.positions) == null ? void 0 : f.left) ?? c.left,
111
+ top: ((k = t == null ? void 0 : t.positions) == null ? void 0 : k.top) ?? c.top,
112
+ right: ((D = t == null ? void 0 : t.positions) == null ? void 0 : D.right) ?? c.right,
113
+ bottom: ((P = t == null ? void 0 : t.positions) == null ? void 0 : P.bottom) ?? c.bottom
114
+ }), o === void 0 && (o = (t == null ? void 0 : t.offsetFromSource) ?? N), p === void 0 && (p = (t == null ? void 0 : t.offsetFromViewport) ?? Z), h === void 0 && (h = (t == null ? void 0 : t.minWidth) ?? G), u === void 0 && (u = (t == null ? void 0 : t.maxWidth) ?? J), m === void 0 && (m = (t == null ? void 0 : t.tooltipBorderWidth) ?? K), x === void 0 && (x = y + " " + Q + " " + ((t == null ? void 0 : t.tooltipClasses) ?? "")), O === void 0 && (O = j + " " + X + " " + ((t == null ? void 0 : t.textClasses) ?? "")), F === void 0 && (F = (t == null ? void 0 : t.arrowSize) ?? Y), T === void 0 && (T = (t == null ? void 0 : t.arrowClasses) ?? ""), W === void 0 && (W = (t == null ? void 0 : t.arrowMinOffsetFromTooltipCorner) ?? E), v === void 0 && (v = (t == null ? void 0 : t.zIndex) ?? l), z === void 0 && (z = b), {
117
115
  tooltipText: s,
118
116
  tooltipPosition: d,
119
117
  tooltipPositions: i,
120
118
  tooltipOffsetFromSource: o,
121
119
  tooltipOffsetFromViewport: p,
122
- tooltipMinWidth: u,
123
- tooltipMaxWidth: w,
120
+ tooltipMinWidth: h,
121
+ tooltipMaxWidth: u,
124
122
  tooltipBorderWidth: m,
125
123
  tooltipClasses: x,
126
124
  textClasses: O,
127
125
  arrowSize: F,
128
126
  arrowClasses: T,
129
127
  arrowMinOffsetFromTooltipCorner: W,
130
- zIndex: z,
131
- shouldShow: v
128
+ zIndex: v,
129
+ shouldShow: z
132
130
  };
133
131
  }
134
- function Ot(e) {
132
+ function Ft(e) {
135
133
  const t = typeof e == "string" ? e : e.content;
136
134
  if (!t)
137
135
  throw new Error("Please enter valid tooltip value");
138
136
  return t;
139
137
  }
140
- function xt(e, t, r) {
141
- let s = e, d = Ft(t.textClasses, t.tooltipText), i = Tt(t.tooltipClasses, t.tooltipBorderWidth);
138
+ function Tt(e, t, r) {
139
+ let s = e, d = Wt(t.textClasses, t.tooltipText), i = vt(t.tooltipClasses, t.tooltipBorderWidth);
142
140
  i.append(d), i.dataset.uuid = r;
143
141
  const o = new AbortController(), p = new AbortController();
144
- return s.addEventListener("mouseenter", () => Wt(s, t, i), { signal: o.signal }), s.addEventListener("mouseleave", zt, { signal: p.signal }), {
142
+ return s.addEventListener("mouseenter", () => zt(s, t, i, r), { signal: o.signal }), s.addEventListener("mouseleave", () => Mt(r), { signal: p.signal }), {
145
143
  anchorElement: s,
146
144
  tooltipConfig: t,
147
145
  tooltipElement: i,
@@ -149,28 +147,28 @@ function xt(e, t, r) {
149
147
  mouseLeaveEventController: p
150
148
  };
151
149
  }
152
- function Ft(e, t) {
150
+ function Wt(e, t) {
153
151
  let r = document.createElement("p");
154
152
  return r.classList.add(...e.trim().split(" ")), r.innerHTML = t, r;
155
153
  }
156
- function Tt(e, t) {
154
+ function vt(e, t) {
157
155
  let r = document.createElement("div");
158
156
  return r.classList.add(...e.trim().split(" ")), r.style.borderWidth = `${t}px`, r;
159
157
  }
160
- function Wt(e, t, r) {
158
+ function zt(e, t, r, s) {
161
159
  if (!t.shouldShow)
162
160
  return;
163
- const s = e.getBoundingClientRect(), d = document.querySelector("body");
164
- d == null || d.appendChild(r);
165
- let i = !1, o = t.tooltipPosition;
166
- for (let p = 0; p < 4 && (o = t.tooltipPositions[t.tooltipPosition][p], o === "left" ? i = vt(s, t, r) : o === "top" ? i = yt(s, t, r) : o === "right" ? i = Mt(s, t, r) : o === "bottom" && (i = St(s, t, r)), !i); p++)
161
+ const d = e.getBoundingClientRect(), i = document.querySelector("body");
162
+ i == null || i.appendChild(r);
163
+ let o = !1, p = t.tooltipPosition;
164
+ for (let h = 0; h < 4 && (p = t.tooltipPositions[t.tooltipPosition][h], p === "left" ? o = yt(d, t, r) : p === "top" ? o = Vt(d, t, r) : p === "right" ? o = St(d, t, r) : p === "bottom" && (o = Bt(d, t, r)), !o); h++)
167
165
  ;
168
- i && (Vt(s, o, t, r), r.style.opacity = "1", r.style.zIndex = t.zIndex.toString(), ht(e, () => S()), wt(e, () => S()));
166
+ o && (at(d, p, t, r), r.style.opacity = "1", r.style.zIndex = t.zIndex.toString(), ut(e, () => S(s)), mt(e, () => S(s)));
169
167
  }
170
- function zt() {
171
- S();
168
+ function Mt(e) {
169
+ S(e);
172
170
  }
173
- function vt(e, t, r) {
171
+ function yt(e, t, r) {
174
172
  const s = Math.min(e.left - t.tooltipOffsetFromSource - t.tooltipOffsetFromViewport, t.tooltipMaxWidth), d = e.top >= t.tooltipOffsetFromViewport, i = window.innerHeight - e.bottom >= t.tooltipOffsetFromViewport;
175
173
  if (s < t.tooltipMinWidth || !d || !i)
176
174
  return !1;
@@ -178,10 +176,10 @@ function vt(e, t, r) {
178
176
  const o = r.getBoundingClientRect();
179
177
  let p = e.top + e.height / 2 - o.height / 2;
180
178
  p < t.tooltipOffsetFromViewport ? p = t.tooltipOffsetFromViewport : p + o.height > window.innerHeight - t.tooltipOffsetFromViewport && (p = window.innerHeight - t.tooltipOffsetFromViewport - o.height);
181
- const u = e.left - t.tooltipOffsetFromSource - o.width;
182
- return e.bottom < p + t.arrowMinOffsetFromTooltipCorner * 2 || e.top > p + o.height - t.arrowMinOffsetFromTooltipCorner * 2 ? !1 : (r.style.top = `${p}px`, r.style.left = `${u}px`, !0);
179
+ const h = e.left - t.tooltipOffsetFromSource - o.width;
180
+ return e.bottom < p + t.arrowMinOffsetFromTooltipCorner * 2 || e.top > p + o.height - t.arrowMinOffsetFromTooltipCorner * 2 ? !1 : (r.style.top = `${p}px`, r.style.left = `${h}px`, !0);
183
181
  }
184
- function Mt(e, t, r) {
182
+ function St(e, t, r) {
185
183
  const s = Math.min(window.innerWidth - (e.right + t.tooltipOffsetFromSource) - t.tooltipOffsetFromViewport, t.tooltipMaxWidth), d = e.top >= t.tooltipOffsetFromViewport, i = window.innerHeight - e.bottom >= t.tooltipOffsetFromViewport;
186
184
  if (s < t.tooltipMinWidth || !d || !i)
187
185
  return !1;
@@ -189,10 +187,10 @@ function Mt(e, t, r) {
189
187
  const o = r.getBoundingClientRect();
190
188
  let p = e.top + e.height / 2 - o.height / 2;
191
189
  p < t.tooltipOffsetFromViewport ? p = t.tooltipOffsetFromViewport : p + o.height > window.innerHeight - t.tooltipOffsetFromViewport && (p = window.innerHeight - t.tooltipOffsetFromViewport - o.height);
192
- const u = e.right + t.tooltipOffsetFromSource;
193
- return e.bottom < p + t.arrowMinOffsetFromTooltipCorner * 2 || e.top > p + o.height - t.arrowMinOffsetFromTooltipCorner * 2 ? !1 : (r.style.top = `${p}px`, r.style.left = `${u}px`, !0);
190
+ const h = e.right + t.tooltipOffsetFromSource;
191
+ return e.bottom < p + t.arrowMinOffsetFromTooltipCorner * 2 || e.top > p + o.height - t.arrowMinOffsetFromTooltipCorner * 2 ? !1 : (r.style.top = `${p}px`, r.style.left = `${h}px`, !0);
194
192
  }
195
- function yt(e, t, r) {
193
+ function Vt(e, t, r) {
196
194
  const s = Math.min(window.innerWidth - t.tooltipOffsetFromViewport * 2, t.tooltipMaxWidth);
197
195
  r.style.maxWidth = `${s}px`;
198
196
  const d = r.getBoundingClientRect();
@@ -202,7 +200,7 @@ function yt(e, t, r) {
202
200
  let o = e.left + e.width / 2 - d.width / 2;
203
201
  return o < t.tooltipOffsetFromViewport ? o = t.tooltipOffsetFromViewport : o + d.width > window.innerWidth - t.tooltipOffsetFromViewport && (o = window.innerWidth - t.tooltipOffsetFromViewport - d.width), e.left > o + d.width - t.arrowMinOffsetFromTooltipCorner * 2 || e.right < o + t.arrowMinOffsetFromTooltipCorner * 2 ? !1 : (r.style.top = `${i}px`, r.style.left = `${o}px`, !0);
204
202
  }
205
- function St(e, t, r) {
203
+ function Bt(e, t, r) {
206
204
  const s = Math.min(window.innerWidth - t.tooltipOffsetFromViewport * 2, t.tooltipMaxWidth);
207
205
  r.style.maxWidth = `${s}px`;
208
206
  const d = r.getBoundingClientRect();
@@ -212,27 +210,27 @@ function St(e, t, r) {
212
210
  let o = e.left + e.width / 2 - d.width / 2;
213
211
  return o < t.tooltipOffsetFromViewport ? o = t.tooltipOffsetFromViewport : o + d.width > window.innerWidth - t.tooltipOffsetFromViewport && (o = window.innerWidth - t.tooltipOffsetFromViewport - d.width), e.left > o + d.width - t.arrowMinOffsetFromTooltipCorner * 2 || e.right < o + t.arrowMinOffsetFromTooltipCorner * 2 ? !1 : (r.style.top = `${i}px`, r.style.left = `${o}px`, !0);
214
212
  }
215
- function Vt(e, t, r, s) {
213
+ function at(e, t, r, s) {
216
214
  var O;
217
215
  const d = document.createElement("div"), i = s.getBoundingClientRect(), o = Math.sin(45 * (180 / Math.PI)) * r.arrowSize, p = 1;
218
- let u = 0, w = 0, m = "";
216
+ let h = 0, u = 0, m = "";
219
217
  switch (t) {
220
218
  case "left":
221
- m = "!zt-border-y-transparent !zt-border-r-transparent", u = e.top - i.top + e.height / 2 - o - r.tooltipBorderWidth, w = i.width - r.tooltipBorderWidth - p;
219
+ m = "!zt-border-y-transparent !zt-border-r-transparent", h = e.top - i.top + e.height / 2 - o - r.tooltipBorderWidth, u = i.width - r.tooltipBorderWidth - p;
222
220
  break;
223
221
  case "top":
224
- m = "!zt-border-x-transparent !zt-border-b-transparent", u = i.height - r.tooltipBorderWidth - p, w = e.left - i.left + e.width / 2 - o - r.tooltipBorderWidth;
222
+ m = "!zt-border-x-transparent !zt-border-b-transparent", h = i.height - r.tooltipBorderWidth - p, u = e.left - i.left + e.width / 2 - o - r.tooltipBorderWidth;
225
223
  break;
226
224
  case "right":
227
- m = "!zt-border-y-transparent !zt-border-l-transparent", u = e.top - i.top + e.height / 2 - o - r.tooltipBorderWidth, w = -r.arrowSize * 2 - r.tooltipBorderWidth + p;
225
+ m = "!zt-border-y-transparent !zt-border-l-transparent", h = e.top - i.top + e.height / 2 - o - r.tooltipBorderWidth, u = -r.arrowSize * 2 - r.tooltipBorderWidth + p;
228
226
  break;
229
227
  case "bottom":
230
- m = "!zt-border-x-transparent !zt-border-t-transparent", u = -r.arrowSize * 2 - r.tooltipBorderWidth + p, w = e.left - i.left + e.width / 2 - o - r.tooltipBorderWidth;
228
+ m = "!zt-border-x-transparent !zt-border-t-transparent", h = -r.arrowSize * 2 - r.tooltipBorderWidth + p, u = e.left - i.left + e.width / 2 - o - r.tooltipBorderWidth;
231
229
  break;
232
230
  }
233
- t === "left" || t === "right" ? C(t, i, u, r) || (u = g(t, i, u, r)) : C(t, i, w, r) || (w = g(t, i, w, r));
234
- const x = tt + " " + nt + " " + m + " " + r.arrowClasses;
235
- d.classList.add(...x.trim().split(" ")), d.style.top = `${u}px`, d.style.left = `${w}px`, d.style.borderWidth = `${r.arrowSize}px`, (O = document.querySelector(`.${y}`)) == null || O.appendChild(d);
231
+ t === "left" || t === "right" ? C(t, i, h, r) || (h = g(t, i, h, r)) : C(t, i, u, r) || (u = g(t, i, u, r));
232
+ const x = tt + " " + ct + " " + m + " " + r.arrowClasses;
233
+ d.classList.add(...x.trim().split(" ")), d.style.top = `${h}px`, d.style.left = `${u}px`, d.style.borderWidth = `${r.arrowSize}px`, (O = document.querySelector(`.${y}`)) == null || O.appendChild(d);
236
234
  }
237
235
  function C(e, t, r, s) {
238
236
  switch (e) {
@@ -254,16 +252,20 @@ function g(e, t, r, s) {
254
252
  return r < s.arrowMinOffsetFromTooltipCorner - s.tooltipBorderWidth ? s.arrowMinOffsetFromTooltipCorner - s.tooltipBorderWidth : t.width - s.tooltipBorderWidth - s.arrowMinOffsetFromTooltipCorner - s.arrowSize * 2;
255
253
  }
256
254
  }
257
- function S() {
258
- var t;
259
- const e = document.querySelector(`.${y}`);
260
- e && e instanceof HTMLElement && (mt(), (t = e.querySelector(`.${tt}`)) == null || t.remove(), e.style.left = "0", e.style.top = "0", e.remove());
255
+ function S(e) {
256
+ var s, d;
257
+ const t = document.querySelector(`.${y}`), r = (s = n[e]) == null ? void 0 : s.tooltipElement;
258
+ r && t && t instanceof HTMLElement && t === r && (nt(), (d = t.querySelector(`.${tt}`)) == null || d.remove(), t.style.left = "0", t.style.top = "0", t.remove());
261
259
  }
262
260
  function B(e) {
263
- S(), e.mouseEnterEventController.abort(), e.mouseLeaveEventController.abort();
264
261
  const t = e.tooltipElement.dataset.uuid;
265
- t && delete c[t];
262
+ t && (S(t), delete n[t]), e.mouseEnterEventController.abort(), e.mouseLeaveEventController.abort();
266
263
  }
264
+ const Ht = {
265
+ install: (e, t = {}) => {
266
+ e.directive("tooltip", Ot(t));
267
+ }
268
+ };
267
269
  export {
268
- at as default
270
+ Ht as default
269
271
  };
@@ -1 +1 @@
1
- (function(F,m){typeof exports=="object"&&typeof module<"u"?module.exports=m(require("vue")):typeof define=="function"&&define.amd?define(["vue"],m):(F=typeof globalThis<"u"?globalThis:F||self,F.ZeroTooltip=m(F.Vue))})(this,function(F){"use strict";let m;const rt=new Uint8Array(16);function st(){if(!m&&(m=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!m))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(rt)}const h=[];for(let e=0;e<256;++e)h.push((e+256).toString(16).slice(1));function dt(e,t=0){return h[e[t+0]]+h[e[t+1]]+h[e[t+2]]+h[e[t+3]]+"-"+h[e[t+4]]+h[e[t+5]]+"-"+h[e[t+6]]+h[e[t+7]]+"-"+h[e[t+8]]+h[e[t+9]]+"-"+h[e[t+10]]+h[e[t+11]]+h[e[t+12]]+h[e[t+13]]+h[e[t+14]]+h[e[t+15]]}const L={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function it(e,t,r){if(L.randomUUID&&!t&&!e)return L.randomUUID();e=e||{};const s=e.random||(e.rng||st)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){r=r||0;for(let d=0;d<16;++d)t[r+d]=s[d];return t}return dt(s)}function ot(){let e=[];const t=(d,i)=>{if(r(d),e.length>0)for(const o of e)o.addEventListener("scroll",i);window.addEventListener("scroll",()=>{i(),s(i)})},r=d=>{let i=d;for(;i!==null&&i.tagName!=="HTML";){if(i.scrollHeight!==i.clientHeight){const o=window.getComputedStyle(i);(o.overflow==="auto"||o.overflow==="scroll")&&e.push(i)}i=i.parentElement}},s=d=>{if(e.length>0){for(const i of e)i.removeEventListener("scroll",d);e=[]}window.removeEventListener("scroll",d)};return{handleHideOnScroll:t}}function pt(){let e=null,t=null;return{handleHideOnResize:(d,i)=>{e=new ResizeObserver(o=>{const p=o[0].target;if(t===null)t=d.getBoundingClientRect();else{const u=p.getBoundingClientRect();(u.left!==t.left||u.top!==t.top||u.width!==t.width||u.height!==t.height)&&i()}}),e.observe(d)},resetResizeReferences:()=>{e!==null&&e.disconnect(),e=null,t=null}}}const{handleHideOnScroll:ut}=ot(),{handleHideOnResize:ht,resetResizeReferences:wt}=pt(),W="zero-tooltip__container",H="zero-tooltip__text",$="zero-tooltip__arrow",c={left:["left","right","top","bottom"],top:["top","bottom","right","left"],right:["right","left","top","bottom"],bottom:["bottom","top","right","left"]},f="top",A=10,_=20,I=100,U=250,k=0,D="zt-fixed zt-opacity-0 zt-inline-block zt-w-fit zt-py-1.5 zt-px-2.5 zt-rounded-md zt-bg-[#495057] zt-shadow-[0_2px_12px_0_rgba(0,0,0,0.1)] zt-box-border",P="zt-text-sm zt-text-white zt-whitespace-pre-wrap zt-break-words",q=5,nt="zt-absolute zt-border-solid zt-border-[#495057]",j=6,Z=1,N=!0,O={},mt=e=>({created:(t,r,s)=>{const d=it();s.el.$_tooltip={uuid:d},B(r.value,e,r.arg,t,d),typeof r.value!="string"&&F.watch(r.value,i=>{O[d]&&a(O[d]),B(i,e,r.arg,t,d)})},updated:(t,r,s)=>{if(typeof r.value=="string"){const d=s.el.$_tooltip.uuid;O[d]&&a(O[d]),B(r.value,e,r.arg,t,d)}},beforeUnmount:(t,r,s)=>{const d=s.el.$_tooltip.uuid;O[d]&&a(O[d])}});function B(e,t,r,s,d){let i=ct(e,t,r);const o=xt(s,i,d);s.matches(":hover")&&s.dispatchEvent(new Event("mouseenter")),O[d]=o}function ct(e,t,r){var J,K,Q,X,Y,E,l,b,C,g,tt,et;let s,d,i,o,p,u,w,n,T,x,z,y,M,S,V;return s=Ot(e),typeof e!="string"&&(d=r??e.defaultPosition??(t==null?void 0:t.defaultPosition)??f,i={left:((J=e.positions)==null?void 0:J.left)??((K=t==null?void 0:t.positions)==null?void 0:K.left)??c.left,top:((Q=e.positions)==null?void 0:Q.top)??((X=t==null?void 0:t.positions)==null?void 0:X.top)??c.top,right:((Y=e.positions)==null?void 0:Y.right)??((E=t==null?void 0:t.positions)==null?void 0:E.right)??c.right,bottom:((l=e.positions)==null?void 0:l.bottom)??((b=t==null?void 0:t.positions)==null?void 0:b.bottom)??c.bottom},o=e.offsetFromSource??(t==null?void 0:t.offsetFromSource)??A,p=e.offsetFromViewport??(t==null?void 0:t.offsetFromViewport)??_,u=e.minWidth??(t==null?void 0:t.minWidth)??I,w=e.maxWidth??(t==null?void 0:t.maxWidth)??U,n=e.tooltipBorderWidth??(t==null?void 0:t.tooltipBorderWidth)??k,T=W+" "+D+" "+(e.tooltipClasses??(t==null?void 0:t.tooltipClasses)??""),x=H+" "+P+" "+(e.textClasses??(t==null?void 0:t.textClasses)??""),z=e.arrowSize??(t==null?void 0:t.arrowSize)??q,y=e.arrowClasses??(t==null?void 0:t.arrowClasses)??"",M=e.arrowMinOffsetFromTooltipCorner??(t==null?void 0:t.arrowMinOffsetFromTooltipCorner)??j,S=e.zIndex??(t==null?void 0:t.zIndex)??Z,V=e.show??N),d===void 0&&(d=r??(t==null?void 0:t.defaultPosition)??f),i===void 0&&(i={left:((C=t==null?void 0:t.positions)==null?void 0:C.left)??c.left,top:((g=t==null?void 0:t.positions)==null?void 0:g.top)??c.top,right:((tt=t==null?void 0:t.positions)==null?void 0:tt.right)??c.right,bottom:((et=t==null?void 0:t.positions)==null?void 0:et.bottom)??c.bottom}),o===void 0&&(o=(t==null?void 0:t.offsetFromSource)??A),p===void 0&&(p=(t==null?void 0:t.offsetFromViewport)??_),u===void 0&&(u=(t==null?void 0:t.minWidth)??I),w===void 0&&(w=(t==null?void 0:t.maxWidth)??U),n===void 0&&(n=(t==null?void 0:t.tooltipBorderWidth)??k),T===void 0&&(T=W+" "+D+" "+((t==null?void 0:t.tooltipClasses)??"")),x===void 0&&(x=H+" "+P+" "+((t==null?void 0:t.textClasses)??"")),z===void 0&&(z=(t==null?void 0:t.arrowSize)??q),y===void 0&&(y=(t==null?void 0:t.arrowClasses)??""),M===void 0&&(M=(t==null?void 0:t.arrowMinOffsetFromTooltipCorner)??j),S===void 0&&(S=(t==null?void 0:t.zIndex)??Z),V===void 0&&(V=N),{tooltipText:s,tooltipPosition:d,tooltipPositions:i,tooltipOffsetFromSource:o,tooltipOffsetFromViewport:p,tooltipMinWidth:u,tooltipMaxWidth:w,tooltipBorderWidth:n,tooltipClasses:T,textClasses:x,arrowSize:z,arrowClasses:y,arrowMinOffsetFromTooltipCorner:M,zIndex:S,shouldShow:V}}function Ot(e){const t=typeof e=="string"?e:e.content;if(!t)throw new Error("Please enter valid tooltip value");return t}function xt(e,t,r){let s=e,d=Ft(t.textClasses,t.tooltipText),i=Tt(t.tooltipClasses,t.tooltipBorderWidth);i.append(d),i.dataset.uuid=r;const o=new AbortController,p=new AbortController;return s.addEventListener("mouseenter",()=>Wt(s,t,i),{signal:o.signal}),s.addEventListener("mouseleave",vt,{signal:p.signal}),{anchorElement:s,tooltipConfig:t,tooltipElement:i,mouseEnterEventController:o,mouseLeaveEventController:p}}function Ft(e,t){let r=document.createElement("p");return r.classList.add(...e.trim().split(" ")),r.innerHTML=t,r}function Tt(e,t){let r=document.createElement("div");return r.classList.add(...e.trim().split(" ")),r.style.borderWidth=`${t}px`,r}function Wt(e,t,r){if(!t.shouldShow)return;const s=e.getBoundingClientRect(),d=document.querySelector("body");d==null||d.appendChild(r);let i=!1,o=t.tooltipPosition;for(let p=0;p<4&&(o=t.tooltipPositions[t.tooltipPosition][p],o==="left"?i=zt(s,t,r):o==="top"?i=Mt(s,t,r):o==="right"?i=yt(s,t,r):o==="bottom"&&(i=St(s,t,r)),!i);p++);i&&(Vt(s,o,t,r),r.style.opacity="1",r.style.zIndex=t.zIndex.toString(),ut(e,()=>v()),ht(e,()=>v()))}function vt(){v()}function zt(e,t,r){const s=Math.min(e.left-t.tooltipOffsetFromSource-t.tooltipOffsetFromViewport,t.tooltipMaxWidth),d=e.top>=t.tooltipOffsetFromViewport,i=window.innerHeight-e.bottom>=t.tooltipOffsetFromViewport;if(s<t.tooltipMinWidth||!d||!i)return!1;r.style.maxWidth=`${s}px`;const o=r.getBoundingClientRect();let p=e.top+e.height/2-o.height/2;p<t.tooltipOffsetFromViewport?p=t.tooltipOffsetFromViewport:p+o.height>window.innerHeight-t.tooltipOffsetFromViewport&&(p=window.innerHeight-t.tooltipOffsetFromViewport-o.height);const u=e.left-t.tooltipOffsetFromSource-o.width;return e.bottom<p+t.arrowMinOffsetFromTooltipCorner*2||e.top>p+o.height-t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${p}px`,r.style.left=`${u}px`,!0)}function yt(e,t,r){const s=Math.min(window.innerWidth-(e.right+t.tooltipOffsetFromSource)-t.tooltipOffsetFromViewport,t.tooltipMaxWidth),d=e.top>=t.tooltipOffsetFromViewport,i=window.innerHeight-e.bottom>=t.tooltipOffsetFromViewport;if(s<t.tooltipMinWidth||!d||!i)return!1;r.style.maxWidth=`${s}px`;const o=r.getBoundingClientRect();let p=e.top+e.height/2-o.height/2;p<t.tooltipOffsetFromViewport?p=t.tooltipOffsetFromViewport:p+o.height>window.innerHeight-t.tooltipOffsetFromViewport&&(p=window.innerHeight-t.tooltipOffsetFromViewport-o.height);const u=e.right+t.tooltipOffsetFromSource;return e.bottom<p+t.arrowMinOffsetFromTooltipCorner*2||e.top>p+o.height-t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${p}px`,r.style.left=`${u}px`,!0)}function Mt(e,t,r){const s=Math.min(window.innerWidth-t.tooltipOffsetFromViewport*2,t.tooltipMaxWidth);r.style.maxWidth=`${s}px`;const d=r.getBoundingClientRect();let i=e.top-t.tooltipOffsetFromSource-d.height;if(i<t.tooltipOffsetFromViewport)return!1;let o=e.left+e.width/2-d.width/2;return o<t.tooltipOffsetFromViewport?o=t.tooltipOffsetFromViewport:o+d.width>window.innerWidth-t.tooltipOffsetFromViewport&&(o=window.innerWidth-t.tooltipOffsetFromViewport-d.width),e.left>o+d.width-t.arrowMinOffsetFromTooltipCorner*2||e.right<o+t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${i}px`,r.style.left=`${o}px`,!0)}function St(e,t,r){const s=Math.min(window.innerWidth-t.tooltipOffsetFromViewport*2,t.tooltipMaxWidth);r.style.maxWidth=`${s}px`;const d=r.getBoundingClientRect();let i=e.bottom+t.tooltipOffsetFromSource;if(i+d.height>window.innerHeight-t.tooltipOffsetFromViewport)return!1;let o=e.left+e.width/2-d.width/2;return o<t.tooltipOffsetFromViewport?o=t.tooltipOffsetFromViewport:o+d.width>window.innerWidth-t.tooltipOffsetFromViewport&&(o=window.innerWidth-t.tooltipOffsetFromViewport-d.width),e.left>o+d.width-t.arrowMinOffsetFromTooltipCorner*2||e.right<o+t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${i}px`,r.style.left=`${o}px`,!0)}function Vt(e,t,r,s){var x;const d=document.createElement("div"),i=s.getBoundingClientRect(),o=Math.sin(45*(180/Math.PI))*r.arrowSize,p=1;let u=0,w=0,n="";switch(t){case"left":n="!zt-border-y-transparent !zt-border-r-transparent",u=e.top-i.top+e.height/2-o-r.tooltipBorderWidth,w=i.width-r.tooltipBorderWidth-p;break;case"top":n="!zt-border-x-transparent !zt-border-b-transparent",u=i.height-r.tooltipBorderWidth-p,w=e.left-i.left+e.width/2-o-r.tooltipBorderWidth;break;case"right":n="!zt-border-y-transparent !zt-border-l-transparent",u=e.top-i.top+e.height/2-o-r.tooltipBorderWidth,w=-r.arrowSize*2-r.tooltipBorderWidth+p;break;case"bottom":n="!zt-border-x-transparent !zt-border-t-transparent",u=-r.arrowSize*2-r.tooltipBorderWidth+p,w=e.left-i.left+e.width/2-o-r.tooltipBorderWidth;break}t==="left"||t==="right"?R(t,i,u,r)||(u=G(t,i,u,r)):R(t,i,w,r)||(w=G(t,i,w,r));const T=$+" "+nt+" "+n+" "+r.arrowClasses;d.classList.add(...T.trim().split(" ")),d.style.top=`${u}px`,d.style.left=`${w}px`,d.style.borderWidth=`${r.arrowSize}px`,(x=document.querySelector(`.${W}`))==null||x.appendChild(d)}function R(e,t,r,s){switch(e){case"left":case"right":return r>s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth&&r<t.height+s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2;case"top":case"bottom":return r>s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth&&r<t.width+s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2}}function G(e,t,r,s){switch(e){case"left":case"right":return r<s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth?s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth:t.height-s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2;case"top":case"bottom":return r<s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth?s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth:t.width-s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2}}function v(){var t;const e=document.querySelector(`.${W}`);e&&e instanceof HTMLElement&&(wt(),(t=e.querySelector(`.${$}`))==null||t.remove(),e.style.left="0",e.style.top="0",e.remove())}function a(e){v(),e.mouseEnterEventController.abort(),e.mouseLeaveEventController.abort();const t=e.tooltipElement.dataset.uuid;t&&delete O[t]}return mt});
1
+ (function(O,T){typeof exports=="object"&&typeof module<"u"?module.exports=T(require("vue")):typeof define=="function"&&define.amd?define(["vue"],T):(O=typeof globalThis<"u"?globalThis:O||self,O.ZeroTooltip=T(O.Vue))})(this,function(O){"use strict";const T="";let W;const st=new Uint8Array(16);function dt(){if(!W&&(W=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!W))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return W(st)}const h=[];for(let e=0;e<256;++e)h.push((e+256).toString(16).slice(1));function it(e,t=0){return h[e[t+0]]+h[e[t+1]]+h[e[t+2]]+h[e[t+3]]+"-"+h[e[t+4]]+h[e[t+5]]+"-"+h[e[t+6]]+h[e[t+7]]+"-"+h[e[t+8]]+h[e[t+9]]+"-"+h[e[t+10]]+h[e[t+11]]+h[e[t+12]]+h[e[t+13]]+h[e[t+14]]+h[e[t+15]]}const H={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ot(e,t,r){if(H.randomUUID&&!t&&!e)return H.randomUUID();e=e||{};const s=e.random||(e.rng||dt)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){r=r||0;for(let d=0;d<16;++d)t[r+d]=s[d];return t}return it(s)}function pt(){let e=[];const t=(d,i)=>{if(r(d),e.length>0)for(const o of e)o.addEventListener("scroll",i);window.addEventListener("scroll",()=>{i(),s(i)})},r=d=>{let i=d;for(;i!==null&&i.tagName!=="HTML";){if(i.scrollHeight!==i.clientHeight){const o=window.getComputedStyle(i);(o.overflow==="auto"||o.overflow==="scroll")&&e.push(i)}i=i.parentElement}},s=d=>{if(e.length>0){for(const i of e)i.removeEventListener("scroll",d);e=[]}window.removeEventListener("scroll",d)};return{handleHideOnScroll:t}}function ut(){let e=null,t=null;return{handleHideOnResize:(d,i)=>{e=new ResizeObserver(o=>{const p=o[0].target;if(t===null)t=d.getBoundingClientRect();else{const u=p.getBoundingClientRect();(u.left!==t.left||u.top!==t.top||u.width!==t.width||u.height!==t.height)&&i()}}),e.observe(d)},resetResizeReferences:()=>{e!==null&&e.disconnect(),e=null,t=null}}}const{handleHideOnScroll:ht}=pt(),{handleHideOnResize:wt,resetResizeReferences:nt}=ut(),v="zero-tooltip__container",$="zero-tooltip__text",A="zero-tooltip__arrow",c={left:["left","right","top","bottom"],top:["top","bottom","right","left"],right:["right","left","top","bottom"],bottom:["bottom","top","right","left"]},f="top",_=10,I=20,U=100,k=250,D=0,P="zt-fixed zt-opacity-0 zt-inline-block zt-w-fit zt-py-1.5 zt-px-2.5 zt-rounded-md zt-bg-[#495057] zt-shadow-[0_2px_12px_0_rgba(0,0,0,0.1)] zt-box-border",q="zt-text-sm zt-text-white zt-whitespace-pre-wrap zt-break-words",j=5,mt="zt-absolute zt-border-solid zt-border-[#495057]",R=6,Z=1,N=!0,m={},ct=e=>({created:(t,r,s)=>{const d=ot();s.el.$_tooltip={uuid:d},a(r.value,e,r.arg,t,d),typeof r.value!="string"&&O.isReactive(r.value)&&O.watch(r.value,i=>{m[d]&&L(m[d]),a(i,e,r.arg,t,d)})},updated:(t,r,s)=>{const d=s.el.$_tooltip.uuid;m[d]&&L(m[d]),a(r.value,e,r.arg,t,d)},beforeUnmount:(t,r,s)=>{const d=s.el.$_tooltip.uuid;m[d]&&L(m[d])}});function a(e,t,r,s,d){let i=Ot(e,t,r);const o=Ft(s,i,d);m[d]=o,s.matches(":hover")&&s.dispatchEvent(new Event("mouseenter"))}function Ot(e,t,r){var K,Q,X,Y,E,l,b,C,g,tt,et,rt;let s,d,i,o,p,u,w,n,F,x,y,M,S,V,B;return s=xt(e),typeof e!="string"&&(d=r??e.defaultPosition??(t==null?void 0:t.defaultPosition)??f,i={left:((K=e.positions)==null?void 0:K.left)??((Q=t==null?void 0:t.positions)==null?void 0:Q.left)??c.left,top:((X=e.positions)==null?void 0:X.top)??((Y=t==null?void 0:t.positions)==null?void 0:Y.top)??c.top,right:((E=e.positions)==null?void 0:E.right)??((l=t==null?void 0:t.positions)==null?void 0:l.right)??c.right,bottom:((b=e.positions)==null?void 0:b.bottom)??((C=t==null?void 0:t.positions)==null?void 0:C.bottom)??c.bottom},o=e.offsetFromSource??(t==null?void 0:t.offsetFromSource)??_,p=e.offsetFromViewport??(t==null?void 0:t.offsetFromViewport)??I,u=e.minWidth??(t==null?void 0:t.minWidth)??U,w=e.maxWidth??(t==null?void 0:t.maxWidth)??k,n=e.tooltipBorderWidth??(t==null?void 0:t.tooltipBorderWidth)??D,F=v+" "+P+" "+(e.tooltipClasses??(t==null?void 0:t.tooltipClasses)??""),x=$+" "+q+" "+(e.textClasses??(t==null?void 0:t.textClasses)??""),y=e.arrowSize??(t==null?void 0:t.arrowSize)??j,M=e.arrowClasses??(t==null?void 0:t.arrowClasses)??"",S=e.arrowMinOffsetFromTooltipCorner??(t==null?void 0:t.arrowMinOffsetFromTooltipCorner)??R,V=e.zIndex??(t==null?void 0:t.zIndex)??Z,B=e.show??N),d===void 0&&(d=r??(t==null?void 0:t.defaultPosition)??f),i===void 0&&(i={left:((g=t==null?void 0:t.positions)==null?void 0:g.left)??c.left,top:((tt=t==null?void 0:t.positions)==null?void 0:tt.top)??c.top,right:((et=t==null?void 0:t.positions)==null?void 0:et.right)??c.right,bottom:((rt=t==null?void 0:t.positions)==null?void 0:rt.bottom)??c.bottom}),o===void 0&&(o=(t==null?void 0:t.offsetFromSource)??_),p===void 0&&(p=(t==null?void 0:t.offsetFromViewport)??I),u===void 0&&(u=(t==null?void 0:t.minWidth)??U),w===void 0&&(w=(t==null?void 0:t.maxWidth)??k),n===void 0&&(n=(t==null?void 0:t.tooltipBorderWidth)??D),F===void 0&&(F=v+" "+P+" "+((t==null?void 0:t.tooltipClasses)??"")),x===void 0&&(x=$+" "+q+" "+((t==null?void 0:t.textClasses)??"")),y===void 0&&(y=(t==null?void 0:t.arrowSize)??j),M===void 0&&(M=(t==null?void 0:t.arrowClasses)??""),S===void 0&&(S=(t==null?void 0:t.arrowMinOffsetFromTooltipCorner)??R),V===void 0&&(V=(t==null?void 0:t.zIndex)??Z),B===void 0&&(B=N),{tooltipText:s,tooltipPosition:d,tooltipPositions:i,tooltipOffsetFromSource:o,tooltipOffsetFromViewport:p,tooltipMinWidth:u,tooltipMaxWidth:w,tooltipBorderWidth:n,tooltipClasses:F,textClasses:x,arrowSize:y,arrowClasses:M,arrowMinOffsetFromTooltipCorner:S,zIndex:V,shouldShow:B}}function xt(e){const t=typeof e=="string"?e:e.content;if(!t)throw new Error("Please enter valid tooltip value");return t}function Ft(e,t,r){let s=e,d=Tt(t.textClasses,t.tooltipText),i=Wt(t.tooltipClasses,t.tooltipBorderWidth);i.append(d),i.dataset.uuid=r;const o=new AbortController,p=new AbortController;return s.addEventListener("mouseenter",()=>vt(s,t,i,r),{signal:o.signal}),s.addEventListener("mouseleave",()=>zt(r),{signal:p.signal}),{anchorElement:s,tooltipConfig:t,tooltipElement:i,mouseEnterEventController:o,mouseLeaveEventController:p}}function Tt(e,t){let r=document.createElement("p");return r.classList.add(...e.trim().split(" ")),r.innerHTML=t,r}function Wt(e,t){let r=document.createElement("div");return r.classList.add(...e.trim().split(" ")),r.style.borderWidth=`${t}px`,r}function vt(e,t,r,s){if(!t.shouldShow)return;const d=e.getBoundingClientRect(),i=document.querySelector("body");i==null||i.appendChild(r);let o=!1,p=t.tooltipPosition;for(let u=0;u<4&&(p=t.tooltipPositions[t.tooltipPosition][u],p==="left"?o=yt(d,t,r):p==="top"?o=St(d,t,r):p==="right"?o=Mt(d,t,r):p==="bottom"&&(o=Vt(d,t,r)),!o);u++);o&&(Bt(d,p,t,r),r.style.opacity="1",r.style.zIndex=t.zIndex.toString(),ht(e,()=>z(s)),wt(e,()=>z(s)))}function zt(e){z(e)}function yt(e,t,r){const s=Math.min(e.left-t.tooltipOffsetFromSource-t.tooltipOffsetFromViewport,t.tooltipMaxWidth),d=e.top>=t.tooltipOffsetFromViewport,i=window.innerHeight-e.bottom>=t.tooltipOffsetFromViewport;if(s<t.tooltipMinWidth||!d||!i)return!1;r.style.maxWidth=`${s}px`;const o=r.getBoundingClientRect();let p=e.top+e.height/2-o.height/2;p<t.tooltipOffsetFromViewport?p=t.tooltipOffsetFromViewport:p+o.height>window.innerHeight-t.tooltipOffsetFromViewport&&(p=window.innerHeight-t.tooltipOffsetFromViewport-o.height);const u=e.left-t.tooltipOffsetFromSource-o.width;return e.bottom<p+t.arrowMinOffsetFromTooltipCorner*2||e.top>p+o.height-t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${p}px`,r.style.left=`${u}px`,!0)}function Mt(e,t,r){const s=Math.min(window.innerWidth-(e.right+t.tooltipOffsetFromSource)-t.tooltipOffsetFromViewport,t.tooltipMaxWidth),d=e.top>=t.tooltipOffsetFromViewport,i=window.innerHeight-e.bottom>=t.tooltipOffsetFromViewport;if(s<t.tooltipMinWidth||!d||!i)return!1;r.style.maxWidth=`${s}px`;const o=r.getBoundingClientRect();let p=e.top+e.height/2-o.height/2;p<t.tooltipOffsetFromViewport?p=t.tooltipOffsetFromViewport:p+o.height>window.innerHeight-t.tooltipOffsetFromViewport&&(p=window.innerHeight-t.tooltipOffsetFromViewport-o.height);const u=e.right+t.tooltipOffsetFromSource;return e.bottom<p+t.arrowMinOffsetFromTooltipCorner*2||e.top>p+o.height-t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${p}px`,r.style.left=`${u}px`,!0)}function St(e,t,r){const s=Math.min(window.innerWidth-t.tooltipOffsetFromViewport*2,t.tooltipMaxWidth);r.style.maxWidth=`${s}px`;const d=r.getBoundingClientRect();let i=e.top-t.tooltipOffsetFromSource-d.height;if(i<t.tooltipOffsetFromViewport)return!1;let o=e.left+e.width/2-d.width/2;return o<t.tooltipOffsetFromViewport?o=t.tooltipOffsetFromViewport:o+d.width>window.innerWidth-t.tooltipOffsetFromViewport&&(o=window.innerWidth-t.tooltipOffsetFromViewport-d.width),e.left>o+d.width-t.arrowMinOffsetFromTooltipCorner*2||e.right<o+t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${i}px`,r.style.left=`${o}px`,!0)}function Vt(e,t,r){const s=Math.min(window.innerWidth-t.tooltipOffsetFromViewport*2,t.tooltipMaxWidth);r.style.maxWidth=`${s}px`;const d=r.getBoundingClientRect();let i=e.bottom+t.tooltipOffsetFromSource;if(i+d.height>window.innerHeight-t.tooltipOffsetFromViewport)return!1;let o=e.left+e.width/2-d.width/2;return o<t.tooltipOffsetFromViewport?o=t.tooltipOffsetFromViewport:o+d.width>window.innerWidth-t.tooltipOffsetFromViewport&&(o=window.innerWidth-t.tooltipOffsetFromViewport-d.width),e.left>o+d.width-t.arrowMinOffsetFromTooltipCorner*2||e.right<o+t.arrowMinOffsetFromTooltipCorner*2?!1:(r.style.top=`${i}px`,r.style.left=`${o}px`,!0)}function Bt(e,t,r,s){var x;const d=document.createElement("div"),i=s.getBoundingClientRect(),o=Math.sin(45*(180/Math.PI))*r.arrowSize,p=1;let u=0,w=0,n="";switch(t){case"left":n="!zt-border-y-transparent !zt-border-r-transparent",u=e.top-i.top+e.height/2-o-r.tooltipBorderWidth,w=i.width-r.tooltipBorderWidth-p;break;case"top":n="!zt-border-x-transparent !zt-border-b-transparent",u=i.height-r.tooltipBorderWidth-p,w=e.left-i.left+e.width/2-o-r.tooltipBorderWidth;break;case"right":n="!zt-border-y-transparent !zt-border-l-transparent",u=e.top-i.top+e.height/2-o-r.tooltipBorderWidth,w=-r.arrowSize*2-r.tooltipBorderWidth+p;break;case"bottom":n="!zt-border-x-transparent !zt-border-t-transparent",u=-r.arrowSize*2-r.tooltipBorderWidth+p,w=e.left-i.left+e.width/2-o-r.tooltipBorderWidth;break}t==="left"||t==="right"?G(t,i,u,r)||(u=J(t,i,u,r)):G(t,i,w,r)||(w=J(t,i,w,r));const F=A+" "+mt+" "+n+" "+r.arrowClasses;d.classList.add(...F.trim().split(" ")),d.style.top=`${u}px`,d.style.left=`${w}px`,d.style.borderWidth=`${r.arrowSize}px`,(x=document.querySelector(`.${v}`))==null||x.appendChild(d)}function G(e,t,r,s){switch(e){case"left":case"right":return r>s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth&&r<t.height+s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2;case"top":case"bottom":return r>s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth&&r<t.width+s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2}}function J(e,t,r,s){switch(e){case"left":case"right":return r<s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth?s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth:t.height-s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2;case"top":case"bottom":return r<s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth?s.arrowMinOffsetFromTooltipCorner-s.tooltipBorderWidth:t.width-s.tooltipBorderWidth-s.arrowMinOffsetFromTooltipCorner-s.arrowSize*2}}function z(e){var s,d;const t=document.querySelector(`.${v}`),r=(s=m[e])==null?void 0:s.tooltipElement;r&&t&&t instanceof HTMLElement&&t===r&&(nt(),(d=t.querySelector(`.${A}`))==null||d.remove(),t.style.left="0",t.style.top="0",t.remove())}function L(e){const t=e.tooltipElement.dataset.uuid;t&&(z(t),delete m[t]),e.mouseEnterEventController.abort(),e.mouseLeaveEventController.abort()}return{install:(e,t={})=>{e.directive("tooltip",ct(t))}}});
package/package.json CHANGED
@@ -10,21 +10,19 @@
10
10
  "require": "./dist/zero-tooltip.umd.cjs",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
- "./dist/styles.css": {
14
- "import": "./dist/styles.css",
15
- "require": "./dist/styles.css"
16
- }
13
+ "./dist/style.css": "./dist/style.css",
14
+ "./style.css": "./dist/style.css"
17
15
  },
18
16
  "./package.json": "./package.json",
19
17
  "files": [
20
18
  "dist",
21
19
  "src"
22
20
  ],
23
- "version": "1.0.7",
21
+ "version": "1.0.9",
24
22
  "type": "module",
25
23
  "scripts": {
26
24
  "dev": "vite",
27
- "build": "vue-tsc && vite build && npx tailwindcss -o ./dist/styles.css --minify",
25
+ "build": "npx tailwindcss -o ./src/style.css --minify && vite build && vue-tsc -d --emitDeclarationOnly",
28
26
  "preview": "vite preview"
29
27
  },
30
28
  "peerDependencies": {