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

beside

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beside - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

6

__tests__/beside-test.js
'use strict';
jest
.dontMock('../src/js/beside');
.dontMock('../src/beside');
describe('beside', () => {
var beside = require('../src/js/beside');
var instance = require('../src/js/instance');
var beside = require('../src/beside');
var instance = require('../src/instance');

@@ -10,0 +10,0 @@ it('init in instance should called', () => {

'use strict';
jest.dontMock('../src/js/check');
jest.dontMock('../src/check');
describe('event', () => {
var check = require('../src/js/check');
var check = require('../src/check');

@@ -8,0 +8,0 @@ it('check offset', () => {

'use strict';
jest.dontMock('../src/js/dom');
jest.dontMock('../src/dom');
describe('dom', () => {
var dom = require('../src/js/dom');
var dom = require('../src/dom');
var buttonStr = '<button id="button" class="button" style="position: absolute;">';

@@ -8,0 +8,0 @@ var $button;

@@ -5,7 +5,7 @@ 'use strict';

.dontMock('jquery')
.dontMock('../src/js/event');
.dontMock('../src/event');
describe('event', () => {
var $ = require('jquery');
var event = require('../src/js/event');
var event = require('../src/event');

@@ -12,0 +12,0 @@ var buttonStr = '<button id="button" class="button" style="position: absolute;">';

@@ -5,8 +5,8 @@ 'use strict';

.dontMock('jquery')
.dontMock('../src/js/instance');
.dontMock('../src/instance');
describe('beside', () => {
var instance = require('../src/js/instance');
var check = require('../src/js/check');
var setPosition = require('../src/js/set-position');
var instance = require('../src/instance');
var check = require('../src/check');
var setPosition = require('../src/set-position');
var options;

@@ -13,0 +13,0 @@

@@ -5,7 +5,7 @@ 'use strict';

.dontMock('jquery')
.dontMock('../src/js/set-position');
.dontMock('../src/set-position');
describe('beside', () => {
var setPosition = require('../src/js/set-position');
var dom = require('../src/js/dom');
var setPosition = require('../src/set-position');
var dom = require('../src/dom');

@@ -12,0 +12,0 @@ beforeEach(() => {

{
"name": "beside",
"version": "1.0.3",
"version": "1.0.7",
"homepage": "https://github.com/forsigner/beside",

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

@@ -10,3 +10,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var i = Object.create(instance);
i.init(options);
return i.init(options);
}

@@ -175,9 +175,18 @@

$body.appendChild($you);
setPosition(options, $you);
$body.appendChild($you);
function onResize() {
setPosition(options, $you);
}
event.bind(window, 'resize', function () {
setPosition(options, $you);
});
var destroy = function destroy() {
event.unbind(window, 'resize', onResize);
$you.remove();
};
event.bind(window, 'resize', onResize);
return destroy;
}

@@ -184,0 +193,0 @@ };

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

!function e(t,n,i){function o(c,s){if(!n[c]){if(!t[c]){var h="function"==typeof require&&require;if(!s&&h)return h(c,!0);if(r)return r(c,!0);var a=new Error("Cannot find module '"+c+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[c]={exports:{}};t[c][0].call(f.exports,function(e){var n=t[c][1][e];return o(n?n:e)},f,f.exports,e,t,n,i)}return n[c].exports}for(var r="function"==typeof require&&require,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(e,t,n){"use strict";function i(e){var t=Object.create(o);t.init(e)}var o=e("./instance");t.exports={init:i}},{"./instance":6}],2:[function(e,t,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=e("./beside");!function(e){"function"==typeof define&&define.amd?define([],e):"object"===("undefined"==typeof window?"undefined":i(window))&&(window.beside=e())}(function(){return o})},{"./beside":1}],3:[function(e,t,n){"use strict";t.exports={offset:function(e){var t=/^[0-9\-]/,n=e.split(" ");if(2!==n.length||!t.test(n[0])||!t.test(n[1]))throw new Error('value offset invalid, you should set something like "-10px 0"')},where:function(e){if(!e||""===e)throw new Error('value where invalid, you should set something like "top left"');var t=e.split(" ");if(t.length<2||t.length>3)throw new Error('value where invalid, you should set something like "top left"')}}},{}],4:[function(e,t,n){"use strict";function i(e,t){var n=window.getComputedStyle(e)[t];return(parseInt(n,10)||0===parseInt(n,10))&&(n=parseInt(n,10)),n}function o(e,t,n){return"number"==typeof n&&"opacity"!==t&&(n=n.toString()+"px"),e.style[t]=n,e}function r(e,t){for(var n in t){var i=t[n];"number"==typeof i&&"opacity"!==n&&(i=i.toString()+"px"),e.style[n]=i}return e}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s={createElement:function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},appendTo:function(e,t){t.appendChild(e)},addClass:function(e,t){var n=e.className.split(" ");return n.indexOf(t)<0&&n.push(t),e.className=n.join(" "),e},removeClass:function(e,t){var n=e.className.split(" "),i=n.indexOf(t);return i>-1&&n.splice(i,1),e.className=n.join(" "),e},css:function(e,t,n){return"object"===("undefined"==typeof t?"undefined":c(t))?r(e,t):"undefined"==typeof n?i(e,t):o(e,t,n)}};t.exports=s},{}],5:[function(e,t,n){"use strict";var i={bind:function(e,t,n){e.addEventListener(t,n,!1)},unbind:function(e,t,n){e.removeEventListener(t,n,!1)},once:function o(e,t,n){var i=this,o=function r(o){i.unbind(e,t,r),n(o)};i.bind(e,t,o)}};t.exports=i},{}],6:[function(e,t,n){"use strict";var i=e("./event"),o=e("./check"),r=e("./set-position");t.exports={init:function(e){e.offset=e.offset||"0 0",o.offset(e.offset),o.where(e.where);var t=e.you,n=document.body;r(e,t),n.appendChild(t),i.bind(window,"resize",function(){r(e,t)})}}},{"./check":3,"./event":5,"./set-position":7}],7:[function(e,t,n){"use strict";var i=e("./dom"),o=e("./you");e("./event");t.exports=function(e,t){var n=Object.create(o);n.init(e),i.css(t,{position:"absolute",top:n.top+"px",left:n.left+"px",opacity:1})}},{"./dom":4,"./event":5,"./you":8}],8:[function(e,t,n){"use strict";function i(e){var t=e.me,n=e.you,i=n.getBoundingClientRect(),o=t.getBoundingClientRect(),r=o.left+s.x,c=o.top+s.y;switch(e.where){case"top center":c-=i.height,r=r-i.width/2+o.width/2;break;case"top left":c-=i.height;break;case"top right":c-=i.height,r=r-i.width+o.width;break;case"top left diagonal":c-=i.height,r-=i.width;break;case"top right diagonal":c-=i.height,r+=o.width;break;case"bottom center":c+=o.height,r=r-i.width/2+o.width/2;break;case"bottom left":c+=o.height;break;case"bottom right":c+=o.height,r=r-i.width+o.width;break;case"bottom left diagonal":c+=o.height,r-=i.width;break;case"bottom right diagonal":c+=o.height,r+=o.width;break;case"left center":c=c-i.height/2+o.height/2,r-=i.width;break;case"left top":r-=i.width;break;case"left bottom":c=c-i.height+o.height,r-=i.width;break;case"right center":c=c-i.height/2+o.height/2,r+=o.width;break;case"right top":r+=o.width;break;case"right bottom":c=c-i.height+o.height,r+=o.width;break;case"top left inner":break;case"top center inner":r=r-i.width/2+o.width/2;break;case"top right inner":r=r-i.width+o.width;break;case"left center inner":c=c-i.height/2+o.height/2;break;case"left center inner":c=c-i.height/2+o.height/2;break;case"center center inner":c=c-i.height/2+o.height/2,r=r-i.width/2+o.width/2;break;case"right center inner":c=c-i.height/2+o.height/2,r=r-i.width+o.width;break;case"bottom left inner":c=c-i.height+o.height;break;case"bottom center inner":c=c-i.height+o.height,r=r-i.width/2+o.width/2;break;case"bottom right inner":c=c-i.height+o.height,r=r-i.width+o.width}var h=parseInt(e.offset.split(" ")[0],10),a=parseInt(e.offset.split(" ")[1],10);this.top=c+a,this.left=r+h}var o=void 0!==window.pageXOffset,r="CSS1Compat"===(document.compatMode||""),c=e("./event"),s={x:o?window.pageXOffset:r?document.documentElement.scrollLeft:document.body.scrollLeft,y:o?window.pageYOffset:r?document.documentElement.scrollTop:document.body.scrollTop};c.bind(window,"scroll",function(){s={x:o?window.pageXOffset:r?document.documentElement.scrollLeft:document.body.scrollLeft,y:o?window.pageYOffset:r?document.documentElement.scrollTop:document.body.scrollTop}}),t.exports={init:i,left:0,top:0}},{"./event":5}]},{},[2]);
!function e(t,n,i){function o(c,s){if(!n[c]){if(!t[c]){var a="function"==typeof require&&require;if(!s&&a)return a(c,!0);if(r)return r(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var f=n[c]={exports:{}};t[c][0].call(f.exports,function(e){var n=t[c][1][e];return o(n?n:e)},f,f.exports,e,t,n,i)}return n[c].exports}for(var r="function"==typeof require&&require,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(e,t,n){"use strict";function i(e){var t=Object.create(o);return t.init(e)}var o=e("./instance");t.exports={init:i}},{"./instance":6}],2:[function(e,t,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=e("./beside");!function(e){"function"==typeof define&&define.amd?define([],e):"object"===("undefined"==typeof window?"undefined":i(window))&&(window.beside=e())}(function(){return o})},{"./beside":1}],3:[function(e,t,n){"use strict";t.exports={offset:function(e){var t=/^[0-9\-]/,n=e.split(" ");if(2!==n.length||!t.test(n[0])||!t.test(n[1]))throw new Error('value offset invalid, you should set something like "-10px 0"')},where:function(e){if(!e||""===e)throw new Error('value where invalid, you should set something like "top left"');var t=e.split(" ");if(t.length<2||t.length>3)throw new Error('value where invalid, you should set something like "top left"')}}},{}],4:[function(e,t,n){"use strict";function i(e,t){var n=window.getComputedStyle(e)[t];return(parseInt(n,10)||0===parseInt(n,10))&&(n=parseInt(n,10)),n}function o(e,t,n){return"number"==typeof n&&"opacity"!==t&&(n=n.toString()+"px"),e.style[t]=n,e}function r(e,t){for(var n in t){var i=t[n];"number"==typeof i&&"opacity"!==n&&(i=i.toString()+"px"),e.style[n]=i}return e}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s={createElement:function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},appendTo:function(e,t){t.appendChild(e)},addClass:function(e,t){var n=e.className.split(" ");return n.indexOf(t)<0&&n.push(t),e.className=n.join(" "),e},removeClass:function(e,t){var n=e.className.split(" "),i=n.indexOf(t);return i>-1&&n.splice(i,1),e.className=n.join(" "),e},css:function(e,t,n){return"object"===("undefined"==typeof t?"undefined":c(t))?r(e,t):"undefined"==typeof n?i(e,t):o(e,t,n)}};t.exports=s},{}],5:[function(e,t,n){"use strict";var i={bind:function(e,t,n){e.addEventListener(t,n,!1)},unbind:function(e,t,n){e.removeEventListener(t,n,!1)},once:function o(e,t,n){var i=this,o=function r(o){i.unbind(e,t,r),n(o)};i.bind(e,t,o)}};t.exports=i},{}],6:[function(e,t,n){"use strict";var i=e("./event"),o=e("./check"),r=e("./set-position");t.exports={init:function(e){function t(){r(e,n)}e.offset=e.offset||"0 0",o.offset(e.offset),o.where(e.where);var n=e.you,c=document.body;c.appendChild(n),r(e,n);var s=function(){i.unbind(window,"resize",t),n.remove()};return i.bind(window,"resize",t),s}}},{"./check":3,"./event":5,"./set-position":7}],7:[function(e,t,n){"use strict";var i=e("./dom"),o=e("./you");e("./event");t.exports=function(e,t){var n=Object.create(o);n.init(e),i.css(t,{position:"absolute",top:n.top+"px",left:n.left+"px",opacity:1})}},{"./dom":4,"./event":5,"./you":8}],8:[function(e,t,n){"use strict";function i(e){var t=e.me,n=e.you,i=n.getBoundingClientRect(),o=t.getBoundingClientRect(),r=o.left+s.x,c=o.top+s.y;switch(e.where){case"top center":c-=i.height,r=r-i.width/2+o.width/2;break;case"top left":c-=i.height;break;case"top right":c-=i.height,r=r-i.width+o.width;break;case"top left diagonal":c-=i.height,r-=i.width;break;case"top right diagonal":c-=i.height,r+=o.width;break;case"bottom center":c+=o.height,r=r-i.width/2+o.width/2;break;case"bottom left":c+=o.height;break;case"bottom right":c+=o.height,r=r-i.width+o.width;break;case"bottom left diagonal":c+=o.height,r-=i.width;break;case"bottom right diagonal":c+=o.height,r+=o.width;break;case"left center":c=c-i.height/2+o.height/2,r-=i.width;break;case"left top":r-=i.width;break;case"left bottom":c=c-i.height+o.height,r-=i.width;break;case"right center":c=c-i.height/2+o.height/2,r+=o.width;break;case"right top":r+=o.width;break;case"right bottom":c=c-i.height+o.height,r+=o.width;break;case"top left inner":break;case"top center inner":r=r-i.width/2+o.width/2;break;case"top right inner":r=r-i.width+o.width;break;case"left center inner":c=c-i.height/2+o.height/2;break;case"left center inner":c=c-i.height/2+o.height/2;break;case"center center inner":c=c-i.height/2+o.height/2,r=r-i.width/2+o.width/2;break;case"right center inner":c=c-i.height/2+o.height/2,r=r-i.width+o.width;break;case"bottom left inner":c=c-i.height+o.height;break;case"bottom center inner":c=c-i.height+o.height,r=r-i.width/2+o.width/2;break;case"bottom right inner":c=c-i.height+o.height,r=r-i.width+o.width}var a=parseInt(e.offset.split(" ")[0],10),h=parseInt(e.offset.split(" ")[1],10);this.top=c+h,this.left=r+a}var o=void 0!==window.pageXOffset,r="CSS1Compat"===(document.compatMode||""),c=e("./event"),s={x:o?window.pageXOffset:r?document.documentElement.scrollLeft:document.body.scrollLeft,y:o?window.pageYOffset:r?document.documentElement.scrollTop:document.body.scrollTop};c.bind(window,"scroll",function(){s={x:o?window.pageXOffset:r?document.documentElement.scrollLeft:document.body.scrollLeft,y:o?window.pageYOffset:r?document.documentElement.scrollTop:document.body.scrollTop}}),t.exports={init:i,left:0,top:0}},{"./event":5}]},{},[2]);
{
"name": "beside",
"version": "1.0.6",
"version": "1.0.7",
"description": "A UI library to make an element beside another",

@@ -5,0 +5,0 @@ "main": "src/beside.js",

# Beside [![Build Status](https://travis-ci.org/forsigner/beside.svg?branch=master)](https://travis-ci.org/forsigner/beside) [![NPM Version](http://img.shields.io/npm/v/beside.svg?style=flat)](https://www.npmjs.org/package/beside)
A UI library to make an element beside another.
An UI library to make an element beside another.

@@ -5,0 +5,0 @@ ### Demo

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

var i = Object.create(instance);
i.init(options);
return i.init(options);
}

@@ -17,10 +17,19 @@ 'use strict';

$body.appendChild($you);
setPosition(options, $you);
$body.appendChild($you);
function onResize () {
setPosition(options, $you);
}
event.bind(window, 'resize', function () {
setPosition(options, $you);
});
var destroy = function () {
event.unbind(window, 'resize', onResize);
$you.remove();
};
event.bind(window, 'resize', onResize);
return destroy;
}
};
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