Skip to content

Commit

Permalink
Update dependencies (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptex committed May 25, 2021
1 parent 09a89b6 commit d1a83ad
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 723 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
.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"
}
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Array.from(buttons).forEach(button => {
```javascript
const buttons = document.querySelectorAll('.js-scroll-to');

[].forEach.call(buttons, function(button) {
button.addEventListener('click', function(event) {
[].forEach.call(buttons, function (button) {
button.addEventListener('click', function (event) {
event.preventDefault();

var href = event.target.getAttribute('href');
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@three11/animate-top-offset",
"version": "0.7.0",
"version": "1.0.0",
"description": "Scroll a container to a specific Y offset",
"main": "dist/animate-top-offset.min.js",
"scripts": {
Expand Down Expand Up @@ -42,9 +42,8 @@
"@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-uglify": "6.0.4"
"rollup-plugin-terser": "7.0.2"
}
}
8 changes: 3 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import babel from 'rollup-plugin-babel';
import { uglify } from 'rollup-plugin-uglify';
import { terser } from 'rollup-plugin-terser';

export default {
input: 'src/animate-top-offset.js',
Expand All @@ -12,10 +12,8 @@ export default {
babel({
exclude: 'node_modules/**',
babelrc: false,
presets: [
['@babel/env', { 'modules': false }]
]
presets: [['@babel/env', { modules: false }]]
}),
uglify()
terser()
]
};
14 changes: 3 additions & 11 deletions src/animate-top-offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,17 @@ const requestAnimFrame = (() => {
win.requestAnimationFrame ||
win.webkitRequestAnimationFrame ||
win.mozRequestAnimationFrame ||
function(callback) {
function (callback) {
win.setTimeout(callback, 1000 / 60);
}
);
})();

const animateTopOffset = (
offset = 0,
container = win,
speed = 2000,
easing = 'easeOutSine'
) => {
const animateTopOffset = (offset = 0, container = win, speed = 2000, easing = 'easeOutSine') => {
let currentTime = 0;

const scrollY = container.scrollY || document.documentElement.scrollTop;
const time = Math.max(
0.1,
Math.min(Math.abs(scrollY - offset) / speed, 0.8)
);
const time = Math.max(0.1, Math.min(Math.abs(scrollY - offset) / speed, 0.8));

const tick = () => {
currentTime += 1 / 60;
Expand Down
Loading

0 comments on commit d1a83ad

Please sign in to comment.