@canonical/router-react 0.47.0 → 0.48.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/types/lib/Link/types.d.ts +14 -15
- package/dist/types/lib/Link/types.d.ts.map +1 -1
- package/dist/types/lib/Outlet/types.d.ts +7 -1
- package/dist/types/lib/Outlet/types.d.ts.map +1 -1
- package/dist/types/lib/RouterProvider/types.d.ts +7 -1
- package/dist/types/lib/RouterProvider/types.d.ts.map +1 -1
- package/package.json +10 -10
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import type { PathBuildOptions, RouteMap, RouteName, RouteOf } from "@canonical/router-core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
3
|
/**
|
|
4
|
-
* Props accepted by `Link`.
|
|
5
|
-
*
|
|
6
4
|
* The route-building half of these props is core's `PathBuildOptions`
|
|
7
5
|
* itself, not a structural duplicate of it: a copy would keep compiling
|
|
8
6
|
* against a stale contract (accepting, say, non-serializable `search`
|
|
9
7
|
* values) long after core tightened it.
|
|
10
8
|
*/
|
|
11
|
-
|
|
12
|
-
/** Content rendered inside the generated anchor element. */
|
|
13
|
-
readonly children?: ReactNode;
|
|
14
|
-
/** Trigger a file download instead of client-side navigation. */
|
|
15
|
-
readonly download?: AnchorHTMLAttributes<HTMLAnchorElement>["download"];
|
|
16
|
-
/** Optional click handler called before router interception runs. */
|
|
17
|
-
readonly onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
18
|
-
/** Optional hover handler called before router warming runs. */
|
|
19
|
-
readonly onMouseEnter?: MouseEventHandler<HTMLAnchorElement>;
|
|
20
|
-
/** Ref forwarded to the underlying anchor element. */
|
|
21
|
-
readonly ref?: Ref<HTMLAnchorElement>;
|
|
9
|
+
type OwnProps<TRoutes extends RouteMap, TName extends RouteName<TRoutes>> = {
|
|
22
10
|
/** The named route to navigate to. */
|
|
23
11
|
readonly to: TName;
|
|
24
|
-
}
|
|
12
|
+
} & PathBuildOptions<RouteOf<TRoutes, TName>>;
|
|
13
|
+
/**
|
|
14
|
+
* Props accepted by `Link`.
|
|
15
|
+
*
|
|
16
|
+
* `href` is excluded from the anchor's native props because it is derived
|
|
17
|
+
* from the chosen route rather than supplied by the caller. The own keys are
|
|
18
|
+
* listed literally rather than as `keyof OwnProps`: `PathBuildOptions` is a
|
|
19
|
+
* conditional mapped type, so `keyof` of it does not resolve while `TName` is
|
|
20
|
+
* still a type parameter.
|
|
21
|
+
*/
|
|
22
|
+
export type LinkProps<TRoutes extends RouteMap, TName extends RouteName<TRoutes>> = OwnProps<TRoutes, TName> & Omit<ComponentProps<"a">, "to" | "params" | "search" | "hash" | "replace" | "href">;
|
|
23
|
+
export {};
|
|
25
24
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Link/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,OAAO,EACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Link/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,OAAO,EACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;GAKG;AACH,KAAK,QAAQ,CAAC,OAAO,SAAS,QAAQ,EAAE,KAAK,SAAS,SAAS,CAAC,OAAO,CAAC,IAAI;IAC1E,sCAAsC;IACtC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;CACpB,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,CACnB,OAAO,SAAS,QAAQ,EACxB,KAAK,SAAS,SAAS,CAAC,OAAO,CAAC,IAC9B,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,GAC1B,IAAI,CACF,cAAc,CAAC,GAAG,CAAC,EACnB,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CACzD,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Props accepted by `Outlet`.
|
|
4
|
+
*
|
|
5
|
+
* Exempt from the native-prop extension convention: `Outlet` renders a
|
|
6
|
+
* `Suspense` around whatever route content matches, so it has no root tag
|
|
7
|
+
* whose native props these could extend.
|
|
8
|
+
*/
|
|
3
9
|
export interface OutletProps {
|
|
4
10
|
/** Content shown while suspended route output is pending. */
|
|
5
11
|
readonly fallback?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Outlet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Outlet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B"}
|
|
@@ -2,7 +2,13 @@ import type { AnyRoute, RouteMap, Router } from "@canonical/router-core";
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
/** A router instance widened to the fully dynamic React binding shape. */
|
|
4
4
|
export type AnyReactRouter = Router<RouteMap, AnyRoute | undefined>;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Props accepted by `RouterProvider`.
|
|
7
|
+
*
|
|
8
|
+
* Exempt from the native-prop extension convention: `RouterProvider` renders
|
|
9
|
+
* a context provider and no DOM element, so it has no root tag whose native
|
|
10
|
+
* props these could extend.
|
|
11
|
+
*/
|
|
6
12
|
export interface RouterProviderProps<TRoutes extends RouteMap, TNotFound extends AnyRoute | undefined = undefined> {
|
|
7
13
|
/** React children that should be able to consume the router. */
|
|
8
14
|
readonly children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/RouterProvider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEpE
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/RouterProvider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB,CAClC,OAAO,SAAS,QAAQ,EACxB,SAAS,SAAS,QAAQ,GAAG,SAAS,GAAG,SAAS;IAElD,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;CAC7C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/router-react",
|
|
3
3
|
"description": "React bindings for @canonical/router-core",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.48.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"test:coverage": "vitest run --coverage"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@canonical/react-ssr": "^0.
|
|
48
|
-
"@canonical/router-core": "^0.
|
|
47
|
+
"@canonical/react-ssr": "^0.48.0",
|
|
48
|
+
"@canonical/router-core": "^0.48.0",
|
|
49
49
|
"react": "^19.2.4",
|
|
50
50
|
"react-dom": "^19.2.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@biomejs/biome": "2.
|
|
54
|
-
"@canonical/biome-config": "0.
|
|
55
|
-
"@canonical/typescript-config-react": "^0.
|
|
56
|
-
"@canonical/vitest-config-react": "^0.
|
|
57
|
-
"@canonical/webarchitect": "0.
|
|
53
|
+
"@biomejs/biome": "2.6.9",
|
|
54
|
+
"@canonical/biome-config": "0.47.0",
|
|
55
|
+
"@canonical/typescript-config-react": "^0.48.0",
|
|
56
|
+
"@canonical/vitest-config-react": "^0.48.0",
|
|
57
|
+
"@canonical/webarchitect": "0.46.0",
|
|
58
58
|
"@testing-library/jest-dom": "^7.0.0",
|
|
59
59
|
"@testing-library/react": "^16.3.2",
|
|
60
60
|
"@types/node": "^26.0.0",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@types/react-dom": "^19.2.3",
|
|
63
63
|
"@vitejs/plugin-react": "^6.0.0",
|
|
64
64
|
"@vitest/coverage-v8": "^5.0.0",
|
|
65
|
-
"jsdom": "^
|
|
65
|
+
"jsdom": "^31.0.0",
|
|
66
66
|
"typescript": "^7.0.2",
|
|
67
67
|
"vite": "^8.0.1",
|
|
68
68
|
"vitest": "^5.0.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "aee4aebab851f90159776a7ba658d0c62e0d2bf4"
|
|
71
71
|
}
|