Comparing version 8.5.4 to 8.5.5
{ | ||
"name": "frdh/mmenu.js", | ||
"version": "8.5.4", | ||
"version": "8.5.5", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ { |
@@ -1,1 +0,1 @@ | ||
export default '8.5.4'; | ||
export default '8.5.5'; |
@@ -39,11 +39,11 @@ import Mmenu from './../oncanvas/mmenu.oncanvas'; | ||
// Make sure to tell the browser the event will be prevented. | ||
passive: false | ||
passive: false, | ||
}); | ||
// Prevent the page from scrolling when dragging in the menu. | ||
this.node.menu.addEventListener('touchmove', function (evnt) { | ||
var panel = evnt.target.closest('.mm-panel'); | ||
if (panel) { | ||
var wrapper = evnt.target.closest('.mm-panel, .mm-iconbar__top, .mm-iconbar__bottom'); | ||
if (wrapper) { | ||
// When dragging a non-scrollable panel, | ||
// we can simple preventDefault and stopPropagation. | ||
if (panel.scrollHeight === panel.offsetHeight) { | ||
if (wrapper.scrollHeight === wrapper.offsetHeight) { | ||
stop(evnt); | ||
@@ -58,6 +58,6 @@ } | ||
// When scrolled up and dragging down | ||
(panel.scrollTop == 0 && touchDir.get() == 'down') || | ||
(wrapper.scrollTop == 0 && touchDir.get() == 'down') || | ||
// When scrolled down and dragging up | ||
(panel.scrollHeight == | ||
panel.scrollTop + panel.offsetHeight && | ||
(wrapper.scrollHeight == | ||
wrapper.scrollTop + wrapper.offsetHeight && | ||
touchDir.get() == 'up')) { | ||
@@ -73,3 +73,3 @@ stop(evnt); | ||
// Make sure to tell the browser the event can be prevented. | ||
passive: false | ||
passive: false, | ||
}); | ||
@@ -76,0 +76,0 @@ // Some small additional improvements |
{ | ||
"name": "mmenu-js", | ||
"version": "8.5.4", | ||
"version": "8.5.5", | ||
"main": "dist/mmenu.js", | ||
@@ -5,0 +5,0 @@ "module": "src/mmenu.js", |
@@ -1,1 +0,1 @@ | ||
export default '8.5.4'; | ||
export default '8.5.5'; |
@@ -11,4 +11,4 @@ import Mmenu from '../../core/oncanvas/mmenu.oncanvas'; | ||
export default function(this: Mmenu) { | ||
var options = extendShorthandOptions(this.opts.iconbar); | ||
export default function (this: Mmenu) { | ||
let options = extendShorthandOptions(this.opts.iconbar); | ||
this.opts.iconbar = extend(options, Mmenu.options.iconbar); | ||
@@ -20,6 +20,6 @@ | ||
var iconbar: HTMLElement; | ||
let iconbar: HTMLElement; | ||
['top', 'bottom'].forEach((position, n) => { | ||
var ctnt = options[position]; | ||
let ctnt = options[position]; | ||
@@ -32,3 +32,3 @@ // Extend shorthand options | ||
// Create node | ||
var part = DOM.create('div.mm-iconbar__' + position); | ||
const part = DOM.create('div.mm-iconbar__' + position); | ||
@@ -79,4 +79,4 @@ // Add content | ||
iconbar.classList.add('mm-iconbar_tabs'); | ||
iconbar.addEventListener('click', evnt => { | ||
var anchor = evnt.target as HTMLElement; | ||
iconbar.addEventListener('click', (evnt) => { | ||
const anchor = evnt.target as HTMLElement; | ||
@@ -93,3 +93,3 @@ if (!anchor.matches('a')) { | ||
try { | ||
var panel = this.node.menu.querySelector( | ||
const panel = this.node.menu.querySelector( | ||
anchor.getAttribute('href') | ||
@@ -108,3 +108,3 @@ )[0]; | ||
const selectTab = (panel: HTMLElement) => { | ||
DOM.find(iconbar, 'a').forEach(anchor => { | ||
DOM.find(iconbar, 'a').forEach((anchor) => { | ||
anchor.classList.remove('mm-iconbar__tab_selected'); | ||
@@ -111,0 +111,0 @@ }); |
@@ -11,3 +11,3 @@ import Mmenu from './../oncanvas/mmenu.oncanvas'; | ||
export default function(this: Mmenu) { | ||
export default function (this: Mmenu) { | ||
// The scrollBugFix add-on fixes a scrolling bug | ||
@@ -47,3 +47,3 @@ // 1) on touch devices | ||
// Make sure to tell the browser the event will be prevented. | ||
passive: false | ||
passive: false, | ||
}); | ||
@@ -54,11 +54,11 @@ | ||
'touchmove', | ||
evnt => { | ||
var panel = (evnt.target as HTMLElement).closest( | ||
'.mm-panel' | ||
(evnt) => { | ||
let wrapper = (evnt.target as HTMLElement).closest( | ||
'.mm-panel, .mm-iconbar__top, .mm-iconbar__bottom' | ||
) as HTMLElement; | ||
if (panel) { | ||
if (wrapper) { | ||
// When dragging a non-scrollable panel, | ||
// we can simple preventDefault and stopPropagation. | ||
if (panel.scrollHeight === panel.offsetHeight) { | ||
if (wrapper.scrollHeight === wrapper.offsetHeight) { | ||
stop(evnt); | ||
@@ -74,6 +74,6 @@ } | ||
// When scrolled up and dragging down | ||
(panel.scrollTop == 0 && touchDir.get() == 'down') || | ||
(wrapper.scrollTop == 0 && touchDir.get() == 'down') || | ||
// When scrolled down and dragging up | ||
(panel.scrollHeight == | ||
panel.scrollTop + panel.offsetHeight && | ||
(wrapper.scrollHeight == | ||
wrapper.scrollTop + wrapper.offsetHeight && | ||
touchDir.get() == 'up') | ||
@@ -91,3 +91,3 @@ ) { | ||
// Make sure to tell the browser the event can be prevented. | ||
passive: false | ||
passive: false, | ||
} | ||
@@ -107,3 +107,3 @@ ); | ||
// Fix issue after device rotation change. | ||
window.addEventListener('orientationchange', evnt => { | ||
window.addEventListener('orientationchange', (evnt) => { | ||
var panel = DOM.children(this.node.pnls, '.mm-panel_opened')[0]; | ||
@@ -110,0 +110,0 @@ if (panel) { |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
740523