Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scroll-into-view/compute-scroll-into-view
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.4
Choose a base ref
...
head repository: scroll-into-view/compute-scroll-into-view
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jan 8, 2023

  1. chore(deps): lock file maintenance (#867)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 8, 2023
    Copy the full SHA
    0c4eb48 View commit details

Commits on Feb 14, 2023

  1. feat(refactor): use named export instead of default

    BREAKING CHANGE: use `import {compute}` instead of `import compute`
    stipsan committed Feb 14, 2023
    Copy the full SHA
    8509530 View commit details
  2. Copy the full SHA
    fc7bd97 View commit details
  3. chore: fix npmrc

    stipsan committed Feb 14, 2023
    Copy the full SHA
    1135990 View commit details
  4. chore(deps): update actions/cache digest to 6998d13 (#873)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 14, 2023
    Copy the full SHA
    006591e View commit details
  5. Delete setup_puppeteer.sh

    stipsan authored Feb 14, 2023
    Copy the full SHA
    c0a6ffb View commit details
  6. Delete config.yml

    stipsan authored Feb 14, 2023
    Copy the full SHA
    7afb2fc View commit details
  7. chore(deps): update dependency jest-puppeteer to v7 (#872)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 14, 2023
    Copy the full SHA
    db3b130 View commit details
  8. Copy the full SHA
    4c1e6e6 View commit details
  9. chore(deps): lock file maintenance (#876)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 14, 2023
    Copy the full SHA
    21b82f5 View commit details

Commits on Mar 28, 2023

  1. Copy the full SHA
    f415c06 View commit details
  2. Copy the full SHA
    d02b640 View commit details
  3. chore(deps): update dependency jest to v29.5.0 (#878)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 28, 2023
    Copy the full SHA
    6033f68 View commit details

Commits on Apr 8, 2023

  1. Copy the full SHA
    d4ad5e1 View commit details
  2. Copy the full SHA
    f76d5f4 View commit details
  3. chore(deps): update devdependencies (non-major) (#868)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 8, 2023
    Copy the full SHA
    0f737ad View commit details
  4. chore(deps): lock file maintenance (#881)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 8, 2023
    Copy the full SHA
    d08917f View commit details
  5. chore(deps): update dependency jest-puppeteer to v8 (#886)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 8, 2023
    Copy the full SHA
    f4d6c2c View commit details
  6. chore(deps): update dependency typescript to v5 (#887)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 8, 2023
    Copy the full SHA
    c442fe8 View commit details
  7. Copy the full SHA
    bfd226f View commit details
  8. chore(deps): lock file maintenance (#888)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 8, 2023
    Copy the full SHA
    ecb0684 View commit details

Commits on Apr 9, 2023

  1. fix: revert package.json and utils.js #882 (#891)

    * revert package.json #882
    
    * revert utils.js
    long76 authored Apr 9, 2023
    Copy the full SHA
    1d57298 View commit details
  2. Copy the full SHA
    ed19503 View commit details
  3. Copy the full SHA
    0c45c0a View commit details
  4. Copy the full SHA
    d6f778d View commit details

Commits on Apr 10, 2023

  1. Copy the full SHA
    8ea6a23 View commit details

Commits on Apr 19, 2023

  1. chore(deps): update dependency @sanity/semantic-release-preset to v4.…

    …1.1 (#885)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 19, 2023
    Copy the full SHA
    e5c08e7 View commit details

Commits on Sep 13, 2023

  1. Copy the full SHA
    ffad204 View commit details
  2. Copy the full SHA
    9e7f63d View commit details

Commits on Sep 30, 2023

  1. feat: account for scroll margin (#906)

    * feat: account for scroll margin
    
    * feat: rename vars
    RostiMelk authored Sep 30, 2023
    Copy the full SHA
    b932154 View commit details
  2. Copy the full SHA
    ee33629 View commit details
  3. Copy the full SHA
    e2902b8 View commit details

Commits on Jan 10, 2025

  1. Copy the full SHA
    77ae1e8 View commit details
  2. Copy the full SHA
    f092f96 View commit details
  3. Copy the full SHA
    16d90f8 View commit details
61 changes: 0 additions & 61 deletions .circleci/config.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .circleci/setup_puppeteer.sh

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -36,8 +36,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
cache: npm
node-version: lts/*
@@ -66,8 +66,8 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
cache: npm
node-version: ${{ matrix.node }}
@@ -81,12 +81,12 @@ jobs:
if: always() && github.event.inputs.release == 'true' && needs.build.result != 'failure' && needs.test.result != 'failure' && needs.test.result != 'cancelled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- uses: actions/checkout@v4
with:
# Need to fetch entire commit history to
# analyze every commit since last release
fetch-depth: 0
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
- uses: actions/setup-node@v3
with:
cache: npm
node-version: lts/*
6 changes: 3 additions & 3 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -15,13 +15,13 @@ jobs:
name: 🤔
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
cache: npm
node-version: lts/*
- run: npm ci --ignore-scripts --only-dev
- uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d # v3
- uses: actions/cache@v3
with:
path: node_modules/.cache/prettier/.prettier-cache
key: prettier-${{ hashFiles('package-lock.json') }}-${{ hashFiles('.gitignore') }}
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,54 @@
All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.1.1](https://github.com/scroll-into-view/compute-scroll-into-view/compare/v3.1.0...v3.1.1) (2025-01-10)

### Bug Fixes

- in if-needed mode, skip bounds checking for non-scrollable scrollingElement ([#915](https://github.com/scroll-into-view/compute-scroll-into-view/issues/915)) ([77ae1e8](https://github.com/scroll-into-view/compute-scroll-into-view/commit/77ae1e878fc897f26f1cef8171ebc9912ba2b187))

## [3.1.0](https://github.com/scroll-into-view/compute-scroll-into-view/compare/v3.0.3...v3.1.0) (2023-09-30)

### Features

- account for scroll margin ([#906](https://github.com/scroll-into-view/compute-scroll-into-view/issues/906)) ([b932154](https://github.com/scroll-into-view/compute-scroll-into-view/commit/b932154473451e92dc71112d2df3e1d674892283))

### Bug Fixes

- scrolling zero-dimension elements ([#901](https://github.com/scroll-into-view/compute-scroll-into-view/issues/901)) ([ffad204](https://github.com/scroll-into-view/compute-scroll-into-view/commit/ffad2040d7b35484e8cdc0332577977164653b62)), closes [#900](https://github.com/scroll-into-view/compute-scroll-into-view/issues/900)

## [3.0.3](https://github.com/scroll-into-view/compute-scroll-into-view/compare/v3.0.2...v3.0.3) (2023-04-10)

### Bug Fixes

- use const replace let ([#889](https://github.com/scroll-into-view/compute-scroll-into-view/issues/889)) ([d6f778d](https://github.com/scroll-into-view/compute-scroll-into-view/commit/d6f778d5a91720f9cb1980b403612d744cfa24bc))

## [3.0.2](https://github.com/scroll-into-view/compute-scroll-into-view/compare/v3.0.1...v3.0.2) (2023-04-09)

### Bug Fixes

- revert package.json and utils.js [#882](https://github.com/scroll-into-view/compute-scroll-into-view/issues/882) ([#891](https://github.com/scroll-into-view/compute-scroll-into-view/issues/891)) ([1d57298](https://github.com/scroll-into-view/compute-scroll-into-view/commit/1d572980b5451eca90a4510e1864265fad65708f))

## [3.0.1](https://github.com/scroll-into-view/compute-scroll-into-view/compare/v3.0.0...v3.0.1) (2023-04-08)

### Bug Fixes

- support `—moduleResolution node16` ([#882](https://github.com/scroll-into-view/compute-scroll-into-view/issues/882)) ([d4ad5e1](https://github.com/scroll-into-view/compute-scroll-into-view/commit/d4ad5e1b53dcb0b1baa7fd6f696d467759c17cbc))

## [3.0.0](https://github.com/scroll-into-view/compute-scroll-into-view/compare/v2.0.4...v3.0.0) (2023-02-14)

### ⚠ BREAKING CHANGES

- **refactor:** use `import {compute}` instead of `import compute`

### Features

- **refactor:** use named export instead of default ([8509530](https://github.com/scroll-into-view/compute-scroll-into-view/commit/850953006334264cf2ef9040bf8c4d7ae6700604))

### Bug Fixes

- drop `pageXOffset` and `pageYOffset` ([fc7bd97](https://github.com/scroll-into-view/compute-scroll-into-view/commit/fc7bd976d34f497da462d02772858eae718a75b2))

## [2.0.4](https://github.com/scroll-into-view/compute-scroll-into-view/compare/v2.0.3...v2.0.4) (2023-01-08)

### Bug Fixes
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Cody Olsen
Copyright (c) 2025 Cody Olsen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -31,15 +31,13 @@ npm i compute-scroll-into-view
You can also use it from a CDN:

```js
const { default: compute } = await import(
'https://esm.sh/compute-scroll-into-view'
)
const { compute } = await import('https://esm.sh/compute-scroll-into-view')
```

# Usage

```js
import compute from 'compute-scroll-into-view'
import { compute } from 'compute-scroll-into-view'

const node = document.getElementById('hero')

85 changes: 85 additions & 0 deletions integration/__snapshots__/viewport-100-percent.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) horizontal completely in view 1`] = `[]`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) horizontal completely overflowing 1`] = `
[
{
"el": "html",
"left": 100,
"top": 0,
},
]
`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) horizontal fully negative overflowing 1`] = `
[
{
"el": "html",
"left": 800,
"top": 0,
},
]
`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) horizontal partially negative overflowing 1`] = `
[
{
"el": "html",
"left": 800,
"top": 0,
},
]
`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) horizontal partially overflowing 1`] = `
[
{
"el": "html",
"left": 100,
"top": 0,
},
]
`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) vertical completely above the fold 1`] = `
[
{
"el": "html",
"left": 0,
"top": 350,
},
]
`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) vertical completely below the fold 1`] = `
[
{
"el": "html",
"left": 0,
"top": 350,
},
]
`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) vertical completely in view 1`] = `[]`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) vertical partially above the fold 1`] = `
[
{
"el": "html",
"left": 0,
"top": 350,
},
]
`;

exports[`scrollMode: if-needed (outside the scrollingElement bounding box) vertical partially below the fold 1`] = `
[
{
"el": "html",
"left": 0,
"top": 350,
},
]
`;
2 changes: 1 addition & 1 deletion integration/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import compute from '../dist/index.js'
import { compute } from '../dist/index.js'
window.computeScrollIntoView = compute

window.mapActions = (item) => ({
47 changes: 47 additions & 0 deletions integration/viewport-100-percent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<script type="module" src="./utils.js"></script>
<style>
html,
body {
width: 100%;
height: 100%;
}
body {
margin: 0;
}
.padding {
width: 100vw;
height: 100vh;
}
.target {
background: crimson;
height: 100px;
width: 100px;
}

.horizontal-scroll {
display: flex;
position: absolute;
top: 0;
height: 100vh;
}

.horizontal-scroll * {
flex-shrink: 0;
}
</style>
<div class="vertical-scroll">
<div class="padding"></div>
<div class="target"></div>
<div class="padding"></div>
</div>
<div class="horizontal-scroll">
<div class="padding"></div>
<div class="target"></div>
<div class="padding"></div>
</div>
Loading