@ionic/react-router 8.8.1-dev.11773168858.1f9c0eb8 → 8.8.1-dev.11773432149.19826d0c
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/index.js +570 -318
- package/dist/index.js.map +1 -1
- package/dist/types/ReactRouter/IonRouteInner.d.ts +1 -1
- package/dist/types/ReactRouter/ReactRouterViewStack.d.ts +18 -1
- package/dist/types/ReactRouter/utils/computeParentPath.d.ts +10 -2
- package/dist/types/ReactRouter/utils/viewItemUtils.d.ts +22 -2
- package/package.json +4 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { IonRouteProps } from '@ionic/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export declare const IonRouteInner: ({ path, element }: IonRouteProps) => React.JSX.Element;
|
|
3
|
+
export declare const IonRouteInner: ({ path, index, caseSensitive, element }: IonRouteProps) => React.JSX.Element;
|
|
@@ -4,10 +4,23 @@
|
|
|
4
4
|
* items" that Ionic can manage in a view stack. This is critical to maintain
|
|
5
5
|
* Ionic’s animation, lifecycle, and history behavior across views.
|
|
6
6
|
*/
|
|
7
|
+
/// <reference types="node" />
|
|
7
8
|
import type { RouteInfo, ViewItem } from '@ionic/react';
|
|
8
9
|
import { ViewStacks } from '@ionic/react';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
export declare class ReactRouterViewStack extends ViewStacks {
|
|
12
|
+
/**
|
|
13
|
+
* Stores the computed parent path for each outlet.
|
|
14
|
+
* Used by findViewItemByPath to correctly evaluate index route matches
|
|
15
|
+
* without requiring the outlet's React element or route children.
|
|
16
|
+
*/
|
|
17
|
+
private outletParentPaths;
|
|
18
|
+
/**
|
|
19
|
+
* Stores the computed mount path for each outlet.
|
|
20
|
+
* Fed back into computeParentPath on subsequent calls to stabilize
|
|
21
|
+
* the parent path computation across navigations (mirrors StackManager.outletMountPath).
|
|
22
|
+
*/
|
|
23
|
+
private outletMountPaths;
|
|
11
24
|
constructor();
|
|
12
25
|
/**
|
|
13
26
|
* Creates a new view item for the given outlet and react route element.
|
|
@@ -33,7 +46,7 @@ export declare class ReactRouterViewStack extends ViewStacks {
|
|
|
33
46
|
* 3. Returns a list of React components that will be rendered inside the outlet
|
|
34
47
|
* Each view is wrapped in <ViewLifeCycleManager> to manage lifecycle and rendering
|
|
35
48
|
*/
|
|
36
|
-
getChildrenToRender: (outletId: string, ionRouterOutlet: React.ReactElement, routeInfo: RouteInfo) => React.JSX.Element[];
|
|
49
|
+
getChildrenToRender: (outletId: string, ionRouterOutlet: React.ReactElement, routeInfo: RouteInfo, reRender: () => void, parentPathnameBase?: string) => React.JSX.Element[];
|
|
37
50
|
/**
|
|
38
51
|
* Finds a view item matching the current route, optionally updating its match state.
|
|
39
52
|
*/
|
|
@@ -60,6 +73,10 @@ export declare class ReactRouterViewStack extends ViewStacks {
|
|
|
60
73
|
* But allow multiple view items for the same route path (for navigation history)
|
|
61
74
|
*/
|
|
62
75
|
add: (viewItem: ViewItem) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Override clear to also clean up the stored parent path for the outlet.
|
|
78
|
+
*/
|
|
79
|
+
clear: (outletId: string) => NodeJS.Timeout;
|
|
63
80
|
/**
|
|
64
81
|
* Override remove
|
|
65
82
|
*/
|
|
@@ -7,6 +7,12 @@ import type React from 'react';
|
|
|
7
7
|
* @returns The common prefix shared by all paths.
|
|
8
8
|
*/
|
|
9
9
|
export declare const computeCommonPrefix: (paths: string[]) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a pathname falls within the scope of a mount path using
|
|
12
|
+
* segment-aware comparison. Prevents false positives like "/tabs-secondary"
|
|
13
|
+
* matching mount path "/tabs".
|
|
14
|
+
*/
|
|
15
|
+
export declare const isPathnameInScope: (pathname: string, mountPath: string) => boolean;
|
|
10
16
|
/**
|
|
11
17
|
* Checks if a route is a specific match (not wildcard-only or index).
|
|
12
18
|
*/
|
|
@@ -43,8 +49,10 @@ interface ComputeParentPathOptions {
|
|
|
43
49
|
* Computes the parent path for a nested outlet based on the current pathname
|
|
44
50
|
* and the outlet's route configuration.
|
|
45
51
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
52
|
+
* When the mount path is known (seeded from React Router's RouteContext), the
|
|
53
|
+
* parent path is simply the mount path — no iterative discovery needed. The
|
|
54
|
+
* iterative fallback only runs for outlets where RouteContext doesn't provide
|
|
55
|
+
* a parent match (typically root-level outlets on first render).
|
|
48
56
|
*
|
|
49
57
|
* @param options The options for computing the parent path.
|
|
50
58
|
* @returns The computed parent path result.
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import type { ViewItem } from '@ionic/react';
|
|
2
|
+
/**
|
|
3
|
+
* Compares two routes by specificity for sorting (most specific first).
|
|
4
|
+
*
|
|
5
|
+
* Sort order:
|
|
6
|
+
* 1. Index routes come first
|
|
7
|
+
* 2. Wildcard-only routes (* or /*) come last
|
|
8
|
+
* 3. Exact matches (no wildcards/params) before wildcard/param routes
|
|
9
|
+
* 4. Among routes with same status, longer paths are more specific
|
|
10
|
+
*/
|
|
11
|
+
export declare const compareRouteSpecificity: (a: {
|
|
12
|
+
path: string;
|
|
13
|
+
index: boolean;
|
|
14
|
+
}, b: {
|
|
15
|
+
path: string;
|
|
16
|
+
index: boolean;
|
|
17
|
+
}) => number;
|
|
2
18
|
/**
|
|
3
19
|
* Sorts view items by route specificity (most specific first).
|
|
4
|
-
*
|
|
5
|
-
*
|
|
20
|
+
*
|
|
21
|
+
* Sort order aligns with findViewItemByPath in ReactRouterViewStack.tsx:
|
|
22
|
+
* 1. Index routes come first
|
|
23
|
+
* 2. Wildcard-only routes (* or /*) come last
|
|
24
|
+
* 3. Exact matches (no wildcards/params) come before wildcard/param routes
|
|
25
|
+
* 4. Among routes with same wildcard status, longer paths are more specific
|
|
6
26
|
*
|
|
7
27
|
* @param views The view items to sort.
|
|
8
28
|
* @returns A new sorted array of view items.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ionic/react-router",
|
|
3
|
-
"version": "8.8.1-dev.
|
|
3
|
+
"version": "8.8.1-dev.11773432149.19826d0c",
|
|
4
4
|
"description": "React Router wrapper for @ionic/react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ionic",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"dist/"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ionic/react": "8.8.1-dev.
|
|
39
|
+
"@ionic/react": "8.8.1-dev.11773432149.19826d0c",
|
|
40
40
|
"tslib": "*"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=16.8.6",
|
|
44
44
|
"react-dom": ">=16.8.6",
|
|
45
|
-
"react-router": ">=6.
|
|
46
|
-
"react-router-dom": ">=6.
|
|
45
|
+
"react-router": ">=6.4.0 <7",
|
|
46
|
+
"react-router-dom": ">=6.4.0 <7"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@ionic/eslint-config": "^0.3.0",
|