@sharadox/scroll-web-library 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/distribution/section-link/index.d.ts +4 -2
- package/distribution/section-link/index.d.ts.map +1 -1
- package/distribution/section-link/index.js +6 -3
- package/distribution/section-link/index.js.map +1 -1
- package/distribution/smooth-scroll/index.d.ts +4 -1
- package/distribution/smooth-scroll/index.d.ts.map +1 -1
- package/distribution/smooth-scroll/index.js +34 -5
- package/distribution/smooth-scroll/index.js.map +1 -1
- package/llms.txt +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,13 +15,13 @@ pnpm add @sharadox/scroll-web-library
|
|
|
15
15
|
|
|
16
16
|
## API
|
|
17
17
|
|
|
18
|
-
| Import | Export
|
|
19
|
-
| ------------------ |
|
|
20
|
-
| `…/smooth-scroll` | `<SmoothScroll duration? anchorOffset?>` (renders nothing; default 1.15 s and -60 px; `#top` glides to the top of any page)
|
|
21
|
-
| `…/section-link` | `<SectionLink href>`: Next.js `Link` for a section (`#id
|
|
22
|
-
| `…/active-section` | `useActiveSection(ids)` → `{ active, within, page }` (keep `ids` stable, for example a module constant)
|
|
23
|
-
| `…/glide` | `glideTo(top, { duration? })`
|
|
24
|
-
| `…/scroll-steps` | `useScrollSteps(sectionRef, count, { duration? })` (0.9 s by default)
|
|
18
|
+
| Import | Export |
|
|
19
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
20
|
+
| `…/smooth-scroll` | `<SmoothScroll duration? anchorOffset?>` (renders nothing; default 1.15 s and -60 px; `#top` glides to the top of any page; in a page or a layout, and a glide from one page never carries over to the next) |
|
|
21
|
+
| `…/section-link` | `<SectionLink href>`: Next.js `Link` for a section: on this page (`#id`) scrolling is left to `SmoothScroll` (`scroll={false}`); on another page (`/en#id`) Next.js scrolls there |
|
|
22
|
+
| `…/active-section` | `useActiveSection(ids)` → `{ active, within, page }` (keep `ids` stable, for example a module constant) |
|
|
23
|
+
| `…/glide` | `glideTo(top, { duration? })` |
|
|
24
|
+
| `…/scroll-steps` | `useScrollSteps(sectionRef, count, { duration? })` (0.9 s by default) |
|
|
25
25
|
|
|
26
26
|
## Develop
|
|
27
27
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import Link from "next/link";
|
|
2
2
|
import type { ComponentProps } from "react";
|
|
3
3
|
/**
|
|
4
|
-
* Next.js `Link` for a section of
|
|
5
|
-
*
|
|
4
|
+
* Next.js `Link` for a section of a page. For one on this page (`#contact`), Next.js updates the address and
|
|
5
|
+
* `SmoothScroll` does the scrolling (`scroll={false}`), so the page glides there instead of two scrolls fighting. For
|
|
6
|
+
* one on another page (`/en#contact`), Next.js goes to that page and scrolls to the section itself, as `Link` does.
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
8
9
|
* <SectionLink href="#contact">Contact</SectionLink>
|
|
10
|
+
* <SectionLink href="/en#contact">Contact</SectionLink>
|
|
9
11
|
*/
|
|
10
12
|
export declare function SectionLink(properties: ComponentProps<typeof Link>): import("react").JSX.Element;
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/section-link/index.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/section-link/index.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,+BAGlE"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Link from "next/link";
|
|
3
3
|
/**
|
|
4
|
-
* Next.js `Link` for a section of
|
|
5
|
-
*
|
|
4
|
+
* Next.js `Link` for a section of a page. For one on this page (`#contact`), Next.js updates the address and
|
|
5
|
+
* `SmoothScroll` does the scrolling (`scroll={false}`), so the page glides there instead of two scrolls fighting. For
|
|
6
|
+
* one on another page (`/en#contact`), Next.js goes to that page and scrolls to the section itself, as `Link` does.
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
8
9
|
* <SectionLink href="#contact">Contact</SectionLink>
|
|
10
|
+
* <SectionLink href="/en#contact">Contact</SectionLink>
|
|
9
11
|
*/
|
|
10
12
|
export function SectionLink(properties) {
|
|
11
|
-
|
|
13
|
+
const here = typeof properties.href === "string" && properties.href.startsWith("#");
|
|
14
|
+
return _jsx(Link, { ...(here ? { scroll: false } : {}), ...properties });
|
|
12
15
|
}
|
|
13
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/section-link/index.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/section-link/index.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,UAAuC;IACjE,MAAM,IAAI,GAAG,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACpF,OAAO,KAAC,IAAI,OAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAM,UAAU,GAAI,CAAC;AACvE,CAAC"}
|
|
@@ -3,7 +3,10 @@ import type { SmoothScrollProperties } from "@sharadox/scroll-web-library/smooth
|
|
|
3
3
|
* Smooth, inertial page scrolling, including in-page anchor links (plain ones and `SectionLink`s) and `#top`, which
|
|
4
4
|
* glides to the top of whatever page is open. A link to the page already open (the logo on the home page, for one)
|
|
5
5
|
* glides back to the top instead of reloading. Smoothing is off when the visitor prefers reduced motion: anchors then
|
|
6
|
-
* jump, and the same-page link still goes to the top without reloading.
|
|
6
|
+
* jump, and the same-page link still goes to the top without reloading. It works in a page or in a layout. A page's smoothing stops as soon as the
|
|
7
|
+
* address is another page's, and only one page smooths at a time; a new page leaves the wheel and touch alone for a moment while
|
|
8
|
+
* Next.js places it. So a glide still under way from the previous page (a trackpad's momentum, say) can't send the new
|
|
9
|
+
* page to the old page's place.
|
|
7
10
|
*/
|
|
8
11
|
export declare function SmoothScroll({ duration, anchorOffset }: SmoothScrollProperties): null;
|
|
9
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/smooth-scroll/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/smooth-scroll/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AAc9F;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAe,EAAE,YAAkB,EAAE,EAAE,sBAAsB,QAqE3F"}
|
|
@@ -1,23 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import Lenis from "lenis";
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
3
4
|
import { useEffect } from "react";
|
|
4
5
|
import { registerGlider } from "@sharadox/scroll-web-library/glide";
|
|
6
|
+
/** Milliseconds after a page opens while Next.js places it (at the top, an anchor or where it was). */
|
|
7
|
+
const SETTLING = 300;
|
|
8
|
+
/**
|
|
9
|
+
* Stops the smoothing of the page that came before. Next.js may keep that page a moment after the new one appears; its
|
|
10
|
+
* smoothing must not go on moving the new page towards where the old one was headed.
|
|
11
|
+
*/
|
|
12
|
+
let stopPrevious = null;
|
|
5
13
|
/** A path without its trailing slash, so "/en/" and "/en" count as the same page. */
|
|
6
14
|
const page = (path) => path.replace(/(.)\/$/, "$1");
|
|
7
15
|
/**
|
|
8
16
|
* Smooth, inertial page scrolling, including in-page anchor links (plain ones and `SectionLink`s) and `#top`, which
|
|
9
17
|
* glides to the top of whatever page is open. A link to the page already open (the logo on the home page, for one)
|
|
10
18
|
* glides back to the top instead of reloading. Smoothing is off when the visitor prefers reduced motion: anchors then
|
|
11
|
-
* jump, and the same-page link still goes to the top without reloading.
|
|
19
|
+
* jump, and the same-page link still goes to the top without reloading. It works in a page or in a layout. A page's smoothing stops as soon as the
|
|
20
|
+
* address is another page's, and only one page smooths at a time; a new page leaves the wheel and touch alone for a moment while
|
|
21
|
+
* Next.js places it. So a glide still under way from the previous page (a trackpad's momentum, say) can't send the new
|
|
22
|
+
* page to the old page's place.
|
|
12
23
|
*/
|
|
13
24
|
export function SmoothScroll({ duration = 1.15, anchorOffset = -60 }) {
|
|
25
|
+
// In a layout, it stays mounted from page to page: each page gets smoothing of its own.
|
|
26
|
+
const pathname = usePathname();
|
|
14
27
|
useEffect(() => {
|
|
28
|
+
stopPrevious?.();
|
|
29
|
+
// While the page is being placed, wheel and touch events still belong to the previous page's gesture; once the
|
|
30
|
+
// address is another page's (a link, or back and forward), this page's smoothing has nothing more to do.
|
|
31
|
+
const opened = performance.now();
|
|
32
|
+
const path = page(location.pathname);
|
|
33
|
+
const here = () => page(location.pathname) === path;
|
|
34
|
+
const listening = () => here() && performance.now() - opened >= SETTLING;
|
|
15
35
|
const lenis = window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
16
36
|
? null
|
|
17
|
-
: new Lenis({ duration, smoothWheel: true });
|
|
37
|
+
: new Lenis({ duration, smoothWheel: true, virtualScroll: listening });
|
|
18
38
|
let frame = 0;
|
|
19
39
|
const animate = (time) => {
|
|
20
|
-
|
|
40
|
+
if (here())
|
|
41
|
+
lenis.raf(time);
|
|
21
42
|
frame = requestAnimationFrame(animate);
|
|
22
43
|
};
|
|
23
44
|
if (lenis)
|
|
@@ -65,13 +86,21 @@ export function SmoothScroll({ duration = 1.15, anchorOffset = -60 }) {
|
|
|
65
86
|
}
|
|
66
87
|
};
|
|
67
88
|
document.addEventListener("click", onClick);
|
|
68
|
-
|
|
89
|
+
const stop = () => {
|
|
69
90
|
cancelAnimationFrame(frame);
|
|
70
91
|
document.removeEventListener("click", onClick);
|
|
71
92
|
lenis?.destroy();
|
|
93
|
+
};
|
|
94
|
+
stopPrevious = stop;
|
|
95
|
+
return () => {
|
|
96
|
+
// Already stopped (and replaced) if a newer page took over; otherwise this page is the one leaving.
|
|
97
|
+
if (stopPrevious !== stop)
|
|
98
|
+
return;
|
|
99
|
+
stop();
|
|
100
|
+
stopPrevious = null;
|
|
72
101
|
registerGlider(null);
|
|
73
102
|
};
|
|
74
|
-
}, [duration, anchorOffset]);
|
|
103
|
+
}, [duration, anchorOffset, pathname]);
|
|
75
104
|
return null;
|
|
76
105
|
}
|
|
77
106
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/smooth-scroll/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGpE,qFAAqF;AACrF,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/smooth-scroll/index.ts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YAC/C,KAAK,EAAE,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC;QACF,YAAY,GAAG,IAAI,CAAC;QACpB,OAAO,GAAG,EAAE;YACV,oGAAoG;YACpG,IAAI,YAAY,KAAK,IAAI;gBAAE,OAAO;YAClC,IAAI,EAAE,CAAC;YACP,YAAY,GAAG,IAAI,CAAC;YACpB,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
- /smooth-scroll: <SmoothScroll duration=1.15 anchorOffset=-60 /> — off with prefers-reduced-motion; handles a[href^="#"] clicks
|
|
6
6
|
- /active-section: useActiveSection(ids: readonly string[]) → { active: id at viewport middle, within: 0–1 through it, page: 0–1 page progress }
|
|
7
7
|
- Peer: react. License: Sharadox Open Source License 0.1.0
|
|
8
|
+
- SmoothScroll works in a page or a layout (it starts afresh for every pathname). Each page's smoothing stops the moment the address is another page's (link, back or forward) and a new page stops the previous one's, so a glide or trackpad momentum from the old page never moves the new one; for 300 ms after a page opens, wheel and touch are left to the browser while Next.js places it (0.4.2).
|
|
8
9
|
- SmoothScroll also turns plain clicks on links to the current page (same path, no hash or query, no target, no modifier keys) into a scroll to the top, without reloading — with or without reduced motion.
|
|
9
10
|
- /glide: glideTo(top, { duration? }) — through the running SmoothScroll (Lenis) or window.scrollTo (smooth, or auto with reduced motion); registerGlider is internal to SmoothScroll
|
|
10
11
|
- /scroll-steps: useScrollSteps(sectionRef, count, { duration? = 0.9 }) — while the section is pinned, each wheel gesture (a pause of 180 ms starts a new one) or finger swipe (30 px+) glides exactly one step; step i sits at top + (i + 0.5) / count × (height − innerHeight); past the ends the page scrolls on
|
|
11
12
|
- 0.3.0: glide, scroll-steps
|
|
12
13
|
- 0.3.1: a finger swipe's step glide starts after the touch event, so smooth scrolling (Lenis) no longer stops it on phones
|
|
13
|
-
- /section-link: <SectionLink href …LinkProps> — next/link
|
|
14
|
+
- /section-link: <SectionLink href …LinkProps> — next/link; for "#id" on this page scroll={false} (SmoothScroll glides), for "/path#id" Next.js navigates and scrolls as usual; SmoothScroll glides (or, with reduced motion, jumps) to the anchor even though Link took the click
|
|
14
15
|
- 0.4.0: SectionLink; SmoothScroll handles "#top" (top of the open page) and anchors whose click a Next.js Link already took; next is a peer dependency
|
|
16
|
+
- 0.4.1: SectionLink leaves Next.js scrolling on for sections of other pages ("/en#contact"), so they land on the section
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/scroll-web-library",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Scrolling for React websites: smooth inertial scrolling with anchor jumps (Lenis) and the active section with page progress.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENCA.md",
|