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

ay-menu-button

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ay-menu-button - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

3

dist-es6/manager.d.ts

@@ -8,2 +8,3 @@ /*! Copyright 2016 Ayogo Health Inc. */

private static transitionEndHandler;
private static scrollJack;
static readonly open: boolean;

@@ -20,2 +21,4 @@ static openMenu(btn: HTMLButtonElement, mnu: HTMLMenuElement, focus?: boolean): void;

private static menuKeypressListener(e);
private static getScrollOffset();
private static blockScrolling(offset);
}

@@ -17,3 +17,5 @@ /*! Copyright 2016 Ayogo Health Inc. */

this.curButton.parentNode.insertBefore(this.curMenu, this.curButton.nextSibling);
let offset = this.getScrollOffset();
this.addMenuStyle();
this.scrollJack = this.blockScrolling(offset);
if (focus) {

@@ -36,2 +38,5 @@ this.focusMenu();

this.curMenu.removeEventListener('click', this.menuClickListener);
if (this.scrollJack) {
this.scrollJack();
}
let oldMenu = this.curMenu;

@@ -91,3 +96,3 @@ this.transitionEndHandler = () => {

let length = this.curMenu.children.length;
let mi = this.curMenu.children[this.focusCount % length];
let mi = this.curMenu.children[(this.focusCount || 0) % length];
if (!mi.hasAttribute('disabled')) {

@@ -197,3 +202,5 @@ mi.click();

e.stopPropagation();
MenuManager.focusCount--;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount--;
}
MenuManager.focusMenu();

@@ -204,3 +211,5 @@ }

e.stopPropagation();
MenuManager.focusCount++;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount++;
}
MenuManager.focusMenu();

@@ -214,2 +223,41 @@ }

}
static getScrollOffset() {
let doc = this.curButton.ownerDocument;
if (doc.body.style.top) {
return Math.abs(parseInt(doc.body.style.top, 10));
}
if (doc.scrollingElement) {
return doc.scrollingElement.scrollTop;
}
else {
return doc.documentElement.scrollTop + doc.body.scrollTop;
}
}
static blockScrolling(offset) {
let doc = this.curButton.ownerDocument;
let htmlNode = doc.documentElement;
let clientWidth = doc.body.clientWidth;
if (doc.body.scrollHeight > htmlNode.clientHeight) {
doc.body.style.position = 'fixed';
doc.body.style.width = '100%';
doc.body.style.top = -offset + 'px';
htmlNode.style.overflowY = 'scroll';
}
if (doc.body.clientWidth < clientWidth) {
doc.body.style.overflow = 'hidden';
}
return function () {
doc.body.style.position = null;
doc.body.style.width = null;
doc.body.style.top = null;
doc.body.style.overflow = null;
htmlNode.style.overflowY = null;
if (doc.scrollingElement) {
doc.scrollingElement.scrollTop = offset;
}
else {
scrollTo(0, offset);
}
};
}
}

@@ -221,2 +269,3 @@ MenuManager.curMenu = null;

MenuManager.transitionEndHandler = null;
MenuManager.scrollJack = null;
//# sourceMappingURL=manager.js.map
/*! Copyright 2017 Ayogo Health Inc. */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('angular')) :
typeof define === 'function' && define.amd ? define(['angular'], factory) :
(global.ayMenuButton = factory(global.angular));
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('angular')) :
typeof define === 'function' && define.amd ? define(['angular'], factory) :
(global.ayMenuButton = factory(global.angular));
}(this, (function (angular) { 'use strict';

@@ -30,3 +30,5 @@

this.curButton.parentNode.insertBefore(this.curMenu, this.curButton.nextSibling);
var offset = this.getScrollOffset();
this.addMenuStyle();
this.scrollJack = this.blockScrolling(offset);
if (focus) {

@@ -50,2 +52,5 @@ this.focusMenu();

this.curMenu.removeEventListener('click', this.menuClickListener);
if (this.scrollJack) {
this.scrollJack();
}
var oldMenu = this.curMenu;

@@ -105,3 +110,3 @@ this.transitionEndHandler = function () {

var length = this.curMenu.children.length;
var mi = this.curMenu.children[this.focusCount % length];
var mi = this.curMenu.children[(this.focusCount || 0) % length];
if (!mi.hasAttribute('disabled')) {

@@ -211,3 +216,5 @@ mi.click();

e.stopPropagation();
MenuManager.focusCount--;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount--;
}
MenuManager.focusMenu();

@@ -218,3 +225,5 @@ }

e.stopPropagation();
MenuManager.focusCount++;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount++;
}
MenuManager.focusMenu();

@@ -228,2 +237,41 @@ }

};
MenuManager.getScrollOffset = function () {
var doc = this.curButton.ownerDocument;
if (doc.body.style.top) {
return Math.abs(parseInt(doc.body.style.top, 10));
}
if (doc.scrollingElement) {
return doc.scrollingElement.scrollTop;
}
else {
return doc.documentElement.scrollTop + doc.body.scrollTop;
}
};
MenuManager.blockScrolling = function (offset) {
var doc = this.curButton.ownerDocument;
var htmlNode = doc.documentElement;
var clientWidth = doc.body.clientWidth;
if (doc.body.scrollHeight > htmlNode.clientHeight) {
doc.body.style.position = 'fixed';
doc.body.style.width = '100%';
doc.body.style.top = -offset + 'px';
htmlNode.style.overflowY = 'scroll';
}
if (doc.body.clientWidth < clientWidth) {
doc.body.style.overflow = 'hidden';
}
return function () {
doc.body.style.position = null;
doc.body.style.width = null;
doc.body.style.top = null;
doc.body.style.overflow = null;
htmlNode.style.overflowY = null;
if (doc.scrollingElement) {
doc.scrollingElement.scrollTop = offset;
}
else {
scrollTo(0, offset);
}
};
};
return MenuManager;

@@ -236,2 +284,3 @@ }());

MenuManager.transitionEndHandler = null;
MenuManager.scrollJack = null;

@@ -238,0 +287,0 @@ var MenuButtonBehaviour = (function () {

/*! Copyright 2017 Ayogo Health Inc. */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.MenuButton = factory());
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.MenuButton = factory());
}(this, (function () { 'use strict';

@@ -30,3 +30,5 @@

this.curButton.parentNode.insertBefore(this.curMenu, this.curButton.nextSibling);
var offset = this.getScrollOffset();
this.addMenuStyle();
this.scrollJack = this.blockScrolling(offset);
if (focus) {

@@ -50,2 +52,5 @@ this.focusMenu();

this.curMenu.removeEventListener('click', this.menuClickListener);
if (this.scrollJack) {
this.scrollJack();
}
var oldMenu = this.curMenu;

@@ -105,3 +110,3 @@ this.transitionEndHandler = function () {

var length = this.curMenu.children.length;
var mi = this.curMenu.children[this.focusCount % length];
var mi = this.curMenu.children[(this.focusCount || 0) % length];
if (!mi.hasAttribute('disabled')) {

@@ -211,3 +216,5 @@ mi.click();

e.stopPropagation();
MenuManager.focusCount--;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount--;
}
MenuManager.focusMenu();

@@ -218,3 +225,5 @@ }

e.stopPropagation();
MenuManager.focusCount++;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount++;
}
MenuManager.focusMenu();

@@ -228,2 +237,41 @@ }

};
MenuManager.getScrollOffset = function () {
var doc = this.curButton.ownerDocument;
if (doc.body.style.top) {
return Math.abs(parseInt(doc.body.style.top, 10));
}
if (doc.scrollingElement) {
return doc.scrollingElement.scrollTop;
}
else {
return doc.documentElement.scrollTop + doc.body.scrollTop;
}
};
MenuManager.blockScrolling = function (offset) {
var doc = this.curButton.ownerDocument;
var htmlNode = doc.documentElement;
var clientWidth = doc.body.clientWidth;
if (doc.body.scrollHeight > htmlNode.clientHeight) {
doc.body.style.position = 'fixed';
doc.body.style.width = '100%';
doc.body.style.top = -offset + 'px';
htmlNode.style.overflowY = 'scroll';
}
if (doc.body.clientWidth < clientWidth) {
doc.body.style.overflow = 'hidden';
}
return function () {
doc.body.style.position = null;
doc.body.style.width = null;
doc.body.style.top = null;
doc.body.style.overflow = null;
htmlNode.style.overflowY = null;
if (doc.scrollingElement) {
doc.scrollingElement.scrollTop = offset;
}
else {
scrollTo(0, offset);
}
};
};
return MenuManager;

@@ -236,2 +284,3 @@ }());

MenuManager.transitionEndHandler = null;
MenuManager.scrollJack = null;

@@ -238,0 +287,0 @@ var MenuButtonBehaviour = (function () {

8

package.json
{
"name": "ay-menu-button",
"version": "1.0.1",
"version": "1.0.2",
"copyright": "Copyright 2016 Ayogo Health Inc.",

@@ -33,6 +33,6 @@ "license": "MIT",

"angular": "^1.5.8",
"rollup": "^0.40.2",
"rollup-plugin-cleanup": "^0.1.4",
"rollup": "^0.41.4",
"rollup-plugin-cleanup": "^1.0.0",
"rollup-plugin-sourcemaps": "^0.4.1",
"typescript": "^2.1.1"
"typescript": "^2.3.1"
},

@@ -39,0 +39,0 @@ "scripts": {

@@ -9,2 +9,3 @@ /*! Copyright 2016 Ayogo Health Inc. */

private static transitionEndHandler : (() => void) | null = null;
private static scrollJack : (() => void) | null = null;

@@ -18,3 +19,3 @@

if (this.transitionEndHandler !== null) {
this.transitionEndHandler!();
this.transitionEndHandler();
}

@@ -34,4 +35,8 @@

let offset = this.getScrollOffset();
this.addMenuStyle();
this.scrollJack = this.blockScrolling(offset);
if (focus) {

@@ -60,2 +65,6 @@ this.focusMenu();

if (this.scrollJack) {
this.scrollJack();
}
let oldMenu = this.curMenu;

@@ -130,3 +139,3 @@ this.transitionEndHandler = () => {

let length = this.curMenu.children.length;
let mi = this.curMenu.children[this.focusCount % length] as HTMLElement;
let mi = this.curMenu.children[(this.focusCount || 0) % length] as HTMLElement;

@@ -276,3 +285,5 @@ if (!mi.hasAttribute('disabled')) {

MenuManager.focusCount--;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount--;
}
MenuManager.focusMenu();

@@ -286,3 +297,5 @@ }

MenuManager.focusCount++;
if (MenuManager.focusCount !== null) {
MenuManager.focusCount++;
}
MenuManager.focusMenu();

@@ -300,2 +313,50 @@ }

}
private static getScrollOffset() {
let doc = this.curButton!.ownerDocument;
if (doc.body.style.top) {
return Math.abs(parseInt(doc.body.style.top, 10));
}
if (doc.scrollingElement) {
return doc.scrollingElement.scrollTop;
} else {
return doc.documentElement.scrollTop + doc.body.scrollTop;
}
}
private static blockScrolling(offset : number) {
let doc = this.curButton!.ownerDocument;
let htmlNode = doc.documentElement;
let clientWidth = doc.body.clientWidth;
if (doc.body.scrollHeight > htmlNode.clientHeight) {
doc.body.style.position = 'fixed';
doc.body.style.width = '100%';
doc.body.style.top = -offset + 'px';
htmlNode.style.overflowY = 'scroll';
}
if (doc.body.clientWidth < clientWidth) {
doc.body.style.overflow = 'hidden';
}
return function() {
doc.body.style.position = null;
doc.body.style.width = null;
doc.body.style.top = null;
doc.body.style.overflow = null;
htmlNode.style.overflowY = null;
if (doc.scrollingElement) {
doc.scrollingElement.scrollTop = offset;
} else {
scrollTo(0, offset);
}
};
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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