New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

internetips

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

internetips - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

test/src/events.test.js

24

dist/bundled.js

@@ -275,3 +275,3 @@ window["internetips"] =

// testing purposes.
var onShowHook, onHideHook, onDestroyHook;
var onShowHook, onHideHook, onDestroyHook, onResetHook;

@@ -352,2 +352,6 @@ /**

}
// Test hook integration
if (typeof onResetHook === 'function') {
onResetHook();
}
}

@@ -383,2 +387,4 @@

}
// After destroying, reset all hooks!
_defineTestHooks();
}

@@ -610,2 +616,3 @@

window.addEventListener('scroll', trackWindowScroll);
document.body.addEventListener('scroll', trackWindowScroll);
window.addEventListener('resize', trackWindowResize);

@@ -619,2 +626,3 @@ }

window.removeEventListener('scroll', trackWindowScroll);
document.body.removeEventListener('scroll', trackWindowScroll);
window.removeEventListener('resize', trackWindowResize);

@@ -659,2 +667,5 @@ }

/**
* Restore config defaults resets the configs.
*/
function _restoreConfigDefaults() {

@@ -664,2 +675,5 @@ Object.assign(configs, stashedConfigs);

/**
* Inspect config dumps the configuration object.
*/
function _inspectConfig() {

@@ -669,2 +683,9 @@ return configs;

/**
* Used to define hooks that will be invoked at certain times;
* intended for test use only. Note that invoking this fn without
* any arguments will nullify any previously bound hooks (eg. reset
* all of them).
* @param {Object} definitions Hook definitions
*/
function _defineTestHooks() {

@@ -676,2 +697,3 @@ var definitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

onDestroyHook = definitions.onDestroy || null;
onResetHook = definitions.onReset || null;
}

@@ -678,0 +700,0 @@

2

dist/bundled.min.js

@@ -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";"function"!=typeof Object.assign&&(Object.assign=function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t),i=1;i<arguments.length;i++){var o=arguments[i];if(null!=o)for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])}return n})},function(t,e,n){"use strict";function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(L)return console.warn("Disallowed: set tooltip configs after first .show().");Object.assign(x,t,{placeClass:Object.assign({},x.placeClass,t.placeClass)},{typeClass:Object.assign({},x.typeClass,t.typeClass)},{defaults:Object.assign({},x.defaults,t.defaults,{effect:x.defaults.effect,target:x.defaults.target})})}function o(t){return t&&t.content?(d(),z=Object.assign({},x.defaults,t,{classes:x.defaults.classes.concat(t.classes||[])}),z.content instanceof Element?L.appendChild(z.content):L.innerHTML=z.content,p(),"solid"===z.effect?l():void c()):console.warn("Cannot .show() tooltip without `content` param.")}function r(){if(z=j=A=V=null,H=O=!1,D=!0,X(k),document.removeEventListener("mousemove",W),L){for(L.style.cssText=null,L.className=x.tooltipClass;L.firstChild;)L.removeChild(L.firstChild);L.innerHTML=""}}function a(){r(),"function"==typeof q&&q()}function s(){w(),r(),L&&L.parentNode.removeChild(L),R&&R.parentNode.removeChild(R),R=L=null,"function"==typeof E&&E()}function l(){if(!z.target)return r(),console.warn("Cannot .show() tooltip when effect === `solid` without target node.");var t=z.target.getBoundingClientRect();z.offsetX+=parseInt(t.width/2)||0,z.offsetY+=parseInt(t.height/2)||0,j=t.left+t.width/2,A=t.top+t.height/2,f()}function c(){if(z.target){var t=z.target.getBoundingClientRect();j=t.left+t.width/2,A=t.top+t.height/2}O=!0,document.addEventListener("mousemove",W),f()}function f(){if(D){var t={};if(!u(t)){var e;switch(!0){case!B.withinLeftWhenVert:t.top=B.topWhenHorizontal,t.left=B.leftWhenDirRight,e="right";break;case!B.withinRightWhenVert:t.top=B.topWhenHorizontal,t.right=B.rightWhenDirLeft,e="left";break;case!B.canPlaceTop:t.left=B.leftWhenVertical,t.top=B.topWhenDirBottom,e="bottom";break;default:t.left=B.leftWhenVertical,t.bottom=B.bottomWhenDirTop,e="top"}p(x.placeClass[e])}h(t),D=!1,H=!0,"function"==typeof F&&F(R.innerHTML)}O&&(k=N(f))}function u(t){var e=!1;if(!z.place)return e;switch(z.place){case"top":B.canPlaceTop&&B.withinLeftAndRightWhenVert&&(p(x.placeClass.top),t.bottom=B.bottomWhenDirTop,t.left=B.leftWhenVertical,e=!0);break;case"right":B.canPlaceRight&&(p(x.placeClass.right),t.top=B.topWhenHorizontal,t.left=B.leftWhenDirRight,e=!0);break;case"bottom":B.canPlaceBottom&&B.withinLeftAndRightWhenVert&&(p(x.placeClass.bottom),t.top=B.topWhenDirBottom,t.left=B.leftWhenVertical,e=!0);break;case"left":B.canPlaceLeft&&(p(x.placeClass.left),t.top=B.topWhenHorizontal,t.right=B.rightWhenDirLeft,e=!0)}return e}function h(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e+=n+":"+parseInt(t[n])+"px;");L.style.cssText=e}function p(t){V!==t&&(V=t,L.className=[x.tooltipClass,x.activeClass,x.typeClass[z.type],t].concat(z.classes).join(" "))}function d(){if(L)return r();R=document.querySelector("."+x.containerClass),R||(R=document.createElement("div"),R.className=x.containerClass,document.body.appendChild(R)),L=R.querySelector("."+x.tooltipClass),L||(L=document.createElement("div"),L.className=x.tooltipClass,R.appendChild(L)),P=document.body.getBoundingClientRect().width,T=window.innerHeight,g(),r()}function g(){w(),window.addEventListener("scroll",m),window.addEventListener("resize",C)}function w(){window.removeEventListener("scroll",m),window.removeEventListener("resize",C)}function m(){H===!0&&r()}function C(){P=document.body.getBoundingClientRect().width,T=window.innerHeight}function W(t){D=!0,j=t.clientX,A=t.clientY}function b(){Object.assign(x,Y)}function v(){return x}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};F=t.onShow||null,q=t.onHide||null,E=t.onDestroy||null}n(0),t.exports={show:o,hide:a,setConfig:i,destroy:s,_restoreConfigDefaults:b,_inspectConfig:v,_defineTestHooks:y};var R,L,H,O,j,A,D,V,k,P,T,z,F,q,E,x={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}},B=Object.create({},{nodeWidth:{get:function(){return L.clientWidth}},nodeHeight:{get:function(){return L.clientHeight}},leftWhenVertical:{get:function(){return j-this.nodeWidth/2}},topWhenHorizontal:{get:function(){return A-this.nodeHeight/2}},rightWhenDirLeft:{get:function(){return P-j+z.offsetX}},leftWhenDirRight:{get:function(){return j+z.offsetX}},bottomWhenDirTop:{get:function(){return T-(A-z.offsetY)}},topWhenDirBottom:{get:function(){return A+z.offsetY}},withinLeftWhenVert:{get:function(){return this.leftWhenVertical>0}},withinRightWhenVert:{get:function(){return j+this.nodeWidth/2<P}},withinLeftAndRightWhenVert:{get:function(){return this.withinRightWhenVert&&this.withinLeftWhenVert}},canPlaceTop:{get:function(){return A-(this.nodeHeight+z.offsetY)>0}},canPlaceBottom:{get:function(){return A+this.nodeHeight+z.offsetY<T}},canPlaceLeft:{get:function(){return j-(this.nodeWidth+z.offsetX)>0&&this.topWhenHorizontal>0}},canPlaceRight:{get:function(){return j+this.nodeWidth+z.offsetX<P&&this.topWhenHorizontal>0}}}),N=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(){console.warn("tooltips require requestAnimationFrame; `float` will not work.")},X=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.msCancelAnimationFrame||function(){},Y=JSON.parse(JSON.stringify(x))}]);
window.internetips=function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},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";"function"!=typeof Object.assign&&(Object.assign=function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t),o=1;o<arguments.length;o++){var i=arguments[o];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])}return n})},function(t,e,n){"use strict";function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(R)return console.warn("Disallowed: set tooltip configs after first .show().");Object.assign(B,t,{placeClass:Object.assign({},B.placeClass,t.placeClass)},{typeClass:Object.assign({},B.typeClass,t.typeClass)},{defaults:Object.assign({},B.defaults,t.defaults,{effect:B.defaults.effect,target:B.defaults.target})})}function i(t){return t&&t.content?(p(),z=Object.assign({},B.defaults,t,{classes:B.defaults.classes.concat(t.classes||[])}),z.content instanceof Element?R.appendChild(z.content):R.innerHTML=z.content,d(),"solid"===z.effect?l():void c()):console.warn("Cannot .show() tooltip without `content` param.")}function r(){if(z=j=A=V=null,H=O=!1,D=!0,Y(k),document.removeEventListener("mousemove",v),R){for(R.style.cssText=null,R.className=B.tooltipClass;R.firstChild;)R.removeChild(R.firstChild);R.innerHTML=""}"function"==typeof x&&x()}function a(){r(),"function"==typeof F&&F()}function s(){m(),r(),R&&R.parentNode.removeChild(R),L&&L.parentNode.removeChild(L),L=R=null,"function"==typeof q&&q(),y()}function l(){if(!z.target)return r(),console.warn("Cannot .show() tooltip when effect === `solid` without target node.");var t=z.target.getBoundingClientRect();z.offsetX+=parseInt(t.width/2)||0,z.offsetY+=parseInt(t.height/2)||0,j=t.left+t.width/2,A=t.top+t.height/2,f()}function c(){if(z.target){var t=z.target.getBoundingClientRect();j=t.left+t.width/2,A=t.top+t.height/2}O=!0,document.addEventListener("mousemove",v),f()}function f(){if(D){var t={};if(!u(t)){var e;switch(!0){case!N.withinLeftWhenVert:t.top=N.topWhenHorizontal,t.left=N.leftWhenDirRight,e="right";break;case!N.withinRightWhenVert:t.top=N.topWhenHorizontal,t.right=N.rightWhenDirLeft,e="left";break;case!N.canPlaceTop:t.left=N.leftWhenVertical,t.top=N.topWhenDirBottom,e="bottom";break;default:t.left=N.leftWhenVertical,t.bottom=N.bottomWhenDirTop,e="top"}d(B.placeClass[e])}h(t),D=!1,H=!0,"function"==typeof E&&E(L.innerHTML)}O&&(k=X(f))}function u(t){var e=!1;if(!z.place)return e;switch(z.place){case"top":N.canPlaceTop&&N.withinLeftAndRightWhenVert&&(d(B.placeClass.top),t.bottom=N.bottomWhenDirTop,t.left=N.leftWhenVertical,e=!0);break;case"right":N.canPlaceRight&&(d(B.placeClass.right),t.top=N.topWhenHorizontal,t.left=N.leftWhenDirRight,e=!0);break;case"bottom":N.canPlaceBottom&&N.withinLeftAndRightWhenVert&&(d(B.placeClass.bottom),t.top=N.topWhenDirBottom,t.left=N.leftWhenVertical,e=!0);break;case"left":N.canPlaceLeft&&(d(B.placeClass.left),t.top=N.topWhenHorizontal,t.right=N.rightWhenDirLeft,e=!0)}return e}function h(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e+=n+":"+parseInt(t[n])+"px;");R.style.cssText=e}function d(t){V!==t&&(V=t,R.className=[B.tooltipClass,B.activeClass,B.typeClass[z.type],t].concat(z.classes).join(" "))}function p(){if(R)return r();L=document.querySelector("."+B.containerClass),L||(L=document.createElement("div"),L.className=B.containerClass,document.body.appendChild(L)),R=L.querySelector("."+B.tooltipClass),R||(R=document.createElement("div"),R.className=B.tooltipClass,L.appendChild(R)),P=document.body.getBoundingClientRect().width,T=window.innerHeight,g(),r()}function g(){m(),window.addEventListener("scroll",w),document.body.addEventListener("scroll",w),window.addEventListener("resize",C)}function m(){window.removeEventListener("scroll",w),document.body.removeEventListener("scroll",w),window.removeEventListener("resize",C)}function w(){H===!0&&r()}function C(){P=document.body.getBoundingClientRect().width,T=window.innerHeight}function v(t){D=!0,j=t.clientX,A=t.clientY}function b(){Object.assign(B,S)}function W(){return B}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E=t.onShow||null,F=t.onHide||null,q=t.onDestroy||null,x=t.onReset||null}n(0),t.exports={show:i,hide:a,setConfig:o,destroy:s,_restoreConfigDefaults:b,_inspectConfig:W,_defineTestHooks:y};var L,R,H,O,j,A,D,V,k,P,T,z,E,F,q,x,B={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}},N=Object.create({},{nodeWidth:{get:function(){return R.clientWidth}},nodeHeight:{get:function(){return R.clientHeight}},leftWhenVertical:{get:function(){return j-this.nodeWidth/2}},topWhenHorizontal:{get:function(){return A-this.nodeHeight/2}},rightWhenDirLeft:{get:function(){return P-j+z.offsetX}},leftWhenDirRight:{get:function(){return j+z.offsetX}},bottomWhenDirTop:{get:function(){return T-(A-z.offsetY)}},topWhenDirBottom:{get:function(){return A+z.offsetY}},withinLeftWhenVert:{get:function(){return this.leftWhenVertical>0}},withinRightWhenVert:{get:function(){return j+this.nodeWidth/2<P}},withinLeftAndRightWhenVert:{get:function(){return this.withinRightWhenVert&&this.withinLeftWhenVert}},canPlaceTop:{get:function(){return A-(this.nodeHeight+z.offsetY)>0}},canPlaceBottom:{get:function(){return A+this.nodeHeight+z.offsetY<T}},canPlaceLeft:{get:function(){return j-(this.nodeWidth+z.offsetX)>0&&this.topWhenHorizontal>0}},canPlaceRight:{get:function(){return j+this.nodeWidth+z.offsetX<P&&this.topWhenHorizontal>0}}}),X=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(){console.warn("tooltips require requestAnimationFrame; `float` will not work.")},Y=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.msCancelAnimationFrame||function(){},S=JSON.parse(JSON.stringify(B))}]);

@@ -164,3 +164,3 @@ 'use strict';

// testing purposes.
var onShowHook, onHideHook, onDestroyHook;
var onShowHook, onHideHook, onDestroyHook, onResetHook;

@@ -241,2 +241,6 @@ /**

}
// Test hook integration
if (typeof onResetHook === 'function') {
onResetHook();
}
}

@@ -272,2 +276,4 @@

}
// After destroying, reset all hooks!
_defineTestHooks();
}

@@ -499,2 +505,3 @@

window.addEventListener('scroll', trackWindowScroll);
document.body.addEventListener('scroll', trackWindowScroll);
window.addEventListener('resize', trackWindowResize);

@@ -508,2 +515,3 @@ }

window.removeEventListener('scroll', trackWindowScroll);
document.body.removeEventListener('scroll', trackWindowScroll);
window.removeEventListener('resize', trackWindowResize);

@@ -548,2 +556,5 @@ }

/**
* Restore config defaults resets the configs.
*/
function _restoreConfigDefaults() {

@@ -553,2 +564,5 @@ Object.assign(configs, stashedConfigs);

/**
* Inspect config dumps the configuration object.
*/
function _inspectConfig() {

@@ -558,2 +572,9 @@ return configs;

/**
* Used to define hooks that will be invoked at certain times;
* intended for test use only. Note that invoking this fn without
* any arguments will nullify any previously bound hooks (eg. reset
* all of them).
* @param {Object} definitions Hook definitions
*/
function _defineTestHooks() {

@@ -565,2 +586,3 @@ var definitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

onDestroyHook = definitions.onDestroy || null;
onResetHook = definitions.onReset || null;
}

@@ -156,3 +156,3 @@ require('./object-assign.polyfill');

// testing purposes.
var onShowHook, onHideHook, onDestroyHook;
var onShowHook, onHideHook, onDestroyHook, onResetHook;

@@ -237,2 +237,6 @@ /**

}
// Test hook integration
if (typeof onResetHook === 'function') {
onResetHook();
}
}

@@ -268,2 +272,4 @@

}
// After destroying, reset all hooks!
_defineTestHooks();
}

@@ -500,2 +506,3 @@

window.addEventListener('scroll', trackWindowScroll);
document.body.addEventListener('scroll', trackWindowScroll);
window.addEventListener('resize', trackWindowResize);

@@ -509,2 +516,3 @@ }

window.removeEventListener('scroll', trackWindowScroll);
document.body.removeEventListener('scroll', trackWindowScroll);
window.removeEventListener('resize', trackWindowResize);

@@ -547,2 +555,5 @@ }

/**
* Restore config defaults resets the configs.
*/
function _restoreConfigDefaults() {

@@ -552,2 +563,5 @@ Object.assign(configs, stashedConfigs);

/**
* Inspect config dumps the configuration object.
*/
function _inspectConfig() {

@@ -557,2 +571,9 @@ return configs;

/**
* Used to define hooks that will be invoked at certain times;
* intended for test use only. Note that invoking this fn without
* any arguments will nullify any previously bound hooks (eg. reset
* all of them).
* @param {Object} definitions Hook definitions
*/
function _defineTestHooks(definitions = {}) {

@@ -562,2 +583,3 @@ onShowHook = definitions.onShow || null;

onDestroyHook = definitions.onDestroy || null;
onResetHook = definitions.onReset || null;
}
{
"name": "internetips",
"version": "0.4.2",
"version": "0.4.3",
"description": "A tooltip library without the whole kitchen sink",

@@ -25,3 +25,5 @@ "main": "dist/node/index.js",

"postversion": "git push && git push --tags",
"release-patch": "npm version patch && npm publish"
"release-patch": "npm version patch && npm publish",
"release-minor": "npm version minor && npm publish",
"release-major": "npm version major && npm publish"
},

@@ -28,0 +30,0 @@ "author": "Jon Hartman",

@@ -22,5 +22,5 @@ // var webpack = require('webpack');

'Firefox',
'BS_IE_10',
'BS_IE_11',
'BS_Edge'
// 'BS_IE_10',
// 'BS_IE_11',
// 'BS_Edge'
];

@@ -32,5 +32,5 @@

'Firefox',
'BS_IE_10',
'BS_IE_11',
'BS_Edge'
// 'BS_IE_10',
// 'BS_IE_11',
// 'BS_Edge'
];

@@ -86,10 +86,10 @@ }

// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'coverage', 'BrowserStack'],
reporters: ['mocha', 'coverage'/*, 'BrowserStack'*/],
// BrowserStack configuration (for IE testing)
browserStack: {
name: 'internetips',
username: process.env.BS_USERNAME,
accessKey: process.env.BS_ACCESS_KEY
},
// browserStack: {
// name: 'internetips',
// username: process.env.BS_USERNAME,
// accessKey: process.env.BS_ACCESS_KEY
// },
captureTimeout: 20000,

@@ -123,23 +123,23 @@

},
BS_IE_10: {
base: 'BrowserStack',
browser: 'ie',
browser_version: '10',
os: 'Windows',
os_version: '7'
},
BS_IE_11: {
base: 'BrowserStack',
browser: 'ie',
browser_version: '11',
os: 'Windows',
os_version: '7'
},
BS_Edge: {
base: 'BrowserStack',
browser: 'edge',
browser_version: '14',
os: 'Windows',
os_version: '10'
}
// BS_IE_10: {
// base: 'BrowserStack',
// browser: 'ie',
// browser_version: '10',
// os: 'Windows',
// os_version: '7'
// },
// BS_IE_11: {
// base: 'BrowserStack',
// browser: 'ie',
// browser_version: '11',
// os: 'Windows',
// os_version: '7'
// },
// BS_Edge: {
// base: 'BrowserStack',
// browser: 'edge',
// browser_version: '14',
// os: 'Windows',
// os_version: '10'
// }
},

@@ -146,0 +146,0 @@

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