mmenu-js
Advanced tools
Comparing version 8.5.3 to 8.5.4
{ | ||
"name" : "frdh/mmenu.js", | ||
"version" : "8.5.3", | ||
"authors" : [{ | ||
"name" : "Fred Heusschen", | ||
"email" : "info@frebsite.nl", | ||
"homepage" : "http://www.frebsite.nl", | ||
"role" : "King :)" | ||
}], | ||
"license" : "CC-BY-NC-4.0", | ||
"description" : "The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.", | ||
"keywords" : [ | ||
"app", | ||
"list", | ||
"listview", | ||
"megamenu", | ||
"menu", | ||
"mmenu", | ||
"mobile", | ||
"navigation", | ||
"off-canvas", | ||
"on-canvas", | ||
"curtain", | ||
"panels", | ||
"submenu" | ||
] | ||
"name": "frdh/mmenu.js", | ||
"version": "8.5.4", | ||
"authors": [ | ||
{ | ||
"name": "Fred Heusschen", | ||
"email": "info@frebsite.nl", | ||
"homepage": "http://www.frebsite.nl", | ||
"role": "King :)" | ||
} | ||
], | ||
"license": "CC-BY-NC-4.0", | ||
"description": "The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.", | ||
"keywords": [ | ||
"app", | ||
"list", | ||
"listview", | ||
"megamenu", | ||
"menu", | ||
"mmenu", | ||
"mobile", | ||
"navigation", | ||
"off-canvas", | ||
"on-canvas", | ||
"curtain", | ||
"panels", | ||
"submenu" | ||
] | ||
} |
@@ -1,1 +0,1 @@ | ||
export default '8.5.3'; | ||
export default '8.5.4'; |
@@ -14,3 +14,3 @@ import Mmenu from '../../core/oncanvas/mmenu.oncanvas'; | ||
// Prevent all sub panels from being initialized. | ||
this.bind('initMenu:after', function () { | ||
this.bind('initPanels:before', function () { | ||
var panels = []; | ||
@@ -30,3 +30,3 @@ // Find all potential subpanels. | ||
'mm-nolistview', | ||
'mm-nopanel' | ||
'mm-nopanel', | ||
]; | ||
@@ -41,31 +41,4 @@ // IE11: | ||
}); | ||
// Prepare current and one level sub panels for initPanels | ||
// re-enable the default opened panel to be initialized. | ||
this.bind('initPanels:before', function () { | ||
var panels = DOM.children(_this.node.pnls, _this.conf.panelNodetype.join(', ')); | ||
panels.forEach(function (panel) { | ||
var filter = '.mm-panel_lazysubmenu', children = DOM.find(panel, filter); | ||
if (panel.matches(filter)) { | ||
children.unshift(panel); | ||
} | ||
children | ||
.filter(function (child) { | ||
return !child.matches('.mm-panel_lazysubmenu .mm-panel_lazysubmenu'); | ||
}) | ||
.forEach(function (child) { | ||
var classnames = [ | ||
'mm-panel_lazysubmenu', | ||
'mm-nolistview', | ||
'mm-nopanel' | ||
]; | ||
// IE11: | ||
classnames.forEach(function (classname) { | ||
child.classList.remove(classname); | ||
}); | ||
// Better browsers: | ||
// child.classList.remove(...classnames); | ||
}); | ||
}); | ||
}); | ||
// initPanels for the default opened panel | ||
this.bind('initOpened:before', function () { | ||
var panels = []; | ||
@@ -77,6 +50,7 @@ DOM.find(_this.node.pnls, '.' + _this.conf.classNames.selected).forEach(function (listitem) { | ||
panels.forEach(function (panel) { | ||
console.log(panel); | ||
var classnames = [ | ||
'mm-panel_lazysubmenu', | ||
'mm-nolistview', | ||
'mm-nopanel' | ||
'mm-nopanel', | ||
]; | ||
@@ -90,15 +64,24 @@ // IE11: | ||
}); | ||
_this.initPanel(panels[panels.length - 1]); | ||
} | ||
}); | ||
// initPanels for current- and sub panels before openPanel | ||
// initPanel for current- and sub panels before openPanel | ||
this.bind('openPanel:before', function (panel) { | ||
var filter = '.mm-panel_lazysubmenu', panels = DOM.find(panel, filter); | ||
if (panel.matches(filter)) { | ||
var panels = DOM.find(panel, '.mm-panel_lazysubmenu').filter(function (panel) { | ||
return !panel.matches('.mm-panel_lazysubmenu .mm-panel_lazysubmenu'); | ||
}); | ||
if (panel.matches('.mm-panel_lazysubmenu')) { | ||
panels.unshift(panel); | ||
} | ||
panels = panels.filter(function (panel) { | ||
return !panel.matches('.mm-panel_lazysubmenu .mm-panel_lazysubmenu'); | ||
}); | ||
panels.forEach(function (panel) { | ||
var classnames = [ | ||
'mm-panel_lazysubmenu', | ||
'mm-nolistview', | ||
'mm-nopanel', | ||
]; | ||
// IE11: | ||
classnames.forEach(function (classname) { | ||
panel.classList.remove(classname); | ||
}); | ||
// Better browsers: | ||
// child.classList.remove(...classnames); | ||
_this.initPanel(panel); | ||
@@ -105,0 +88,0 @@ }); |
@@ -8,3 +8,3 @@ import version from '../../_version'; | ||
import * as media from '../../_modules/matchmedia'; | ||
import { type, extend, transitionend, uniqueId, valueOrFn } from '../../_modules/helpers'; | ||
import { type, extend, transitionend, uniqueId, valueOrFn, } from '../../_modules/helpers'; | ||
// Add the translations. | ||
@@ -34,3 +34,3 @@ translate(); | ||
'closeAllPanels', | ||
'setSelected' | ||
'setSelected', | ||
]; | ||
@@ -344,3 +344,3 @@ // Storage objects for nodes, variables, hooks and click handlers. | ||
this.opts.extensions = { | ||
all: this.opts.extensions | ||
all: this.opts.extensions, | ||
}; | ||
@@ -711,3 +711,3 @@ } | ||
toExternal: target.matches('[rel="external"]') || | ||
target.matches('[target="_blank"]') | ||
target.matches('[target="_blank"]'), | ||
}; | ||
@@ -717,3 +717,3 @@ var onClick = { | ||
setSelected: null, | ||
preventDefault: target.getAttribute('href').slice(0, 1) == '#' | ||
preventDefault: target.getAttribute('href').slice(0, 1) == '#', | ||
}; | ||
@@ -720,0 +720,0 @@ // Find hooked behavior. |
{ | ||
"name": "mmenu-js", | ||
"version": "8.5.3", | ||
"main": "dist/mmenu.js", | ||
"module": "src/mmenu.js", | ||
"author": "Fred Heusschen <info@frebsite.nl>", | ||
"license": "CC-BY-NC-4.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/FrDH/mmenu-js.git" | ||
}, | ||
"description": "The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.", | ||
"keywords": [ | ||
"app", | ||
"list", | ||
"listview", | ||
"megamenu", | ||
"menu", | ||
"mmenu", | ||
"mobile", | ||
"navigation", | ||
"off-canvas", | ||
"on-canvas", | ||
"curtain", | ||
"panels", | ||
"submenu" | ||
], | ||
"scripts": { | ||
"build": "gulp default" | ||
}, | ||
"devDependencies": { | ||
"gulp": "^4.0.2", | ||
"gulp-autoprefixer": "^6.1.0", | ||
"gulp-clean-css": "^4.2.0", | ||
"gulp-concat": "^2.6.1", | ||
"gulp-sass": "^4.0.2", | ||
"gulp-typescript": "^5.0.1", | ||
"typescript": "^3.4.5", | ||
"webpack-stream": "^5.2.1" | ||
} | ||
"name": "mmenu-js", | ||
"version": "8.5.4", | ||
"main": "dist/mmenu.js", | ||
"module": "src/mmenu.js", | ||
"author": "Fred Heusschen <info@frebsite.nl>", | ||
"license": "CC-BY-NC-4.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/FrDH/mmenu-js.git" | ||
}, | ||
"description": "The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.", | ||
"keywords": [ | ||
"app", | ||
"list", | ||
"listview", | ||
"megamenu", | ||
"menu", | ||
"mmenu", | ||
"mobile", | ||
"navigation", | ||
"off-canvas", | ||
"on-canvas", | ||
"curtain", | ||
"panels", | ||
"submenu" | ||
], | ||
"scripts": { | ||
"build": "gulp default" | ||
}, | ||
"devDependencies": { | ||
"gulp": "^4.0.2", | ||
"gulp-autoprefixer": "^6.1.0", | ||
"gulp-clean-css": "^4.2.0", | ||
"gulp-concat": "^2.6.1", | ||
"gulp-sass": "^4.0.2", | ||
"gulp-typescript": "^5.0.1", | ||
"typescript": "^3.4.5", | ||
"webpack-stream": "^5.2.1" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
export default '8.5.3'; | ||
export default '8.5.4'; |
@@ -10,3 +10,3 @@ import Mmenu from '../../core/oncanvas/mmenu.oncanvas'; | ||
export default function(this: Mmenu) { | ||
export default function (this: Mmenu) { | ||
var options = extendShorthandOptions(this.opts.lazySubmenus); | ||
@@ -17,7 +17,7 @@ this.opts.lazySubmenus = extend(options, Mmenu.options.lazySubmenus); | ||
// Prevent all sub panels from being initialized. | ||
this.bind('initMenu:after', () => { | ||
this.bind('initPanels:before', () => { | ||
var panels: HTMLElement[] = []; | ||
// Find all potential subpanels. | ||
DOM.find(this.node.pnls, 'li').forEach(listitem => { | ||
DOM.find(this.node.pnls, 'li').forEach((listitem) => { | ||
panels.push( | ||
@@ -33,14 +33,14 @@ ...DOM.children( | ||
panels | ||
.filter(panel => !panel.matches('.mm-listview_inset')) | ||
.filter(panel => !panel.matches('.mm-nolistview')) | ||
.filter(panel => !panel.matches('.mm-nopanel')) | ||
.forEach(panel => { | ||
.filter((panel) => !panel.matches('.mm-listview_inset')) | ||
.filter((panel) => !panel.matches('.mm-nolistview')) | ||
.filter((panel) => !panel.matches('.mm-nopanel')) | ||
.forEach((panel) => { | ||
var classnames = [ | ||
'mm-panel_lazysubmenu', | ||
'mm-nolistview', | ||
'mm-nopanel' | ||
'mm-nopanel', | ||
]; | ||
// IE11: | ||
classnames.forEach(classname => { | ||
classnames.forEach((classname) => { | ||
panel.classList.add(classname); | ||
@@ -54,43 +54,4 @@ }); | ||
// Prepare current and one level sub panels for initPanels | ||
// re-enable the default opened panel to be initialized. | ||
this.bind('initPanels:before', () => { | ||
const panels = DOM.children( | ||
this.node.pnls, | ||
this.conf.panelNodetype.join(', ') | ||
); | ||
panels.forEach(panel => { | ||
var filter = '.mm-panel_lazysubmenu', | ||
children = DOM.find(panel, filter); | ||
if (panel.matches(filter)) { | ||
children.unshift(panel); | ||
} | ||
children | ||
.filter( | ||
child => | ||
!child.matches( | ||
'.mm-panel_lazysubmenu .mm-panel_lazysubmenu' | ||
) | ||
) | ||
.forEach(child => { | ||
let classnames = [ | ||
'mm-panel_lazysubmenu', | ||
'mm-nolistview', | ||
'mm-nopanel' | ||
]; | ||
// IE11: | ||
classnames.forEach(classname => { | ||
child.classList.remove(classname); | ||
}); | ||
// Better browsers: | ||
// child.classList.remove(...classnames); | ||
}); | ||
}); | ||
}); | ||
// initPanels for the default opened panel | ||
this.bind('initOpened:before', () => { | ||
var panels: HTMLElement[] = []; | ||
@@ -100,3 +61,3 @@ DOM.find( | ||
'.' + this.conf.classNames.selected | ||
).forEach(listitem => { | ||
).forEach((listitem) => { | ||
panels.push(...DOM.parents(listitem, '.mm-panel_lazysubmenu')); | ||
@@ -106,11 +67,12 @@ }); | ||
if (panels.length) { | ||
panels.forEach(panel => { | ||
panels.forEach((panel) => { | ||
console.log(panel); | ||
let classnames = [ | ||
'mm-panel_lazysubmenu', | ||
'mm-nolistview', | ||
'mm-nopanel' | ||
'mm-nopanel', | ||
]; | ||
// IE11: | ||
classnames.forEach(classname => { | ||
classnames.forEach((classname) => { | ||
panel.classList.remove(classname); | ||
@@ -122,15 +84,9 @@ }); | ||
}); | ||
this.initPanel(panels[panels.length - 1]); | ||
} | ||
}); | ||
// initPanels for current- and sub panels before openPanel | ||
// initPanel for current- and sub panels before openPanel | ||
this.bind('openPanel:before', (panel: HTMLElement) => { | ||
var filter = '.mm-panel_lazysubmenu', | ||
panels = DOM.find(panel, filter); | ||
if (panel.matches(filter)) { | ||
panels.unshift(panel); | ||
} | ||
panels = panels.filter( | ||
panel => | ||
let panels = DOM.find(panel, '.mm-panel_lazysubmenu').filter( | ||
(panel) => | ||
!panel.matches( | ||
@@ -141,3 +97,21 @@ '.mm-panel_lazysubmenu .mm-panel_lazysubmenu' | ||
panels.forEach(panel => { | ||
if (panel.matches('.mm-panel_lazysubmenu')) { | ||
panels.unshift(panel); | ||
} | ||
panels.forEach((panel) => { | ||
const classnames = [ | ||
'mm-panel_lazysubmenu', | ||
'mm-nolistview', | ||
'mm-nopanel', | ||
]; | ||
// IE11: | ||
classnames.forEach((classname) => { | ||
panel.classList.remove(classname); | ||
}); | ||
// Better browsers: | ||
// child.classList.remove(...classnames); | ||
this.initPanel(panel); | ||
@@ -144,0 +118,0 @@ }); |
@@ -13,3 +13,3 @@ import version from '../../_version'; | ||
uniqueId, | ||
valueOrFn | ||
valueOrFn, | ||
} from '../../_modules/helpers'; | ||
@@ -125,3 +125,3 @@ | ||
'closeAllPanels', | ||
'setSelected' | ||
'setSelected', | ||
]; | ||
@@ -188,5 +188,5 @@ | ||
// Open current and all vertical parent panels. | ||
DOM.parents(panel, '.mm-listitem_vertical').forEach(listitem => { | ||
DOM.parents(panel, '.mm-listitem_vertical').forEach((listitem) => { | ||
listitem.classList.add('mm-listitem_opened'); | ||
DOM.children(listitem, '.mm-panel').forEach(panel => { | ||
DOM.children(listitem, '.mm-panel').forEach((panel) => { | ||
panel.classList.remove('mm-hidden'); | ||
@@ -198,3 +198,3 @@ }); | ||
let parents = DOM.parents(panel, '.mm-panel').filter( | ||
panel => !panel.parentElement.matches('.mm-listitem_vertical') | ||
(panel) => !panel.parentElement.matches('.mm-listitem_vertical') | ||
); | ||
@@ -221,4 +221,4 @@ | ||
panels | ||
.filter(parent => parent !== panel) | ||
.forEach(parent => { | ||
.filter((parent) => parent !== panel) | ||
.forEach((parent) => { | ||
parent.classList.remove('mm-panel_opened-parent'); | ||
@@ -242,3 +242,3 @@ }); | ||
// Add classes for animation. | ||
panels.forEach(panel => { | ||
panels.forEach((panel) => { | ||
panel.classList.remove('mm-panel_highest'); | ||
@@ -248,5 +248,5 @@ }); | ||
panels | ||
.filter(hidden => hidden !== current) | ||
.filter(hidden => hidden !== panel) | ||
.forEach(hidden => { | ||
.filter((hidden) => hidden !== current) | ||
.filter((hidden) => hidden !== panel) | ||
.forEach((hidden) => { | ||
hidden.classList.add('mm-hidden'); | ||
@@ -349,3 +349,3 @@ }); | ||
let listitems = this.node.pnls.querySelectorAll('.mm-listitem'); | ||
listitems.forEach(listitem => { | ||
listitems.forEach((listitem) => { | ||
listitem.classList.remove('mm-listitem_selected'); | ||
@@ -359,3 +359,3 @@ listitem.classList.remove('mm-listitem_opened'); | ||
DOM.children(this.node.pnls, '.mm-panel').forEach(panel => { | ||
DOM.children(this.node.pnls, '.mm-panel').forEach((panel) => { | ||
if (panel !== opened) { | ||
@@ -402,3 +402,3 @@ panel.classList.remove('mm-panel_opened'); | ||
// First, remove the selected class from all listitems. | ||
DOM.find(this.node.menu, '.mm-listitem_selected').forEach(li => { | ||
DOM.find(this.node.menu, '.mm-listitem_selected').forEach((li) => { | ||
li.classList.remove('mm-listitem_selected'); | ||
@@ -450,4 +450,4 @@ }); | ||
this._api.forEach(fn => { | ||
this.API[fn] = function() { | ||
this._api.forEach((fn) => { | ||
this.API[fn] = function () { | ||
var re = that[fn].apply(that, arguments); // 1) | ||
@@ -514,3 +514,3 @@ return typeof re == 'undefined' ? that.API : re; | ||
this.opts.extensions = { | ||
all: this.opts.extensions | ||
all: this.opts.extensions, | ||
}; | ||
@@ -520,5 +520,5 @@ } | ||
// Loop over object. | ||
Object.keys(this.opts.extensions).forEach(query => { | ||
Object.keys(this.opts.extensions).forEach((query) => { | ||
let classnames = this.opts.extensions[query].map( | ||
extension => 'mm-menu_' + extension | ||
(extension) => 'mm-menu_' + extension | ||
); | ||
@@ -531,3 +531,3 @@ | ||
// IE11: | ||
classnames.forEach(classname => { | ||
classnames.forEach((classname) => { | ||
this.node.menu.classList.add(classname); | ||
@@ -541,3 +541,3 @@ }); | ||
// IE11: | ||
classnames.forEach(classname => { | ||
classnames.forEach((classname) => { | ||
this.node.menu.classList.remove(classname); | ||
@@ -574,3 +574,3 @@ }); | ||
DOM.children(this.node.menu).forEach(panel => { | ||
DOM.children(this.node.menu).forEach((panel) => { | ||
if ( | ||
@@ -628,3 +628,3 @@ this.conf.panelNodetype.indexOf(panel.nodeName.toLowerCase()) > | ||
panels.forEach(panel => { | ||
panels.forEach((panel) => { | ||
this.initPanel(panel); | ||
@@ -661,10 +661,14 @@ }); | ||
// Find panel listitem > panel | ||
DOM.children(panel, '.mm-listview').forEach(listview => { | ||
DOM.children(listview, '.mm-listitem').forEach(listitem => { | ||
children.push(...DOM.children(listitem, panelNodetype)); | ||
}); | ||
DOM.children(panel, '.mm-listview').forEach((listview) => { | ||
DOM.children(listview, '.mm-listitem').forEach( | ||
(listitem) => { | ||
children.push( | ||
...DOM.children(listitem, panelNodetype) | ||
); | ||
} | ||
); | ||
}); | ||
// Initiate subpanel(s). | ||
children.forEach(child => { | ||
children.forEach((child) => { | ||
this.initPanel(child); | ||
@@ -727,3 +731,3 @@ }); | ||
/** The parent listitem. */ | ||
var parent = [panel.parentElement].filter(listitem => | ||
var parent = [panel.parentElement].filter((listitem) => | ||
listitem.matches('li') | ||
@@ -784,3 +788,3 @@ )[0]; | ||
DOM.children(panel, 'ul, ol').forEach(listview => { | ||
DOM.children(panel, 'ul, ol').forEach((listview) => { | ||
this.initListview(listview); | ||
@@ -922,3 +926,3 @@ }); | ||
DOM.children(listview).forEach(listitem => { | ||
DOM.children(listview).forEach((listitem) => { | ||
listitem.classList.add('mm-listitem'); | ||
@@ -932,3 +936,3 @@ | ||
DOM.children(listitem, 'a, span').forEach(item => { | ||
DOM.children(listitem, 'a, span').forEach((item) => { | ||
if (!item.matches('.mm-btn')) { | ||
@@ -961,3 +965,3 @@ item.classList.add('mm-listitem__text'); | ||
// Deselect the listitems. | ||
listitems.forEach(listitem => { | ||
listitems.forEach((listitem) => { | ||
lastitem = listitem; | ||
@@ -993,3 +997,3 @@ listitem.classList.remove('mm-listitem_selected'); | ||
'click', | ||
evnt => { | ||
(evnt) => { | ||
/** The clicked element. */ | ||
@@ -1009,3 +1013,3 @@ var target = (evnt.target as HTMLElement).closest( | ||
target.matches('[rel="external"]') || | ||
target.matches('[target="_blank"]') | ||
target.matches('[target="_blank"]'), | ||
}; | ||
@@ -1017,3 +1021,3 @@ | ||
preventDefault: | ||
target.getAttribute('href').slice(0, 1) == '#' | ||
target.getAttribute('href').slice(0, 1) == '#', | ||
}; | ||
@@ -1020,0 +1024,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
736929
13207