@vingy/vueltip 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +8 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1409,10 +1409,17 @@ const getOption = (key) => options[key];
|
|
|
1409
1409
|
|
|
1410
1410
|
//#endregion
|
|
1411
1411
|
//#region src/state.ts
|
|
1412
|
+
let timerId;
|
|
1412
1413
|
const tooltipPlacement = ref("top");
|
|
1413
1414
|
const debouncedTooltipPlacement = ref("top");
|
|
1414
1415
|
const hoveredElement = ref();
|
|
1415
1416
|
const debouncedHoveredElement = ref();
|
|
1417
|
+
const forceClearHoveredElement = (el) => {
|
|
1418
|
+
if (el !== debouncedHoveredElement.value && el !== hoveredElement.value) return;
|
|
1419
|
+
hoveredElement.value = void 0;
|
|
1420
|
+
debouncedHoveredElement.value = void 0;
|
|
1421
|
+
if (timerId) clearTimeout(timerId);
|
|
1422
|
+
};
|
|
1416
1423
|
const contentMap = ref(/* @__PURE__ */ new Map());
|
|
1417
1424
|
const getContent = (key) => contentMap.value.get(key);
|
|
1418
1425
|
const setContent = (key, value) => contentMap.value.set(key, value);
|
|
@@ -1420,7 +1427,6 @@ const deleteContent = (key) => contentMap.value.delete(key);
|
|
|
1420
1427
|
const generateKey = () => crypto.randomUUID();
|
|
1421
1428
|
const tooltipKey = ref();
|
|
1422
1429
|
const tooltipContent = ref();
|
|
1423
|
-
let timerId;
|
|
1424
1430
|
watch([
|
|
1425
1431
|
tooltipKey,
|
|
1426
1432
|
hoveredElement,
|
|
@@ -1611,6 +1617,7 @@ const vueltipDirective = {
|
|
|
1611
1617
|
},
|
|
1612
1618
|
beforeUnmount: (el) => {
|
|
1613
1619
|
ensureKey(el, (key) => deleteContent(key));
|
|
1620
|
+
forceClearHoveredElement(el);
|
|
1614
1621
|
el.removeEventListener("mouseenter", onMouseover);
|
|
1615
1622
|
el.removeEventListener("focus", onMouseover);
|
|
1616
1623
|
el.removeEventListener("mouseleave", onMouseout);
|