page-transition 0.0.0-stage → 0.1.0-beta.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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +233 -2
  3. package/dist/components/TransitionLink.d.ts +5 -0
  4. package/dist/components/TransitionLink.js +9 -0
  5. package/dist/context/CssTransitionProvider.d.ts +12 -0
  6. package/dist/context/CssTransitionProvider.js +110 -0
  7. package/dist/context/ManualTransitionProvider.d.ts +6 -0
  8. package/dist/context/ManualTransitionProvider.js +33 -0
  9. package/dist/context/TransitionContext.d.ts +24 -0
  10. package/dist/context/TransitionContext.js +20 -0
  11. package/dist/functions/checkTransitionFinish.d.ts +6 -0
  12. package/dist/functions/checkTransitionFinish.js +13 -0
  13. package/dist/functions/debounce.d.ts +11 -0
  14. package/dist/functions/debounce.js +8 -0
  15. package/dist/functions/parseClipPath.d.ts +1 -0
  16. package/dist/functions/parseClipPath.js +9 -0
  17. package/dist/functions/parseClipPathAll.d.ts +1 -0
  18. package/dist/functions/parseClipPathAll.js +20 -0
  19. package/dist/functions/parseDelay.d.ts +1 -0
  20. package/dist/functions/parseDelay.js +10 -0
  21. package/dist/functions/parseOpacity.d.ts +1 -0
  22. package/dist/functions/parseOpacity.js +6 -0
  23. package/dist/functions/parseOpacityAll.d.ts +1 -0
  24. package/dist/functions/parseOpacityAll.js +13 -0
  25. package/dist/functions/resetDelay.d.ts +1 -0
  26. package/dist/functions/resetDelay.js +7 -0
  27. package/dist/functions/transitionEnd.d.ts +21 -0
  28. package/dist/functions/transitionEnd.js +29 -0
  29. package/dist/functions/transitionEndReverse.d.ts +21 -0
  30. package/dist/functions/transitionEndReverse.js +36 -0
  31. package/dist/functions/wait.d.ts +2 -0
  32. package/dist/functions/wait.js +12 -0
  33. package/dist/hooks/manual/useHandleLinkClick.d.ts +10 -0
  34. package/dist/hooks/manual/useHandleLinkClick.js +17 -0
  35. package/dist/hooks/manual/usePopState.d.ts +9 -0
  36. package/dist/hooks/manual/usePopState.js +21 -0
  37. package/dist/hooks/useHandleLinkClick.d.ts +26 -0
  38. package/dist/hooks/useHandleLinkClick.js +94 -0
  39. package/dist/hooks/usePopState.d.ts +25 -0
  40. package/dist/hooks/usePopState.js +98 -0
  41. package/dist/hooks/useScrollRestoration.d.ts +1 -0
  42. package/dist/hooks/useScrollRestoration.js +26 -0
  43. package/dist/hooks/useTransitionEndData.d.ts +11 -0
  44. package/dist/hooks/useTransitionEndData.js +17 -0
  45. package/dist/hooks/useTransitionEndHandler.d.ts +7 -0
  46. package/dist/hooks/useTransitionEndHandler.js +9 -0
  47. package/dist/hooks/useTransitionEndObj.d.ts +16 -0
  48. package/dist/hooks/useTransitionEndObj.js +15 -0
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.js +3 -0
  51. package/package.json +23 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Simon Schindler
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,234 @@
1
- # Temporary Holding Version
1
+ # page-transition
2
+ A page transition library for the Next.js App Router.
2
3
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
4
+ ## Features
5
+
6
+ - CSS & Manual mode
7
+ - Scroll restoration
8
+
9
+ ## Install
10
+
11
+ `npm install page-transition@beta`
12
+
13
+ ## Usage
14
+ Import your page transition styles and wrap your page content with `TransitionProvider` in your root layout.
15
+
16
+ ```tsx
17
+ import { TransitionProvider } from "page-transition"
18
+ import '.../your-page-transition-styles.css'
19
+
20
+ export default function RootLayout({ children }: LayoutProps<"/">) {
21
+ return (
22
+ <html lang="en">
23
+ <body>
24
+ <TransitionProvider>
25
+ {children}
26
+ </TransitionProvider>
27
+ </body>
28
+ </html>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ## Components
34
+
35
+ ### `TransitionProvider`
36
+ #### Props
37
+
38
+ |Prop|Type|Default|Mode|
39
+ |---|---|---|---|
40
+ | mode | "css" \| "manual" | "css" | Both |
41
+ | header | JSX | - | CSS |
42
+ | options | *Options* | {} | CSS |
43
+
44
+ *Options*
45
+
46
+ | Option | Type | Default |
47
+ |---|---|---|
48
+ | transitionProperty | "opacity" \| "clip-path" | "opacity" |
49
+ | overlayCount | number | 0 |
50
+
51
+ **Prop Descriptions**
52
+
53
+ **mode**
54
+ Select the transition mode.
55
+
56
+ **header**
57
+ The component rendered outside the transition container.
58
+
59
+ **options.transitionProperty**
60
+ Defines which property transitionend waits for.
61
+
62
+ **options.overlayCount**
63
+ Defines how many overlay items should be created.
64
+
65
+
66
+ ```tsx
67
+ <TransitionProvider
68
+ header={<Header/>}
69
+ options={{
70
+ transitionProperty: "clip-path",
71
+ overlayCount: 1
72
+ }}
73
+ >
74
+ {children}
75
+ </TransitionProvider>
76
+ ```
77
+
78
+ ### `TransitionLink`
79
+ #### Props
80
+
81
+ |Prop|type|default|
82
+ |---|---|---|
83
+ | href | string | - |
84
+
85
+ **Description**
86
+ Triggers the transition.
87
+
88
+
89
+ ```tsx
90
+ <TransitionLink href={"/home"}>
91
+ Home
92
+ </TransitionLink>
93
+ ```
94
+
95
+ ### CSS Mode
96
+
97
+ The `TransitionProvider` uses a container with a `data-transition` attribute. When navigation starts, it adds the `exit` class and waits for the transitionend event of the configured transition property.
98
+
99
+ Once the transition ends, navigation is performed and the scroll position is restored using window.history.state.scrollY.
100
+
101
+ After navigation, the `exit` class is removed and the `enter` class is added. Once the next transitionend event fires, the enter class is removed.
102
+
103
+ For overlay animations, a `.overlay-wrapper` is available. You can add overlay items by setting the `overlayCount` option.
104
+
105
+ To access the overlay wrapper and its items, use `useTransitionContext`.
106
+
107
+ ```ts
108
+ import { useTransitionContext } from "page-transition"
109
+
110
+ const {overlayWrapper, overlayItems} = useTransitionContext()
111
+
112
+ ```
113
+
114
+ #### CSS/SCSS Examples
115
+ <details>
116
+ <summary>Opacity</summary>
117
+ <br/>
118
+ options
119
+
120
+ ```ts
121
+ transitionProperty: "opacity"
122
+ overlayCount: 0
123
+ ```
124
+
125
+ ```css
126
+ [data-transition]{
127
+ will-change: opacity;
128
+ opacity: 1;
129
+ }
130
+ [data-transition].exit{
131
+ opacity: 0;
132
+ transition: opacity 0.4s ease;
133
+
134
+ }
135
+ [data-transition].enter{
136
+ opacity: 1;
137
+ transition: opacity 0.5s ease;
138
+ }
139
+ ```
140
+ </details>
141
+
142
+ <details>
143
+ <summary>Single Overlay</summary>
144
+ <br/>
145
+ options
146
+
147
+ ```ts
148
+ transitionProperty: "clip-path"
149
+ overlayCount: 1
150
+ ```
151
+
152
+ ```css
153
+ [data-transition] .overlay-wrapper{
154
+ position: fixed;
155
+ inset: 0;
156
+
157
+ display: grid;
158
+ grid-template-columns: 1fr;
159
+ }
160
+ [data-transition] .overlay-item{
161
+ background: black;
162
+ transition: none;
163
+ will-change: clip-path;
164
+ clip-path: inset(100% 0 0 0);
165
+ }
166
+ [data-transition].exit .overlay-item{
167
+ clip-path: inset(0 0 0 0);
168
+ transition: clip-path 1.2s ease;
169
+ }
170
+ [data-transition].enter .overlay-item{
171
+ clip-path: inset(0 0 100% 0);
172
+ transition: clip-path 1.2s ease;
173
+ }
174
+ ```
175
+ </details>
176
+
177
+ <details>
178
+ <summary>Staggered Overlays</summary>
179
+ <br/>
180
+ options
181
+
182
+ ```ts
183
+ transitionProperty: "clip-path"
184
+ overlayCount: 10
185
+ ```
186
+
187
+ ```scss
188
+ [data-transition] .overlay-wrapper{
189
+ position: fixed;
190
+ inset: 0;
191
+
192
+ display: grid;
193
+ grid-template-columns: repeat(10, 1fr);
194
+ }
195
+ [data-transition] .overlay-item{
196
+ background: black;
197
+ transition: none;
198
+ will-change: clip-path;
199
+ clip-path: inset(100% 0 0 0);
200
+ }
201
+ [data-transition].exit .overlay-item{
202
+ clip-path: inset(0 0 0 0);
203
+ transition: clip-path 1.0s ease;
204
+ @for $i from 0 to 10{
205
+ &:nth-child(#{$i+1}){
206
+ transition-delay: $i * 0.2s;
207
+ }
208
+ }
209
+ }
210
+ [data-transition].enter .overlay-item{
211
+ clip-path: inset(0 0 100% 0);
212
+ transition: clip-path 1.0s ease;
213
+ @for $i from 0 to 10{
214
+ &:nth-child(#{$i+1}){
215
+ transition-delay: $i * 0.2s;
216
+ }
217
+ }
218
+ }
219
+ ```
220
+ </details>
221
+
222
+ ### Manual Mode
223
+
224
+ In manual mode, you can control the transition using `useTransitionContext`.
225
+
226
+ After triggering the navigation, `state.current` is set to `exiting`. You can then call `resolveFn.current()` to proceed with the navigation. Once `state.current` is set to `entering`, the new page has loaded. After the animation finishes, `state.current` should be set to `idle`.
227
+
228
+
229
+ ```ts
230
+ import { useTransitionContext } from "page-transition"
231
+
232
+ const { resolveFn, state } = useTransitionContext()
233
+
234
+ ```
@@ -0,0 +1,5 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function TransitionLink({ href, children }: {
3
+ href: string;
4
+ children: ReactNode;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Link from "next/link";
3
+ import { useTransitionContext } from "../context/TransitionContext";
4
+ export function TransitionLink({ href, children }) {
5
+ const { handleLinkClick } = useTransitionContext();
6
+ return (_jsx(Link, { href: href, onClick: (e) => {
7
+ handleLinkClick.current(e, href);
8
+ }, children: children }));
9
+ }
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from "react";
2
+ interface TransitionOptions {
3
+ transitionProperty: 'opacity' | 'clip-path';
4
+ overlayCount: number;
5
+ }
6
+ interface ProviderProps {
7
+ header?: ReactNode;
8
+ options?: TransitionOptions;
9
+ children: ReactNode;
10
+ }
11
+ export declare function CssTransitionProvider({ header, options, children }: ProviderProps): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,110 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { TransitionContext } from "./TransitionContext";
4
+ import { useRef, useMemo, useEffect } from "react";
5
+ import { usePathname } from "next/navigation";
6
+ import { useTransitionEndHandler } from "../hooks/useTransitionEndHandler";
7
+ import { useTransitionEndData } from "../hooks/useTransitionEndData";
8
+ import { useTransitionEndObj } from "../hooks/useTransitionEndObj";
9
+ import { transitionEnd } from "../functions/transitionEnd";
10
+ import { useHandleLinkClick } from "../hooks/useHandleLinkClick";
11
+ import { useScrollRestoration } from "../hooks/useScrollRestoration";
12
+ import { usePopState } from "../hooks/usePopState";
13
+ import { parseDelay } from "../functions/parseDelay";
14
+ export function CssTransitionProvider({ header, options = {
15
+ transitionProperty: 'opacity',
16
+ overlayCount: 0
17
+ }, children }) {
18
+ const container = useRef(null);
19
+ const overlayWrapper = useRef(null);
20
+ const overlayItems = useRef([]);
21
+ const pathname = usePathname();
22
+ const currentPathname = useRef(pathname);
23
+ const resolveUseFn = useRef(null);
24
+ const mount = useRef({
25
+ mounted: false,
26
+ initPathname: pathname
27
+ });
28
+ const state = useRef('idle');
29
+ const useUse = useRef(false);
30
+ const reverse = useRef({
31
+ _lock: true,
32
+ get lock() {
33
+ return this._lock;
34
+ },
35
+ set lock(value) {
36
+ if (delay.current === 0 || overlayItems.current.length < 2) {
37
+ if (this._lock === false)
38
+ this._lock = true;
39
+ return;
40
+ }
41
+ this._lock = value;
42
+ }
43
+ });
44
+ const delay = useRef(null);
45
+ const handleLinkClick = useRef(() => { });
46
+ const transitionEndHandler = useTransitionEndHandler();
47
+ const transitionEndData = useTransitionEndData({
48
+ elArray: options.overlayCount === 0 ? container : overlayItems,
49
+ transitionProperty: options.transitionProperty
50
+ });
51
+ usePopState({
52
+ container,
53
+ currentPathname,
54
+ transitionEndData,
55
+ transitionEndHandler,
56
+ state,
57
+ reverse,
58
+ delay,
59
+ useUse,
60
+ resolveUseFn
61
+ });
62
+ useHandleLinkClick({
63
+ container,
64
+ handleLinkClick,
65
+ currentPathname,
66
+ transitionEndData,
67
+ transitionEndHandler,
68
+ state,
69
+ reverse,
70
+ delay,
71
+ useUse,
72
+ resolveUseFn
73
+ });
74
+ useScrollRestoration();
75
+ const removeEnter = useTransitionEndObj({
76
+ transitionEndData,
77
+ fn: () => {
78
+ container.current?.classList.remove('enter');
79
+ state.current = 'idle';
80
+ reverse.current.lock = true;
81
+ }
82
+ });
83
+ useEffect(() => {
84
+ if (mount.current.mounted === false &&
85
+ mount.current.initPathname === pathname) {
86
+ return;
87
+ }
88
+ mount.current.mounted = true;
89
+ if (delay.current === null) {
90
+ delay.current = parseDelay(transitionEndData.current.elArray);
91
+ }
92
+ if (!container.current)
93
+ return;
94
+ transitionEnd({
95
+ transitionEndObj: removeEnter,
96
+ transitionEndHandler,
97
+ reverse,
98
+ delay
99
+ });
100
+ container.current.classList.remove('exit');
101
+ container.current.classList.add('enter');
102
+ currentPathname.current = pathname;
103
+ state.current = 'entering';
104
+ reverse.current.lock = false;
105
+ }, [pathname]);
106
+ const value = useMemo(() => ({ handleLinkClick, overlayWrapper, overlayItems }), []);
107
+ return (_jsxs(TransitionContext.Provider, { value: value, children: [header, _jsxs("div", { ref: container, "data-transition": true, children: [_jsx("div", { ref: overlayWrapper, className: "overlay-wrapper", children: Array.from({ length: options.overlayCount }).map((_, i) => (_jsx("div", { ref: (el) => {
108
+ overlayItems.current[i] = el;
109
+ }, className: "overlay-item" }, i))) }), children] })] }));
110
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from "react";
2
+ interface ProviderProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare function ManualTransitionProvider({ children }: ProviderProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { TransitionContext } from "./TransitionContext";
4
+ import { useEffect, useRef, useMemo } from "react";
5
+ import { usePathname } from "next/navigation";
6
+ import { usePopState } from "../hooks/manual/usePopState";
7
+ import { useHandleLinkClick } from "../hooks/manual/useHandleLinkClick";
8
+ export function ManualTransitionProvider({ children }) {
9
+ const pathname = usePathname();
10
+ const handleLinkClick = useRef(() => { });
11
+ const resolveFn = useRef(null);
12
+ const state = useRef('idle');
13
+ const useUse = useRef(false);
14
+ const resolveUseFn = useRef(null);
15
+ usePopState({
16
+ resolveFn,
17
+ state,
18
+ useUse,
19
+ resolveUseFn
20
+ });
21
+ useHandleLinkClick({
22
+ handleLinkClick,
23
+ resolveFn,
24
+ state,
25
+ useUse,
26
+ resolveUseFn
27
+ });
28
+ useEffect(() => {
29
+ state.current = 'entering';
30
+ }, [pathname]);
31
+ const value = useMemo(() => ({ handleLinkClick, resolveFn, state }), []);
32
+ return (_jsx(TransitionContext.Provider, { value: value, children: children }));
33
+ }
@@ -0,0 +1,24 @@
1
+ import type { ReactNode, RefObject } from "react";
2
+ interface ContextProps {
3
+ handleLinkClick: RefObject<((e: React.MouseEvent, url: string) => void)>;
4
+ overlayWrapper?: RefObject<HTMLDivElement | null>;
5
+ overlayItems?: RefObject<(HTMLDivElement | null)[]>;
6
+ resolveFn?: RefObject<(() => void) | null>;
7
+ state?: RefObject<'idle' | 'exiting' | 'entering'>;
8
+ }
9
+ export declare const TransitionContext: import("react").Context<ContextProps | null>;
10
+ export declare function useTransitionContext(): ContextProps;
11
+ type Mode = 'css' | 'manual';
12
+ type TransitionProperty = 'opacity' | 'clip-path';
13
+ interface TransitionOptions {
14
+ transitionProperty: TransitionProperty;
15
+ overlayCount: number;
16
+ }
17
+ interface ProviderProps {
18
+ header?: ReactNode;
19
+ mode?: Mode;
20
+ options?: TransitionOptions;
21
+ children: ReactNode;
22
+ }
23
+ export declare function TransitionProvider({ header, mode, options, children, }: ProviderProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext } from "react";
4
+ import { CssTransitionProvider } from "./CssTransitionProvider";
5
+ import { ManualTransitionProvider } from "./ManualTransitionProvider";
6
+ export const TransitionContext = createContext(null);
7
+ export function useTransitionContext() {
8
+ const context = useContext(TransitionContext);
9
+ if (!context)
10
+ throw new Error('useTransitionContext in Provider!');
11
+ return context;
12
+ }
13
+ export function TransitionProvider({ header, mode = 'css', options = {
14
+ transitionProperty: 'opacity',
15
+ overlayCount: 0
16
+ }, children, }) {
17
+ return (mode === 'css' ?
18
+ _jsx(CssTransitionProvider, { header: header, options: options, children: children }) :
19
+ _jsx(ManualTransitionProvider, { children: children }));
20
+ }
@@ -0,0 +1,6 @@
1
+ interface TransitionEndData {
2
+ elArray: (HTMLDivElement | null)[];
3
+ propertyName: 'opacity' | 'clip-path';
4
+ }
5
+ export declare function checkTransitionFinish(transitionEndData: TransitionEndData, fn: (() => void) | null): boolean;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ import { parseOpacityAll } from "./parseOpacityAll";
2
+ import { parseClipPathAll } from "./parseClipPathAll";
3
+ export function checkTransitionFinish(transitionEndData, fn) {
4
+ const parse = {
5
+ 'opacity': () => parseOpacityAll(transitionEndData.elArray),
6
+ 'clip-path': () => parseClipPathAll(transitionEndData.elArray)
7
+ };
8
+ if (parse[transitionEndData.propertyName]()) {
9
+ fn?.();
10
+ return true;
11
+ }
12
+ return false;
13
+ }
@@ -0,0 +1,11 @@
1
+ import type { RefObject } from "react";
2
+ interface Obj {
3
+ timeOutId: number | null;
4
+ fn: () => void;
5
+ ms?: number;
6
+ }
7
+ interface Props {
8
+ ref: RefObject<Obj>;
9
+ }
10
+ export declare function debounce({ ref }: Props): void;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ export function debounce({ ref }) {
2
+ if (ref.current.timeOutId !== null) {
3
+ window.clearTimeout(ref.current.timeOutId);
4
+ }
5
+ ref.current.timeOutId = window.setTimeout(() => {
6
+ ref.current.fn();
7
+ }, ref.current.ms ?? 200);
8
+ }
@@ -0,0 +1 @@
1
+ export declare function parseClipPath(el: HTMLDivElement | null): number | null;
@@ -0,0 +1,9 @@
1
+ export function parseClipPath(el) {
2
+ if (!el)
3
+ return null;
4
+ const clipPath = getComputedStyle(el).clipPath;
5
+ const match = clipPath.match(/inset\(([^)]+)\)/);
6
+ const result = match?.[1]?.split(/\s+/) ?? null;
7
+ const number = result?.map(value => parseFloat(value)).find(value => value > 0) ?? 0;
8
+ return number / 100;
9
+ }
@@ -0,0 +1 @@
1
+ export declare function parseClipPathAll(elArray: (HTMLDivElement | null)[]): null | boolean;
@@ -0,0 +1,20 @@
1
+ export function parseClipPathAll(elArray) {
2
+ if (elArray.length === 0)
3
+ return null;
4
+ const array = [];
5
+ elArray.forEach((el) => {
6
+ if (!el)
7
+ return;
8
+ const clipPath = getComputedStyle(el).clipPath;
9
+ const m = clipPath.match(/inset\(([^)]+)\)/);
10
+ const result = m?.[1]?.split(/\s+/) ?? null;
11
+ const number = result?.map((string) => parseFloat(string)).find(n => n > 0) ?? 0;
12
+ array.push(number);
13
+ });
14
+ for (const number of array) {
15
+ if (number < 100) {
16
+ return false;
17
+ }
18
+ }
19
+ return true;
20
+ }
@@ -0,0 +1 @@
1
+ export declare function parseDelay(elArray: (HTMLDivElement | null)[]): number | null;
@@ -0,0 +1,10 @@
1
+ export function parseDelay(elArray) {
2
+ if (elArray.length === 0)
3
+ return null;
4
+ const lastIndex = elArray.length - 1;
5
+ const lastEl = elArray[lastIndex];
6
+ if (!lastEl)
7
+ return null;
8
+ const lastDelay = parseFloat(getComputedStyle(lastEl).transitionDelay);
9
+ return lastDelay / (lastIndex || 1);
10
+ }
@@ -0,0 +1 @@
1
+ export declare function parseOpacity(el: HTMLDivElement | null): number | null;
@@ -0,0 +1,6 @@
1
+ export function parseOpacity(el) {
2
+ if (!el)
3
+ return null;
4
+ const opacity = getComputedStyle(el).opacity;
5
+ return 1 - parseFloat(opacity);
6
+ }
@@ -0,0 +1 @@
1
+ export declare function parseOpacityAll(elArray: (HTMLDivElement | null)[]): boolean | null;
@@ -0,0 +1,13 @@
1
+ export function parseOpacityAll(elArray) {
2
+ if (elArray.length === 0)
3
+ return null;
4
+ for (const el of elArray) {
5
+ if (!el)
6
+ continue;
7
+ const opacity = parseFloat(getComputedStyle(el).opacity);
8
+ if (opacity > 0) {
9
+ return false;
10
+ }
11
+ }
12
+ return true;
13
+ }
@@ -0,0 +1 @@
1
+ export declare function resetDelay(elArray: (HTMLDivElement | null)[]): void;
@@ -0,0 +1,7 @@
1
+ export function resetDelay(elArray) {
2
+ elArray.forEach((el) => {
3
+ if (!el)
4
+ return;
5
+ el.style.transitionDelay = "";
6
+ });
7
+ }
@@ -0,0 +1,21 @@
1
+ import type { RefObject } from "react";
2
+ interface TransitionEndObj {
3
+ elArray: (HTMLDivElement | null)[];
4
+ propertyName: 'opacity' | 'clip-path';
5
+ fn: (() => void) | null;
6
+ }
7
+ interface TransitionEndHandler {
8
+ handler: ((e: TransitionEvent) => void) | null;
9
+ handlerEl: HTMLDivElement | null;
10
+ }
11
+ interface Props {
12
+ transitionEndObj: RefObject<TransitionEndObj>;
13
+ transitionEndHandler: RefObject<TransitionEndHandler>;
14
+ reverse: RefObject<{
15
+ _lock: boolean;
16
+ lock: boolean;
17
+ }>;
18
+ delay: RefObject<number | null>;
19
+ }
20
+ export declare function transitionEnd({ transitionEndObj, transitionEndHandler, reverse, delay }: Props): void;
21
+ export {};
@@ -0,0 +1,29 @@
1
+ import { transtionEndReverse } from "./transitionEndReverse";
2
+ export function transitionEnd({ transitionEndObj, transitionEndHandler, reverse, delay }) {
3
+ const lastIndex = transitionEndObj.current.elArray.length - 1;
4
+ if (transitionEndHandler.current.handler &&
5
+ transitionEndHandler.current.handlerEl) {
6
+ transitionEndHandler.current.handlerEl.removeEventListener('transitionend', transitionEndHandler.current.handler);
7
+ }
8
+ if (!reverse.current.lock) {
9
+ transtionEndReverse({
10
+ transitionEndObj,
11
+ transitionEndHandler,
12
+ reverse,
13
+ delay
14
+ });
15
+ return;
16
+ }
17
+ const handler = (e) => {
18
+ if (e.target !== e.currentTarget)
19
+ return;
20
+ if (transitionEndObj.current.propertyName &&
21
+ e.propertyName !== transitionEndObj.current.propertyName)
22
+ return;
23
+ transitionEndObj.current.elArray[lastIndex]?.removeEventListener('transitionend', handler);
24
+ transitionEndObj.current.fn?.();
25
+ };
26
+ transitionEndHandler.current.handler = handler;
27
+ transitionEndHandler.current.handlerEl = transitionEndObj.current.elArray[lastIndex];
28
+ transitionEndObj.current.elArray[lastIndex]?.addEventListener('transitionend', transitionEndHandler.current.handler);
29
+ }
@@ -0,0 +1,21 @@
1
+ import type { RefObject } from "react";
2
+ interface TransitionEndObj {
3
+ elArray: (HTMLDivElement | null)[];
4
+ propertyName: 'opacity' | 'clip-path';
5
+ fn: (() => void) | null;
6
+ }
7
+ interface TransitionEndHandler {
8
+ handler: ((e: TransitionEvent) => void) | null;
9
+ handlerEl: HTMLDivElement | null;
10
+ }
11
+ interface Props {
12
+ transitionEndObj: RefObject<TransitionEndObj>;
13
+ transitionEndHandler: RefObject<TransitionEndHandler>;
14
+ reverse: RefObject<{
15
+ _lock: boolean;
16
+ lock: boolean;
17
+ }>;
18
+ delay: RefObject<number | null>;
19
+ }
20
+ export declare function transtionEndReverse({ transitionEndObj, transitionEndHandler, reverse, delay }: Props): void;
21
+ export {};
@@ -0,0 +1,36 @@
1
+ import { parseClipPath } from "./parseClipPath";
2
+ import { parseOpacity } from "./parseOpacity";
3
+ import { resetDelay } from "./resetDelay";
4
+ export function transtionEndReverse({ transitionEndObj, transitionEndHandler, reverse, delay }) {
5
+ if (transitionEndHandler.current.handler &&
6
+ transitionEndHandler.current.handlerEl)
7
+ transitionEndHandler.current.handlerEl.removeEventListener('transitionend', transitionEndHandler.current.handler);
8
+ const obj = transitionEndObj.current;
9
+ const property = transitionEndObj.current.propertyName;
10
+ const parseFn = {
11
+ opacity: parseOpacity,
12
+ 'clip-path': parseClipPath
13
+ };
14
+ let summ = 0;
15
+ obj.elArray.toReversed().forEach((el) => {
16
+ if (!el)
17
+ return;
18
+ const progress = parseFn[property](el);
19
+ const d = (delay.current ?? 0) * (progress ?? 0);
20
+ el.style.transitionDelay = `${summ}s`;
21
+ summ += d;
22
+ });
23
+ const firstEl = obj.elArray[0];
24
+ const handler = (e) => {
25
+ if (e.propertyName !== obj.propertyName ||
26
+ e.target !== e.currentTarget)
27
+ return;
28
+ resetDelay(obj.elArray);
29
+ reverse.current.lock = true;
30
+ firstEl?.removeEventListener('transitionend', handler);
31
+ obj.fn?.();
32
+ };
33
+ transitionEndHandler.current.handler = handler;
34
+ transitionEndHandler.current.handlerEl = firstEl;
35
+ firstEl?.addEventListener('transitionend', handler);
36
+ }
@@ -0,0 +1,2 @@
1
+ import type { RefObject } from "react";
2
+ export declare function wait(fn: () => void, count: number, rafId: RefObject<null | number>): void;
@@ -0,0 +1,12 @@
1
+ export function wait(fn, count, rafId) {
2
+ if (count < 1) {
3
+ fn();
4
+ rafId.current = null;
5
+ return;
6
+ }
7
+ if (rafId.current !== null)
8
+ cancelAnimationFrame(rafId.current);
9
+ rafId.current = requestAnimationFrame(() => {
10
+ wait(fn, --count, rafId);
11
+ });
12
+ }
@@ -0,0 +1,10 @@
1
+ import type { RefObject } from "react";
2
+ interface Props {
3
+ handleLinkClick: RefObject<((e: React.MouseEvent, url: string) => void)>;
4
+ resolveFn: RefObject<(() => void) | null>;
5
+ state: RefObject<'idle' | 'exiting' | 'entering'>;
6
+ useUse: RefObject<boolean>;
7
+ resolveUseFn: RefObject<(() => void) | null>;
8
+ }
9
+ export declare function useHandleLinkClick({ handleLinkClick, resolveFn, state, useUse, resolveUseFn }: Props): void;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useCallback } from "react";
3
+ import { useRouter } from "next/navigation";
4
+ export function useHandleLinkClick({ handleLinkClick, resolveFn, state, useUse, resolveUseFn }) {
5
+ const router = useRouter();
6
+ handleLinkClick.current = useCallback((e, url) => {
7
+ e.preventDefault();
8
+ new Promise((resolve) => {
9
+ resolveFn.current = resolve;
10
+ state.current = 'exiting';
11
+ }).then(() => {
12
+ if (useUse.current)
13
+ resolveUseFn.current?.();
14
+ router.push(url);
15
+ });
16
+ }, []);
17
+ }
@@ -0,0 +1,9 @@
1
+ import type { RefObject } from "react";
2
+ interface Props {
3
+ resolveFn: RefObject<(() => void) | null>;
4
+ state: RefObject<'idle' | 'exiting' | 'entering'>;
5
+ useUse: RefObject<boolean>;
6
+ resolveUseFn: RefObject<(() => void) | null>;
7
+ }
8
+ export declare function usePopState({ resolveFn, state, useUse, resolveUseFn }: Props): void;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { useEffect, useState, use } from "react";
3
+ export function usePopState({ resolveFn, state, useUse, resolveUseFn }) {
4
+ const [promise, setPromise] = useState(null);
5
+ if (promise) {
6
+ useUse.current = true;
7
+ use(promise);
8
+ useUse.current = false;
9
+ }
10
+ useEffect(() => {
11
+ const handlePopstate = () => {
12
+ setPromise(new Promise((resolve) => {
13
+ resolveFn.current = resolve;
14
+ resolveUseFn.current = resolve;
15
+ state.current = 'exiting';
16
+ }));
17
+ };
18
+ window.addEventListener('popstate', handlePopstate);
19
+ return () => window.removeEventListener('popstate', handlePopstate);
20
+ }, []);
21
+ }
@@ -0,0 +1,26 @@
1
+ import type { RefObject } from "react";
2
+ interface TransitionEndData {
3
+ elArray: (HTMLDivElement | null)[];
4
+ propertyName: 'opacity' | 'clip-path';
5
+ }
6
+ interface TransitionEndHandler {
7
+ handler: ((e: TransitionEvent) => void) | null;
8
+ handlerEl: HTMLDivElement | null;
9
+ }
10
+ interface Props {
11
+ container: RefObject<HTMLDivElement | null>;
12
+ handleLinkClick: RefObject<((e: React.MouseEvent, url: string) => void)>;
13
+ currentPathname: RefObject<string>;
14
+ transitionEndData: RefObject<TransitionEndData>;
15
+ transitionEndHandler: RefObject<TransitionEndHandler>;
16
+ state: RefObject<'idle' | 'exiting' | 'entering' | 'navigating'>;
17
+ reverse: RefObject<{
18
+ _lock: boolean;
19
+ lock: boolean;
20
+ }>;
21
+ delay: RefObject<number | null>;
22
+ useUse: RefObject<boolean>;
23
+ resolveUseFn: RefObject<(() => void) | null>;
24
+ }
25
+ export declare function useHandleLinkClick({ container, handleLinkClick, currentPathname, transitionEndData, transitionEndHandler, reverse, delay, state, useUse, resolveUseFn }: Props): void;
26
+ export {};
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { useCallback, useRef } from "react";
3
+ import { useRouter } from "next/navigation";
4
+ import { useTransitionEndObj } from "../hooks/useTransitionEndObj";
5
+ import { transitionEnd } from "../functions/transitionEnd";
6
+ import { checkTransitionFinish } from "../functions/checkTransitionFinish";
7
+ export function useHandleLinkClick({ container, handleLinkClick, currentPathname, transitionEndData, transitionEndHandler, reverse, delay, state, useUse, resolveUseFn }) {
8
+ const router = useRouter();
9
+ const afterExitFn = useRef(null);
10
+ const nextPage = useRef(null);
11
+ const push = useTransitionEndObj({
12
+ transitionEndData,
13
+ fn: () => {
14
+ if (!nextPage.current)
15
+ return;
16
+ if (useUse.current)
17
+ resolveUseFn.current?.();
18
+ state.current = 'navigating';
19
+ router.push(nextPage.current);
20
+ nextPage.current = null;
21
+ }
22
+ });
23
+ const removeEnter = useTransitionEndObj({
24
+ transitionEndData,
25
+ fn: () => {
26
+ container.current?.classList.remove('enter');
27
+ state.current = 'idle';
28
+ reverse.current.lock = true;
29
+ }
30
+ });
31
+ const afterExit = useTransitionEndObj({
32
+ transitionEndData,
33
+ fn: afterExitFn.current = () => {
34
+ transitionEnd({
35
+ transitionEndObj: removeEnter,
36
+ transitionEndHandler,
37
+ reverse,
38
+ delay
39
+ });
40
+ if (useUse.current)
41
+ resolveUseFn.current?.();
42
+ container.current?.classList.remove('exit');
43
+ container.current?.classList.add('enter');
44
+ reverse.current.lock = false;
45
+ state.current = 'entering';
46
+ }
47
+ });
48
+ handleLinkClick.current = useCallback((e, url) => {
49
+ e.preventDefault();
50
+ nextPage.current = url;
51
+ new Promise((resolve) => {
52
+ if (state.current === 'navigating') {
53
+ if (url === currentPathname.current) {
54
+ return;
55
+ }
56
+ else if (url !== currentPathname.current) {
57
+ if (checkTransitionFinish(transitionEndData.current, () => {
58
+ if (!nextPage.current)
59
+ return;
60
+ state.current = 'navigating';
61
+ router.push(nextPage.current);
62
+ nextPage.current = null;
63
+ }))
64
+ return;
65
+ resolve();
66
+ }
67
+ }
68
+ else {
69
+ resolve();
70
+ }
71
+ }).then(() => {
72
+ if (url === currentPathname.current) {
73
+ if (state.current !== 'exiting')
74
+ return;
75
+ transitionEnd({
76
+ transitionEndObj: afterExit,
77
+ transitionEndHandler,
78
+ reverse,
79
+ delay
80
+ });
81
+ return;
82
+ }
83
+ transitionEnd({
84
+ transitionEndObj: push,
85
+ transitionEndHandler,
86
+ reverse,
87
+ delay
88
+ });
89
+ container.current?.classList.remove('enter');
90
+ container.current?.classList.add('exit');
91
+ state.current = 'exiting';
92
+ });
93
+ }, [router]);
94
+ }
@@ -0,0 +1,25 @@
1
+ import type { RefObject } from "react";
2
+ interface TransitionEndData {
3
+ elArray: (HTMLDivElement | null)[];
4
+ propertyName: 'opacity' | 'clip-path';
5
+ }
6
+ interface TransitionEndHandler {
7
+ handler: ((e: TransitionEvent) => void) | null;
8
+ handlerEl: HTMLDivElement | null;
9
+ }
10
+ interface Props {
11
+ container: RefObject<HTMLDivElement | null>;
12
+ currentPathname: RefObject<string>;
13
+ transitionEndData: RefObject<TransitionEndData>;
14
+ transitionEndHandler: RefObject<TransitionEndHandler>;
15
+ reverse: RefObject<{
16
+ _lock: boolean;
17
+ lock: boolean;
18
+ }>;
19
+ delay: RefObject<number | null>;
20
+ state: RefObject<'idle' | 'exiting' | 'entering' | 'navigating'>;
21
+ useUse: RefObject<boolean>;
22
+ resolveUseFn: RefObject<(() => void) | null>;
23
+ }
24
+ export declare function usePopState({ container, currentPathname, transitionEndData, transitionEndHandler, reverse, delay, state, useUse, resolveUseFn }: Props): void;
25
+ export {};
@@ -0,0 +1,98 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState, use } from "react";
3
+ import { useTransitionEndObj } from "./useTransitionEndObj";
4
+ import { transitionEnd } from "../functions/transitionEnd";
5
+ import { checkTransitionFinish } from "../functions/checkTransitionFinish";
6
+ export function usePopState({ container, currentPathname, transitionEndData, transitionEndHandler, reverse, delay, state, useUse, resolveUseFn }) {
7
+ const [promise, setPromise] = useState(null);
8
+ if (promise) {
9
+ useUse.current = true;
10
+ use(promise);
11
+ useUse.current = false;
12
+ }
13
+ const resolveFn = useRef(null);
14
+ const afterExitFn = useRef(null);
15
+ const removeEnter = useTransitionEndObj({
16
+ transitionEndData,
17
+ fn: () => {
18
+ container.current?.classList.remove('enter');
19
+ state.current = 'idle';
20
+ reverse.current.lock = true;
21
+ }
22
+ });
23
+ const afterExit = useTransitionEndObj({
24
+ transitionEndData,
25
+ fn: afterExitFn.current = () => {
26
+ transitionEnd({
27
+ transitionEndObj: removeEnter,
28
+ transitionEndHandler,
29
+ reverse,
30
+ delay
31
+ });
32
+ container.current?.classList.remove('exit');
33
+ container.current?.classList.add('enter');
34
+ state.current = 'entering';
35
+ reverse.current.lock = false;
36
+ resolveFn.current?.();
37
+ }
38
+ });
39
+ const pop = useTransitionEndObj({
40
+ transitionEndData,
41
+ fn: () => {
42
+ state.current = 'navigating';
43
+ window.scrollTo(0, window.history.state.scrollY ?? 0);
44
+ resolveFn.current?.();
45
+ resolveFn.current = null;
46
+ }
47
+ });
48
+ useEffect(() => {
49
+ const handlePopstate = () => {
50
+ setPromise(new Promise((resolve) => {
51
+ resolveFn.current = resolve;
52
+ resolveUseFn.current = resolve;
53
+ new Promise((resolveNavigating) => {
54
+ if (state.current === "navigating") {
55
+ if (currentPathname.current !== window.location.pathname) {
56
+ if (checkTransitionFinish(transitionEndData.current, () => {
57
+ resolveFn.current?.();
58
+ }))
59
+ return;
60
+ }
61
+ else if (currentPathname.current === window.location.pathname) {
62
+ if (checkTransitionFinish(transitionEndData.current, afterExitFn.current)) {
63
+ return;
64
+ }
65
+ else {
66
+ resolveNavigating();
67
+ }
68
+ }
69
+ }
70
+ else {
71
+ resolveNavigating();
72
+ }
73
+ }).then(() => {
74
+ if (currentPathname.current === window.location.pathname) {
75
+ transitionEnd({
76
+ transitionEndObj: afterExit,
77
+ transitionEndHandler,
78
+ reverse,
79
+ delay
80
+ });
81
+ return;
82
+ }
83
+ transitionEnd({
84
+ transitionEndObj: pop,
85
+ transitionEndHandler,
86
+ reverse,
87
+ delay
88
+ });
89
+ container.current?.classList.remove('enter');
90
+ container.current?.classList.add('exit');
91
+ state.current = 'exiting';
92
+ });
93
+ }));
94
+ };
95
+ window.addEventListener('popstate', handlePopstate);
96
+ return () => window.removeEventListener('popstate', handlePopstate);
97
+ }, []);
98
+ }
@@ -0,0 +1 @@
1
+ export declare function useScrollRestoration(): void;
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ import { debounce } from "../functions/debounce";
4
+ export function useScrollRestoration() {
5
+ const saveScrollY = () => {
6
+ window.history.replaceState({
7
+ ...window.history.state,
8
+ scrollY: window.scrollY
9
+ }, "");
10
+ };
11
+ const debounceRef = useRef({
12
+ timeOutId: null,
13
+ fn: saveScrollY
14
+ });
15
+ useEffect(() => {
16
+ window.history.scrollRestoration = 'manual';
17
+ const handleScroll = () => {
18
+ debounce({ ref: debounceRef });
19
+ };
20
+ window.addEventListener('scroll', handleScroll);
21
+ return () => {
22
+ window.history.scrollRestoration = 'auto';
23
+ window.removeEventListener('scroll', handleScroll);
24
+ };
25
+ }, []);
26
+ }
@@ -0,0 +1,11 @@
1
+ import type { RefObject } from "react";
2
+ interface TransitionEndData {
3
+ elArray: (HTMLDivElement | null)[];
4
+ propertyName: 'opacity' | 'clip-path';
5
+ }
6
+ interface Props {
7
+ elArray: RefObject<HTMLDivElement | null | (HTMLDivElement | null)[]>;
8
+ transitionProperty: 'opacity' | 'clip-path';
9
+ }
10
+ export declare function useTransitionEndData({ elArray, transitionProperty }: Props): RefObject<TransitionEndData>;
11
+ export {};
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ export function useTransitionEndData({ elArray, transitionProperty }) {
4
+ const transitionEndData = useRef({
5
+ elArray: [],
6
+ propertyName: transitionProperty
7
+ });
8
+ useEffect(() => {
9
+ transitionEndData.current = {
10
+ ...transitionEndData.current,
11
+ elArray: Array.isArray(elArray.current) ?
12
+ elArray.current :
13
+ [elArray.current],
14
+ };
15
+ }, []);
16
+ return transitionEndData;
17
+ }
@@ -0,0 +1,7 @@
1
+ import type { RefObject } from "react";
2
+ interface TransitionEndHandler {
3
+ handler: ((e: TransitionEvent) => void) | null;
4
+ handlerEl: HTMLDivElement | null;
5
+ }
6
+ export declare function useTransitionEndHandler(): RefObject<TransitionEndHandler>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { useRef } from "react";
3
+ export function useTransitionEndHandler() {
4
+ const transitionEndHandler = useRef({
5
+ handler: null,
6
+ handlerEl: null
7
+ });
8
+ return transitionEndHandler;
9
+ }
@@ -0,0 +1,16 @@
1
+ import type { RefObject } from "react";
2
+ interface TransitionEndData {
3
+ elArray: (HTMLDivElement | null)[];
4
+ propertyName: 'opacity' | 'clip-path';
5
+ }
6
+ interface Props {
7
+ transitionEndData: RefObject<TransitionEndData>;
8
+ fn: () => void;
9
+ }
10
+ interface TransitionEndObj {
11
+ elArray: (HTMLDivElement | null)[];
12
+ propertyName: 'opacity' | 'clip-path';
13
+ fn: (() => void) | null;
14
+ }
15
+ export declare function useTransitionEndObj({ transitionEndData, fn }: Props): RefObject<TransitionEndObj>;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ import { useRef, useEffect } from "react";
2
+ export function useTransitionEndObj({ transitionEndData, fn }) {
3
+ const transitionEndObj = useRef({
4
+ elArray: [null],
5
+ propertyName: transitionEndData.current.propertyName,
6
+ fn: null,
7
+ });
8
+ useEffect(() => {
9
+ transitionEndObj.current = {
10
+ ...transitionEndData.current,
11
+ fn
12
+ };
13
+ }, []);
14
+ return transitionEndObj;
15
+ }
@@ -0,0 +1,2 @@
1
+ export { TransitionProvider, useTransitionContext } from "./context/TransitionContext";
2
+ export { TransitionLink } from "./components/TransitionLink";
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ export { TransitionProvider, useTransitionContext } from "./context/TransitionContext";
3
+ export { TransitionLink } from "./components/TransitionLink";
package/package.json CHANGED
@@ -1,6 +1,24 @@
1
1
  {
2
- "name": "page-transition",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "page-transition",
3
+ "version": "0.1.0-beta.2",
4
+ "description": "A page transition library for the Next.js App Router.",
5
+ "license": "MIT",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "scripts": {
12
+ "build": "tsc"
13
+ },
14
+ "peerDependencies": {
15
+ "next": "^15.0.0 || ^16.0.0",
16
+ "react": "^18.0.0 || ^19.0.0",
17
+ "react-dom": "^18.0.0 || ^19.0.0"
18
+ },
19
+ "devDependencies": {
20
+ "@types/react": "^19.3.0",
21
+ "@types/react-dom": "^19.3.0",
22
+ "typescript": "^5.9.3"
23
+ }
24
+ }