Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,33 @@ updates:
labels: [dependencies]

- package-ecosystem: npm
directories:
[
/examples/vite,
/examples/next,
/examples/vue,
/examples/nuxt,
/examples/sveltekit,
/examples/solid,
/examples/angular,
/examples/astro,
]
directories: [/examples/vite, /examples/next, /examples/vue, /examples/nuxt, /examples/sveltekit, /examples/solid, /examples/astro]
schedule:
interval: monthly
cooldown:
default-days: 7
groups:
examples:
patterns: ['*']
ignore:
# Node's types stay on a long-term support line, as above
- dependency-name: '@types/node'
update-types: [version-update:semver-major]
labels: [dependencies]

# Each Angular release names the TypeScript versions it builds with, so the Angular example's TypeScript moves with Angular
- package-ecosystem: npm
directory: /examples/angular
schedule:
interval: monthly
cooldown:
default-days: 7
groups:
angular-example:
patterns: ['*']
ignore:
- dependency-name: '@types/node'
update-types: [version-update:semver-major]
- dependency-name: typescript
update-types: [version-update:semver-major, version-update:semver-minor]
labels: [dependencies]
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Svifa follows [semantic versioning](https://semver.org).

## Unreleased
## 1.2.0

### Added

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ imports it as published, Yarn's Plug'n'Play mode included.
Or load the script build, which sets `window.Svifa`:

```html
<script src="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.1.0/dist/svifa.global.min.js" integrity="sha384-qKb8HGrSvPlPYWa82GEkPwHwfWHPnLTgRQEbT9FTWXv65mbh9DIDVIlMgCtLt50X" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.2.0/dist/svifa.global.min.js" integrity="sha384-Cvbx0AtzHAYXN/83k5dga5GIWLE56mbxDTK87Hk3OdpWBtLbcH3kYCymXOMyyIaC" crossorigin="anonymous"></script>
```

Pin the exact version in the address, as here: the `integrity` hash then makes the browser refuse any file that differs from the
Expand Down Expand Up @@ -364,8 +364,8 @@ each page as it comes in. A script reaches the page's Svifa through the hidden e
### A plain page

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.1.0/svifa.css" integrity="sha384-otF4Jeb3ig0lwx4TPg07EA4DX21Rv2bYdenWzivt0s9iF/itD6ESvFkAKjyNPwyE" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.1.0/dist/svifa.global.min.js" integrity="sha384-qKb8HGrSvPlPYWa82GEkPwHwfWHPnLTgRQEbT9FTWXv65mbh9DIDVIlMgCtLt50X" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.2.0/svifa.css" integrity="sha384-otF4Jeb3ig0lwx4TPg07EA4DX21Rv2bYdenWzivt0s9iF/itD6ESvFkAKjyNPwyE" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.2.0/dist/svifa.global.min.js" integrity="sha384-Cvbx0AtzHAYXN/83k5dga5GIWLE56mbxDTK87Hk3OdpWBtLbcH3kYCymXOMyyIaC" crossorigin="anonymous"></script>
<script>
const svifa = new Svifa()
</script>
Expand Down
4 changes: 2 additions & 2 deletions examples/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Svifa on a plain page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.1.0/svifa.css" integrity="sha384-otF4Jeb3ig0lwx4TPg07EA4DX21Rv2bYdenWzivt0s9iF/itD6ESvFkAKjyNPwyE" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.2.0/svifa.css" integrity="sha384-otF4Jeb3ig0lwx4TPg07EA4DX21Rv2bYdenWzivt0s9iF/itD6ESvFkAKjyNPwyE" crossorigin="anonymous" />
<style>
:root {
--paper: #ffffff;
Expand Down Expand Up @@ -122,7 +122,7 @@ <h2>Between pixels</h2>
<p>Scroll slowly and watch the text: it moves evenly to the end, with no one-pixel hops as it settles.</p>
</section>
</main>
<script src="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.1.0/dist/svifa.global.min.js" integrity="sha384-qKb8HGrSvPlPYWa82GEkPwHwfWHPnLTgRQEbT9FTWXv65mbh9DIDVIlMgCtLt50X" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.2.0/dist/svifa.global.min.js" integrity="sha384-Cvbx0AtzHAYXN/83k5dga5GIWLE56mbxDTK87Hk3OdpWBtLbcH3kYCymXOMyyIaC" crossorigin="anonymous"></script>
<script>
// The page glides, and so do same-page links, stopping below the sticky header.
const svifa = new Svifa({ subpixel: 'main > section', anchors: { offset: -56 } })
Expand Down
2 changes: 1 addition & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This file is the complete reference for writing code that uses Svifa. The README

npm install @arcwrightstudio/svifa (or pnpm add, yarn add, bun add, deno add npm:@arcwrightstudio/svifa)

Script tag: https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.1.0/dist/svifa.global.min.js sets window.Svifa.
Script tag: https://cdn.jsdelivr.net/npm/@arcwrightstudio/svifa@1.2.0/dist/svifa.global.min.js sets window.Svifa.

## Rules that matter

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arcwrightstudio/svifa",
"version": "1.1.0",
"version": "1.2.0",
"description": "A smooth scroll library for the page or any scrolling element: the same feel at every refresh rate, drawn between pixels, and out of the way of everything else.",
"keywords": [
"angular",
Expand Down
4 changes: 4 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { defineConfig, devices } from '@playwright/test'
// (@not-webkit). The package's own tests use no browser, so they run once.
const CHROMIUM_ONLY = ['**/scrollbars.spec.ts', '**/package.spec.ts', '**/server.spec.ts']

// Playwright starts every worker with FORCE_COLOR set, and Node warns in each one that also inherits a NO_COLOR. The runner has
// already read NO_COLOR for its own output by the time it reads this file, so the workers are started without it.
delete process.env.NO_COLOR

export default defineConfig({
testDir: 'tests',
fullyParallel: true,
Expand Down
20 changes: 17 additions & 3 deletions scripts/check-example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// The plain-page example and the README load Svifa from jsDelivr, pinned to a version and to the files' integrity hashes. This
// checks that they pin the version in package.json, and that each hash is the hash of the file that version serves: the published
// file once the version is on npm (between releases, while the source changes), this build's file while it is not (a release
// being prepared, so the tags work the moment it is published). Run after the build. usage: node scripts/check-example.mjs [--write]
// being prepared, so the tags work the moment it is published). Every other address of the package on the CDN, as llms.txt gives
// one, pins that version too. Run after the build. usage: node scripts/check-example.mjs [--write]
// --write puts this version and those hashes into them.
import { createHash } from 'node:crypto'
import { readFileSync, writeFileSync } from 'node:fs'
Expand Down Expand Up @@ -75,12 +76,25 @@ for (const place of ['examples/html/index.html', 'README.md']) {
}
if (found === 0) problems.push('the example and the README load nothing from the CDN')

// every address of the package on the CDN, inside a tag or not, pins this version
const address = /https:\/\/cdn\.jsdelivr\.net\/npm\/(@?[^@"\s]+)@([^/"\s]+)\//g
for (const place of ['README.md', 'llms.txt', 'examples/html/index.html']) {
const path = `${root}${place}`
const text = readFileSync(path, 'utf8').replace(address, (whole, pkg, pinned) => {
if (pkg !== name || pinned === version) return whole
if (write) return whole.replace(`@${pinned}/`, `@${version}/`)
problems.push(`${place}: an address pins ${pinned}, but package.json is at ${version}`)
return whole
})
if (write) writeFileSync(path, text)
}

const source = files ? `the files of ${version} as published` : `this build's files (${version} is not published yet)`
if (write) {
console.log(`the example and the README now pin ${name}@${version} and the hashes of ${source}`)
console.log(`the example, the README and llms.txt now pin ${name}@${version}, with the hashes of ${source}`)
} else if (problems.length) {
console.error(problems.join('\n'))
process.exit(1)
} else {
console.log(`the example and the README pin ${name}@${version}, and their ${found} hashes are those of ${source}`)
console.log(`the example, the README and llms.txt pin ${name}@${version}, and the ${found} hashes are those of ${source}`)
}