@erain20029/tooltips 2.0.152 → 2.0.153
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(h){typeof define=="function"&&define.amd?define(h):h()})((function(){"use strict";const h=".tooltip-overlay{position:fixed;z-index:9999;pointer-events:none;background:#53616e;border-radius:8px;box-shadow:0 4px 20px #00000040;color:#dadadb;min-width:45px;max-width:300px;overflow:visible}.tooltip-overlay.with-image{max-width:384px}.tooltip-card{display:flex;align-items:center;gap:16px;padding:10px;box-sizing:border-box}.tooltip-image{width:80px;height:80px;border-radius:8px;object-fit:cover}.tooltip-text{flex:1;color:#fff}.tooltip-title{font-weight:300;line-height:1.3}.tooltip-desc{margin-top:8px;line-height:1.5;font-weight:300;letter-spacing:.2px;overflow-wrap:break-word}.tooltip-arrow .icon{width:40px;height:40px;position:absolute}.tooltip-arrow.rotated .icon{transform:rotate(180deg)}";(function(){function L(){if(document.getElementById("tooltip-overlay-styles"))return;const i=document.createElement("style");i.id="tooltip-overlay-styles",i.textContent=h,document.head.appendChild(i)}let d=null,g=null,b=[],u=!1;function E(i){const e=i.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,r=t/2,o=n/2,p=e.left<=r?"left":"right",f=e.top<=o?"top":"bottom";return{position:{horizontal:p,vertical:f},coordinates:{top:e.top,right:t-e.right,bottom:n-e.bottom,left:e.left,height:e.height}}}function H(i={},e={}){const t={small:16,medium:18,large:22},n={small:12,medium:14,large:16};return{titleSize:t[i.title]??16,descSize:n[i.description]??12,titleAlign:e.title??"left",descAlign:e.description??"left"}}function $(){d&&(d.remove(),d=null,g=null)}async function M(){if(u)return;let i=localStorage.getItem("product");if(!i){const r=window.location.hostname,o=await fetch(`http://192.168.8.226:3000/product/${r}`);if(!o.ok)throw new Error("Failed to load tooltip product");const p=await o.json();console.log(p),i=JSON.stringify({id:p.productId}),localStorage.setItem("product",i)}const{id:e}=JSON.parse(i),t=document.createElement("script");if(t.type="module",t.src=`http://192.168.8.226:3000/documentation/${e}/tooltip.js`,await new Promise((r,o)=>{t.onload=r,t.onerror=o,document.head.appendChild(t)}),typeof window.tooltipGetter!="function")return;const n=await window.tooltipGetter();b=Array.isArray(n)?n:[],u=!0}function z(i,e){$(),L();const t=document.createElement("div");t.className="tooltip-overlay",t.style.position="fixed",t.style.pointerEvents="none",t.style.zIndex="9999";const n=e.position?.image??"left",r=!!e.image;r?(t.classList.add("with-image"),t.style.maxWidth="384px"):t.style.maxWidth="300px";const o=document.createElement("div");o.className="tooltip-arrow",o.style.position="absolute",o.style.width="34px",o.style.height="34px";const p='<svg viewBox="0 0 60 40" style="width: 100%; height: 100%; fill: #53616e;"><path d="M26.5 6 L6 38 L47 38 Z" /></svg>',f='<svg viewBox="0 0 60 40" style="width: 100%; height: 100%; fill: #53616e; transform: rotate(180deg);"><path d="M26.5 6 L6 38 L47 38 Z" /></svg>',m=r?`<img src="http://localhost:3000${e.image}" style="width: 80px; height: 80px; border-radius: 4px; object-fit: cover; ${n==="top"?"display: block; margin: 24px auto 0;":""}" />`:"",l=document.createElement("div");l.className="tooltip-card",l.style.display="flex",l.style.alignItems="center",l.style.gap="12px",l.style.padding="
|
|
1
|
+
(function(h){typeof define=="function"&&define.amd?define(h):h()})((function(){"use strict";const h=".tooltip-overlay{position:fixed;z-index:9999;pointer-events:none;background:#53616e;border-radius:8px;box-shadow:0 4px 20px #00000040;color:#dadadb;min-width:45px;max-width:300px;overflow:visible}.tooltip-overlay.with-image{max-width:384px}.tooltip-card{display:flex;align-items:center;gap:16px;padding:10px;box-sizing:border-box}.tooltip-image{width:80px;height:80px;border-radius:8px;object-fit:cover}.tooltip-text{flex:1;color:#fff}.tooltip-title{font-weight:300;line-height:1.3}.tooltip-desc{margin-top:8px;line-height:1.5;font-weight:300;letter-spacing:.2px;overflow-wrap:break-word}.tooltip-arrow .icon{width:40px;height:40px;position:absolute}.tooltip-arrow.rotated .icon{transform:rotate(180deg)}";(function(){function L(){if(document.getElementById("tooltip-overlay-styles"))return;const i=document.createElement("style");i.id="tooltip-overlay-styles",i.textContent=h,document.head.appendChild(i)}let d=null,g=null,b=[],u=!1;function E(i){const e=i.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,r=t/2,o=n/2,p=e.left<=r?"left":"right",f=e.top<=o?"top":"bottom";return{position:{horizontal:p,vertical:f},coordinates:{top:e.top,right:t-e.right,bottom:n-e.bottom,left:e.left,height:e.height}}}function H(i={},e={}){const t={small:16,medium:18,large:22},n={small:12,medium:14,large:16};return{titleSize:t[i.title]??16,descSize:n[i.description]??12,titleAlign:e.title??"left",descAlign:e.description??"left"}}function $(){d&&(d.remove(),d=null,g=null)}async function M(){if(u)return;let i=localStorage.getItem("product");if(!i){const r=window.location.hostname,o=await fetch(`http://192.168.8.226:3000/product/${r}`);if(!o.ok)throw new Error("Failed to load tooltip product");const p=await o.json();console.log(p),i=JSON.stringify({id:p.productId}),localStorage.setItem("product",i)}const{id:e}=JSON.parse(i),t=document.createElement("script");if(t.type="module",t.src=`http://192.168.8.226:3000/documentation/${e}/tooltip.js`,await new Promise((r,o)=>{t.onload=r,t.onerror=o,document.head.appendChild(t)}),typeof window.tooltipGetter!="function")return;const n=await window.tooltipGetter();b=Array.isArray(n)?n:[],u=!0}function z(i,e){$(),L();const t=document.createElement("div");t.className="tooltip-overlay",t.style.position="fixed",t.style.pointerEvents="none",t.style.zIndex="9999";const n=e.position?.image??"left",r=!!e.image;r?(t.classList.add("with-image"),t.style.maxWidth="384px"):t.style.maxWidth="300px";const o=document.createElement("div");o.className="tooltip-arrow",o.style.position="absolute",o.style.width="34px",o.style.height="34px";const p='<svg viewBox="0 0 60 40" style="width: 100%; height: 100%; fill: #53616e;"><path d="M26.5 6 L6 38 L47 38 Z" /></svg>',f='<svg viewBox="0 0 60 40" style="width: 100%; height: 100%; fill: #53616e; transform: rotate(180deg);"><path d="M26.5 6 L6 38 L47 38 Z" /></svg>',m=r?`<img src="http://localhost:3000${e.image}" style="width: 80px; height: 80px; border-radius: 4px; object-fit: cover; ${n==="top"?"display: block; margin: 24px auto 0;":""}" />`:"",l=document.createElement("div");l.className="tooltip-card",l.style.display="flex",l.style.alignItems="center",l.style.gap="12px",l.style.padding="8px",l.style.minWidth="63px",l.style.minHeight="20px";const T=`
|
|
2
2
|
<div class="tooltip-text" style="flex: 1;">
|
|
3
3
|
<div class="tooltip-title" style="font-weight: 300;">
|
|
4
4
|
${e.title}
|