Skip to content

Commit

Permalink
Update dependencies (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptex authored May 25, 2021
1 parent e9b52cf commit 37ab3c4
Show file tree
Hide file tree
Showing 9 changed files with 424 additions and 820 deletions.
35 changes: 17 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@
name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
build:
runs-on: ubuntu-latest

runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn build
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn build
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ yarn.lock

# Config files
.babelrc
.github
.whitesource
renovate.json
rollup.config.js
webpack.config.js
2 changes: 1 addition & 1 deletion .whitesource
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"issueSettings": {
"minSeverityLevel": "LOW"
}
}
}
246 changes: 122 additions & 124 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,127 +1,125 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ScrollSpy Demo</title>

<style>
body {
font-family: monospace;
font-size: 1rem;
line-height: 1.25;
margin: 0;
}

header {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 10;
background-color: #fff;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
}

nav ul {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
list-style: none outside none;
}

nav li {
padding: 0 1rem;
}

nav a {
color: black;
padding: 1rem 0;
display: block;
}

nav a:hover {
text-decoration: none;
}

nav .current a {
color: red;
}

main {
padding-top: 3rem;
}

section {
text-align: center;
height: 75vh;
display: flex;
flex-flow: row wrap;
align-items: center;
justify-content: center;
border-bottom: 1px solid #000;
}

footer {
text-align: center;
padding: 1rem;
}
</style>
</head>

<body>
<header class="header">
<nav>
<ul class="nav">
<li><a href="#section1">Section 1</a></li>

<li><a href="#section2">Section 2</a></li>

<li><a href="#section3">Section 3</a></li>

<li><a href="#section4">Section 4</a></li>
</ul>
</nav>
</header>

<main>
<section id="section1" class="section">
<h1>Section 1</h1>
</section>

<section id="section2" class="section">
<h2>Section 2</h2>
</section>

<section id="section3" class="section">
<h3>Section 3</h3>
</section>

<section id="section4" class="section">
<h4>Section 4</h4>
</section>
</main>

<footer>
<p>&copy; 2018 Three 11 | License MIT</p>
</footer>

<script src="../dist/scrollspy.min.js"></script>

<script>
new ScrollSpy({
linkCurrentClass: 'current',
linksContainerSelector: '.nav',
sectionSelector: '.section',
headerOffset: true,
headerClass: '.header'
});
</script>
</body>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>ScrollSpy Demo</title>

<style>
body {
font-family: monospace;
font-size: 1rem;
line-height: 1.25;
margin: 0;
}

header {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 10;
background-color: #fff;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
}

nav ul {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
list-style: none outside none;
}

nav li {
padding: 0 1rem;
}

nav a {
color: black;
padding: 1rem 0;
display: block;
}

nav a:hover {
text-decoration: none;
}

nav .current a {
color: red;
}

main {
padding-top: 3rem;
}

section {
text-align: center;
height: 75vh;
display: flex;
flex-flow: row wrap;
align-items: center;
justify-content: center;
border-bottom: 1px solid #000;
}

footer {
text-align: center;
padding: 1rem;
}
</style>
</head>

<body>
<header class="header">
<nav>
<ul class="nav">
<li><a href="#section1">Section 1</a></li>

<li><a href="#section2">Section 2</a></li>

<li><a href="#section3">Section 3</a></li>

<li><a href="#section4">Section 4</a></li>
</ul>
</nav>
</header>

<main>
<section id="section1" class="section">
<h1>Section 1</h1>
</section>

<section id="section2" class="section">
<h2>Section 2</h2>
</section>

<section id="section3" class="section">
<h3>Section 3</h3>
</section>

<section id="section4" class="section">
<h4>Section 4</h4>
</section>
</main>

<footer>
<p>&copy; 2018 Three 11 | License MIT</p>
</footer>

<script src="../dist/scrollspy.min.js"></script>

<script>
new ScrollSpy({
linkCurrentClass: 'current',
linksContainerSelector: '.nav',
sectionSelector: '.section',
headerOffset: true,
headerClass: '.header'
});
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion dist/scrollspy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@three11/scrollspy",
"version": "0.4.0",
"version": "1.0.0",
"description": "Vanilla ES2017 module for scroll spy",
"main": "dist/scrollspy.min.js",
"scripts": {
Expand Down Expand Up @@ -45,10 +45,10 @@
"@babel/cli": "7.14.3",
"@babel/core": "7.14.3",
"@babel/preset-env": "7.14.2",
"rollup": "2.48.0",
"rollup": "2.49.0",
"rollup-plugin-babel": "4.4.0",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-uglify": "6.0.4"
"rollup-plugin-terser": "7.0.2"
}
}
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonJS from 'rollup-plugin-commonjs';
import { uglify } from 'rollup-plugin-uglify';
import { terser } from 'rollup-plugin-terser';

export default {
input: 'src/scrollspy.js',
Expand All @@ -20,6 +20,6 @@ export default {
commonJS({
include: 'node_modules/**'
}),
uglify()
terser()
]
};
9 changes: 2 additions & 7 deletions src/scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ export default class ScrollSpy {
return section.offsetTop;
}

return (
section.offsetTop -
document.querySelector(this.headerClass).offsetHeight
);
return section.offsetTop - document.querySelector(this.headerClass).offsetHeight;
}

/**
Expand Down Expand Up @@ -147,9 +144,7 @@ export default class ScrollSpy {
.querySelectorAll(`.${this.linkCurrentClass}`)
.forEach(item => item.classList.remove(this.linkCurrentClass));

this.links[this.currentIdx].parentNode.classList.add(
this.linkCurrentClass
);
this.links[this.currentIdx].parentNode.classList.add(this.linkCurrentClass);
}

/**
Expand Down
Loading

0 comments on commit 37ab3c4

Please sign in to comment.