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

@servicensw/navigation

Package Overview
Dependencies
Maintainers
2
Versions
197
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@servicensw/navigation - npm Package Compare versions

Comparing version 2.0.0-dev.7 to 2.0.0-dev.8

2

dist/js/smooth-scrolling.js

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

!function(){"use strict";var t=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var e=function(){function e(t){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.element=t,!this.element||!this.element.nodeType)throw new Error("The DOM element(s) were not found when creating Smooth Scrolling.");this.clickHandler=this.clickHandler.bind(this),this.scrollAnimation=this.scrollAnimation.bind(this),this.init()}return t(e,[{key:"scrollAnimation",value:function(t){this.startTime=this.startTime||t;var e=t-this.startTime,n=this.constructor.easeInOutCubic(e,this.start,this.offset,this.duration);window.scroll(0,n),e<this.duration?window.requestAnimationFrame(this.scrollAnimation):this.startTime=null}},{key:"scrollTo",value:function(){this.duration=400,this.start=window.pageYOffset,this.end=this.constructor.elementOffset(this.target),this.offset=this.end-this.start,window.requestAnimationFrame(this.scrollAnimation)}},{key:"clickHandler",value:function(t){t.preventDefault(),window.history&&window.history.replaceState(void 0,void 0,"#"+this.target.getAttribute("id")),this.scrollTo(),this.target.focus()}},{key:"init",value:function(){this.element.hash.length>1&&(this.target=document.querySelector(this.element.hash),this.target&&(this.target.setAttribute("tabindex","-1"),this.element.addEventListener("click",this.clickHandler)))}}],[{key:"easeInOutCubic",value:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t+e:-n/2*((t-=1)*(t-2)-1)+e}},{key:"elementOffset",value:function(t){var e=0;return null!==t.offsetParent&&(e=t.offsetTop+t.offsetParent.offsetTop,document.body.classList.contains("has-sticky-nav")&&(e-=document.querySelector(".sticky-nav").clientHeight),e-=20),e}}]),e}();document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('a[href*="#"]').forEach(function(t){new e(t)})}),window.SmoothScrolling=e}();
!function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),n=function(){function n(e){if(t(this,n),this.element=e,!this.element||!this.element.nodeType)throw new Error("The DOM element(s) were not found when creating Smooth Scrolling.");this.clickHandler=this.clickHandler.bind(this),this.scrollAnimation=this.scrollAnimation.bind(this),this.init()}return e(n,[{key:"scrollAnimation",value:function(t){this.startTime=this.startTime||t;var e=t-this.startTime,n=this.constructor.easeInOutCubic(e,this.start,this.offset,this.duration);window.scroll(0,n),e<this.duration?window.requestAnimationFrame(this.scrollAnimation):this.startTime=null}},{key:"scrollTo",value:function(){this.duration=400,this.start=window.pageYOffset,this.end=this.constructor.elementOffset(this.target),this.offset=this.end-this.start,window.requestAnimationFrame(this.scrollAnimation)}},{key:"clickHandler",value:function(t){t.preventDefault(),window.history&&window.history.replaceState(void 0,void 0,"#"+this.target.getAttribute("id")),this.scrollTo(),this.target.focus()}},{key:"init",value:function(){this.element.hash.length>1&&(this.target=document.querySelector(this.element.hash),this.target&&(this.target.setAttribute("tabindex","-1"),this.element.addEventListener("click",this.clickHandler)))}}],[{key:"easeInOutCubic",value:function(t,e,n,i){return(t/=i/2)<1?n/2*t*t+e:-n/2*((t-=1)*(t-2)-1)+e}},{key:"elementOffset",value:function(t){var e=0;return null!==t.offsetParent&&(e=t.offsetTop+t.offsetParent.offsetTop,document.body.classList.contains("has-sticky-nav")&&(e-=document.querySelector(".sticky-nav").clientHeight),e-=20),e}}]),n}();document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('a[href*="#"]').forEach(function(t){new n(t)})}),window.SmoothScrolling=n}();

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

!function(){"use strict";function e(e,t,n,i){var a,o=0;return"boolean"!=typeof t&&(i=n,n=t,t=void 0),function(){var c=this,r=Number(new Date)-o,s=arguments;function l(){o=Number(new Date),n.apply(c,s)}i&&!a&&l(),a&&clearTimeout(a),void 0===i&&r>e?l():!0!==t&&(a=setTimeout(i?function(){a=void 0}:l,void 0===i?e-r:e))}}var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var n=function(){function n(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.element=t,!this.element||!this.element.nodeType)throw new Error("The DOM element was not found when creating the Sticky navigation.");var i,a,o;this.content=document.getElementById("stickyNavContainer"),this.headings=this.content.getElementsByTagName("h2"),this.clickHandler=this.clickHandler.bind(this),this.scrollHandler=(i=100,a=this.scrollHandler.bind(this),void 0===o?e(i,a,!1):e(i,o,!1!==a)),this.init()}return t(n,[{key:"scrollHandler",value:function(){var e=this,t=window.pageYOffset,n=this.element.getElementsByTagName("a");Object.keys(this.headings).forEach(function(i){var a=e.headings[i],o=a.offsetTop+a.offsetParent.offsetTop-e.element.clientHeight-30;t>o&&(Object.keys(n).forEach(function(e){n[e].classList.remove("is-active")}),n[i].classList.add("is-active"))})}},{key:"clickHandler",value:function(e){var t=this.element.getElementsByTagName("a");Object.keys(t).forEach(function(e){t[e].classList.remove("is-active")}),e.target.classList.add("is-active")}},{key:"init",value:function(){var e=this;document.body.classList.add("has-sticky-nav");var t=document.createElement("ul");Object.keys(this.headings).forEach(function(n){var i=e.headings[n],a=e.constructor.convertHeading(i.textContent);i.setAttribute("id",a),i.setAttribute("tabindex","-1");var o=document.createElement("li"),c=document.createElement("a");if(c.setAttribute("href","#"+a),c.textContent=i.textContent,c.addEventListener("click",e.clickHandler),o.appendChild(c),t.appendChild(o),window.SmoothScrolling)new window.SmoothScrolling(c)}),this.element.appendChild(t),window.addEventListener("scroll",this.scrollHandler)}}],[{key:"convertHeading",value:function(e){return e.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}}]),n}();document.addEventListener("DOMContentLoaded",function(){new n(document.getElementById("stickyNav"))})}();
!function(){"use strict";function e(e,t,n,i){var a,o=0;return"boolean"!=typeof t&&(i=n,n=t,t=void 0),function(){var c=this,r=Number(new Date)-o,s=arguments;function l(){o=Number(new Date),n.apply(c,s)}i&&!a&&l(),a&&clearTimeout(a),void 0===i&&r>e?l():!0!==t&&(a=setTimeout(i?function(){a=void 0}:l,void 0===i?e-r:e))}}var t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),i=function(){function i(n){if(t(this,i),this.element=n,!this.element||!this.element.nodeType)throw new Error("The DOM element was not found when creating the Sticky navigation.");var a,o,c;this.content=document.getElementById("stickyNavContainer"),this.headings=this.content.getElementsByTagName("h2"),this.clickHandler=this.clickHandler.bind(this),this.scrollHandler=(a=100,o=this.scrollHandler.bind(this),void 0===c?e(a,o,!1):e(a,c,!1!==o)),this.init()}return n(i,[{key:"scrollHandler",value:function(){var e=this,t=window.pageYOffset,n=this.element.getElementsByTagName("a");Object.keys(this.headings).forEach(function(i){var a=e.headings[i],o=a.offsetTop+a.offsetParent.offsetTop-e.element.clientHeight-30;t>o&&(Object.keys(n).forEach(function(e){n[e].classList.remove("is-active")}),n[i].classList.add("is-active"))})}},{key:"clickHandler",value:function(e){var t=this.element.getElementsByTagName("a");Object.keys(t).forEach(function(e){t[e].classList.remove("is-active")}),e.target.classList.add("is-active")}},{key:"init",value:function(){var e=this;document.body.classList.add("has-sticky-nav");var t=document.createElement("ul");Object.keys(this.headings).forEach(function(n){var i=e.headings[n],a=e.constructor.convertHeading(i.textContent);i.setAttribute("id",a),i.setAttribute("tabindex","-1");var o=document.createElement("li"),c=document.createElement("a");if(c.setAttribute("href","#"+a),c.textContent=i.textContent,c.addEventListener("click",e.clickHandler),o.appendChild(c),t.appendChild(o),window.SmoothScrolling)new window.SmoothScrolling(c)}),this.element.appendChild(t),window.addEventListener("scroll",this.scrollHandler)}}],[{key:"convertHeading",value:function(e){return e.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}}]),i}();document.addEventListener("DOMContentLoaded",function(){new i(document.getElementById("stickyNav"))})}();
{
"name": "@servicensw/navigation",
"version": "2.0.0-dev.7",
"version": "2.0.0-dev.8",
"description": "Navigation",

@@ -22,4 +22,4 @@ "repository": {

"devDependencies": {
"@servicensw/base": "^2.0.0-dev.11",
"@servicensw/builder": "^2.0.0-dev.6",
"@servicensw/base": "^2.0.0-dev.13",
"@servicensw/builder": "^2.0.0-dev.7",
"postcss-cli": "^5.0.0",

@@ -26,0 +26,0 @@ "rollup": "^0.58.2"

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