@sharadox/scroll-web-library 0.5.1-dependency-update.13 → 0.6.0-changelog.21
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/CHANGELOG.md +19 -0
- package/README.md +1 -0
- package/distribution/scrolled-past/index.d.ts +10 -0
- package/distribution/scrolled-past/index.d.ts.map +1 -0
- package/distribution/scrolled-past/index.js +25 -0
- package/distribution/scrolled-past/index.js.map +1 -0
- package/llms.txt +2 -4
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
What changed in each version of `@sharadox/scroll-web-library`, newest first.
|
|
4
|
+
|
|
5
|
+
## 0.4.1
|
|
6
|
+
|
|
7
|
+
SectionLink leaves Next.js scrolling on for sections of other pages ("/en#contact"), so they land on the section
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
SectionLink; SmoothScroll handles "#top" (top of the open page) and anchors whose click a Next.js Link already took; next is a peer dependency
|
|
12
|
+
|
|
13
|
+
## 0.3.1
|
|
14
|
+
|
|
15
|
+
A finger swipe's step glide starts after the touch event, so smooth scrolling (Lenis) no longer stops it on phones
|
|
16
|
+
|
|
17
|
+
## 0.3.0
|
|
18
|
+
|
|
19
|
+
Glide, scroll-steps
|
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ pnpm add @sharadox/scroll-web-library
|
|
|
17
17
|
|
|
18
18
|
| Import | Export |
|
|
19
19
|
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
20
|
+
| `…/scrolled-past` | `useScrolledPast(point)`: whether the page has scrolled past a distance (or a share of the window's height), kept up to date |
|
|
20
21
|
| `…/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
22
|
| `…/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
23
|
| `…/active-section` | `useActiveSection(ids)` → `{ active, within, page }` (keep `ids` stable, for example a module constant) |
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the page has scrolled past a point, kept up to date as it scrolls: a distance in pixels, or a function of
|
|
3
|
+
* the window's height (`(height) => height * 0.6`, past most of the first screen). False until the page has loaded.
|
|
4
|
+
* For a bar that turns solid once the page moves, or an action that appears below the hero.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const scrolled = useScrolledPast(24);
|
|
8
|
+
*/
|
|
9
|
+
export declare function useScrolledPast(point: number | ((windowHeight: number) => number)): boolean;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/scrolled-past/index.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,OAAO,CAa3F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Whether the page has scrolled past a point, kept up to date as it scrolls: a distance in pixels, or a function of
|
|
5
|
+
* the window's height (`(height) => height * 0.6`, past most of the first screen). False until the page has loaded.
|
|
6
|
+
* For a bar that turns solid once the page moves, or an action that appears below the hero.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const scrolled = useScrolledPast(24);
|
|
10
|
+
*/
|
|
11
|
+
export function useScrolledPast(point) {
|
|
12
|
+
const [past, setPast] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const update = () => setPast(scrollY > (typeof point === "number" ? point : point(innerHeight)));
|
|
15
|
+
update();
|
|
16
|
+
addEventListener("scroll", update, { passive: true });
|
|
17
|
+
addEventListener("resize", update, { passive: true });
|
|
18
|
+
return () => {
|
|
19
|
+
removeEventListener("scroll", update);
|
|
20
|
+
removeEventListener("resize", update);
|
|
21
|
+
};
|
|
22
|
+
}, [point]);
|
|
23
|
+
return past;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/scrolled-past/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,KAAkD;IAChF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACjG,MAAM,EAAE,CAAC;QACT,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,OAAO,GAAG,EAAE;YACV,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACtC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACxC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Smooth scrolling (Lenis) and active-section tracking for React.
|
|
4
4
|
|
|
5
|
+
- /scrolled-past: useScrolledPast(point: px | (windowHeight) => px) → boolean, kept up to date on scroll and resize (a bar that turns solid, an action that appears below the hero)
|
|
5
6
|
- /smooth-scroll: <SmoothScroll duration=1.15 anchorOffset=-60 /> — off with prefers-reduced-motion; handles a[href^="#"] clicks
|
|
6
7
|
- /active-section: useActiveSection(ids: readonly string[]) → { active: id at viewport middle, within: 0–1 through it, page: 0–1 page progress }
|
|
7
8
|
- Peer: react. License: Sharadox Open Source License 0.1.0
|
|
@@ -10,8 +11,5 @@
|
|
|
10
11
|
- /glide: glideTo(top, { duration? }) — through the running SmoothScroll (Lenis) or window.scrollTo (smooth, or auto with reduced motion); registerGlider is internal to SmoothScroll
|
|
11
12
|
- /glide-into-view: glideIntoView(element, { offset? = 96, duration? }) — glides the element's top to offset below the window's top, only when it isn't wholly in view (0.5.0)
|
|
12
13
|
- /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
|
|
13
|
-
- 0.3.0: glide, scroll-steps
|
|
14
|
-
- 0.3.1: a finger swipe's step glide starts after the touch event, so smooth scrolling (Lenis) no longer stops it on phones
|
|
15
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
|
|
16
|
-
-
|
|
17
|
-
- 0.4.1: SectionLink leaves Next.js scrolling on for sections of other pages ("/en#contact"), so they land on the section
|
|
15
|
+
- Changes by version: CHANGELOG.md (in the package)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/scroll-web-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-changelog.21",
|
|
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",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"LICENCA.md",
|
|
26
26
|
"LICENSE.md",
|
|
27
27
|
"NOTICE.md",
|
|
28
|
-
"llms.txt"
|
|
28
|
+
"llms.txt",
|
|
29
|
+
"CHANGELOG.md"
|
|
29
30
|
],
|
|
30
31
|
"sideEffects": [
|
|
31
32
|
"**/*.css"
|