eco-vue-js 0.3.75 → 0.3.76

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"WDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Dropdown/WDropdown.vue"],"names":[],"mappings":"AAiBA;AAMA,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8MvD,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"WDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Dropdown/WDropdown.vue"],"names":[],"mappings":"AAgBA;AAMA,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4MvD,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
@@ -1,8 +1,7 @@
1
- import { defineComponent, ref, computed, onBeforeMount, onMounted, onBeforeUnmount, watch, toRef, openBlock, createElementBlock, normalizeStyle, normalizeClass, unref, renderSlot } from 'vue';
1
+ import { defineComponent, ref, computed, onBeforeMount, onMounted, onBeforeUnmount, watch, toRef, openBlock, createElementBlock, normalizeStyle, normalizeClass, renderSlot } from 'vue';
2
2
  import DOMListenerContainer from '../../utils/DOMListenerContainer.js';
3
3
  import { isClientSide, getAllScrollParents } from '../../utils/utils.js';
4
4
  import { horizontalGetterOrderMap, searchStyleGetter } from './utils/DropdownStyle.js';
5
- import { HorizontalAlign } from '../../utils/HorizontalAlign.js';
6
5
 
7
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
7
  __name: "WDropdown",
@@ -36,16 +35,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
35
  ...verticalStyle.value
37
36
  };
38
37
  });
39
- const setParentRect = (updateSize = false) => {
38
+ const setParentRect = (updateSize = false, updateAlign = false) => {
40
39
  const newRect = props.parentElement.getBoundingClientRect();
41
40
  const isLeftChanged = newRect.left !== parentRect?.left;
42
41
  const isTopChanged = newRect.top !== parentRect?.top || newRect.bottom !== parentRect?.bottom;
43
- if (!horizontalGetter || isLeftChanged && props.updateAlign) {
42
+ if (!horizontalGetter || isLeftChanged && (props.updateAlign || updateAlign)) {
44
43
  horizontalGetter = searchStyleGetter(order.value, newRect, props.maxWidth);
45
44
  if (updateSize)
46
45
  widthStyle.value = horizontalGetter.widthStyleGetter(newRect, props.maxWidth);
47
46
  }
48
- if (!verticalGetter || isTopChanged && props.updateAlign) {
47
+ if (!verticalGetter || isTopChanged && (props.updateAlign || updateAlign)) {
49
48
  const order2 = horizontalGetter.verticalGetterOrder;
50
49
  verticalGetter = searchStyleGetter(order2, newRect, props.maxHeight);
51
50
  isTop.value = verticalGetter.isTop;
@@ -87,7 +86,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
87
86
  domListenerContainer.destroy();
88
87
  });
89
88
  watch(toRef(props, "parentElement"), () => {
90
- setParentRect();
89
+ setParentRect(false, true);
91
90
  });
92
91
  __expose({
93
92
  update: () => {
@@ -100,8 +99,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
100
99
  ref: dropdown,
101
100
  style: normalizeStyle(styles.value),
102
101
  class: normalizeClass(["fixed h-auto group/dropdown", {
103
- "dropdown-top": isTop.value,
104
- "w-0 flex justify-center": _ctx.horizontalAlign === unref(HorizontalAlign).CENTER
102
+ "dropdown-top": isTop.value
105
103
  }])
106
104
  }, [
107
105
  renderSlot(_ctx.$slots, "default", {
@@ -1 +1 @@
1
- {"version":3,"file":"WDropdownMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownMenu/WDropdownMenu.vue"],"names":[],"mappings":"AAsCA;AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6L5D,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"WDropdownMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownMenu/WDropdownMenu.vue"],"names":[],"mappings":"AAuCA;AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6L5D,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
@@ -48,10 +48,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
48
48
  "max-height": _ctx.maxHeight,
49
49
  "max-width": _ctx.maxWidth,
50
50
  "emit-update": _ctx.emitUpdate,
51
- class: normalizeClass({
51
+ class: normalizeClass([{
52
52
  "z-[2]": !_ctx.teleport,
53
53
  "z-30": _ctx.teleport
54
- }),
54
+ }, "will-change-[top,bottom]"]),
55
55
  "onUpdate:rect": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:rect"))
56
56
  }, {
57
57
  default: withCtx(() => [
@@ -4,12 +4,14 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimePr
4
4
  overflowOnly?: boolean | undefined;
5
5
  light?: boolean | undefined;
6
6
  trigger?: Element | undefined;
7
+ maxHeight?: number | undefined;
7
8
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
9
  text?: string | undefined;
9
10
  noTouch?: boolean | undefined;
10
11
  overflowOnly?: boolean | undefined;
11
12
  light?: boolean | undefined;
12
13
  trigger?: Element | undefined;
14
+ maxHeight?: number | undefined;
13
15
  }>>>, {}, {}>;
14
16
  export default _default;
15
17
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1 +1 @@
1
- {"version":3,"file":"WTooltip.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/WTooltip.vue"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;AA0HA,wBAYG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
1
+ {"version":3,"file":"WTooltip.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/WTooltip.vue"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;AAmIA,wBAaG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, useSlots, ref, computed, watch, toRef, onBeforeUnmount, unref, openBlock, createElementBlock, createCommentVNode } from 'vue';
1
+ import { defineComponent, useSlots, ref, computed, watch, toRef, onBeforeUnmount, unref, openBlock, createElementBlock, createCommentVNode, markRaw } from 'vue';
2
2
  import { getIsTouchDevice } from '../../utils/mobile.js';
3
3
  import { Tooltip } from '../../utils/Tooltip.js';
4
4
  import { getIncrement } from './models/utils.js';
@@ -10,7 +10,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10
10
  noTouch: { type: Boolean },
11
11
  overflowOnly: { type: Boolean },
12
12
  light: { type: Boolean },
13
- trigger: {}
13
+ trigger: {},
14
+ maxHeight: {}
14
15
  },
15
16
  setup(__props) {
16
17
  const props = __props;
@@ -32,7 +33,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
32
33
  if (parent.value.scrollHeight === Math.round(rect.height) && parent.value.scrollWidth === Math.round(rect.width))
33
34
  return;
34
35
  }
35
- Tooltip.add({ parent: parent.value, slot, text: props.text, light: props.light, key: getIncrement() });
36
+ Tooltip.add({
37
+ parent: parent.value,
38
+ slot: slot ? markRaw(slot) : void 0,
39
+ text: props.text,
40
+ light: props.light,
41
+ key: getIncrement(),
42
+ maxHeight: props.maxHeight
43
+ });
36
44
  };
37
45
  const close = () => {
38
46
  isOpen.value = false;
@@ -1 +1 @@
1
- {"version":3,"file":"WTooltipContainer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/WTooltipContainer.vue"],"names":[],"mappings":"AAkEA;;AAoSA,wBAKG"}
1
+ {"version":3,"file":"WTooltipContainer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/WTooltipContainer.vue"],"names":[],"mappings":"AA4CA;;AAoMA,wBAKG"}
@@ -1,20 +1,17 @@
1
- import { defineComponent, ref, onBeforeMount, onMounted, onBeforeUnmount, onUnmounted, openBlock, createBlock, Transition, withCtx, unref, createElementVNode, normalizeClass, normalizeStyle, resolveDynamicComponent, createElementBlock, toDisplayString, createCommentVNode } from 'vue';
1
+ import { defineComponent, ref, onBeforeMount, onMounted, onBeforeUnmount, onUnmounted, openBlock, createBlock, Transition, withCtx, unref, createVNode, resolveDynamicComponent, createElementBlock, toDisplayString, createCommentVNode, markRaw } from 'vue';
2
2
  import _sfc_main$1 from '../Dropdown/WDropdown.vue.js';
3
3
  import { HorizontalAlign } from '../../utils/HorizontalAlign.js';
4
4
  import { initTooltip } from '../../utils/Tooltip.js';
5
- import { isClientSide } from '../../utils/utils.js';
5
+ import _sfc_main$2 from './components/TooltipContainer.vue.js';
6
6
 
7
7
  const _hoisted_1 = {
8
8
  key: 1,
9
9
  class: "whitespace-nowrap"
10
10
  };
11
- const MARGIN = 12;
12
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
13
12
  __name: "WTooltipContainer",
14
13
  setup(__props) {
15
14
  const tooltipMeta = ref(null);
16
- const container = ref();
17
- const containerWidth = ref(0);
18
15
  let timeout;
19
16
  const setTooltipMeta = (meta) => {
20
17
  clearTimeoutOnClose();
@@ -25,8 +22,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25
22
  }, 100);
26
23
  } else if (tooltipMeta.value !== meta) {
27
24
  timeout = setTimeout(() => {
28
- tooltipMeta.value = meta;
29
- updateContainerStyles(container.value);
25
+ tooltipMeta.value = markRaw(meta);
26
+ timeout = void 0;
30
27
  }, 25);
31
28
  }
32
29
  };
@@ -40,45 +37,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
37
  clearTimeout(timeout);
41
38
  timeout = void 0;
42
39
  };
43
- const updateContainerStyles = (value) => {
44
- if (!value) {
45
- containerWidth.value = 0;
46
- } else {
47
- containerWidth.value = value.getBoundingClientRect().width;
48
- }
49
- };
50
- const getMarginStyles = (left, right) => {
51
- if (!isClientSide || !containerWidth.value)
52
- return;
53
- const l = left ? Number.parseFloat(left.substring(0, left.indexOf("px"))) : void 0;
54
- if (l !== void 0) {
55
- const containerLeft = l - containerWidth.value / 2 - MARGIN;
56
- if (containerLeft < 0)
57
- return { marginLeft: 0 - containerLeft + "px", marginRight: containerLeft + "px" };
58
- const containerRight = window.innerWidth - l - containerWidth.value / 2 - MARGIN;
59
- if (containerRight < 0)
60
- return { marginRight: 0 - containerRight + "px", marginLeft: containerRight + "px" };
61
- return {};
62
- }
63
- const r = right ? Number.parseFloat(right.substring(0, right.indexOf("px"))) : void 0;
64
- if (r !== void 0) {
65
- const containerLeft = window.innerWidth - r - containerWidth.value / 2 - MARGIN;
66
- if (containerLeft < 0)
67
- return { marginLeft: 0 - containerLeft + "px", marginRight: containerLeft + "px" };
68
- const containerRight = r - containerWidth.value / 2 - MARGIN;
69
- if (containerRight < 0)
70
- return { marginRight: 0 - containerRight + "px", marginLeft: containerRight + "px" };
71
- return {};
72
- }
73
- };
74
- const marginStyleCache = ref();
75
- const getMarginStylesCached = (left, right) => {
76
- const styles = getMarginStyles(left, right);
77
- if (!styles)
78
- return marginStyleCache.value;
79
- marginStyleCache.value = styles;
80
- return styles;
81
- };
82
40
  onBeforeMount(() => {
83
41
  initTooltip(setTooltipMeta);
84
42
  });
@@ -103,45 +61,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
103
61
  key: 0,
104
62
  "parent-element": tooltipMeta.value.parent,
105
63
  "horizontal-align": unref(HorizontalAlign).CENTER,
106
- "max-height": 200,
64
+ "max-height": tooltipMeta.value?.maxHeight ?? 120,
107
65
  "max-width": 240,
108
66
  "emit-update": "",
109
- class: "z-[10000] [--arrow-size:8px] transition-[top,bottom,left,right]",
67
+ class: "z-[10000] sm:transition-[top,bottom,left,right] will-change-[top,bottom,left,right] isolate",
110
68
  "onUpdate:rect": close
111
69
  }, {
112
70
  default: withCtx(({ left, right, istop }) => [
113
- createElementVNode("div", {
114
- ref_key: "container",
115
- ref: container,
116
- class: "flex justify-center items-center flex-col drop-shadow-md dark:drop-shadow-none pointer-events-none"
117
- }, [
118
- createElementVNode("div", {
119
- class: normalizeClass(["w-[calc(var(--arrow-size)/2)] z-10 pointer-events-auto border-[transparent] border-solid [border-width:var(--arrow-size)]", {
120
- "text-black-default dark:text-gray-800": !tooltipMeta.value.light,
121
- "text-default dark:text-gray-800": tooltipMeta.value.light,
122
- "border-t-current order-2": istop,
123
- "border-b-current": !istop
124
- }]),
125
- onMouseover: _cache[0] || (_cache[0] = ($event) => setTooltipMeta(tooltipMeta.value)),
126
- onMouseleave: _cache[1] || (_cache[1] = ($event) => setTooltipMeta(null))
127
- }, null, 34),
128
- createElementVNode("div", {
129
- class: normalizeClass(["py-3 px-4 rounded-xl text-xs font-medium text-center transition-[margin] pointer-events-auto", {
130
- "bg-black-default dark:bg-gray-800 text-default": !tooltipMeta.value.light,
131
- "bg-default dark:bg-gray-800 text-accent": tooltipMeta.value.light
132
- }]),
133
- style: normalizeStyle(getMarginStylesCached(left, right)),
134
- onMouseover: _cache[2] || (_cache[2] = ($event) => setTooltipMeta(tooltipMeta.value)),
135
- onMouseleave: _cache[3] || (_cache[3] = ($event) => setTooltipMeta(null))
136
- }, [
71
+ createVNode(_sfc_main$2, {
72
+ "tooltip-meta": tooltipMeta.value,
73
+ left,
74
+ right,
75
+ "is-top": istop,
76
+ onOver: _cache[0] || (_cache[0] = ($event) => setTooltipMeta(tooltipMeta.value)),
77
+ onLeave: _cache[1] || (_cache[1] = ($event) => setTooltipMeta(null))
78
+ }, {
79
+ default: withCtx(() => [
137
80
  tooltipMeta.value.slot ? (openBlock(), createBlock(resolveDynamicComponent(tooltipMeta.value.slot), {
138
81
  key: tooltipMeta.value.key
139
82
  })) : tooltipMeta.value.text ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(tooltipMeta.value.text), 1)) : createCommentVNode("", true)
140
- ], 38)
141
- ], 512)
83
+ ]),
84
+ _: 2
85
+ }, 1032, ["tooltip-meta", "left", "right", "is-top"])
142
86
  ]),
143
87
  _: 1
144
- }, 8, ["parent-element", "horizontal-align"])) : createCommentVNode("", true)
88
+ }, 8, ["parent-element", "horizontal-align", "max-height"])) : createCommentVNode("", true)
145
89
  ]),
146
90
  _: 1
147
91
  });
@@ -0,0 +1,36 @@
1
+ import type { TooltipMeta } from '../../../utils/Tooltip';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
+ tooltipMeta: TooltipMeta;
4
+ isTop?: boolean | undefined;
5
+ left?: string | undefined;
6
+ right?: string | undefined;
7
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ over: () => void;
9
+ leave: () => void;
10
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
+ tooltipMeta: TooltipMeta;
12
+ isTop?: boolean | undefined;
13
+ left?: string | undefined;
14
+ right?: string | undefined;
15
+ }>>> & {
16
+ onLeave?: (() => any) | undefined;
17
+ onOver?: (() => any) | undefined;
18
+ }, {}, {}>, {
19
+ default?(_: {}): any;
20
+ }>;
21
+ export default _default;
22
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
+ type __VLS_TypePropsToRuntimeProps<T> = {
24
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
25
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
+ } : {
27
+ type: import('vue').PropType<T[K]>;
28
+ required: true;
29
+ };
30
+ };
31
+ type __VLS_WithTemplateSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
36
+ //# sourceMappingURL=TooltipContainer.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipContainer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Tooltip/components/TooltipContainer.vue"],"names":[],"mappings":"AA+BA;AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;AA2MhD,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { defineComponent, ref, watch, toRef, onMounted, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, renderSlot, nextTick } from 'vue';
2
+ import { isClientSide } from '../../../utils/utils.js';
3
+
4
+ const _hoisted_1 = { class: "flex justify-center items-center flex-col drop-shadow-md dark:drop-shadow-none pointer-events-none" };
5
+ const MARGIN = 12;
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ __name: "TooltipContainer",
8
+ props: {
9
+ tooltipMeta: {},
10
+ isTop: { type: Boolean },
11
+ left: {},
12
+ right: {}
13
+ },
14
+ emits: ["over", "leave"],
15
+ setup(__props) {
16
+ const props = __props;
17
+ const container = ref();
18
+ const transformX = ref(0);
19
+ const getTransformX = () => {
20
+ if (!isClientSide || !container.value)
21
+ return 0;
22
+ const l = props.left ? Number.parseFloat(props.left.slice(0, -2)) : null;
23
+ if (typeof l === "number") {
24
+ const containerLeft = l - container.value.offsetWidth / 2 - MARGIN;
25
+ if (containerLeft < 0)
26
+ return containerLeft * -1;
27
+ const containerRight = window.innerWidth - l - container.value.offsetWidth / 2 - MARGIN;
28
+ if (containerRight < 0)
29
+ return containerRight;
30
+ return 0;
31
+ }
32
+ const r = props.right ? Number.parseFloat(props.right.slice(0, -2)) : null;
33
+ if (typeof r === "number") {
34
+ const containerLeft = window.innerWidth - r - container.value.offsetWidth / 2 - MARGIN;
35
+ if (containerLeft < 0)
36
+ return containerLeft * -1;
37
+ const containerRight = r - container.value.offsetWidth / 2 - MARGIN;
38
+ if (containerRight < 0)
39
+ return containerRight;
40
+ return 0;
41
+ }
42
+ return 0;
43
+ };
44
+ const setTransformX = async () => {
45
+ await nextTick();
46
+ transformX.value = getTransformX();
47
+ };
48
+ watch(toRef(props, "tooltipMeta"), () => {
49
+ setTransformX();
50
+ });
51
+ onMounted(() => {
52
+ setTransformX();
53
+ });
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createElementBlock("div", _hoisted_1, [
56
+ createElementVNode("div", {
57
+ class: normalizeClass(["w-1 z-10 pointer-events-auto border-[transparent] border-solid border-[0.5rem]", {
58
+ "text-black-default dark:text-gray-800": !_ctx.tooltipMeta.light,
59
+ "text-default dark:text-gray-800": _ctx.tooltipMeta.light,
60
+ "border-t-current order-2": _ctx.isTop,
61
+ "border-b-current": !_ctx.isTop
62
+ }]),
63
+ onMouseover: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("over")),
64
+ onMouseleave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("leave"))
65
+ }, null, 34),
66
+ createElementVNode("div", {
67
+ ref_key: "container",
68
+ ref: container,
69
+ class: normalizeClass(["py-3 px-4 rounded-xl text-xs font-medium text-center pointer-events-auto translate-x-[var(--t-translate-x)] max-w-[calc(100vw-1.5rem)]", {
70
+ "bg-black-default dark:bg-gray-800 text-default": !_ctx.tooltipMeta.light,
71
+ "bg-default dark:bg-gray-800 text-accent": _ctx.tooltipMeta.light
72
+ }]),
73
+ style: normalizeStyle({
74
+ "--t-translate-x": transformX.value + "px"
75
+ }),
76
+ onMouseover: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("over")),
77
+ onMouseleave: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("leave"))
78
+ }, [
79
+ renderSlot(_ctx.$slots, "default")
80
+ ], 38)
81
+ ]);
82
+ };
83
+ }
84
+ });
85
+
86
+ export { _sfc_main as default };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from './TooltipContainer.vue.js';
2
+
3
+
4
+
5
+ export { _sfc_main as default };
@@ -5,6 +5,7 @@ export type TooltipMeta = {
5
5
  text?: string;
6
6
  light?: boolean;
7
7
  key: number;
8
+ maxHeight?: number;
8
9
  };
9
10
  export type SetTooltipMeta = (meta: TooltipMeta | null) => void;
10
11
  export declare const initTooltip: (value: SetTooltipMeta | undefined) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/utils/Tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,KAAK,CAAA;AAE9B,MAAM,MAAM,WAAW,GAAG;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,CAAA;AAE1G,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;AAI/D,eAAO,MAAM,WAAW,UAAW,cAAc,GAAG,SAAS,SAE5D,CAAA;AAED,eAAO,MAAM,OAAO;cACR,WAAW,GAAG,IAAI;aAGnB,IAAI;CAGd,CAAA"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/utils/Tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,KAAK,CAAA;AAE9B,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,WAAW,CAAA;IACnB,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;AAI/D,eAAO,MAAM,WAAW,UAAW,cAAc,GAAG,SAAS,SAE5D,CAAA;AAED,eAAO,MAAM,OAAO;cACR,WAAW,GAAG,IAAI;aAGnB,IAAI;CAGd,CAAA"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.3.75",
7
+ "version": "0.3.76",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "run-p type-check build-only",