-
Notifications
You must be signed in to change notification settings - Fork 5
/
ractive-tooltip.min.js
1 lines (1 loc) · 5.15 KB
/
ractive-tooltip.min.js
1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RactiveTooltip=t():e.RactiveTooltip=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function r(e,t,n){var r={x:e.pageX,y:e.pageY},o=n.offsetWidth,s=n.offsetHeight,a=r.y-n.offsetHeight-5,f=r.x-5,u=a-s-5,p=f+o-i.innerWidth;p>0&&(f-=o-5),u<0&&(a+=2*s-5),n.style.left=f+"px",n.style.top=a+"px"}function o(e,t){var n,o,i,a=function(o){t&&0!==t.length&&(n||(n=s.createElement("div"),n.className="ractive-tooltip",n.textContent=t),r(o,e,n),s.body.appendChild(n))},f=function(t){return n?void r(t,e,n):void a(t)},u=function(e){n&&n.parentNode&&n.parentNode.removeChild(n)};o={mouseenter:a,touchstart:a,mousemove:f,touchmove:f,mouseleave:u,touchend:u};for(i in o)o.hasOwnProperty(i)&&e.addEventListener(i,o[i],!1);return{update:function(e){t=e,n&&(n.textContent=t),t&&0!==t.length||!n||!n.parentNode||n.parentNode.removeChild(n)},teardown:function(){n&&n.parentNode&&(n.parentNode.removeChild(n),n=null);for(i in o)o.hasOwnProperty(i)&&e.removeEventListener(i,o[i],!1)}}}n(1);var i=window,s=i.document;e.exports=o},function(e,t,n){var r=n(2);"string"==typeof r&&(r=[[e.id,r,""]]);n(4)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){t=e.exports=n(3)(),t.push([e.id,".ractive-tooltip{position:absolute;display:table;padding:.5em;color:#fff;background:#000;box-shadow:0 2px 2px rgba(0,0,0,.1);border-radius:5px;white-space:nowrap;z-index:99999;font-style:normal;text-transform:none;pointer-events:none}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(e,t,n){function r(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=l[r.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](r.parts[i]);for(;i<r.parts.length;i++)o.parts.push(u(r.parts[i],t))}else{for(var s=[],i=0;i<r.parts.length;i++)s.push(u(r.parts[i],t));l[r.id]={id:r.id,refs:1,parts:s}}}}function o(e){for(var t=[],n={},r=0;r<e.length;r++){var o=e[r],i=o[0],s=o[1],a=o[2],f=o[3],u={css:s,media:a,sourceMap:f};n[i]?n[i].parts.push(u):t.push(n[i]={id:i,parts:[u]})}return t}function i(e,t){var n=m(),r=x[x.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),x.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=x.indexOf(e);t>=0&&x.splice(t,1)}function a(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function f(e){var t=document.createElement("link");return t.rel="stylesheet",i(e,t),t}function u(e,t){var n,r,o;if(t.singleton){var i=y++;n=g||(g=a(t)),r=p.bind(null,n,i,!1),o=p.bind(null,n,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=f(t),r=d.bind(null,n),o=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=a(t),r=c.bind(null,n),o=function(){s(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}function p(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=b(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function c(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function d(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}var l={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},v=h(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),m=h(function(){return document.head||document.getElementsByTagName("head")[0]}),g=null,y=0,x=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=v()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return r(n,t),function(e){for(var i=[],s=0;s<n.length;s++){var a=n[s],f=l[a.id];f.refs--,i.push(f)}if(e){var u=o(e);r(u,t)}for(var s=0;s<i.length;s++){var f=i[s];if(0===f.refs){for(var p=0;p<f.parts.length;p++)f.parts[p]();delete l[f.id]}}}};var b=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()}])});