@gridui/follow-scroll 1.0.9 → 1.0.11

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 CHANGED
@@ -7,4 +7,10 @@ Load styles for any composed dependency used by this family. Applications own ro
7
7
 
8
8
  See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/follow-scroll/.changeset/history).
9
9
 
10
+ The native viewport and its scrollbar are separate children of a local container.
11
+ The jump action reserves its space while hidden, keeping viewport geometry stable.
12
+ Content and viewport resizing reconcile follow position before paint; readers who
13
+ scroll away stay paused until they return near the end or activate the jump action.
14
+ Changing `onFollowingChange` does not restart observation.
15
+
10
16
  [Component reference](docs/reference/README.md) contains focused API pages for each public component.
@@ -5,7 +5,7 @@
5
5
  * @description Follow Scroll
6
6
  */
7
7
  import { type FollowScrollOptions } from "./use-follow-scroll";
8
- import type { ComponentPropsWithRef, FC } from "react";
8
+ import { type ComponentPropsWithRef, type FC } from "react";
9
9
  export type FollowScrollProps = Omit<ComponentPropsWithRef<"div">, "onScroll"> & FollowScrollOptions & {
10
10
  readonly label: string;
11
11
  readonly jumpLabel: string;
package/dist/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  // src/follow-scroll/use-follow-scroll.ts
2
- import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { useCallback, useLayoutEffect, useRef, useState } from "react";
3
3
  var useFollowScroll = ({ threshold = 48, onFollowingChange } = {}) => {
4
4
  if (!Number.isFinite(threshold) || threshold < 0) {
5
5
  throw new Error("FollowScroll threshold must be finite and nonnegative.");
6
6
  }
7
+ const onChange = useRef(onFollowingChange);
8
+ onChange.current = onFollowingChange;
9
+ const refresh = useRef(void 0);
7
10
  const viewportRef = useRef(null);
8
11
  const contentRef = useRef(null);
9
12
  const followingRef = useRef(true);
@@ -17,8 +20,8 @@ var useFollowScroll = ({ threshold = 48, onFollowingChange } = {}) => {
17
20
  }
18
21
  followingRef.current = next;
19
22
  setFollowing(next);
20
- onFollowingChange?.(next);
21
- }, [onFollowingChange]);
23
+ onChange.current?.(next);
24
+ }, []);
22
25
  const scrollToEnd = useCallback(() => {
23
26
  const viewport = viewportRef.current;
24
27
  if (viewport) {
@@ -26,22 +29,18 @@ var useFollowScroll = ({ threshold = 48, onFollowingChange } = {}) => {
26
29
  viewport.scrollTop = viewport.scrollHeight;
27
30
  }
28
31
  }, [changeFollowing]);
29
- useEffect(() => {
32
+ useLayoutEffect(() => {
30
33
  const viewport = viewportRef.current;
31
34
  const content = contentRef.current;
32
35
  if (!viewport || !content) {
33
36
  return;
34
37
  }
35
- let frame = 0;
36
38
  const followGrowth = () => {
37
- cancelAnimationFrame(frame);
38
- frame = requestAnimationFrame(() => {
39
- const distance = viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop;
40
- if (followingRef.current || distance <= threshold) {
41
- changeFollowing(true);
42
- viewport.scrollTop = viewport.scrollHeight;
43
- }
44
- });
39
+ const distance = viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop;
40
+ if (followingRef.current || distance <= threshold) {
41
+ changeFollowing(true);
42
+ viewport.scrollTop = viewport.scrollHeight;
43
+ }
45
44
  };
46
45
  const onScroll = () => {
47
46
  const distance = viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop;
@@ -51,9 +50,10 @@ var useFollowScroll = ({ threshold = 48, onFollowingChange } = {}) => {
51
50
  observer?.observe(content);
52
51
  observer?.observe(viewport);
53
52
  viewport.addEventListener("scroll", onScroll);
53
+ refresh.current = followGrowth;
54
54
  followGrowth();
55
55
  return () => {
56
- cancelAnimationFrame(frame);
56
+ refresh.current = void 0;
57
57
  observer?.disconnect();
58
58
  viewport.removeEventListener("scroll", onScroll);
59
59
  };
@@ -61,6 +61,9 @@ var useFollowScroll = ({ threshold = 48, onFollowingChange } = {}) => {
61
61
  threshold,
62
62
  changeFollowing
63
63
  ]);
64
+ useLayoutEffect(() => {
65
+ refresh.current?.();
66
+ });
64
67
  return {
65
68
  viewportRef,
66
69
  contentRef,
@@ -73,20 +76,28 @@ var useFollowScroll = ({ threshold = 48, onFollowingChange } = {}) => {
73
76
  import { Button } from "@gridui/button";
74
77
  import { useInteractionOutline, useScrollbars } from "@gridui/overlay";
75
78
  import { cn } from "@gridui/style-utils";
79
+ import { useImperativeHandle, useRef as useRef2 } from "react";
76
80
  import { jsx, jsxs } from "react/jsx-runtime";
77
81
  var FollowScroll = (props) => {
78
82
  const { ref: forwardedRef, label, jumpLabel, threshold, onFollowingChange, children, className, ...restProps } = props;
83
+ const containerRef = useRef2(null);
84
+ useImperativeHandle(forwardedRef, () => {
85
+ return containerRef.current;
86
+ }, []);
79
87
  const { viewportRef, contentRef, following, scrollToEnd } = useFollowScroll({
80
88
  ...threshold === void 0 ? {} : { threshold },
81
89
  ...onFollowingChange === void 0 ? {} : { onFollowingChange }
82
90
  });
83
- const scrollbarRef = useScrollbars({ ref: viewportRef });
91
+ const scrollbarRef = useScrollbars({
92
+ ref: viewportRef,
93
+ containerRef
94
+ });
84
95
  const scrollRef = useInteractionOutline({ ref: scrollbarRef });
85
96
  return /* @__PURE__ */ jsxs(
86
97
  "div",
87
98
  {
88
99
  ...restProps,
89
- ref: forwardedRef,
100
+ ref: containerRef,
90
101
  className: cn("gridui-follow-scroll", className),
91
102
  children: [
92
103
  /* @__PURE__ */ jsx(
@@ -107,9 +118,12 @@ var FollowScroll = (props) => {
107
118
  )
108
119
  }
109
120
  ),
110
- !following && /* @__PURE__ */ jsx(
121
+ /* @__PURE__ */ jsx(
111
122
  Button,
112
123
  {
124
+ "aria-hidden": following || void 0,
125
+ inert: following,
126
+ "data-following": following,
113
127
  className: "gridui-follow-scroll-jump",
114
128
  size: "small",
115
129
  onClick: () => {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/follow-scroll/use-follow-scroll.ts", "../src/follow-scroll/follow-scroll.tsx"],
4
- "sourcesContent": ["/**\n * @author WMXPY\n * @package Follow Scroll\n * @namespace FollowScroll\n * @description Use Follow Scroll\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type FollowScrollOptions = {\n readonly threshold?: number;\n readonly onFollowingChange?: (following: boolean) => void;\n};\n\nexport const useFollowScroll = ({ threshold = 48, onFollowingChange }: FollowScrollOptions = {}) => {\n if (!Number.isFinite(threshold) || threshold < 0) {\n throw new Error(\"FollowScroll threshold must be finite and nonnegative.\");\n }\n const viewportRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const followingRef = useRef(true);\n const [\n following,\n setFollowing,\n ] = useState(true);\n const changeFollowing = useCallback((next: boolean) => {\n if (followingRef.current === next) {\n return;\n }\n followingRef.current = next;\n setFollowing(next);\n onFollowingChange?.(next);\n }, [onFollowingChange]);\n const scrollToEnd = useCallback(() => {\n const viewport = viewportRef.current;\n if (viewport) {\n changeFollowing(true);\n viewport.scrollTop = viewport.scrollHeight;\n }\n }, [changeFollowing]);\n useEffect(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n if (!viewport || !content) {\n return;\n }\n let frame = 0;\n const followGrowth = () => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n const distance = viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop;\n if (followingRef.current || distance <= threshold) {\n changeFollowing(true);\n viewport.scrollTop = viewport.scrollHeight;\n }\n });\n };\n const onScroll = () => {\n const distance = viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop;\n changeFollowing(distance <= threshold);\n };\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(followGrowth);\n observer?.observe(content);\n observer?.observe(viewport);\n viewport.addEventListener(\"scroll\", onScroll);\n followGrowth();\n return () => {\n cancelAnimationFrame(frame);\n observer?.disconnect();\n viewport.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n threshold,\n changeFollowing,\n ]);\n return {\n viewportRef,\n contentRef,\n following,\n scrollToEnd,\n };\n};\n", "/**\n * @author WMXPY\n * @package Follow Scroll\n * @namespace FollowScroll\n * @description Follow Scroll\n */\n\nimport { type FollowScrollOptions, useFollowScroll } from \"./use-follow-scroll\";\nimport { Button } from \"@gridui/button\";\nimport { useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FollowScrollProps = Omit<ComponentPropsWithRef<\"div\">, \"onScroll\"> & FollowScrollOptions & {\n readonly label: string;\n readonly jumpLabel: string;\n};\n\nexport const FollowScroll: FC<FollowScrollProps> = (props: FollowScrollProps) => {\n const { ref: forwardedRef, label, jumpLabel, threshold, onFollowingChange, children, className, ...restProps } = props;\n const { viewportRef, contentRef, following, scrollToEnd } = useFollowScroll({\n ...(threshold === undefined ? {} : { threshold }),\n ...(onFollowingChange === undefined ? {} : { onFollowingChange }),\n });\n const scrollbarRef = useScrollbars({ ref: viewportRef });\n const scrollRef = useInteractionOutline({ ref: scrollbarRef });\n return (<div\n {...restProps}\n ref={forwardedRef}\n className={cn(\"gridui-follow-scroll\", className)}\n >\n <div\n ref={scrollRef}\n className=\"gridui-follow-scroll-viewport\"\n role=\"region\"\n aria-label={label}\n tabIndex={0}\n >\n <div\n ref={contentRef}\n className=\"gridui-follow-scroll-content\"\n >\n {children}\n </div>\n </div>\n {!following && (<Button\n className=\"gridui-follow-scroll-jump\"\n size=\"small\"\n onClick={() => {\n scrollToEnd();\n viewportRef.current?.focus({ preventScroll: true });\n }}\n >\n {jumpLabel}\n </Button>)}\n </div>);\n};\n"],
5
- "mappings": ";AAOA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAOlD,IAAM,kBAAkB,CAAC,EAAE,YAAY,IAAI,kBAAkB,IAAyB,CAAC,MAAM;AAChG,MAAI,CAAC,OAAO,SAAS,SAAS,KAAK,YAAY,GAAG;AAC9C,UAAM,IAAI,MAAM,wDAAw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AAAA,EACJ;AACJ;",
6
- "names": []
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Follow Scroll\n * @namespace FollowScroll\n * @description Use Follow Scroll\n */\n\nimport { useCallback, useLayoutEffect, useRef, useState } from \"react\";\n\nexport type FollowScrollOptions = {\n readonly threshold?: number;\n readonly onFollowingChange?: (following: boolean) => void;\n};\n\nexport const useFollowScroll = ({ threshold = 48, onFollowingChange }: FollowScrollOptions = {}) => {\n if (!Number.isFinite(threshold) || threshold < 0) {\n throw new Error(\"FollowScroll threshold must be finite and nonnegative.\");\n }\n const onChange = useRef(onFollowingChange);\n onChange.current = onFollowingChange;\n const refresh = useRef<(() => void) | undefined>(undefined);\n const viewportRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const followingRef = useRef(true);\n const [\n following,\n setFollowing,\n ] = useState(true);\n const changeFollowing = useCallback((next: boolean) => {\n if (followingRef.current === next) {\n return;\n }\n followingRef.current = next;\n setFollowing(next);\n onChange.current?.(next);\n }, []);\n const scrollToEnd = useCallback(() => {\n const viewport = viewportRef.current;\n if (viewport) {\n changeFollowing(true);\n viewport.scrollTop = viewport.scrollHeight;\n }\n }, [changeFollowing]);\n useLayoutEffect(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n if (!viewport || !content) {\n return;\n }\n const followGrowth = () => {\n const distance = viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop;\n if (followingRef.current || distance <= threshold) {\n changeFollowing(true);\n viewport.scrollTop = viewport.scrollHeight;\n }\n };\n const onScroll = () => {\n const distance = viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop;\n changeFollowing(distance <= threshold);\n };\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(followGrowth);\n observer?.observe(content);\n observer?.observe(viewport);\n viewport.addEventListener(\"scroll\", onScroll);\n refresh.current = followGrowth;\n followGrowth();\n return () => {\n refresh.current = undefined;\n observer?.disconnect();\n viewport.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n threshold,\n changeFollowing,\n ]);\n useLayoutEffect(() => {\n refresh.current?.();\n });\n return {\n viewportRef,\n contentRef,\n following,\n scrollToEnd,\n };\n};\n", "/**\n * @author WMXPY\n * @package Follow Scroll\n * @namespace FollowScroll\n * @description Follow Scroll\n */\n\nimport { type FollowScrollOptions, useFollowScroll } from \"./use-follow-scroll\";\nimport { Button } from \"@gridui/button\";\nimport { useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type ComponentPropsWithRef, type FC, useImperativeHandle, useRef } from \"react\";\n\nexport type FollowScrollProps = Omit<ComponentPropsWithRef<\"div\">, \"onScroll\"> & FollowScrollOptions & {\n readonly label: string;\n readonly jumpLabel: string;\n};\n\nexport const FollowScroll: FC<FollowScrollProps> = (props: FollowScrollProps) => {\n const { ref: forwardedRef, label, jumpLabel, threshold, onFollowingChange, children, className, ...restProps } = props;\n const containerRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(forwardedRef, () => {\n return containerRef.current!;\n }, []);\n const { viewportRef, contentRef, following, scrollToEnd } = useFollowScroll({\n ...(threshold === undefined ? {} : { threshold }),\n ...(onFollowingChange === undefined ? {} : { onFollowingChange }),\n });\n const scrollbarRef = useScrollbars({\n ref: viewportRef,\n containerRef,\n });\n const scrollRef = useInteractionOutline({ ref: scrollbarRef });\n return (<div\n {...restProps}\n ref={containerRef}\n className={cn(\"gridui-follow-scroll\", className)}\n >\n <div\n ref={scrollRef}\n className=\"gridui-follow-scroll-viewport\"\n role=\"region\"\n aria-label={label}\n tabIndex={0}\n >\n <div\n ref={contentRef}\n className=\"gridui-follow-scroll-content\"\n >\n {children}\n </div>\n </div>\n <Button\n aria-hidden={following || undefined}\n inert={following}\n data-following={following}\n className=\"gridui-follow-scroll-jump\"\n size=\"small\"\n onClick={() => {\n scrollToEnd();\n viewportRef.current?.focus({ preventScroll: true });\n }}\n >\n {jumpLabel}\n </Button>\n </div>);\n};\n"],
5
+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,MAE/C;AAAA;AAAA,UAAC;AAAA;AAAA,YACG,KAAK;AAAA,YACL,WAAU;AAAA,YACV,MAAK;AAAA,YACL,cAAY;AAAA,YACZ,UAAU;AAAA,YAEV;AAAA,cAAC;AAAA;AAAA,gBACG,KAAK;AAAA,gBACL,WAAU;AAAA,gBAET;AAAA;AAAA,YACL;AAAA;AAAA,QACJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACG,eAAa,aAAa;AAAA,YAC1B,OAAO;AAAA,YACP,kBAAgB;AAAA,YAChB,WAAU;AAAA,YACV,MAAK;AAAA,YACL,SAAS,MAAM;AACX,0BAAY;AACZ,0BAAY,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;AAAA,YACtD;AAAA,YAEC;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACJ;AACJ;",
6
+ "names": ["useRef"]
7
7
  }
package/dist/styles.css CHANGED
@@ -18,6 +18,9 @@
18
18
  .gridui-follow-scroll-content {
19
19
  display: flow-root;
20
20
  }
21
+ .gridui-follow-scroll-jump[data-following="true"] {
22
+ visibility: hidden;
23
+ }
21
24
  .gridui-follow-scroll-jump {
22
25
  align-self: center;
23
26
  flex: none;
package/docs/catalog.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/follow-scroll",
4
- "version": "1.0.9",
4
+ "version": "1.0.11",
5
5
  "category": "core",
6
6
  "description": "GridUI React follow scroll",
7
- "usage": "Component reference contains focused API pages for each public component.",
7
+ "usage": "The native viewport and its scrollbar are separate children of a local container. The jump action reserves its space while hidden, keeping viewport geometry stable. Content and viewport resizing reconcile follow position before paint; readers who scroll away stay paused until they return near the end or activate the jump action. Changing `onFollowingChange` does not restart observation.",
8
8
  "documentation": [
9
9
  "README.md",
10
10
  "docs/follow-scroll.md",
@@ -40,6 +40,7 @@
40
40
  "@gridui/follow-scroll/styles.css"
41
41
  ],
42
42
  "examples": [
43
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/follow-scroll/stories/getting-started.mdx",
43
44
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/follow-scroll/stories/live-content.mdx",
44
45
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/follow-scroll/stories/follow-scroll.stories.tsx"
45
46
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/follow-scroll",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "GridUI React follow scroll",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -27,15 +27,15 @@
27
27
  "react-dom": "^19.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@gridui/button": "^4.1.0",
31
- "@gridui/overlay": "^2.0.0",
30
+ "@gridui/button": "^5.1.0",
31
+ "@gridui/overlay": "^2.3.0",
32
32
  "@gridui/style-utils": "^4.0.0",
33
- "@gridui/theme": "^2.5.3"
33
+ "@gridui/theme": "^3.0.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@gridui-internal/configuration": "0.0.0-internal",
37
37
  "@jest/globals": "30.5.2",
38
- "@storybook/react-vite": "10.6.6",
38
+ "@storybook/react-vite": "10.6.7",
39
39
  "@types/jest": "30.0.0",
40
40
  "@types/node": "26.6.6",
41
41
  "@types/react": "19.3.0",