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.0.3 to 0.0.5

dist/bundled.js

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

@@ -6,6 +6,2 @@ 'use strict';

});
exports.destroy = exports.setConfig = exports.hide = exports.show = undefined;
var _shims = require('./shims');
exports.show = show;

@@ -15,2 +11,4 @@ exports.hide = hide;

exports.destroy = destroy;
exports._restoreConfigDefaults = _restoreConfigDefaults;
exports._inspectConfig = _inspectConfig;

@@ -152,2 +150,15 @@

/**
* Try as much as possible to use a requestAnimationFrame implementation,
* but if unavailable, we don't provide a polyfill and instead just log
* to the console. In other words, conciously do not support browsers
* that don't have this. HOWEVER - the tooltip will still show up positioned
* with 'solid' mode, it just won't follow the mouse.
*/
var _requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function () {
console.warn('tooltips require requestAnimationFrame; `float` will not work.');
};
var _cancelAnimationFrame = window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelRequestAnimationFrame || window.mozCancelAnimationFrame || window.msCancelRequestAnimationFrame || window.msCancelAnimationFrame || function () {};
/**
* Set configuration defaults. If the tooltip node already exists (eg. has been

@@ -211,3 +222,3 @@ * .show()n once), disallow changing configs. Also, since the properties

frameNeedsUpdate = true;
(0, _shims._cancelAnimationFrame)(animationFrame);
_cancelAnimationFrame(animationFrame);
document.removeEventListener('mousemove', trackMousePosition);

@@ -318,3 +329,3 @@ if (tipNode) {

if (isFloating) {
animationFrame = (0, _shims._requestAnimationFrame)(updateTooltip);
animationFrame = _requestAnimationFrame(updateTooltip);
}

@@ -491,2 +502,16 @@ }

pointY = ev.clientY;
}
/**
* Testing purposes only; give a way to introspect. These methods *are* made
* public, but if implementors decide to use them its on them.
*/
var stashedConfigs = JSON.parse(JSON.stringify(configs));
function _restoreConfigDefaults() {
Object.assign(configs, stashedConfigs);
}
function _inspectConfig() {
return configs;
}

@@ -1,8 +0,10 @@

import {
_requestAnimationFrame,
_cancelAnimationFrame
} from './shims';
export {
show,
hide,
setConfig,
destroy,
_restoreConfigDefaults,
_inspectConfig
};
export { show, hide, setConfig, destroy };
var

@@ -121,2 +123,31 @@ containerNode,

/**
* Try as much as possible to use a requestAnimationFrame implementation,
* but if unavailable, we don't provide a polyfill and instead just log
* to the console. In other words, conciously do not support browsers
* that don't have this. HOWEVER - the tooltip will still show up positioned
* with 'solid' mode, it just won't follow the mouse.
*/
const _requestAnimationFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function () {
console.warn(
'tooltips require requestAnimationFrame; `float` will not work.'
);
};
const _cancelAnimationFrame =
window.cancelAnimationFrame ||
window.webkitCancelRequestAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.mozCancelRequestAnimationFrame ||
window.mozCancelAnimationFrame ||
window.msCancelRequestAnimationFrame ||
window.msCancelAnimationFrame ||
function () {};
/**
* Set configuration defaults. If the tooltip node already exists (eg. has been

@@ -466,1 +497,15 @@ * .show()n once), disallow changing configs. Also, since the properties

}
/**
* Testing purposes only; give a way to introspect. These methods *are* made
* public, but if implementors decide to use them its on them.
*/
const stashedConfigs = JSON.parse(JSON.stringify(configs));
function _restoreConfigDefaults() {
Object.assign(configs, stashedConfigs);
}
function _inspectConfig() {
return configs;
}
{
"name": "internetips",
"version": "0.0.3",
"version": "0.0.5",
"description": "A tooltip library without the whole kitchen sink",

@@ -16,5 +16,13 @@ "main": "dist/node/index.js",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel lib/ -d dist/node/ && webpack && node-sass --output ./dist/ ./lib/style.scss",
"start": "webpack-dev-server --open"
"lint": "eslint lib/ test/",
"start": "webpack-dev-server --open",
"test": "karma start ./test/karma.conf.js --single-run",
"test-watch": "karma start ./test/karma.conf.js --log-level debug",
"prepublish": "npm run build",
"prebuild": "npm run test",
"pretest": "npm run lint",
"preversion": "npm run build",
"version": "git add -A dist",
"postversion": "git push && git push --tags"
},

@@ -38,5 +46,17 @@ "author": "Jon Hartman",

"babel-preset-es2015": "6.24.0",
"chai": "3.5.0",
"eslint": "3.18.0",
"istanbul-instrumenter-loader": "^2.0.0",
"karma": "1.5.0",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "1.0.1",
"karma-ie-launcher": "1.0.0",
"karma-mocha": "1.3.0",
"karma-mocha-reporter": "2.2.3",
"karma-webpack": "2.0.3",
"lodash": "4.17.4",
"mocha": "3.2.0",
"node-sass": "4.5.1",
"sinon": "2.1.0",
"webpack": "2.2.1",

@@ -43,0 +63,0 @@ "webpack-dev-server": "2.4.2"

@@ -28,16 +28,29 @@ const webpack = require('webpack');

module.exports = [
// unminified
// _.merge({
// // target: 'web',
// node require-able
// _.merge({}, defaults, {
// target: 'node',
// output: {
// filename: 'bundled.js'
// library: 'internetips',
// libraryTarget: 'commonjs2',
// path: path.resolve(__dirname, 'dist/node'),
// filename: 'index.js'
// }
// }, defaults),
// }),
// minified
// web (attached to window as 'internetips')
_.merge({
// target: 'web',
target: 'web',
output: {
library: 'internetips',
libraryTarget: 'window',
filename: 'bundled.js'
}
}, defaults),
// web minified
_.merge({
target: 'web',
output: {
library: 'internetips',
libraryTarget: 'window',
filename: 'bundled.min.js'

@@ -48,16 +61,3 @@ },

]
}, defaults),
// minified with inline source map
// _.merge({
// output: {
// library: 'internetips',
// libraryTarget: 'window',
// filename: 'bundled.min.mapped.js'
// },
// devtool: 'eval-source-map',
// plugins: [
// new webpack.optimize.UglifyJsPlugin()
// ]
// }, defaults)
}, defaults)
];
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