@molecule/app-routing-react-router 1.2.5 → 1.4.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.
@@ -0,0 +1,188 @@
1
+ /**
2
+ * The two `RouterHistory` implementations this bond hands to `@molecule/app-routing`'s
3
+ * `createHistoryRouter`: the live history that reads React Router through the hooks of a
4
+ * mounted component (`MoleculeRouterProvider`, `useMoleculeRouter`), and the snapshot
5
+ * history `createReactRouter` builds from its config.
6
+ *
7
+ * @module
8
+ */
9
+ import { I18nError } from '@molecule/app-i18n';
10
+ const newHistoryKey = () => Math.random().toString(36).slice(2);
11
+ /**
12
+ * Builds the live history a mounted component owns: it reads the latest
13
+ * {@link ReactRouterSnapshot} the component wrote, navigates through that render's
14
+ * `useNavigate()`, and its `listen` registry is notified by the component's effect after
15
+ * React Router commits a navigation (its own links, the back button, or a navigation
16
+ * this router started).
17
+ *
18
+ * @param snapshot - The component's ref, replaced on every render.
19
+ * @returns The history with its {@link ReactRouterHistory.notify} entry.
20
+ */
21
+ export const createReactRouterHistory = (snapshot) => {
22
+ const listeners = new Set();
23
+ const requireSnapshot = () => {
24
+ const current = snapshot.current;
25
+ if (!current) {
26
+ throw new I18nError('routing.error.reactRouterHistoryBeforeRender', undefined, 'The React Router history was used before its component rendered. Mount it inside a React Router router through MoleculeRouterProvider or useMoleculeRouter.');
27
+ }
28
+ return current;
29
+ };
30
+ const matchedParams = () => {
31
+ const matched = {};
32
+ for (const [name, value] of Object.entries(snapshot.current?.params ?? {})) {
33
+ if (value !== undefined)
34
+ matched[name] = value;
35
+ }
36
+ return Object.keys(matched).length > 0 ? matched : undefined;
37
+ };
38
+ // Above any matched `<Route>`, `useParams()` is empty, and it stays empty (or stays
39
+ // readable, inside one) for the component's whole life — a component never moves
40
+ // between positions in the route tree. So whether the history carries native params is
41
+ // decided once, at creation: with an empty `useParams()` it reports none, and
42
+ // `createHistoryRouter` then matches the registered route definitions instead.
43
+ const nativeParams = matchedParams();
44
+ const history = {
45
+ location: () => {
46
+ const current = snapshot.current;
47
+ if (!current)
48
+ return { pathname: '/', search: '', hash: '' };
49
+ return {
50
+ pathname: current.location.pathname,
51
+ search: current.location.search,
52
+ hash: current.location.hash,
53
+ // React Router models "no state" as `null`; the molecule location leaves it
54
+ // `undefined`, so a stateless entry and an absent state read the same.
55
+ state: current.location.state ?? undefined,
56
+ key: current.location.key,
57
+ };
58
+ },
59
+ push: (path, state) => requireSnapshot().navigate(path, { replace: false, state }),
60
+ replace: (path, state) => requireSnapshot().navigate(path, { replace: true, state }),
61
+ go: (delta) => requireSnapshot().navigate(delta),
62
+ listen: (listener) => {
63
+ listeners.add(listener);
64
+ return () => {
65
+ listeners.delete(listener);
66
+ };
67
+ },
68
+ notify: (action) => {
69
+ for (const listener of [...listeners])
70
+ listener(action);
71
+ },
72
+ destroy: () => {
73
+ listeners.clear();
74
+ },
75
+ };
76
+ if (nativeParams) {
77
+ history.params = () => {
78
+ const matched = matchedParams();
79
+ // Presence was decided at creation and cannot flip, so this answers with a match.
80
+ return matched ?? nativeParams;
81
+ };
82
+ }
83
+ return history;
84
+ };
85
+ /**
86
+ * Builds the history `createReactRouter` runs on: it navigates through the configured
87
+ * React Router `navigate` (falling back to `window.location` for the hook-less
88
+ * `provider`), reads the configured location/params snapshot, and reports each
89
+ * navigation itself — a snapshot has no router that could report back.
90
+ *
91
+ * @param config - The `createReactRouter` config.
92
+ * @returns The history.
93
+ */
94
+ export const createReactRouterSnapshotHistory = (config) => {
95
+ const { navigate: navigateFn, location: snapshotLocation, params } = config;
96
+ const listeners = new Set();
97
+ let key = newHistoryKey();
98
+ const location = () => {
99
+ if (snapshotLocation) {
100
+ return {
101
+ pathname: snapshotLocation.pathname,
102
+ search: snapshotLocation.search,
103
+ hash: snapshotLocation.hash,
104
+ // Same normalization as the live history: no state reads as `undefined`.
105
+ state: snapshotLocation.state ?? undefined,
106
+ key: snapshotLocation.key ?? key,
107
+ };
108
+ }
109
+ if (typeof window !== 'undefined') {
110
+ return {
111
+ pathname: window.location.pathname,
112
+ search: window.location.search,
113
+ hash: window.location.hash,
114
+ state: window.history.state ?? undefined,
115
+ key,
116
+ };
117
+ }
118
+ return { pathname: '/', search: '', hash: '', key };
119
+ };
120
+ const paramsOf = () => {
121
+ const normalized = {};
122
+ for (const [name, value] of Object.entries(params ?? {})) {
123
+ if (value !== undefined)
124
+ normalized[name] = value;
125
+ }
126
+ return normalized;
127
+ };
128
+ const report = (action) => {
129
+ key = newHistoryKey();
130
+ for (const listener of [...listeners])
131
+ listener(action);
132
+ };
133
+ const navigateSnapshot = (path, replace, state) => {
134
+ if (navigateFn) {
135
+ navigateFn(path, { replace, state });
136
+ }
137
+ else if (typeof window !== 'undefined') {
138
+ // The hook-less fallback the package has always had: a full-page navigation.
139
+ if (replace)
140
+ window.location.replace(path);
141
+ else
142
+ window.location.href = path;
143
+ }
144
+ };
145
+ const history = {
146
+ location,
147
+ push: (path, state) => {
148
+ navigateSnapshot(path, false, state);
149
+ report('push');
150
+ },
151
+ replace: (path, state) => {
152
+ navigateSnapshot(path, true, state);
153
+ report('replace');
154
+ },
155
+ go: (delta) => {
156
+ if (navigateFn) {
157
+ navigateFn(delta);
158
+ report('pop');
159
+ }
160
+ else if (typeof window !== 'undefined') {
161
+ // The core's back()/forward() arrive as the ±1 moves, which window history
162
+ // names `back` and `forward`; any other delta goes through `go` itself.
163
+ if (delta === -1)
164
+ window.history.back();
165
+ else if (delta === 1)
166
+ window.history.forward();
167
+ else
168
+ window.history.go(delta);
169
+ report('pop');
170
+ }
171
+ },
172
+ listen: (listener) => {
173
+ listeners.add(listener);
174
+ return () => {
175
+ listeners.delete(listener);
176
+ };
177
+ },
178
+ destroy: () => {
179
+ listeners.clear();
180
+ },
181
+ };
182
+ // Without configured params the history reports none, and `createHistoryRouter` falls
183
+ // back to matching the registered route definitions.
184
+ if (params)
185
+ history.params = paramsOf;
186
+ return history;
187
+ };
188
+ //# sourceMappingURL=history.js.map
@@ -0,0 +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CAAC,CAAA"}
package/dist/hooks.d.ts CHANGED
@@ -23,20 +23,23 @@ export interface MoleculeRouterProviderProps {
23
23
  onRouterReady?: (router: Router) => void;
24
24
  }
25
25
  /**
26
- * Provider component that creates a molecule Router from React Router hooks and
27
- * bonds it as the active singleton via `@molecule/app-routing`'s `setRouter`.
28
- *
29
- * Bonding happens in an effect on mount (and again whenever the location/params
30
- * change), so `@molecule/app-routing`'s `navigate()`/`getRouter()` drive THIS real
31
- * React Router adapter — no manual `setRouter` wiring required. Mount it once inside
32
- * any React Router router when non-React code needs the bond, named routes are
33
- * configured, or `onRouterReady` is needed. The routing hooks work without this provider.
26
+ * Provider component that creates ONE molecule Router over React Router for its whole
27
+ * mounted life and bonds it as the active singleton via `@molecule/app-routing`'s
28
+ * `setRouter`. Subscribers and guards registered on the router survive navigation:
29
+ * `@molecule/app-routing`'s `getRouter()` keeps returning it, `onRouterReady` fires once,
30
+ * and React Router's own links and the back button reach `router.subscribe()`.
31
+ *
32
+ * Bonding happens in an effect on mount, so `@molecule/app-routing`'s
33
+ * `navigate()`/`getRouter()` drive THIS real React Router adapter — no manual `setRouter`
34
+ * wiring required. Mount it once inside any React Router router when non-React code needs
35
+ * the bond, named routes are configured, or `onRouterReady` is needed. The routing hooks
36
+ * work without this provider.
34
37
  *
35
38
  * @param props - The provider props (see {@link MoleculeRouterProviderProps}):
36
39
  * `children` (rendered inside the router context), `routes` (optional named-route
37
- * definitions), and `onRouterReady` (optional callback invoked with the router
38
- * after it is bonded, e.g. to register guards — bonding via `setRouter` happens
39
- * regardless).
40
+ * definitions; pass a stable array — later identities register onto the same router),
41
+ * and `onRouterReady` (optional callback invoked ONCE with the router after it is
42
+ * bonded, e.g. to register guards — bonding via `setRouter` happens regardless).
40
43
  * @returns The rendered provider wrapping children with the router context.
41
44
  * @example
42
45
  * ```tsx
@@ -65,9 +68,11 @@ export declare function MoleculeRouterProvider(props: MoleculeRouterProviderProp
65
68
  * package or React Router itself. No MoleculeRouterProvider is required.
66
69
  *
67
70
  * When MoleculeRouterProvider is mounted, returns its exact router with its named
68
- * routes. Otherwise creates a local adapter from React Router's hooks without
69
- * bonding it globally. Mount MoleculeRouterProvider for the non-React
70
- * `@molecule/app-routing` navigate()/getRouter() bond or onRouterReady.
71
+ * routes. Otherwise creates ONE router for the calling component's whole life — its
72
+ * location, params and queries follow React Router through every navigation, and
73
+ * `subscribe()` hears React Router's own links and the back button — without bonding
74
+ * it globally. Mount MoleculeRouterProvider for the non-React `@molecule/app-routing`
75
+ * navigate()/getRouter() bond or onRouterReady.
71
76
  *
72
77
  * @returns The molecule Router instance
73
78
  * @throws {Error} If used outside a React Router router; mount a router component.
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAEZ,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EAOpB,MAAM,OAAO,CAAA;AAad,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAOtE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;IAE1B;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgC5F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAqB1C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAA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;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,UAAU,CAAC,CAGxD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAK9C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GACX,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CA8ErD"}
package/dist/hooks.js CHANGED
@@ -5,29 +5,98 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  * @module
6
6
  */
7
7
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
8
- import { useInRouterContext, useLocation, useNavigate, useParams, useSearchParams, } from 'react-router';
9
- import { t } from '@molecule/app-i18n';
10
- import { setRouter } from '@molecule/app-routing';
11
- import { createReactRouter } from './provider.js';
8
+ import { useInRouterContext, useLocation, useNavigate, useNavigationType, useParams, } from 'react-router';
9
+ import { I18nError } from '@molecule/app-i18n';
10
+ import { createHistoryRouter, setRouter } from '@molecule/app-routing';
11
+ import { createReactRouterHistory, } from './history.js';
12
12
  /**
13
13
  * Context for the molecule Router.
14
14
  */
15
15
  const MoleculeRouterContext = createContext(null);
16
16
  /**
17
- * Provider component that creates a molecule Router from React Router hooks and
18
- * bonds it as the active singleton via `@molecule/app-routing`'s `setRouter`.
17
+ * Maps React Router's navigation type to the molecule action.
19
18
  *
20
- * Bonding happens in an effect on mount (and again whenever the location/params
21
- * change), so `@molecule/app-routing`'s `navigate()`/`getRouter()` drive THIS real
22
- * React Router adapter — no manual `setRouter` wiring required. Mount it once inside
23
- * any React Router router when non-React code needs the bond, named routes are
24
- * configured, or `onRouterReady` is needed. The routing hooks work without this provider.
19
+ * @param navigationType - The `useNavigationType()` value of the committed render.
20
+ * @returns The molecule `NavigationAction` for it.
21
+ */
22
+ const navigationTypeToAction = (navigationType) => {
23
+ if (navigationType === 'POP')
24
+ return 'pop';
25
+ if (navigationType === 'REPLACE')
26
+ return 'replace';
27
+ return 'push';
28
+ };
29
+ /**
30
+ * Notifies the live history's subscribers once after each navigation React Router
31
+ * commits, however it started — a link, the back button, or a navigation through the
32
+ * molecule router. The effect runs when the committed location reaches the component;
33
+ * it is keyed on the location key, so a key React Router already reported (a StrictMode
34
+ * replay) is not reported twice, and the first run — the mount — reports nothing.
35
+ *
36
+ * @param history - The component's live history; `null` skips (a provider's router is already notified by the provider).
37
+ * @param locationKey - The location key of the committed render.
38
+ * @param navigationType - How React Router reached the current entry.
39
+ */
40
+ function useNotifyCommittedNavigation(history, locationKey, navigationType) {
41
+ const lastNotifiedKey = useRef(undefined);
42
+ useEffect(() => {
43
+ if (!history || lastNotifiedKey.current === locationKey)
44
+ return;
45
+ const firstNotification = lastNotifiedKey.current === undefined;
46
+ lastNotifiedKey.current = locationKey;
47
+ if (firstNotification)
48
+ return;
49
+ history.notify(navigationTypeToAction(navigationType));
50
+ }, [history, locationKey, navigationType]);
51
+ }
52
+ /**
53
+ * Builds the component-owned molecule router on the live history: the router is created
54
+ * once for the component's whole life, and the history reads a ref that every render
55
+ * refreshes with the latest `useNavigate()`/`useLocation()`/`useParams()`/
56
+ * `useNavigationType()` values, so its reads always answer for the committed render.
57
+ *
58
+ * @param routes - Route definitions the router is created with; later ones register through `router.registerRoutes`.
59
+ * @returns The router, its live history, and the committed location key with the navigation type of this render.
60
+ */
61
+ function useMoleculeRouterInstance(routes) {
62
+ const navigate = useNavigate();
63
+ const location = useLocation();
64
+ const params = useParams();
65
+ const navigationType = useNavigationType();
66
+ const snapshot = useRef(undefined);
67
+ snapshot.current = {
68
+ navigate,
69
+ location: {
70
+ pathname: location.pathname,
71
+ search: location.search,
72
+ hash: location.hash,
73
+ state: location.state,
74
+ key: location.key,
75
+ },
76
+ params,
77
+ };
78
+ const [history] = useState(() => createReactRouterHistory(snapshot));
79
+ const [router] = useState(() => createHistoryRouter(history, { routes }));
80
+ return { router, history, locationKey: location.key, navigationType };
81
+ }
82
+ /**
83
+ * Provider component that creates ONE molecule Router over React Router for its whole
84
+ * mounted life and bonds it as the active singleton via `@molecule/app-routing`'s
85
+ * `setRouter`. Subscribers and guards registered on the router survive navigation:
86
+ * `@molecule/app-routing`'s `getRouter()` keeps returning it, `onRouterReady` fires once,
87
+ * and React Router's own links and the back button reach `router.subscribe()`.
88
+ *
89
+ * Bonding happens in an effect on mount, so `@molecule/app-routing`'s
90
+ * `navigate()`/`getRouter()` drive THIS real React Router adapter — no manual `setRouter`
91
+ * wiring required. Mount it once inside any React Router router when non-React code needs
92
+ * the bond, named routes are configured, or `onRouterReady` is needed. The routing hooks
93
+ * work without this provider.
25
94
  *
26
95
  * @param props - The provider props (see {@link MoleculeRouterProviderProps}):
27
96
  * `children` (rendered inside the router context), `routes` (optional named-route
28
- * definitions), and `onRouterReady` (optional callback invoked with the router
29
- * after it is bonded, e.g. to register guards — bonding via `setRouter` happens
30
- * regardless).
97
+ * definitions; pass a stable array — later identities register onto the same router),
98
+ * and `onRouterReady` (optional callback invoked ONCE with the router after it is
99
+ * bonded, e.g. to register guards — bonding via `setRouter` happens regardless).
31
100
  * @returns The rendered provider wrapping children with the router context.
32
101
  * @example
33
102
  * ```tsx
@@ -51,28 +120,26 @@ const MoleculeRouterContext = createContext(null);
51
120
  */
52
121
  export function MoleculeRouterProvider(props) {
53
122
  const { children, routes = [], onRouterReady } = props;
54
- const navigate = useNavigate();
55
- const location = useLocation();
56
- const params = useParams();
57
- useSearchParams(); // Subscribe to search param changes
58
- const router = useMemo(() => createReactRouter({
59
- navigate,
60
- location: {
61
- pathname: location.pathname,
62
- search: location.search,
63
- hash: location.hash,
64
- state: location.state,
65
- key: location.key,
66
- },
67
- params,
68
- routes,
69
- }), [navigate, location, params, routes]);
123
+ const { router, history, locationKey, navigationType } = useMoleculeRouterInstance(routes);
124
+ const readyCallback = useRef(onRouterReady);
125
+ readyCallback.current = onRouterReady;
70
126
  useEffect(() => {
71
- // Bond THIS adapter so @molecule/app-routing's navigate()/getRouter() drive the
72
- // real React Router instead of the core's auto-created fallback browser router.
127
+ // Bonded once per router: `@molecule/app-routing`'s navigate()/getRouter() drive THIS
128
+ // real React Router adapter for the provider's whole life, and `onRouterReady` fires
129
+ // once instead of on every navigation.
73
130
  setRouter(router);
74
- onRouterReady?.(router);
75
- }, [router, onRouterReady]);
131
+ readyCallback.current?.(router);
132
+ }, [router]);
133
+ const registeredRoutes = useRef(routes);
134
+ useEffect(() => {
135
+ // The routes the router was created with are already registered; a later array
136
+ // registers onto THIS router instead of replacing it.
137
+ if (registeredRoutes.current === routes)
138
+ return;
139
+ registeredRoutes.current = routes;
140
+ router.registerRoutes(routes);
141
+ }, [routes, router]);
142
+ useNotifyCommittedNavigation(history, locationKey, navigationType);
76
143
  return _jsx(MoleculeRouterContext.Provider, { value: router, children: children });
77
144
  }
78
145
  /**
@@ -81,9 +148,11 @@ export function MoleculeRouterProvider(props) {
81
148
  * package or React Router itself. No MoleculeRouterProvider is required.
82
149
  *
83
150
  * When MoleculeRouterProvider is mounted, returns its exact router with its named
84
- * routes. Otherwise creates a local adapter from React Router's hooks without
85
- * bonding it globally. Mount MoleculeRouterProvider for the non-React
86
- * `@molecule/app-routing` navigate()/getRouter() bond or onRouterReady.
151
+ * routes. Otherwise creates ONE router for the calling component's whole life — its
152
+ * location, params and queries follow React Router through every navigation, and
153
+ * `subscribe()` hears React Router's own links and the back button — without bonding
154
+ * it globally. Mount MoleculeRouterProvider for the non-React `@molecule/app-routing`
155
+ * navigate()/getRouter() bond or onRouterReady.
87
156
  *
88
157
  * @returns The molecule Router instance
89
158
  * @throws {Error} If used outside a React Router router; mount a router component.
@@ -105,16 +174,14 @@ export function useMoleculeRouter() {
105
174
  const router = useContext(MoleculeRouterContext);
106
175
  const inRouter = useInRouterContext();
107
176
  if (!inRouter) {
108
- throw new Error(t('routing.error.useMoleculeRouterOutsideRouter', undefined, {
109
- defaultValue: 'useMoleculeRouter must be used within a React Router router. Mount BrowserRouter, HashRouter, MemoryRouter, Router, or RouterProvider.',
110
- }));
177
+ // Thrown like the package's other errors: the key travels with the English message
178
+ // and is translated wherever the error is shown.
179
+ throw new I18nError('routing.error.useMoleculeRouterOutsideRouter', undefined, '`useMoleculeRouter` must be used within a React Router router. Mount `BrowserRouter`, `HashRouter`, `MemoryRouter`, `Router`, or `RouterProvider`.');
111
180
  }
112
- // Always call the React Router hooks, including when the provider supplies the
113
- // adapter. The guard above throws only for an invalid render outside any router.
114
- const navigate = useNavigate();
115
- const location = useLocation();
116
- const params = useParams();
117
- return useMemo(() => router ?? createReactRouter({ navigate, location, params }), [router, navigate, location, params]);
181
+ const { router: localRouter, history, locationKey, navigationType, } = useMoleculeRouterInstance([]);
182
+ // The provider's router notifies through the provider; a locally created one is idle.
183
+ useNotifyCommittedNavigation(router ? null : history, locationKey, navigationType);
184
+ return router ?? localRouter;
118
185
  }
119
186
  /**
120
187
  * Hook to check if a path is currently active inside any React Router router.
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EACZ,aAAa,EAIb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,GAChB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGjD;;GAEG;AACH,MAAM,qBAAqB,GAAG,aAAa,CAAgB,IAAI,CAAC,CAAA;AAsBhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,s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,YAAY,CACzB,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EACxC,EAAE,EACF,MAAM,CAAC,QAAQ,CAAC,IAAI,CACrB,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;IAE9B,OAAO;QACL,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC;QAClE,cAAc;KACN,CAAA;AACZ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -24,6 +24,33 @@
24
24
  * survive. Add `path` when changing path params, or `selections` when linking views.
25
25
  * It works under ordinary `BrowserRouter` without a data router or an extra provider.
26
26
  *
27
+ * **URL-selected tabs or filters? Render `ListRouteNav`.** Declare each view's label,
28
+ * path and query together. It renders every declared choice on every route, builds
29
+ * each destination through `useListRoute`, resets pagination on selection, and derives
30
+ * the active link from the URL. Keep this declaration shared by the related routes.
31
+ * Use the UI package's `Tabs` for panels whose selection is genuinely local state.
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * import { ListRouteNav } from '@molecule/app-routing-react-router'
36
+ * import { useTranslation } from '@molecule/app-react'
37
+ *
38
+ * function OrderViews() {
39
+ * const { t } = useTranslation()
40
+ * return (
41
+ * <ListRouteNav
42
+ * aria-label={t('orders.views', undefined, { defaultValue: 'Order views' })}
43
+ * selections={{
44
+ * all: { path: '/orders', query: { view: undefined },
45
+ * label: t('orders.all', undefined, { defaultValue: 'All orders' }) },
46
+ * open: { path: '/orders', query: { view: 'open' },
47
+ * label: t('orders.open', undefined, { defaultValue: 'Open orders' }) },
48
+ * }}
49
+ * />
50
+ * )
51
+ * }
52
+ * ```
53
+ *
27
54
  * @example
28
55
  * ```tsx
29
56
  * import { Routes, Route } from 'react-router'
@@ -187,6 +214,7 @@
187
214
  export * from './hooks.js';
188
215
  export * from './lazyPage.js';
189
216
  export * from './list-types.js';
217
+ export * from './ListRouteNav.js';
190
218
  export * from './provider.js';
191
219
  export * from './routers.js';
192
220
  export type { GuardResult, NavigateOptions, NavigationGuard, QueryParams, ReactRouterConfig, ReactRouterHooks, RouteChangeListener, RouteDefinition, RouteLocation, RouteMatch, RouteParams, RouterConfig, } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyLG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,YAAY,EACV,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAA;AACnB,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoNG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,YAAY,EACV,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAA;AACnB,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -24,6 +24,33 @@
24
24
  * survive. Add `path` when changing path params, or `selections` when linking views.
25
25
  * It works under ordinary `BrowserRouter` without a data router or an extra provider.
26
26
  *
27
+ * **URL-selected tabs or filters? Render `ListRouteNav`.** Declare each view's label,
28
+ * path and query together. It renders every declared choice on every route, builds
29
+ * each destination through `useListRoute`, resets pagination on selection, and derives
30
+ * the active link from the URL. Keep this declaration shared by the related routes.
31
+ * Use the UI package's `Tabs` for panels whose selection is genuinely local state.
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * import { ListRouteNav } from '@molecule/app-routing-react-router'
36
+ * import { useTranslation } from '@molecule/app-react'
37
+ *
38
+ * function OrderViews() {
39
+ * const { t } = useTranslation()
40
+ * return (
41
+ * <ListRouteNav
42
+ * aria-label={t('orders.views', undefined, { defaultValue: 'Order views' })}
43
+ * selections={{
44
+ * all: { path: '/orders', query: { view: undefined },
45
+ * label: t('orders.all', undefined, { defaultValue: 'All orders' }) },
46
+ * open: { path: '/orders', query: { view: 'open' },
47
+ * label: t('orders.open', undefined, { defaultValue: 'Open orders' }) },
48
+ * }}
49
+ * />
50
+ * )
51
+ * }
52
+ * ```
53
+ *
27
54
  * @example
28
55
  * ```tsx
29
56
  * import { Routes, Route } from 'react-router'
@@ -187,6 +214,7 @@
187
214
  export * from './hooks.js';
188
215
  export * from './lazyPage.js';
189
216
  export * from './list-types.js';
217
+ export * from './ListRouteNav.js';
190
218
  export * from './provider.js';
191
219
  export * from './routers.js';
192
220
  export * from './useListRoute.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyLG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAe5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoNG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAe5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}