path-rush 1.4.1 → 1.6.0

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/dist/react.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { LinkProps } from 'react-router-dom';
4
- export { LinkProps, Location, NavLink, NavLinkProps, Navigate, NavigateOptions, NavigateProps, Params, To, useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom';
3
+ import * as react_router_dom from 'react-router-dom';
4
+ import { LinkProps, NavLinkProps, Navigate as Navigate$1, Location as Location$1 } from 'react-router-dom';
5
+ export { LinkProps, NavLinkProps, NavigateOptions, NavigateProps, To } from 'react-router-dom';
5
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
 
7
8
  declare function useLink(props: {
@@ -11,8 +12,84 @@ declare function useLink(props: {
11
12
  isActive: boolean;
12
13
  };
13
14
 
15
+ /**
16
+ * Компонент для навигационных ссылок
17
+ *
18
+ * Используется для клиентской навигации без перезагрузки страницы
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <Link to="/about">About</Link>
23
+ * <Link to="/users/123" state={{ from: 'home' }}>User Profile</Link>
24
+ * ```
25
+ */
14
26
  declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
15
27
 
28
+ /**
29
+ * Компонент для навигационных ссылок с поддержкой активного состояния
30
+ *
31
+ * Автоматически добавляет класс 'active' когда маршрут активен
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * <NavLink to="/about">About</NavLink>
36
+ * <NavLink to="/users" className={({ isActive }) => isActive ? 'active' : ''}>
37
+ * Users
38
+ * </NavLink>
39
+ * ```
40
+ */
41
+ declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
42
+
43
+ /**
44
+ * Компонент для программного редиректа
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <Navigate to="/login" replace />
49
+ * <Navigate to="/dashboard" state={{ from: location }} />
50
+ * ```
51
+ */
52
+ declare const Navigate: typeof Navigate$1;
53
+
54
+ interface RouteTransitionProps {
55
+ children: React__default.ReactNode;
56
+ /**
57
+ * CSS класс для анимации входа
58
+ * @default 'route-enter'
59
+ */
60
+ enterClass?: string;
61
+ /**
62
+ * CSS класс для активного состояния (после входа)
63
+ * @default 'route-enter-active'
64
+ */
65
+ enterActiveClass?: string;
66
+ /**
67
+ * CSS класс для анимации выхода
68
+ * @default 'route-exit'
69
+ */
70
+ exitClass?: string;
71
+ /**
72
+ * CSS класс для активного состояния выхода
73
+ * @default 'route-exit-active'
74
+ */
75
+ exitActiveClass?: string;
76
+ /**
77
+ * Длительность анимации в миллисекундах
78
+ * @default 300
79
+ */
80
+ duration?: number;
81
+ /**
82
+ * Кастомная функция для анимации
83
+ */
84
+ onTransition?: (direction: 'enter' | 'exit') => void;
85
+ /**
86
+ * Режим анимации: 'fade', 'slide', 'custom'
87
+ * @default 'fade'
88
+ */
89
+ mode?: 'fade' | 'slide' | 'custom';
90
+ }
91
+ declare function RouteTransition({ children, enterClass, enterActiveClass, exitClass, exitActiveClass, duration, onTransition, mode, }: RouteTransitionProps): react_jsx_runtime.JSX.Element;
92
+
16
93
  type RouterProviderProps = {
17
94
  /**
18
95
  * ⏳ Кастомный индикатор загрузки
@@ -39,9 +116,96 @@ type RouterProviderProps = {
39
116
  * @default '/'
40
117
  */
41
118
  basePath?: string;
119
+ /**
120
+ * 🎬 Включить анимации переходов между страницами
121
+ *
122
+ * ▸ Если true, страницы будут анимироваться при переключении
123
+ *
124
+ * ▸ Можно настроить через transitionConfig
125
+ *
126
+ * @default false
127
+ */
128
+ enableTransitions?: boolean;
129
+ /**
130
+ * ⚙️ Конфигурация анимаций переходов
131
+ *
132
+ * ▸ Настройка CSS классов и параметров анимации
133
+ *
134
+ * ▸ Если не указано, используются значения по умолчанию
135
+ */
136
+ transitionConfig?: {
137
+ enterClass?: string;
138
+ enterActiveClass?: string;
139
+ exitClass?: string;
140
+ exitActiveClass?: string;
141
+ duration?: number;
142
+ mode?: 'fade' | 'slide' | 'custom';
143
+ onTransition?: (direction: 'enter' | 'exit') => void;
144
+ };
42
145
  children?: React__default.ReactNode;
43
146
  };
44
147
 
45
- declare function RouterProvider({ children, preloader, basePath, }: Readonly<RouterProviderProps>): react_jsx_runtime.JSX.Element;
148
+ declare function RouterProvider({ children, preloader, basePath, enableTransitions, transitionConfig, }: Readonly<RouterProviderProps>): react_jsx_runtime.JSX.Element;
149
+
150
+ /**
151
+ * Тип локации с информацией о текущем маршруте
152
+ */
153
+ type Location = Location$1;
154
+ /**
155
+ * Хук для получения текущей локации
156
+ *
157
+ * @returns Объект с информацией о текущем маршруте
158
+ *
159
+ * @example
160
+ * ```tsx
161
+ * const location = useLocation()
162
+ * console.log(location.pathname) // '/about'
163
+ * console.log(location.search) // '?id=123'
164
+ * ```
165
+ */
166
+ declare function useLocation(): Location;
167
+
168
+ /**
169
+ * Хук для программной навигации
170
+ *
171
+ * @returns Функция для навигации
172
+ *
173
+ * @example
174
+ * ```tsx
175
+ * const navigate = useNavigate()
176
+ * navigate('/about')
177
+ * navigate('/users', { replace: true })
178
+ * navigate(-1) // назад
179
+ * ```
180
+ */
181
+ declare function useNavigate(): react_router_dom.NavigateFunction;
182
+
183
+ type Params = Record<string, string | undefined>;
184
+ /**
185
+ * Хук для получения параметров маршрута
186
+ *
187
+ * @returns Объект с параметрами текущего маршрута
188
+ *
189
+ * @example
190
+ * ```tsx
191
+ * // Для маршрута /users/:id
192
+ * const { id } = useParams()
193
+ * ```
194
+ */
195
+ declare function useParams<T extends Params = Params>(): T;
196
+
197
+ /**
198
+ * Хук для работы с query параметрами URL
199
+ *
200
+ * @returns Кортеж из [searchParams, setSearchParams]
201
+ *
202
+ * @example
203
+ * ```tsx
204
+ * const [searchParams, setSearchParams] = useSearchParams()
205
+ * const id = searchParams.get('id')
206
+ * setSearchParams({ id: '123' })
207
+ * ```
208
+ */
209
+ declare function useSearchParams(): [URLSearchParams, react_router_dom.SetURLSearchParams];
46
210
 
47
- export { Link, RouterProvider, type RouterProviderProps, useLink };
211
+ export { Link, type Location, NavLink, Navigate, type Params, RouteTransition, type RouteTransitionProps, RouterProvider, type RouterProviderProps, useLink, useLocation, useNavigate, useParams, useSearchParams };
package/dist/react.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { LinkProps } from 'react-router-dom';
4
- export { LinkProps, Location, NavLink, NavLinkProps, Navigate, NavigateOptions, NavigateProps, Params, To, useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom';
3
+ import * as react_router_dom from 'react-router-dom';
4
+ import { LinkProps, NavLinkProps, Navigate as Navigate$1, Location as Location$1 } from 'react-router-dom';
5
+ export { LinkProps, NavLinkProps, NavigateOptions, NavigateProps, To } from 'react-router-dom';
5
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
 
7
8
  declare function useLink(props: {
@@ -11,8 +12,84 @@ declare function useLink(props: {
11
12
  isActive: boolean;
12
13
  };
13
14
 
15
+ /**
16
+ * Компонент для навигационных ссылок
17
+ *
18
+ * Используется для клиентской навигации без перезагрузки страницы
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <Link to="/about">About</Link>
23
+ * <Link to="/users/123" state={{ from: 'home' }}>User Profile</Link>
24
+ * ```
25
+ */
14
26
  declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
15
27
 
28
+ /**
29
+ * Компонент для навигационных ссылок с поддержкой активного состояния
30
+ *
31
+ * Автоматически добавляет класс 'active' когда маршрут активен
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * <NavLink to="/about">About</NavLink>
36
+ * <NavLink to="/users" className={({ isActive }) => isActive ? 'active' : ''}>
37
+ * Users
38
+ * </NavLink>
39
+ * ```
40
+ */
41
+ declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
42
+
43
+ /**
44
+ * Компонент для программного редиректа
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <Navigate to="/login" replace />
49
+ * <Navigate to="/dashboard" state={{ from: location }} />
50
+ * ```
51
+ */
52
+ declare const Navigate: typeof Navigate$1;
53
+
54
+ interface RouteTransitionProps {
55
+ children: React__default.ReactNode;
56
+ /**
57
+ * CSS класс для анимации входа
58
+ * @default 'route-enter'
59
+ */
60
+ enterClass?: string;
61
+ /**
62
+ * CSS класс для активного состояния (после входа)
63
+ * @default 'route-enter-active'
64
+ */
65
+ enterActiveClass?: string;
66
+ /**
67
+ * CSS класс для анимации выхода
68
+ * @default 'route-exit'
69
+ */
70
+ exitClass?: string;
71
+ /**
72
+ * CSS класс для активного состояния выхода
73
+ * @default 'route-exit-active'
74
+ */
75
+ exitActiveClass?: string;
76
+ /**
77
+ * Длительность анимации в миллисекундах
78
+ * @default 300
79
+ */
80
+ duration?: number;
81
+ /**
82
+ * Кастомная функция для анимации
83
+ */
84
+ onTransition?: (direction: 'enter' | 'exit') => void;
85
+ /**
86
+ * Режим анимации: 'fade', 'slide', 'custom'
87
+ * @default 'fade'
88
+ */
89
+ mode?: 'fade' | 'slide' | 'custom';
90
+ }
91
+ declare function RouteTransition({ children, enterClass, enterActiveClass, exitClass, exitActiveClass, duration, onTransition, mode, }: RouteTransitionProps): react_jsx_runtime.JSX.Element;
92
+
16
93
  type RouterProviderProps = {
17
94
  /**
18
95
  * ⏳ Кастомный индикатор загрузки
@@ -39,9 +116,96 @@ type RouterProviderProps = {
39
116
  * @default '/'
40
117
  */
41
118
  basePath?: string;
119
+ /**
120
+ * 🎬 Включить анимации переходов между страницами
121
+ *
122
+ * ▸ Если true, страницы будут анимироваться при переключении
123
+ *
124
+ * ▸ Можно настроить через transitionConfig
125
+ *
126
+ * @default false
127
+ */
128
+ enableTransitions?: boolean;
129
+ /**
130
+ * ⚙️ Конфигурация анимаций переходов
131
+ *
132
+ * ▸ Настройка CSS классов и параметров анимации
133
+ *
134
+ * ▸ Если не указано, используются значения по умолчанию
135
+ */
136
+ transitionConfig?: {
137
+ enterClass?: string;
138
+ enterActiveClass?: string;
139
+ exitClass?: string;
140
+ exitActiveClass?: string;
141
+ duration?: number;
142
+ mode?: 'fade' | 'slide' | 'custom';
143
+ onTransition?: (direction: 'enter' | 'exit') => void;
144
+ };
42
145
  children?: React__default.ReactNode;
43
146
  };
44
147
 
45
- declare function RouterProvider({ children, preloader, basePath, }: Readonly<RouterProviderProps>): react_jsx_runtime.JSX.Element;
148
+ declare function RouterProvider({ children, preloader, basePath, enableTransitions, transitionConfig, }: Readonly<RouterProviderProps>): react_jsx_runtime.JSX.Element;
149
+
150
+ /**
151
+ * Тип локации с информацией о текущем маршруте
152
+ */
153
+ type Location = Location$1;
154
+ /**
155
+ * Хук для получения текущей локации
156
+ *
157
+ * @returns Объект с информацией о текущем маршруте
158
+ *
159
+ * @example
160
+ * ```tsx
161
+ * const location = useLocation()
162
+ * console.log(location.pathname) // '/about'
163
+ * console.log(location.search) // '?id=123'
164
+ * ```
165
+ */
166
+ declare function useLocation(): Location;
167
+
168
+ /**
169
+ * Хук для программной навигации
170
+ *
171
+ * @returns Функция для навигации
172
+ *
173
+ * @example
174
+ * ```tsx
175
+ * const navigate = useNavigate()
176
+ * navigate('/about')
177
+ * navigate('/users', { replace: true })
178
+ * navigate(-1) // назад
179
+ * ```
180
+ */
181
+ declare function useNavigate(): react_router_dom.NavigateFunction;
182
+
183
+ type Params = Record<string, string | undefined>;
184
+ /**
185
+ * Хук для получения параметров маршрута
186
+ *
187
+ * @returns Объект с параметрами текущего маршрута
188
+ *
189
+ * @example
190
+ * ```tsx
191
+ * // Для маршрута /users/:id
192
+ * const { id } = useParams()
193
+ * ```
194
+ */
195
+ declare function useParams<T extends Params = Params>(): T;
196
+
197
+ /**
198
+ * Хук для работы с query параметрами URL
199
+ *
200
+ * @returns Кортеж из [searchParams, setSearchParams]
201
+ *
202
+ * @example
203
+ * ```tsx
204
+ * const [searchParams, setSearchParams] = useSearchParams()
205
+ * const id = searchParams.get('id')
206
+ * setSearchParams({ id: '123' })
207
+ * ```
208
+ */
209
+ declare function useSearchParams(): [URLSearchParams, react_router_dom.SetURLSearchParams];
46
210
 
47
- export { Link, RouterProvider, type RouterProviderProps, useLink };
211
+ export { Link, type Location, NavLink, Navigate, type Params, RouteTransition, type RouteTransitionProps, RouterProvider, type RouterProviderProps, useLink, useLocation, useNavigate, useParams, useSearchParams };