@wordpress/route 0.3.1-next.v.0 → 0.4.1-next.v.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/build/index.cjs CHANGED
@@ -21,9 +21,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Link: () => import_react_router2.Link,
24
+ notFound: () => import_react_router2.notFound,
24
25
  privateApis: () => import_private_apis.privateApis,
25
26
  redirect: () => import_react_router2.redirect,
26
27
  useInvalidate: () => useInvalidate,
28
+ useLinkProps: () => import_react_router2.useLinkProps,
27
29
  useNavigate: () => import_react_router2.useNavigate,
28
30
  useParams: () => import_react_router2.useParams,
29
31
  useSearch: () => import_react_router2.useSearch
@@ -39,9 +41,11 @@ function useInvalidate() {
39
41
  // Annotate the CommonJS export names for ESM import in node:
40
42
  0 && (module.exports = {
41
43
  Link,
44
+ notFound,
42
45
  privateApis,
43
46
  redirect,
44
47
  useInvalidate,
48
+ useLinkProps,
45
49
  useNavigate,
46
50
  useParams,
47
51
  useSearch
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { useRouter } from '@tanstack/react-router';\nexport {\n\tLink,\n\tredirect,\n\tuseNavigate,\n\tuseParams,\n\tuseSearch,\n} from '@tanstack/react-router';\nexport type {\n\tAnyRoute,\n\tLinkProps,\n\tNavigateOptions,\n\tRouteOptions,\n\tRouterOptions,\n\tToOptions,\n\tUseNavigateResult,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nexport { privateApis } from './private-apis';\n\n/**\n * Hook to invalidate the router cache and trigger a re-render.\n * This is useful when you want to refetch data without changing the URL.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const invalidate = useInvalidate();\n *\n * const handleRefresh = () => {\n * invalidate();\n * };\n *\n * return <button onClick={handleRefresh}>Refresh</button>;\n * }\n * ```\n *\n * @return A function to invalidate the router.\n */\nexport function useInvalidate() {\n\tconst router = useRouter();\n\treturn () => router.invalidate();\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0B;AAC1B,IAAAA,uBAMO;AAcP,0BAA4B;AAqBrB,SAAS,gBAAgB;AAC/B,QAAM,aAAS,+BAAU;AACzB,SAAO,MAAM,OAAO,WAAW;AAChC;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { useRouter } from '@tanstack/react-router';\nexport {\n\tLink,\n\tnotFound,\n\tredirect,\n\tuseLinkProps,\n\tuseNavigate,\n\tuseParams,\n\tuseSearch,\n} from '@tanstack/react-router';\nexport type {\n\tAnyRoute,\n\tLinkProps,\n\tNavigateOptions,\n\tRouteOptions,\n\tRouterOptions,\n\tToOptions,\n\tUseNavigateResult,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nexport { privateApis } from './private-apis';\n\n/**\n * Hook to invalidate the router cache and trigger a re-render.\n * This is useful when you want to refetch data without changing the URL.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const invalidate = useInvalidate();\n *\n * const handleRefresh = () => {\n * invalidate();\n * };\n *\n * return <button onClick={handleRefresh}>Refresh</button>;\n * }\n * ```\n *\n * @return A function to invalidate the router.\n */\nexport function useInvalidate() {\n\tconst router = useRouter();\n\treturn () => router.invalidate();\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0B;AAC1B,IAAAA,uBAQO;AAcP,0BAA4B;AAqBrB,SAAS,gBAAgB;AAC/B,QAAM,aAAS,+BAAU;AACzB,SAAO,MAAM,OAAO,WAAW;AAChC;",
6
6
  "names": ["import_react_router"]
7
7
  }
@@ -44,6 +44,7 @@ var privateApis = {};
44
44
  useLocation: import_react_router.useLocation,
45
45
  useMatches: import_react_router.useMatches,
46
46
  useRouter: import_react_router.useRouter,
47
+ useRouterState: import_react_router.useRouterState,
47
48
  // History utilities
48
49
  parseHref: import_history.parseHref
49
50
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/private-apis.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { parseHref } from '@tanstack/history';\nimport {\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateLink,\n\tcreateRootRoute,\n\tcreateRoute,\n\tcreateRouter,\n\tOutlet,\n\tredirect,\n\tRouterProvider,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nimport { lock } from './lock-unlock';\n\n/**\n * Private APIs for the boot package only.\n * These are router setup and internal utilities that should not be used\n * by individual routes.\n */\nexport const privateApis = {};\n\n// Lock the private APIs so only authorized modules can access them\nlock( privateApis, {\n\t// Router creation and setup\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateRouter,\n\tcreateRootRoute,\n\tcreateRoute,\n\tOutlet,\n\tRouterProvider,\n\n\t// Internal routing utilities\n\tredirect,\n\tcreateLink,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n\n\t// History utilities\n\tparseHref,\n} );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,0BAeO;AAKP,yBAAqB;AAOd,IAAM,cAAc,CAAC;AAAA,IAG5B,yBAAM,aAAa;AAAA;AAAA,EAElB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AACD,CAAE;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { parseHref } from '@tanstack/history';\nimport {\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateLink,\n\tcreateRootRoute,\n\tcreateRoute,\n\tcreateRouter,\n\tOutlet,\n\tredirect,\n\tRouterProvider,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n\tuseRouterState,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nimport { lock } from './lock-unlock';\n\n/**\n * Private APIs for the boot package only.\n * These are router setup and internal utilities that should not be used\n * by individual routes.\n */\nexport const privateApis = {};\n\n// Lock the private APIs so only authorized modules can access them\nlock( privateApis, {\n\t// Router creation and setup\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateRouter,\n\tcreateRootRoute,\n\tcreateRoute,\n\tOutlet,\n\tRouterProvider,\n\n\t// Internal routing utilities\n\tredirect,\n\tcreateLink,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n\tuseRouterState,\n\n\t// History utilities\n\tparseHref,\n} );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,0BAgBO;AAKP,yBAAqB;AAOd,IAAM,cAAc,CAAC;AAAA,IAG5B,yBAAM,aAAa;AAAA;AAAA,EAElB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AACD,CAAE;",
6
6
  "names": []
7
7
  }
@@ -2,7 +2,9 @@
2
2
  import { useRouter } from "@tanstack/react-router";
3
3
  import {
4
4
  Link,
5
+ notFound,
5
6
  redirect,
7
+ useLinkProps,
6
8
  useNavigate,
7
9
  useParams,
8
10
  useSearch
@@ -14,9 +16,11 @@ function useInvalidate() {
14
16
  }
15
17
  export {
16
18
  Link,
19
+ notFound,
17
20
  privateApis,
18
21
  redirect,
19
22
  useInvalidate,
23
+ useLinkProps,
20
24
  useNavigate,
21
25
  useParams,
22
26
  useSearch
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { useRouter } from '@tanstack/react-router';\nexport {\n\tLink,\n\tredirect,\n\tuseNavigate,\n\tuseParams,\n\tuseSearch,\n} from '@tanstack/react-router';\nexport type {\n\tAnyRoute,\n\tLinkProps,\n\tNavigateOptions,\n\tRouteOptions,\n\tRouterOptions,\n\tToOptions,\n\tUseNavigateResult,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nexport { privateApis } from './private-apis';\n\n/**\n * Hook to invalidate the router cache and trigger a re-render.\n * This is useful when you want to refetch data without changing the URL.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const invalidate = useInvalidate();\n *\n * const handleRefresh = () => {\n * invalidate();\n * };\n *\n * return <button onClick={handleRefresh}>Refresh</button>;\n * }\n * ```\n *\n * @return A function to invalidate the router.\n */\nexport function useInvalidate() {\n\tconst router = useRouter();\n\treturn () => router.invalidate();\n}\n"],
5
- "mappings": ";AAGA,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAcP,SAAS,mBAAmB;AAqBrB,SAAS,gBAAgB;AAC/B,QAAM,SAAS,UAAU;AACzB,SAAO,MAAM,OAAO,WAAW;AAChC;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { useRouter } from '@tanstack/react-router';\nexport {\n\tLink,\n\tnotFound,\n\tredirect,\n\tuseLinkProps,\n\tuseNavigate,\n\tuseParams,\n\tuseSearch,\n} from '@tanstack/react-router';\nexport type {\n\tAnyRoute,\n\tLinkProps,\n\tNavigateOptions,\n\tRouteOptions,\n\tRouterOptions,\n\tToOptions,\n\tUseNavigateResult,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nexport { privateApis } from './private-apis';\n\n/**\n * Hook to invalidate the router cache and trigger a re-render.\n * This is useful when you want to refetch data without changing the URL.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const invalidate = useInvalidate();\n *\n * const handleRefresh = () => {\n * invalidate();\n * };\n *\n * return <button onClick={handleRefresh}>Refresh</button>;\n * }\n * ```\n *\n * @return A function to invalidate the router.\n */\nexport function useInvalidate() {\n\tconst router = useRouter();\n\treturn () => router.invalidate();\n}\n"],
5
+ "mappings": ";AAGA,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAcP,SAAS,mBAAmB;AAqBrB,SAAS,gBAAgB;AAC/B,QAAM,SAAS,UAAU;AACzB,SAAO,MAAM,OAAO,WAAW;AAChC;",
6
6
  "names": []
7
7
  }
@@ -14,7 +14,8 @@ import {
14
14
  useLoaderData,
15
15
  useLocation,
16
16
  useMatches,
17
- useRouter
17
+ useRouter,
18
+ useRouterState
18
19
  } from "@tanstack/react-router";
19
20
  import { lock } from "./lock-unlock.mjs";
20
21
  var privateApis = {};
@@ -35,6 +36,7 @@ lock(privateApis, {
35
36
  useLocation,
36
37
  useMatches,
37
38
  useRouter,
39
+ useRouterState,
38
40
  // History utilities
39
41
  parseHref
40
42
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/private-apis.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { parseHref } from '@tanstack/history';\nimport {\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateLink,\n\tcreateRootRoute,\n\tcreateRoute,\n\tcreateRouter,\n\tOutlet,\n\tredirect,\n\tRouterProvider,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nimport { lock } from './lock-unlock';\n\n/**\n * Private APIs for the boot package only.\n * These are router setup and internal utilities that should not be used\n * by individual routes.\n */\nexport const privateApis = {};\n\n// Lock the private APIs so only authorized modules can access them\nlock( privateApis, {\n\t// Router creation and setup\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateRouter,\n\tcreateRootRoute,\n\tcreateRoute,\n\tOutlet,\n\tRouterProvider,\n\n\t// Internal routing utilities\n\tredirect,\n\tcreateLink,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n\n\t// History utilities\n\tparseHref,\n} );\n"],
5
- "mappings": ";AAGA,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP,SAAS,YAAY;AAOd,IAAM,cAAc,CAAC;AAG5B,KAAM,aAAa;AAAA;AAAA,EAElB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AACD,CAAE;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { parseHref } from '@tanstack/history';\nimport {\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateLink,\n\tcreateRootRoute,\n\tcreateRoute,\n\tcreateRouter,\n\tOutlet,\n\tredirect,\n\tRouterProvider,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n\tuseRouterState,\n} from '@tanstack/react-router';\n\n/**\n * Internal dependencies\n */\nimport { lock } from './lock-unlock';\n\n/**\n * Private APIs for the boot package only.\n * These are router setup and internal utilities that should not be used\n * by individual routes.\n */\nexport const privateApis = {};\n\n// Lock the private APIs so only authorized modules can access them\nlock( privateApis, {\n\t// Router creation and setup\n\tcreateBrowserHistory,\n\tcreateLazyRoute,\n\tcreateRouter,\n\tcreateRootRoute,\n\tcreateRoute,\n\tOutlet,\n\tRouterProvider,\n\n\t// Internal routing utilities\n\tredirect,\n\tcreateLink,\n\tuseCanGoBack,\n\tuseLoaderData,\n\tuseLocation,\n\tuseMatches,\n\tuseRouter,\n\tuseRouterState,\n\n\t// History utilities\n\tparseHref,\n} );\n"],
5
+ "mappings": ";AAGA,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP,SAAS,YAAY;AAOd,IAAM,cAAc,CAAC;AAG5B,KAAM,aAAa;AAAA;AAAA,EAElB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AACD,CAAE;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- export { Link, redirect, useNavigate, useParams, useSearch, } from '@tanstack/react-router';
1
+ export { Link, notFound, redirect, useLinkProps, useNavigate, useParams, useSearch, } from '@tanstack/react-router';
2
2
  export type { AnyRoute, LinkProps, NavigateOptions, RouteOptions, RouterOptions, ToOptions, UseNavigateResult, } from '@tanstack/react-router';
3
3
  /**
4
4
  * Internal dependencies
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,GACT,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACX,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,aAAa,EACb,SAAS,EACT,iBAAiB,GACjB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,wBAG5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,GACT,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACX,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,aAAa,EACb,SAAS,EACT,iBAAiB,GACjB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,wBAG5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,eAAO,MAAM,WAAW,IAAK,CAAC"}
1
+ {"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.ts"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,eAAO,MAAM,WAAW,IAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/route",
3
- "version": "0.3.1-next.v.0+500f87dd8",
3
+ "version": "0.4.1-next.v.0+b8934fcf9",
4
4
  "description": "Routing utilities for WordPress admin interfaces.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@tanstack/history": "^1.133.28",
47
47
  "@tanstack/react-router": "^1.120.5",
48
- "@wordpress/private-apis": "^1.37.1-next.v.0+500f87dd8"
48
+ "@wordpress/private-apis": "^1.38.1-next.v.0+b8934fcf9"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^18.0.0"
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "ca0db0ee8ac2116cd307650136027d26d0cdd9bd"
56
+ "gitHead": "17529010285784fd2e735348a28391c79de87c88"
57
57
  }
package/src/index.ts CHANGED
@@ -4,7 +4,9 @@
4
4
  import { useRouter } from '@tanstack/react-router';
5
5
  export {
6
6
  Link,
7
+ notFound,
7
8
  redirect,
9
+ useLinkProps,
8
10
  useNavigate,
9
11
  useParams,
10
12
  useSearch,
@@ -17,6 +17,7 @@ import {
17
17
  useLocation,
18
18
  useMatches,
19
19
  useRouter,
20
+ useRouterState,
20
21
  } from '@tanstack/react-router';
21
22
 
22
23
  /**
@@ -50,6 +51,7 @@ lock( privateApis, {
50
51
  useLocation,
51
52
  useMatches,
52
53
  useRouter,
54
+ useRouterState,
53
55
 
54
56
  // History utilities
55
57
  parseHref,