internetips
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,1 +0,1 @@ | ||
window.internetips=function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(){console.warn("tooltips require requestAnimationFrame; `float` will not work.")},o=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.msCancelAnimationFrame||function(){};e._requestAnimationFrame=i,e._cancelAnimationFrame=o},function(t,e,n){"use strict";function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(b)return console.warn("Disallowed: set tooltip configs after first .show().");Object.assign(D,{placeClass:Object.assign({},D.placeClass,t.placeClass)},{typeClass:Object.assign({},D.typeClass,t.typeClass)},{defaults:Object.assign({},D.defaults,t.defaults,{effect:D.defaults.effect,target:D.defaults.target})})}function o(t){return t&&t.content?(d(),q=Object.assign({},D.defaults,t,{classes:D.defaults.classes.concat(t.classes||[])}),b.innerHTML=q.content,h(),"solid"===q.effect?s():void l()):console.warn("Cannot .show() tooltip without `content` param.")}function r(){q=A=L=H=null,y=R=!1,F=!0,(0,W._cancelAnimationFrame)(V),document.removeEventListener("mousemove",C),b&&(b.style.cssText=null,b.className=D.tooltipClass,b.innerHTML=null)}function a(){m(),r(),b&&b.parentNode.removeChild(b),v&&v.parentNode.removeChild(v),v=b=null}function s(){if(!q.target)return r(),console.warn("Cannot .show() tooltip when effect === `solid` without target node.");var t=q.target.getBoundingClientRect();q.offsetX+=parseInt(t.width/2)||0,q.offsetY+=parseInt(t.height/2)||0,A=t.left+t.width/2,L=t.top+t.height/2,c()}function l(){if(q.target){var t=q.target.getBoundingClientRect();A=t.left+t.width/2,L=t.top+t.height/2}R=!0,document.addEventListener("mousemove",C),c()}function c(){if(F){var t={};if(!f(t)){var e;switch(!0){case!z.withinLeftWhenVert:t.top=z.topWhenHorizontal,t.left=z.leftWhenDirRight,e="right";break;case!z.withinRightWhenVert:t.top=z.topWhenHorizontal,t.right=z.rightWhenDirLeft,e="left";break;case!z.canPlaceTop:t.left=z.leftWhenVertical,t.top=z.topWhenDirBottom,e="bottom";break;default:t.left=z.leftWhenVertical,t.bottom=z.bottomWhenDirTop,e="top"}h(D.placeClass[e])}u(t),F=!1,y=!0}R&&(V=(0,W._requestAnimationFrame)(c))}function f(t){var e=!1;if(!q.place)return e;switch(q.place){case"top":z.canPlaceTop&&z.withinLeftAndRightWhenVert&&(h(D.placeClass.top),t.bottom=z.bottomWhenDirTop,t.left=z.leftWhenVertical,e=!0);break;case"right":z.canPlaceRight&&(h(D.placeClass.right),t.top=z.topWhenHorizontal,t.left=z.leftWhenDirRight,e=!0);break;case"bottom":z.canPlaceBottom&&z.withinLeftAndRightWhenVert&&(h(D.placeClass.bottom),t.top=z.topWhenDirBottom,t.left=z.leftWhenVertical,e=!0);break;case"left":z.canPlaceLeft&&(h(D.placeClass.left),t.top=z.topWhenHorizontal,t.right=z.rightWhenDirLeft,e=!0)}return e}function u(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e+=n+":"+parseInt(t[n])+"px;");b.style.cssText=e}function h(t){H!==t&&(H=t,b.className=[D.tooltipClass,D.activeClass,D.typeClass[q.type],t].concat(q.classes).join(" "))}function d(){if(b)return r();v=document.querySelector("."+D.containerClass),v||(v=document.createElement("div"),v.className=D.containerClass,document.body.appendChild(v)),b=v.querySelector("."+D.tooltipClass),b||(b=document.createElement("div"),b.className=D.tooltipClass,v.appendChild(b)),P=document.body.getBoundingClientRect().width,k=window.innerHeight,p(),r()}function p(){m(),window.addEventListener("scroll",g),window.addEventListener("resize",w)}function m(){window.removeEventListener("scroll",g),window.removeEventListener("resize",w)}function g(){y===!0&&r()}function w(){P=document.body.getBoundingClientRect().width,k=window.innerHeight}function C(t){F=!0,A=t.clientX,L=t.clientY}Object.defineProperty(e,"__esModule",{value:!0}),e.destroy=e.setConfig=e.hide=e.show=void 0;var W=n(0);e.show=o,e.hide=r,e.setConfig=i,e.destroy=a;var v,b,y,R,A,L,F,H,V,P,k,q,D={containerClass:"internetips-container",tooltipClass:"internetips",activeClass:"internetips-show",placeClass:{top:"internetips-place-top",right:"internetips-place-right",bottom:"internetips-place-bottom",left:"internetips-place-left"},typeClass:{dark:"internetips-type-dark",light:"internetips-type-light"},defaults:{effect:"float",target:null,place:null,type:"dark",classes:[],offsetX:15,offsetY:15}},z=Object.create({},{nodeWidth:{get:function(){return b.clientWidth}},nodeHeight:{get:function(){return b.clientHeight}},leftWhenVertical:{get:function(){return A-this.nodeWidth/2}},topWhenHorizontal:{get:function(){return L-this.nodeHeight/2}},rightWhenDirLeft:{get:function(){return P-A+q.offsetX}},leftWhenDirRight:{get:function(){return A+q.offsetX}},bottomWhenDirTop:{get:function(){return k-(L-q.offsetY)}},topWhenDirBottom:{get:function(){return L+q.offsetY}},withinLeftWhenVert:{get:function(){return this.leftWhenVertical>0}},withinRightWhenVert:{get:function(){return A+this.nodeWidth/2<P}},withinLeftAndRightWhenVert:{get:function(){return this.withinRightWhenVert&&this.withinLeftWhenVert}},canPlaceTop:{get:function(){return L-(this.nodeHeight+q.offsetY)>0}},canPlaceBottom:{get:function(){return L+this.nodeHeight+q.offsetY<k}},canPlaceLeft:{get:function(){return A-(this.nodeWidth+q.offsetX)>0&&this.topWhenHorizontal>0}},canPlaceRight:{get:function(){return A+this.nodeWidth+q.offsetX<P&&this.topWhenHorizontal>0}}})}]); | ||
window.internetips=function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(){console.warn("tooltips require requestAnimationFrame; `float` will not work.")},o=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.msCancelAnimationFrame||function(){};e._requestAnimationFrame=i,e._cancelAnimationFrame=o},function(t,e,n){"use strict";function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(b)return console.warn("Disallowed: set tooltip configs after first .show().");Object.assign(D,t,{placeClass:Object.assign({},D.placeClass,t.placeClass)},{typeClass:Object.assign({},D.typeClass,t.typeClass)},{defaults:Object.assign({},D.defaults,t.defaults,{effect:D.defaults.effect,target:D.defaults.target})})}function o(t){return t&&t.content?(d(),q=Object.assign({},D.defaults,t,{classes:D.defaults.classes.concat(t.classes||[])}),b.innerHTML=q.content,h(),"solid"===q.effect?s():void l()):console.warn("Cannot .show() tooltip without `content` param.")}function r(){q=A=L=H=null,y=R=!1,F=!0,(0,W._cancelAnimationFrame)(V),document.removeEventListener("mousemove",C),b&&(b.style.cssText=null,b.className=D.tooltipClass,b.innerHTML=null)}function a(){m(),r(),b&&b.parentNode.removeChild(b),v&&v.parentNode.removeChild(v),v=b=null}function s(){if(!q.target)return r(),console.warn("Cannot .show() tooltip when effect === `solid` without target node.");var t=q.target.getBoundingClientRect();q.offsetX+=parseInt(t.width/2)||0,q.offsetY+=parseInt(t.height/2)||0,A=t.left+t.width/2,L=t.top+t.height/2,c()}function l(){if(q.target){var t=q.target.getBoundingClientRect();A=t.left+t.width/2,L=t.top+t.height/2}R=!0,document.addEventListener("mousemove",C),c()}function c(){if(F){var t={};if(!f(t)){var e;switch(!0){case!z.withinLeftWhenVert:t.top=z.topWhenHorizontal,t.left=z.leftWhenDirRight,e="right";break;case!z.withinRightWhenVert:t.top=z.topWhenHorizontal,t.right=z.rightWhenDirLeft,e="left";break;case!z.canPlaceTop:t.left=z.leftWhenVertical,t.top=z.topWhenDirBottom,e="bottom";break;default:t.left=z.leftWhenVertical,t.bottom=z.bottomWhenDirTop,e="top"}h(D.placeClass[e])}u(t),F=!1,y=!0}R&&(V=(0,W._requestAnimationFrame)(c))}function f(t){var e=!1;if(!q.place)return e;switch(q.place){case"top":z.canPlaceTop&&z.withinLeftAndRightWhenVert&&(h(D.placeClass.top),t.bottom=z.bottomWhenDirTop,t.left=z.leftWhenVertical,e=!0);break;case"right":z.canPlaceRight&&(h(D.placeClass.right),t.top=z.topWhenHorizontal,t.left=z.leftWhenDirRight,e=!0);break;case"bottom":z.canPlaceBottom&&z.withinLeftAndRightWhenVert&&(h(D.placeClass.bottom),t.top=z.topWhenDirBottom,t.left=z.leftWhenVertical,e=!0);break;case"left":z.canPlaceLeft&&(h(D.placeClass.left),t.top=z.topWhenHorizontal,t.right=z.rightWhenDirLeft,e=!0)}return e}function u(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e+=n+":"+parseInt(t[n])+"px;");b.style.cssText=e}function h(t){H!==t&&(H=t,b.className=[D.tooltipClass,D.activeClass,D.typeClass[q.type],t].concat(q.classes).join(" "))}function d(){if(b)return r();v=document.querySelector("."+D.containerClass),v||(v=document.createElement("div"),v.className=D.containerClass,document.body.appendChild(v)),b=v.querySelector("."+D.tooltipClass),b||(b=document.createElement("div"),b.className=D.tooltipClass,v.appendChild(b)),P=document.body.getBoundingClientRect().width,k=window.innerHeight,p(),r()}function p(){m(),window.addEventListener("scroll",g),window.addEventListener("resize",w)}function m(){window.removeEventListener("scroll",g),window.removeEventListener("resize",w)}function g(){y===!0&&r()}function w(){P=document.body.getBoundingClientRect().width,k=window.innerHeight}function C(t){F=!0,A=t.clientX,L=t.clientY}Object.defineProperty(e,"__esModule",{value:!0}),e.destroy=e.setConfig=e.hide=e.show=void 0;var W=n(0);e.show=o,e.hide=r,e.setConfig=i,e.destroy=a;var v,b,y,R,A,L,F,H,V,P,k,q,D={containerClass:"internetips-container",tooltipClass:"internetips",activeClass:"internetips-show",placeClass:{top:"internetips-place-top",right:"internetips-place-right",bottom:"internetips-place-bottom",left:"internetips-place-left"},typeClass:{dark:"internetips-type-dark",light:"internetips-type-light"},defaults:{effect:"float",target:null,place:null,type:"dark",classes:[],offsetX:15,offsetY:15}},z=Object.create({},{nodeWidth:{get:function(){return b.clientWidth}},nodeHeight:{get:function(){return b.clientHeight}},leftWhenVertical:{get:function(){return A-this.nodeWidth/2}},topWhenHorizontal:{get:function(){return L-this.nodeHeight/2}},rightWhenDirLeft:{get:function(){return P-A+q.offsetX}},leftWhenDirRight:{get:function(){return A+q.offsetX}},bottomWhenDirTop:{get:function(){return k-(L-q.offsetY)}},topWhenDirBottom:{get:function(){return L+q.offsetY}},withinLeftWhenVert:{get:function(){return this.leftWhenVertical>0}},withinRightWhenVert:{get:function(){return A+this.nodeWidth/2<P}},withinLeftAndRightWhenVert:{get:function(){return this.withinRightWhenVert&&this.withinLeftWhenVert}},canPlaceTop:{get:function(){return L-(this.nodeHeight+q.offsetY)>0}},canPlaceBottom:{get:function(){return L+this.nodeHeight+q.offsetY<k}},canPlaceLeft:{get:function(){return A-(this.nodeWidth+q.offsetX)>0&&this.topWhenHorizontal>0}},canPlaceRight:{get:function(){return A+this.nodeWidth+q.offsetX<P&&this.topWhenHorizontal>0}}})}]); |
@@ -165,3 +165,3 @@ 'use strict'; | ||
} | ||
Object.assign(configs, { placeClass: Object.assign({}, configs.placeClass, options.placeClass) }, { typeClass: Object.assign({}, configs.typeClass, options.typeClass) }, { defaults: Object.assign({}, configs.defaults, options.defaults, { | ||
Object.assign(configs, options, { placeClass: Object.assign({}, configs.placeClass, options.placeClass) }, { typeClass: Object.assign({}, configs.typeClass, options.typeClass) }, { defaults: Object.assign({}, configs.defaults, options.defaults, { | ||
// ensure 'effect' and 'target' defaults are retained | ||
@@ -168,0 +168,0 @@ effect: configs.defaults.effect, |
@@ -136,3 +136,3 @@ import { | ||
} | ||
Object.assign(configs, | ||
Object.assign(configs, options, | ||
{placeClass: Object.assign({}, configs.placeClass, options.placeClass)}, | ||
@@ -139,0 +139,0 @@ {typeClass: Object.assign({}, configs.typeClass, options.typeClass)}, |
{ | ||
"name": "internetips", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A tooltip library without the whole kitchen sink", | ||
@@ -5,0 +5,0 @@ "main": "dist/node/index.js", |
53093