woby-tooltip 1.0.4 → 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/dist/index.es.js CHANGED
@@ -1,406 +1,231 @@
1
- import { jsxs, jsx } from "woby/jsx-runtime";
2
- import { $$, $, store, useMemo, cloneElement, useEffect, isObservable } from "woby";
3
- const isSide = (side, str) => $$(side) === str;
4
- const isAlign = (align, str) => $$(align) === str;
5
- const isAlignA = (position, str) => $$(position) === str;
6
- const TextBox = (props) => {
7
- const hoverIndex = $(null);
8
- const firstH = $(null);
9
- const lastH = $(null);
10
- const totH = $(null);
11
- const spanHeightsRef = store({});
12
- store.on(spanHeightsRef, () => {
13
- const heights = Object.keys(spanHeightsRef).map((key) => spanHeightsRef[key].clientHeight);
14
- const firsth = heights[0];
15
- const lasth = heights[heights.length - 1];
16
- const toth = heights.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
17
- totH(toth);
18
- firstH(firsth);
19
- lastH(lasth);
1
+ import { jsx, jsxs } from "woby/jsx-runtime";
2
+ import { useEffect, $$, createContext, $, useMemo } from "woby";
3
+ let nanoid = (size = 21) => crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
4
+ byte &= 63;
5
+ if (byte < 36) {
6
+ id += byte.toString(36);
7
+ } else if (byte < 62) {
8
+ id += (byte - 26).toString(36).toUpperCase();
9
+ } else if (byte > 62) {
10
+ id += "-";
11
+ } else {
12
+ id += "_";
13
+ }
14
+ return id;
15
+ }, "");
16
+ const isTemp = (s) => !!s.raw;
17
+ const extract = (C, props, classNames) => {
18
+ const { className, ...p } = props;
19
+ const cls = p.class;
20
+ delete p.class;
21
+ return /* @__PURE__ */ jsx(C, { class: [classNames, cls, className], ...p });
22
+ };
23
+ const append = (child, parent) => {
24
+ return useEffect(() => {
25
+ const [c, p] = [$$($$(child)), $$($$(parent))];
26
+ p.appendChild(c);
27
+ const um = () => p.removeChild(c);
28
+ return um;
20
29
  });
21
- const unsetHover = () => {
22
- hoverIndex(null);
23
- props.hoverArrow(false);
24
- };
25
- const onSpanHover = (index, lastIndex2, numChildren) => {
26
- hoverIndex(index);
27
- const { static: rctStatic, arw: arrow2, pos: position2, hoverArrow } = props;
28
- if (!rctStatic && (index === 0 && (isSide(position2.side, "bottom") || isAlignA(arrow2, "v-start")) || index === lastIndex2 && (isSide(position2.side, "top") || isAlignA(arrow2, "v-end")) || numChildren === 1)) {
29
- return hoverArrow(true);
30
+ };
31
+ function Styled(comp) {
32
+ function styled2(strings, ...values) {
33
+ if (isTemp(strings)) {
34
+ const C = comp;
35
+ const N = "_" + nanoid(10);
36
+ useEffect(() => {
37
+ const r = `.${N} {
38
+ ${strings.map((str, i) => i < values.length ? str + $$(values[i]) : str).join("")}
39
+ }`;
40
+ return append(/* @__PURE__ */ jsx("style", { id: N, children: r }), document.head);
41
+ });
42
+ return C ? (props) => extract(C, props, N) : N;
30
43
  }
31
- return hoverArrow(false);
32
- };
33
- const {
34
- arw: arrow,
35
- pos: position,
36
- lines: lineSeparated,
37
- static: tpStatic,
38
- textboxWidth: width,
39
- shadowColor: shCol,
40
- shadowShape: shShape,
41
- move,
42
- backgroundColor,
43
- padding,
44
- borderRadius,
45
- hoverBackground,
46
- hoverColor,
47
- color,
48
- alert,
49
- flat,
50
- children,
51
- class: cls,
52
- className
53
- } = props;
54
- const numberChildren = Array.isArray(children) ? children.length : 1;
55
- const lastIndex = numberChildren - 1;
56
- const adjChildren = [children].flat().map((child, index) => {
57
- const hover = useMemo(() => !tpStatic && $$(hoverIndex) === index);
58
- const nhover = useMemo(() => !$$(hover));
59
- const childProps = {
60
- // ...child.props,
61
- ref: (span) => spanHeightsRef[`span${index + 1}`] = span,
62
- class: [padding, {
63
- "whitespace-nowrap": () => $$(width) === "auto",
64
- [$$(hoverColor)]: hover,
65
- [$$(hoverBackground)]: hover,
66
- [$$(color)]: nhover,
67
- [$$(backgroundColor)]: nhover,
68
- [$$(lineSeparated)]: () => $$(lineSeparated) && lastIndex !== index
69
- }],
70
- // style,
71
- onMouseOver: () => onSpanHover(index, lastIndex, numberChildren)
44
+ return Styled(strings).styled;
45
+ }
46
+ return { comp, styled: styled2 };
47
+ }
48
+ const styled = Styled().styled;
49
+ createContext();
50
+ function useComputedStyle(target, patterns = []) {
51
+ const styles = $({});
52
+ useEffect(() => {
53
+ if (!$$(target)) return () => {
54
+ };
55
+ const getMatchingStyles = () => {
56
+ const computedStyle = window.getComputedStyle($$(target));
57
+ const matchedStyles = {};
58
+ for (const property of computedStyle) {
59
+ if (patterns.some(
60
+ (pattern) => typeof pattern === "string" ? property === pattern : pattern.test(property)
61
+ )) {
62
+ matchedStyles[property] = computedStyle.getPropertyValue(property);
63
+ }
64
+ }
65
+ return matchedStyles;
72
66
  };
73
- return cloneElement(child, childProps);
67
+ styles(getMatchingStyles());
68
+ const observer = new MutationObserver(() => {
69
+ const updatedStyles = getMatchingStyles();
70
+ styles((prevStyles) => {
71
+ const hasChanges = Object.keys(updatedStyles).some(
72
+ (key) => updatedStyles[key] !== prevStyles[key]
73
+ );
74
+ return hasChanges ? updatedStyles : prevStyles;
75
+ });
76
+ });
77
+ observer.observe($$(target), {
78
+ attributes: true,
79
+ attributeFilter: ["style", "class"],
80
+ subtree: false
81
+ });
82
+ return () => observer.disconnect();
74
83
  });
75
- const calcHPos = (align, left2, center, right2) => {
76
- return isAlign(align, "center") ? center : isAlign(align, "left") ? left2 : right2;
77
- };
78
- const calcVPos = (perc, elHeight, divider, adjMove, totHeight) => {
79
- return `calc(${perc}% - ${totHeight || 0}px - ${elHeight}px/${divider} + ${adjMove || 0}px)`;
80
- };
81
- const calcTopPos = (align, elHeight, totHeight) => {
82
- if ($$(align) === "center") {
83
- return calcVPos(50, elHeight, 2, null, totHeight);
84
- }
85
- if ($$(align) === "bottom") {
86
- return calcVPos(100, elHeight, 2, -12, totHeight);
87
- }
88
- return calcVPos(0, elHeight, 2, 12, totHeight);
84
+ return styles;
85
+ }
86
+ const tooltipDef = `text-left border-b-[#666] border-b border-dotted
87
+ [&:hover_.tpcontents]:visible [&:hover_.tpcontents]:opacity-100
88
+ `;
89
+ const tooltip = `inline-block relative
90
+ [&:hover_.tpcontents]:visible [&:hover_.tpcontents]:opacity-100
91
+ `;
92
+ const topDef = `bg-[#eeeeee] min-w-[200px] box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
93
+ const top = `absolute z-[99999999] left-2/4 -top-5 `;
94
+ const top_i = `absolute overflow-hidden top-full after:content-[''] after:absolute after:-translate-x-2/4 after:-translate-y-2/4 after:rotate-45 after:left-2/4 `;
95
+ const rightDef = `bg-[#eeeeee] min-w-[200px] box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
96
+ const right = `absolute z-[99999999] ml-5 left-full top-2/4 `;
97
+ const right_i = `absolute overflow-hidden right-full after:content-[''] after:absolute after:translate-x-2/4 after:-translate-y-2/4 after:-rotate-45 after:left-0 after:top-2/4 `;
98
+ const bottomDef = `bg-[#eeeeee] min-w-[200px] box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
99
+ const bottom = `absolute z-[99999999] left-2/4 top-10 `;
100
+ const bottom_i = `absolute overflow-hidden bottom-full after:content-[''] after:absolute after:-translate-x-2/4 after:translate-y-2/4 after:rotate-45 after:left-2/4 `;
101
+ const leftDef = `bg-[#eeeeee] min-w-[200px] box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
102
+ const left = `absolute z-[99999999] mr-5 right-full top-2/4 `;
103
+ const left_i = `absolute overflow-hidden left-full after:content-[''] after:absolute after:-translate-x-2/4 after:-translate-y-2/4 after:-rotate-45 after:left-0 after:top-2/4 `;
104
+ const Tooltip = ({ children, class: cls = tooltipDef, className, ...props }) => {
105
+ return /* @__PURE__ */ jsx("div", { class: [tooltip, cls, className], children });
106
+ };
107
+ function cssMultiply(value, multiplier) {
108
+ const match = ($$(value) + "").match(/^(-?\d*\.?\d+)([a-z%]*)$/);
109
+ if (!match)
110
+ throw new Error(`Invalid CSS unit: ${$$(value)}`);
111
+ const [, numericValue, unit] = match;
112
+ const result = +numericValue * multiplier;
113
+ return `${result}${unit}`;
114
+ }
115
+ const x2 = (value) => cssMultiply(value, 2);
116
+ const translate = (x, y) => `translate(${$$(x)}, ${$$(y)})`;
117
+ const TooltipContent = ({ children, style, class: cls = $(), className, static: st, position = "top", arrowLocation = "50%", arrowSize = "12px", ...props }) => {
118
+ const setDef = () => {
119
+ if (!$$(cls))
120
+ switch ($$(position)) {
121
+ case "top":
122
+ cls(topDef);
123
+ case "left":
124
+ cls(leftDef);
125
+ case "right":
126
+ cls(rightDef);
127
+ case "bottom":
128
+ cls(bottomDef);
129
+ }
89
130
  };
90
- let left = $("");
91
- let right = $("");
92
- let top = $("8px");
93
- const hLeftPos = useMemo(() => calcHPos(position.align, "100% - 50px", "50% - 40px", "0% - 30px"));
94
- const hRightPos = useMemo(() => calcHPos(position.align, "0% - 30px", "50% - 40px", "100% - 50px"));
95
- useEffect(() => {
96
- const { align } = position;
97
- switch ($$(arrow)) {
98
- case "h-start":
99
- left(`calc(${$$(hRightPos)})`);
100
- break;
101
- case "h-end":
102
- right(`calc(${$$(hLeftPos)})`);
103
- break;
104
- case "v-start":
105
- top(calcTopPos(align, $$(firstH), null));
106
- break;
107
- case "v-end":
108
- top(calcTopPos(align, $$(lineSeparated) ? -$$(lastH) + 1 : -$$(lastH), $$(totH)));
109
- break;
110
- case "v-center":
111
- top(`calc(0% - ${$$(totH)}px/2 + 11px)`);
112
- if (isAlign(align, "center")) {
113
- top(`calc(50% - ${$$(totH)}px/2)`);
114
- }
115
- if (isAlign(align, "bottom")) {
116
- top(`calc(100% - ${$$(totH)}px/2 - 11px)`);
117
- }
118
- break;
131
+ useEffect(setDef);
132
+ setDef();
133
+ const pos = useMemo(() => {
134
+ switch ($$(position)) {
135
+ case "top":
136
+ return top;
137
+ case "right":
138
+ return right;
139
+ case "bottom":
140
+ return bottom;
141
+ case "left":
142
+ return left;
119
143
  }
120
- switch ($$(position.side)) {
144
+ });
145
+ const transform = useMemo(() => {
146
+ switch ($$(position)) {
121
147
  case "top":
122
- top(calcVPos(0, $$(totH), 1, 13));
123
- break;
148
+ return translate("-" + $$(arrowLocation), "-100%");
124
149
  case "left":
125
- right("8px");
126
- break;
127
150
  case "right":
128
- left("8px");
129
- break;
151
+ return translate("0", "-" + $$(arrowLocation));
152
+ case "bottom":
153
+ return translate("-" + $$(arrowLocation), "0");
130
154
  }
131
155
  });
132
- const textBoxWidthValue = useMemo(() => {
133
- let textBoxWidthValue2 = $$(width);
134
- if (textBoxWidthValue2 !== "auto") {
135
- textBoxWidthValue2 = Number($$(width).slice(0, -2));
136
- if (move.left > 0)
137
- textBoxWidthValue2 += move.left;
138
- if (move.right > 0)
139
- textBoxWidthValue2 += move.right;
156
+ const ali = useMemo(() => {
157
+ switch ($$(position)) {
158
+ case "bottom":
159
+ case "top":
160
+ return { left: arrowLocation };
161
+ case "left":
162
+ case "right":
163
+ return { top: arrowLocation };
140
164
  }
141
- return textBoxWidthValue2;
142
165
  });
143
- const boxStyle = {
144
- left,
145
- right,
146
- top,
147
- width: textBoxWidthValue,
148
- borderRadius
149
- };
150
- const shColAdj = useMemo(() => $$(shCol).substr(0, $$(shCol).lastIndexOf(",")).replace(/[)]/g, ","));
151
- const shadow = useMemo(() => `${$$(shShape)} ${$$(shCol)}, 0 0 3px ${$$(shColAdj)}, 0.1), 0 0 0 1px ${$$(shColAdj)}, 0.15)`);
152
- const boxShadow = useMemo(() => $$(flat) ? null : $$(shadow));
153
- const alertStyle = useMemo(() => $$(alert) ? "rpt-alert" : "");
154
- const rgb = useMemo(() => $$(alert) || "rgb(248, 109, 109)");
155
- const alertShadow = useMemo(() => $$(alert) ? `0 0 0 ${$$(rgb).slice(0, $$(rgb).length - 1)}, 0.4)` : null);
156
- const noNeg = (number) => number > 0 ? number : 0;
157
- return /* @__PURE__ */ jsxs(
158
- "div",
159
- {
160
- class: [`absolute animation-none`, alertStyle, cls ?? className],
161
- style: {
162
- ...boxStyle,
163
- boxShadow: alertShadow,
164
- padding: `${move.down}px ${move.left}px ${move.up}px ${move.right}px`
165
- },
166
- children: [
167
- /* @__PURE__ */ jsx(
168
- "div",
169
- {
170
- class: [`absolute animation-none w-full h-full z-0`, borderRadius],
171
- style: {
172
- boxShadow,
173
- height: () => `calc(100% - ${noNeg(move.down) + noNeg(move.up)}px)`,
174
- width: () => `calc(100% - ${noNeg(move.left) + noNeg(move.right)}px)`
175
- }
176
- }
177
- ),
178
- /* @__PURE__ */ jsx(
179
- "div",
180
- {
181
- class: [`relative z-[2] w-full`, backgroundColor, borderRadius],
182
- onMouseLeave: unsetHover,
183
- children: /* @__PURE__ */ jsx(
184
- "div",
185
- {
186
- class: [!tpStatic ? "[&_span]:cursor-pointer w-full" : null, borderRadius, "overflow-hidden"],
187
- children: adjChildren
188
- }
189
- )
190
- }
191
- )
192
- ]
166
+ const ii = useMemo(() => {
167
+ switch ($$(position)) {
168
+ case "top":
169
+ return top_i + styled`
170
+ margin-left:-${$$(arrowSize)};
171
+ width:${x2(arrowSize)};
172
+ height:${$$(arrowSize)};
173
+
174
+ &::after{
175
+ width:${$$(arrowSize)};
176
+ height:${$$(arrowSize)};
177
+ }
178
+ `;
179
+ case "right":
180
+ return right_i + styled`
181
+ margin-top:-${$$(arrowSize)};
182
+ width:${$$(arrowSize)};
183
+ height:${x2(arrowSize)};
184
+
185
+ &::after{
186
+ width:${$$(arrowSize)};
187
+ height:${$$(arrowSize)};
188
+ }
189
+ `;
190
+ case "bottom":
191
+ return bottom_i + styled`
192
+ margin-left:-${$$(arrowSize)};
193
+ width:${x2(arrowSize)};
194
+ height:${$$(arrowSize)};
195
+
196
+ &::after{
197
+ width:${$$(arrowSize)};
198
+ height:${$$(arrowSize)};
199
+ }
200
+ `;
201
+ case "left":
202
+ return left_i + styled`
203
+ margin-top:-${$$(arrowSize)};
204
+ width:${$$(arrowSize)};
205
+ height:${x2(arrowSize)};
206
+
207
+ &::after{
208
+ width:${$$(arrowSize)};
209
+ height:${$$(arrowSize)};
210
+ }
211
+ `;
193
212
  }
194
- );
195
- };
196
- const Arrow = ({ isHovered, hovBkg, bkgCol, flat }) => {
197
- const backgroundColor = useMemo(() => $$(isHovered) ? $$(hovBkg) : $$(bkgCol));
198
- const boxShadow = useMemo(() => $$(flat) ? null : "[box-shadow:rgba(0,0,0,0.18)0px_0px_0px_1px]");
199
- return /* @__PURE__ */ jsx("div", { class: [`rotate-45 w-[14px] h-[14px] m-[3px] z-[1]`, backgroundColor, boxShadow] });
200
- };
201
- const output = "";
202
- const Tooltip = (properties = {}) => {
203
- const props = {
204
- /** tailwind */
205
- hoverBackground: "bg-[#ececec]",
206
- /** tailwind */
207
- hoverColor: "text-[black]",
208
- /** tailwind */
209
- backgroundColor: "bg-[white]",
210
- /** not tailwind */
211
- textboxWidth: "150px",
212
- /** tailwind */
213
- fontSize: "[font-size:inherit]",
214
- /** tailwind */
215
- color: "text-inherit",
216
- borderRadius: "rounded-[5px]",
217
- shadowColor: "rgba(0,0,0,0.251)",
218
- shadowShape: "0 8px 15px",
219
- moveDown: "0px",
220
- moveRight: "0px",
221
- moveLeft: "0px",
222
- moveUp: "0px",
223
- position: "bottom center",
224
- arrowAlign: $("start"),
225
- textAlign: "left",
226
- fontFamily: "inherit",
227
- fontWeight: "bold",
228
- zIndex: "100",
229
- animation: "",
230
- show: false,
231
- ...properties
232
- };
233
- const {
234
- position: pos,
235
- lineSeparated: lines,
236
- arrowAlign: arwAlign,
237
- hoverBackground,
238
- backgroundColor,
239
- moveDown,
240
- moveRight,
241
- moveLeft,
242
- moveUp,
243
- textAlign,
244
- fontFamily,
245
- fontWeight,
246
- fontSize,
247
- color,
248
- zIndex,
249
- animation,
250
- flat,
251
- parentRef: pf,
252
- parent: Parent,
253
- // shadowColor, shadowShape, textboxWidth, padding, borderRadius, hoverColor,
254
- containerClass
255
- } = props;
256
- const show = (
257
- /* $$(parent) ? props.show : */
258
- isObservable(props.show) ? props.show : $(props.show)
259
- );
260
- const parentRef = isObservable(pf) ? pf : $(pf);
261
- useEffect(() => {
262
- const p = $$(parentRef);
263
- if (!p)
264
- return;
265
- const on = () => show(true);
266
- const off = () => show(false);
267
- p.addEventListener("mouseenter", on);
268
- p.addEventListener("mouseleave", off);
269
- return () => {
270
- p.removeEventListener("mouseenter", on);
271
- p.removeEventListener("mouseleave", off);
272
- };
273
- });
274
- const hoverArrow = $(false);
275
- const mount = $(true);
276
- useEffect(() => {
277
- if ($$(show))
278
- mount(true);
279
- if (!$$(animation))
280
- mount(false);
281
213
  });
282
- const lineSeparated = typeof $$(lines) === "boolean" ? $("border-b border-b-[#ececec]") : isObservable(lines) ? lines : $(lines);
283
- const position = {
284
- side: $$(pos).split(" ")[0],
285
- align: $$(pos).split(" ")[1]
286
- };
287
- const arrow = $($$(arwAlign));
288
- const { side, align } = position;
289
- const classes = ["absolute flex"];
290
- let tooltipStyle = {};
291
- let bottom;
292
- switch (side) {
293
- case "bottom":
294
- classes.push("top-full left-0 w-full justify-center");
295
- break;
296
- case "top":
297
- classes.push("left-0 w-full justify-center");
298
- bottom = "100%";
299
- break;
300
- case "right":
301
- classes.push("top-0 left-full h-full justify-start");
302
- break;
303
- default:
304
- classes.push("top-0 right-full h-full justify-end");
305
- break;
306
- }
307
- const onAxis = {
308
- y: isSide(position.side, "top") || isSide(position.side, "bottom"),
309
- x: isSide(position.side, "left") || isSide(position.side, "right")
310
- };
311
- arrow(onAxis.y ? `h-${$$(arrow)}` : `v-${$$(arrow)}`);
312
- const num = (str) => Number(str.slice(0, -2));
313
- const move = {
314
- down: num(moveDown),
315
- up: num(moveUp),
316
- left: num(moveLeft),
317
- right: num(moveRight)
318
- };
319
- const oneMovePropIsNeg = move.down < 0 || move.up < 0 || move.left < 0 || move.right < 0;
320
- switch (align) {
321
- case "left":
322
- if (onAxis.y)
323
- classes.push("!justify-start");
324
- break;
325
- case "right":
326
- if (onAxis.y)
327
- classes.push("!justify-end");
328
- break;
329
- case "bottom":
330
- if (onAxis.x)
331
- classes.push("items-end");
332
- break;
333
- case "top":
334
- break;
335
- default:
336
- if (onAxis.x) {
337
- classes.push("items-center");
338
- if (!oneMovePropIsNeg) {
339
- move.down *= 2;
340
- move.up *= 2;
341
- }
342
- }
343
- if (onAxis.y && !oneMovePropIsNeg) {
344
- move.right *= 2;
345
- move.left *= 2;
346
- }
347
- break;
348
- }
349
- const adjustment = `${move.down}px ${move.left}px ${move.up}px ${move.right}px`;
350
- tooltipStyle = {
351
- ...tooltipStyle,
352
- zIndex,
353
- color,
354
- bottom,
355
- fontSize,
356
- textAlign,
357
- fontFamily,
358
- fontWeight,
359
- padding: oneMovePropIsNeg ? null : adjustment,
360
- margin: oneMovePropIsNeg ? adjustment : null,
361
- animation: () => $$(show) ? `rpt-${$$(animation)} 0.2s` : `rpt-${$$(animation)}-out 0.15s`
362
- };
363
- const e = useMemo(
364
- () => !$$(animation) && $$(show) && $$(props.children) || $$(show) && $$(mount) && $$(props.children) ? /* @__PURE__ */ jsx(
365
- "div",
366
- {
367
- className: classes,
368
- style: tooltipStyle,
369
- onAnimationEnd: () => {
370
- if (!$$(show) && $$(animation))
371
- mount(false);
372
- },
373
- children: /* @__PURE__ */ jsxs("div", { class: "flex justify-center", children: [
374
- /* @__PURE__ */ jsx(
375
- Arrow,
376
- {
377
- isHovered: hoverArrow,
378
- hovBkg: hoverBackground,
379
- bkgCol: backgroundColor,
380
- flat
381
- }
382
- ),
383
- /* @__PURE__ */ jsx(
384
- TextBox,
385
- {
386
- ...props,
387
- hoverArrow,
388
- lines: lineSeparated,
389
- pos: position,
390
- arw: arrow,
391
- move
392
- }
393
- )
394
- ] })
395
- }
396
- ) : null
397
- );
398
- return useMemo(() => $$(Parent) ? /* @__PURE__ */ jsxs("div", { class: [containerClass ?? "relative"], ref: parentRef, children: [
399
- Parent,
400
- e
401
- ] }) : e);
214
+ const tp = $();
215
+ const ir = $();
216
+ const sty = useComputedStyle(tp, ["background-color", /^border-(?!.*-radius$)/, "box-shadow"]);
217
+ return /* @__PURE__ */ jsxs("div", { ref: tp, class: [pos, cls, () => $$(st) ? "" : "invisible opacity-0", className, "tpcontents"], style: [style, { transform }], ...props, children: [
218
+ children,
219
+ () => /* @__PURE__ */ jsx("i", { ref: ir, class: [ii, styled`
220
+ &::after{
221
+ ${Object.keys($$(sty)).map((k) => `${k}:${$$(sty)[k]};
222
+ `).join("")}
223
+ }
224
+ `], style: ali })
225
+ ] });
402
226
  };
403
227
  export {
404
- Tooltip
228
+ Tooltip,
229
+ TooltipContent
405
230
  };
406
231
  //# sourceMappingURL=index.es.js.map