Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-tooltip

Package Overview
Dependencies
Maintainers
0
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-tooltip - npm Package Compare versions

Comparing version 0.35.1 to 0.35.2

8

build/vega-tooltip.js

@@ -8,3 +8,3 @@ (function (global, factory) {

var name = "vega-tooltip";
var version$1 = "0.35.1";
var version$1 = "0.35.2";
var description = "A tooltip plugin for Vega-Lite and Vega visualizations.";

@@ -348,6 +348,4 @@ var keywords = [

parentItem = parentItem.mark.group;
if ('x' in parentItem && 'y' in parentItem) {
left += parentItem.x;
top += parentItem.y;
}
left += parentItem.x ?? 0;
top += parentItem.y ?? 0;
}

@@ -354,0 +352,0 @@ const markWidth = markBounds.x2 - markBounds.x1;

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vegaTooltip={},t.vega)}(this,(function(t,e){"use strict";var n="0.35.1";function i(t,n,i,o){if(e.isArray(t))return`[${t.map((t=>n(e.isString(t)?t:l(t,i)))).join(", ")}]`;if(e.isObject(t)){let s="";const{title:r,image:d,...a}=t;r&&(s+=`<h2>${n(r)}</h2>`),d&&(s+=`<img src="${new URL(n(d),o||location.href).href}">`);const p=Object.keys(a);if(p.length>0){s+="<table>";for(const t of p){let o=a[t];void 0!==o&&(e.isObject(o)&&(o=l(o,i)),s+=`<tr><td class="key">${n(t)}</td><td class="value">${n(o)}</td></tr>`)}s+="</table>"}return s||"{}"}return n(t)}function o(t){const e=[];return function(n,i){if("object"!=typeof i||null===i)return i;const o=e.indexOf(this)+1;return e.length=o,e.length>t?"[Object]":e.indexOf(i)>=0?"[Circular]":(e.push(i),i)}}function l(t,e){return JSON.stringify(t,o(e))}var s="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";const r="vg-tooltip-element",d={offsetX:10,offsetY:10,id:r,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:a,maxDepth:2,formatTooltip:i,baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function a(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;")}function p(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return s.toString().replace(r,t)}function c(t,e,{offsetX:n,offsetY:i}){const o=u({x1:t.clientX,x2:t.clientX,y1:t.clientY,y2:t.clientY},e,n,i),l=["bottom-right","bottom-left","top-right","top-left"];for(const t of l)if(g(o[t],e))return o[t];return o["top-left"]}function h(t,e,n,i,o){const{position:l,offsetX:s,offsetY:r}=o,d=u(f(t._el.getBoundingClientRect(),t._origin,n),i,s,r),a=Array.isArray(l)?l:[l];for(const t of a)if(g(d[t],i)&&!m(e,d[t],i))return d[t];return c(e,i,o)}function f(t,e,n){const i=n.isVoronoi?n.datum.bounds:n.bounds;let o=t.left+e[0]+i.x1,l=t.top+e[1]+i.y1,s=n;for(;s.mark.group;)s=s.mark.group,"x"in s&&"y"in s&&(o+=s.x,l+=s.y);return{x1:o,x2:o+(i.x2-i.x1),y1:l,y2:l+(i.y2-i.y1)}}function u(t,e,n,i){const o=(t.x1+t.x2)/2,l=(t.y1+t.y2)/2,s=t.x1-e.width-n,r=o-e.width/2,d=t.x2+n,a=t.y1-e.height-i,p=l-e.height/2,c=t.y2+i;return{top:{x:r,y:a},bottom:{x:r,y:c},left:{x:s,y:p},right:{x:d,y:p},"top-left":{x:s,y:a},"top-right":{x:d,y:a},"bottom-left":{x:s,y:c},"bottom-right":{x:d,y:c}}}function g(t,e){return t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight}function m(t,e,n){return t.clientX>=e.x&&t.clientX<=e.x+n.width&&t.clientY>=e.y&&t.clientY<=e.y+n.height}class x{constructor(t){this.options={...d,...t};const e=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const t=document.createElement("style");t.setAttribute("id",this.options.styleId),t.innerHTML=p(e);const n=document.head;n.childNodes.length>0?n.insertBefore(t,n.childNodes[0]):n.appendChild(t)}}tooltipHandler(t,e,n,i){if(this.el=document.getElementById(this.options.id),!this.el){this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip");(document.fullscreenElement??document.body).appendChild(this.el)}if(null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:o,y:l}="mark"===this.options.anchor?h(t,e,n,this.el.getBoundingClientRect(),this.options):c(e,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${l}px`,this.el.style.left=`${o}px`}}const b=n;t.DEFAULT_OPTIONS=d,t.Handler=x,t.calculatePositionRelativeToCursor=c,t.calculatePositionRelativeToMark=h,t.createDefaultStyle=p,t.default=function(t,e){const n=new x(e);return t.tooltip(n.call).run(),n},t.escapeHTML=a,t.formatValue=i,t.getMarkBounds=f,t.getPositions=u,t.mouseIsOnTooltip=m,t.replacer=o,t.stringify=l,t.tooltipIsInViewport=g,t.version=b,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vegaTooltip={},t.vega)}(this,(function(t,e){"use strict";var n="0.35.2";function i(t,n,i,o){if(e.isArray(t))return`[${t.map((t=>n(e.isString(t)?t:l(t,i)))).join(", ")}]`;if(e.isObject(t)){let s="";const{title:r,image:d,...a}=t;r&&(s+=`<h2>${n(r)}</h2>`),d&&(s+=`<img src="${new URL(n(d),o||location.href).href}">`);const p=Object.keys(a);if(p.length>0){s+="<table>";for(const t of p){let o=a[t];void 0!==o&&(e.isObject(o)&&(o=l(o,i)),s+=`<tr><td class="key">${n(t)}</td><td class="value">${n(o)}</td></tr>`)}s+="</table>"}return s||"{}"}return n(t)}function o(t){const e=[];return function(n,i){if("object"!=typeof i||null===i)return i;const o=e.indexOf(this)+1;return e.length=o,e.length>t?"[Object]":e.indexOf(i)>=0?"[Circular]":(e.push(i),i)}}function l(t,e){return JSON.stringify(t,o(e))}var s="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";const r="vg-tooltip-element",d={offsetX:10,offsetY:10,id:r,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:a,maxDepth:2,formatTooltip:i,baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function a(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;")}function p(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return s.toString().replace(r,t)}function c(t,e,{offsetX:n,offsetY:i}){const o=u({x1:t.clientX,x2:t.clientX,y1:t.clientY,y2:t.clientY},e,n,i),l=["bottom-right","bottom-left","top-right","top-left"];for(const t of l)if(g(o[t],e))return o[t];return o["top-left"]}function h(t,e,n,i,o){const{position:l,offsetX:s,offsetY:r}=o,d=u(f(t._el.getBoundingClientRect(),t._origin,n),i,s,r),a=Array.isArray(l)?l:[l];for(const t of a)if(g(d[t],i)&&!m(e,d[t],i))return d[t];return c(e,i,o)}function f(t,e,n){const i=n.isVoronoi?n.datum.bounds:n.bounds;let o=t.left+e[0]+i.x1,l=t.top+e[1]+i.y1,s=n;for(;s.mark.group;)s=s.mark.group,o+=s.x??0,l+=s.y??0;return{x1:o,x2:o+(i.x2-i.x1),y1:l,y2:l+(i.y2-i.y1)}}function u(t,e,n,i){const o=(t.x1+t.x2)/2,l=(t.y1+t.y2)/2,s=t.x1-e.width-n,r=o-e.width/2,d=t.x2+n,a=t.y1-e.height-i,p=l-e.height/2,c=t.y2+i;return{top:{x:r,y:a},bottom:{x:r,y:c},left:{x:s,y:p},right:{x:d,y:p},"top-left":{x:s,y:a},"top-right":{x:d,y:a},"bottom-left":{x:s,y:c},"bottom-right":{x:d,y:c}}}function g(t,e){return t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight}function m(t,e,n){return t.clientX>=e.x&&t.clientX<=e.x+n.width&&t.clientY>=e.y&&t.clientY<=e.y+n.height}class b{constructor(t){this.options={...d,...t};const e=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const t=document.createElement("style");t.setAttribute("id",this.options.styleId),t.innerHTML=p(e);const n=document.head;n.childNodes.length>0?n.insertBefore(t,n.childNodes[0]):n.appendChild(t)}}tooltipHandler(t,e,n,i){if(this.el=document.getElementById(this.options.id),!this.el){this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip");(document.fullscreenElement??document.body).appendChild(this.el)}if(null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:o,y:l}="mark"===this.options.anchor?h(t,e,n,this.el.getBoundingClientRect(),this.options):c(e,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${l}px`,this.el.style.left=`${o}px`}}const x=n;t.DEFAULT_OPTIONS=d,t.Handler=b,t.calculatePositionRelativeToCursor=c,t.calculatePositionRelativeToMark=h,t.createDefaultStyle=p,t.default=function(t,e){const n=new b(e);return t.tooltip(n.call).run(),n},t.escapeHTML=a,t.formatValue=i,t.getMarkBounds=f,t.getPositions=u,t.mouseIsOnTooltip=m,t.replacer=o,t.stringify=l,t.tooltipIsInViewport=g,t.version=x,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=vega-tooltip.min.js.map
import { isArray, isString, isObject } from 'vega-util';
var name = "vega-tooltip";
var version$1 = "0.35.1";
var version$1 = "0.35.2";
var description = "A tooltip plugin for Vega-Lite and Vega visualizations.";

@@ -343,6 +343,4 @@ var keywords = [

parentItem = parentItem.mark.group;
if ('x' in parentItem && 'y' in parentItem) {
left += parentItem.x;
top += parentItem.y;
}
left += parentItem.x ?? 0;
top += parentItem.y ?? 0;
}

@@ -349,0 +347,0 @@ const markWidth = markBounds.x2 - markBounds.x1;

{
"name": "vega-tooltip",
"version": "0.35.1",
"version": "0.35.2",
"description": "A tooltip plugin for Vega-Lite and Vega visualizations.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -99,6 +99,4 @@ import {Bounds} from 'vega-typings';

parentItem = parentItem.mark.group;
if ('x' in parentItem && 'y' in parentItem) {
left += parentItem.x;
top += parentItem.y;
}
left += parentItem.x ?? 0;
top += parentItem.y ?? 0;
}

@@ -105,0 +103,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc