priority-nav 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +106 -96
- package/demo/css/main.css +155 -155
- package/demo/css/priority-nav-core.css +38 -38
- package/demo/images/src/svg/arrow-down.svg +11 -11
- package/demo/images/src/svg/github-mark.svg +11 -11
- package/demo/images/src/svg/knob.svg +19 -19
- package/demo/index.html +143 -143
- package/demo/js/classList.js +69 -69
- package/demo/js/html5shiv.min.js +3 -3
- package/demo/js/priority-nav.js +666 -666
- package/demo/scss/base/_base.scss +13 -13
- package/demo/scss/base/_boxsizing.scss +13 -13
- package/demo/scss/base/_typography.scss +37 -37
- package/demo/scss/components/_github-links.scss +11 -11
- package/demo/scss/components/_logo.scss +14 -14
- package/demo/scss/components/_nav.scss +118 -118
- package/demo/scss/components/_social.scss +8 -8
- package/demo/scss/layouts/_header.scss +20 -20
- package/demo/scss/main.scss +42 -42
- package/demo/scss/pages/_home.scss +29 -29
- package/demo/scss/utils/_easings.scss +38 -38
- package/demo/scss/utils/_helpers.scss +92 -92
- package/demo/scss/utils/_triangles.scss +26 -26
- package/demo/scss/utils/_variables.scss +29 -29
- package/demo/scss/vendors/_normalize.scss +424 -424
- package/dist/priority-nav-core.css +9 -9
- package/dist/priority-nav.js +719 -724
- package/dist/priority-nav.min.js +3 -2
- package/package.json +46 -46
package/dist/priority-nav.min.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
/*
|
2
|
-
* priority-nav - v1.0.
|
2
|
+
* priority-nav - v1.0.13 | (c) 2025 @gijsroge | MIT license
|
3
3
|
* Repository: https://github.com/gijsroge/priority-navigation.git
|
4
4
|
* Description: Priority+ pattern navigation that hides menu items if they don't fit on screen.
|
5
5
|
* Demo: http://gijsroge.github.io/priority-nav.js/
|
6
6
|
*/
|
7
|
-
|
7
|
+
|
8
|
+
!function(e,t){"function"==typeof define&&define.amd?define("priorityNav",t(e)):"object"==typeof exports?module.exports=t(e):e.priorityNav=t(e)}(window||this,function(e){"use strict";var i,d,c,s,u,a,l,p={},v=[],h=!!document.querySelector&&!!e.addEventListener,f={},m=0,y=0,w={initClass:"js-priorityNav",mainNavWrapper:"nav",mainNav:"ul",navDropdownClassName:"nav__dropdown",navDropdownToggleClassName:"nav__dropdown-toggle",navDropdownLabel:"more",navDropdownBreakpointLabel:"menu",breakPoint:500,throttleDelay:50,offsetPixels:0,count:!0,moved:function(){},movedBack:function(){}},S=function(e,t,n){if("[object Object]"===Object.prototype.toString.call(e))for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(n,e[o],o,e);else for(var r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)};var o=function(e,t){if(e.classList)e.classList.toggle(t);else{var n=e.className.split(" "),o=n.indexOf(t);0<=o?n.splice(o,1):n.push(t),e.className=n.join(" ")}},n=function(e){var t,n,o,r,i,a,s,l;t=e,n=window.getComputedStyle(t),o=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),d=t.clientWidth-o,e.querySelector(u).parentNode===e?e.querySelector(u).offsetWidth:0,c=q(e)+f.offsetPixels,y=(r=document,i=window,a=r.compatMode&&"CSS1Compat"===r.compatMode?r.documentElement:r.body,s=a.clientWidth,l=a.clientHeight,i.innerWidth&&s>i.innerWidth&&(s=i.innerWidth,l=i.innerHeight),{width:s,height:l}).width};p.doesItFit=function(t){var o,r,i,a,e=0===t.getAttribute("instance")?e:f.throttleDelay;0,o=function(){var e=t.getAttribute("instance");for(n(t);d<=c&&0<t.querySelector(s).children.length||y<f.breakPoint&&0<t.querySelector(s).children.length;)p.toDropdown(t,e),n(t),y<f.breakPoint&&b(t,e,f.navDropdownBreakpointLabel);for(;d>=v[e][v[e].length-1]&&y>f.breakPoint;)p.toMenu(t,e),y>f.breakPoint&&b(t,e,f.navDropdownLabel);v[e].length<1&&(t.querySelector(u).classList.remove("show"),b(t,e,f.navDropdownLabel)),t.querySelector(s).children.length<1?(t.classList.add("is-empty"),b(t,e,f.navDropdownBreakpointLabel)):t.classList.remove("is-empty"),g(t,e)},r=e,function(){var e=this,t=arguments,n=i&&!a;clearTimeout(a),a=setTimeout(function(){a=null,i||o.apply(e,t)},r),n&&o.apply(e,t)}()};var g=function(e,t){v[t].length<1?(e.querySelector(a).classList.add("priority-nav-is-hidden"),e.querySelector(a).classList.remove("priority-nav-is-visible"),e.classList.remove("priority-nav-has-dropdown"),e.querySelector(".priority-nav__wrapper").setAttribute("aria-haspopup","false")):(e.querySelector(a).classList.add("priority-nav-is-visible"),e.querySelector(a).classList.remove("priority-nav-is-hidden"),e.classList.add("priority-nav-has-dropdown"),e.querySelector(".priority-nav__wrapper").setAttribute("aria-haspopup","true"))},r=function(e,t){e.querySelector(a).setAttribute("priorityNav-count",v[t].length)},b=function(e,t,n){e.querySelector(a).innerHTML=n};p.toDropdown=function(e,t){e.querySelector(u).firstChild&&0<e.querySelector(s).children.length?e.querySelector(u).insertBefore(e.querySelector(s).lastElementChild,e.querySelector(u).firstChild):0<e.querySelector(s).children.length&&e.querySelector(u).appendChild(e.querySelector(s).lastElementChild),v[t].push(c),g(e,t),0<e.querySelector(s).children.length&&f.count&&r(e,t),f.moved()},p.toMenu=function(e,t){0<e.querySelector(u).children.length&&e.querySelector(s).appendChild(e.querySelector(u).firstElementChild),v[t].pop(),g(e,t),0<e.querySelector(s).children.length&&f.count&&r(e,t),f.movedBack()};var q=function(e){for(var t=e.childNodes,n=0,o=0;o<t.length;o++)3!==t[o].nodeType&&(isNaN(t[o].offsetWidth)||(n+=t[o].offsetWidth));return n},L=function(t,n){window.attachEvent?window.attachEvent("onresize",function(){p.doesItFit&&p.doesItFit(t)}):window.addEventListener&&window.addEventListener("resize",function(){p.doesItFit&&p.doesItFit(t)},!0),t.querySelector(a).addEventListener("click",function(){o(t.querySelector(u),"show"),o(this,"is-open"),o(t,"is-open"),-1!==t.className.indexOf("is-open")?t.querySelector(u).setAttribute("aria-hidden","false"):(t.querySelector(u).setAttribute("aria-hidden","true"),t.querySelector(u).blur())}),document.addEventListener("click",function(e){(function(e,t){for(var n=t.charAt(0);e&&e!==document;e=e.parentNode)if("."===n){if(e.classList.contains(t.substr(1)))return e}else if("#"===n){if(e.id===t.substr(1))return e}else if("["===n&&e.hasAttribute(t.substr(1,t.length-2)))return e;return!1})(e.target,"."+n.navDropdownClassName)||e.target===t.querySelector(a)||(t.querySelector(u).classList.remove("show"),t.querySelector(a).classList.remove("is-open"),t.classList.remove("is-open"))}),document.onkeydown=function(e){27===(e=e||window.event).keyCode&&(document.querySelector(u).classList.remove("show"),document.querySelector(a).classList.remove("is-open"),i.classList.remove("is-open"))}};NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;e<t;e++)this[e]&&this[e].parentElement&&this[e].parentElement.removeChild(this[e])},p.destroy=function(){f&&(document.documentElement.classList.remove(f.initClass),l.remove(),f=null,delete p.init,delete p.doesItFit)},h&&"undefined"!=typeof Node&&(Node.prototype.insertAfter=function(e,t){this.insertBefore(e,t.nextSibling)});var N=function(e){var t=e.charAt(0);return"."!==t&&"#"!==t};return p.init=function(e){var n,o,r;if(o=e||{},r={},S(n=w,function(e,t){r[t]=n[t]}),S(o,function(e,t){r[t]=o[t]}),f=r,h||"undefined"!=typeof Node)if(N(f.navDropdownClassName)&&N(f.navDropdownToggleClassName)){var t=document.querySelectorAll(f.mainNavWrapper);S(t,function(e){var t,n;(v[m]=[],e.setAttribute("instance",m++),i=e)?(s=f.mainNav,e.querySelector(s)?(t=e,n=f,l=document.createElement("span"),u=document.createElement("ul"),(a=document.createElement("button")).innerHTML=n.navDropdownLabel,a.setAttribute("aria-controls","menu"),a.setAttribute("type","button"),u.setAttribute("aria-hidden","true"),t.querySelector(s).parentNode===t?(t.insertAfter(l,t.querySelector(s)),l.appendChild(a),l.appendChild(u),u.classList.add(n.navDropdownClassName),u.classList.add("priority-nav__dropdown"),a.classList.add(n.navDropdownToggleClassName),a.classList.add("priority-nav__dropdown-toggle"),a.setAttribute("type","button"),l.classList.add(n.navDropdownClassName+"-wrapper"),l.classList.add("priority-nav__wrapper"),t.classList.add("priority-nav")):console.warn("mainNav is not a direct child of mainNavWrapper, double check please"),u="."+f.navDropdownClassName,e.querySelector(u)?(a="."+f.navDropdownToggleClassName,e.querySelector(a)?(L(e,f),p.doesItFit(e)):console.warn("couldn't find the specified navDropdownToggle element")):console.warn("couldn't find the specified navDropdown element")):console.warn("couldn't find the specified mainNav element")):console.warn("couldn't find the specified mainNavWrapper element")}),0,document.documentElement.classList.add(f.initClass)}else console.warn("No symbols allowed in navDropdownClassName & navDropdownToggleClassName. These are not selectors.");else console.warn("This browser doesn't support priorityNav")},p});
|
package/package.json
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
{
|
2
|
-
"name": "priority-nav",
|
3
|
-
"title": "priority-nav",
|
4
|
-
"version": "1.0.
|
5
|
-
"main": "dist/priority-nav.js",
|
6
|
-
"description": "Priority+ pattern navigation that hides menu items if they don't fit on screen.",
|
7
|
-
"homepage": "http://gijsroge.github.io/priority-nav.js/",
|
8
|
-
"author": {
|
9
|
-
"name": "Gijs Rogé",
|
10
|
-
"url": "http://twitter.com/gijsroge"
|
11
|
-
},
|
12
|
-
"repository": {
|
13
|
-
"type": "git",
|
14
|
-
"url": "https://github.com/gijsroge/priority-navigation.git"
|
15
|
-
},
|
16
|
-
"keywords": [
|
17
|
-
"priority+",
|
18
|
-
"responsive",
|
19
|
-
"navigation"
|
20
|
-
],
|
21
|
-
"license": {
|
22
|
-
"type": "MIT",
|
23
|
-
"url": "https://github.com/gijsroge/priority-navigation/blob/master/LICENSE"
|
24
|
-
},
|
25
|
-
"bugs": {
|
26
|
-
"url": "https://github.com/gijsroge/priority-navigation/issues"
|
27
|
-
},
|
28
|
-
"engines": {
|
29
|
-
"node": ">=0.8.0"
|
30
|
-
},
|
31
|
-
"devDependencies": {
|
32
|
-
"load-grunt-tasks": "3.2
|
33
|
-
"crayola": "0.0.1",
|
34
|
-
"grunt": "0.
|
35
|
-
"grunt-bump": "0.
|
36
|
-
"grunt-contrib-concat": "0.
|
37
|
-
"grunt-contrib-jshint": "
|
38
|
-
"grunt-contrib-uglify": "
|
39
|
-
"grunt-contrib-watch": "0.
|
40
|
-
"jshint-stylish": "2.
|
41
|
-
"grunt-sass": "1.0
|
42
|
-
},
|
43
|
-
"scripts": {
|
44
|
-
"test": "grunt jshint"
|
45
|
-
}
|
46
|
-
}
|
1
|
+
{
|
2
|
+
"name": "priority-nav",
|
3
|
+
"title": "priority-nav",
|
4
|
+
"version": "1.0.14",
|
5
|
+
"main": "dist/priority-nav.js",
|
6
|
+
"description": "Priority+ pattern navigation that hides menu items if they don't fit on screen.",
|
7
|
+
"homepage": "http://gijsroge.github.io/priority-nav.js/",
|
8
|
+
"author": {
|
9
|
+
"name": "Gijs Rogé",
|
10
|
+
"url": "http://twitter.com/gijsroge"
|
11
|
+
},
|
12
|
+
"repository": {
|
13
|
+
"type": "git",
|
14
|
+
"url": "https://github.com/gijsroge/priority-navigation.git"
|
15
|
+
},
|
16
|
+
"keywords": [
|
17
|
+
"priority+",
|
18
|
+
"responsive",
|
19
|
+
"navigation"
|
20
|
+
],
|
21
|
+
"license": {
|
22
|
+
"type": "MIT",
|
23
|
+
"url": "https://github.com/gijsroge/priority-navigation/blob/master/LICENSE"
|
24
|
+
},
|
25
|
+
"bugs": {
|
26
|
+
"url": "https://github.com/gijsroge/priority-navigation/issues"
|
27
|
+
},
|
28
|
+
"engines": {
|
29
|
+
"node": ">=0.8.0"
|
30
|
+
},
|
31
|
+
"devDependencies": {
|
32
|
+
"load-grunt-tasks": "3.5.2",
|
33
|
+
"crayola": "0.0.1",
|
34
|
+
"grunt": "1.0.2",
|
35
|
+
"grunt-bump": "0.8.0",
|
36
|
+
"grunt-contrib-concat": "1.0.1",
|
37
|
+
"grunt-contrib-jshint": "1.1.0",
|
38
|
+
"grunt-contrib-uglify": "3.3.0",
|
39
|
+
"grunt-contrib-watch": "1.0.1",
|
40
|
+
"jshint-stylish": "2.2.1",
|
41
|
+
"grunt-sass": "2.1.0"
|
42
|
+
},
|
43
|
+
"scripts": {
|
44
|
+
"test": "grunt jshint"
|
45
|
+
}
|
46
|
+
}
|