@wordpress/boot 0.2.0 → 0.2.1-next.16d95556a.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.
Files changed (29) hide show
  1. package/build-module/components/app/router.js +12 -10
  2. package/build-module/components/app/router.js.map +2 -2
  3. package/build-module/components/navigation/router-link-item.js +3 -1
  4. package/build-module/components/navigation/router-link-item.js.map +2 -2
  5. package/build-module/components/navigation/use-sidebar-parent.js +3 -1
  6. package/build-module/components/navigation/use-sidebar-parent.js.map +2 -2
  7. package/build-module/components/root/index.js +2 -1
  8. package/build-module/components/root/index.js.map +2 -2
  9. package/build-module/components/root/single-page.js +2 -1
  10. package/build-module/components/root/single-page.js.map +2 -2
  11. package/build-module/components/site-icon-link/index.js +3 -1
  12. package/build-module/components/site-icon-link/index.js.map +2 -2
  13. package/build-types/components/app/router.d.ts +3 -0
  14. package/build-types/components/app/router.d.ts.map +1 -1
  15. package/build-types/components/navigation/router-link-item.d.ts +1 -3
  16. package/build-types/components/navigation/router-link-item.d.ts.map +1 -1
  17. package/build-types/components/navigation/use-sidebar-parent.d.ts.map +1 -1
  18. package/build-types/components/root/index.d.ts.map +1 -1
  19. package/build-types/components/root/single-page.d.ts.map +1 -1
  20. package/build-types/components/site-icon-link/index.d.ts.map +1 -1
  21. package/package.json +21 -22
  22. package/src/components/app/router.tsx +16 -15
  23. package/src/components/navigation/router-link-item.tsx +8 -1
  24. package/src/components/navigation/use-sidebar-parent.ts +8 -5
  25. package/src/components/root/index.tsx +2 -1
  26. package/src/components/root/single-page.tsx +2 -1
  27. package/src/components/site-icon-link/index.tsx +5 -2
  28. package/tsconfig.json +1 -0
  29. package/tsconfig.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/boot",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-next.16d95556a.0",
4
4
  "description": "Minimal boot package for WordPress admin pages.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -34,26 +34,25 @@
34
34
  "wpScriptModuleExports": "./build-module/index.js",
35
35
  "types": "build-types",
36
36
  "dependencies": {
37
- "@tanstack/history": "^1.133.28",
38
- "@tanstack/react-router": "^1.120.5",
39
- "@wordpress/admin-ui": "^1.3.0",
40
- "@wordpress/commands": "^1.35.0",
41
- "@wordpress/components": "^30.8.0",
42
- "@wordpress/compose": "^7.35.0",
43
- "@wordpress/core-data": "^7.35.0",
44
- "@wordpress/data": "^10.35.0",
45
- "@wordpress/editor": "^14.35.0",
46
- "@wordpress/element": "^6.35.0",
47
- "@wordpress/html-entities": "^4.35.0",
48
- "@wordpress/i18n": "^6.8.0",
49
- "@wordpress/icons": "^11.2.0",
50
- "@wordpress/keyboard-shortcuts": "^5.35.0",
51
- "@wordpress/keycodes": "^4.35.0",
52
- "@wordpress/lazy-editor": "^1.1.0",
53
- "@wordpress/primitives": "^4.35.0",
54
- "@wordpress/private-apis": "^1.35.0",
55
- "@wordpress/theme": "^0.2.0",
56
- "@wordpress/url": "^4.35.0",
37
+ "@wordpress/admin-ui": "^1.3.1-next.16d95556a.0",
38
+ "@wordpress/commands": "^1.35.1-next.16d95556a.0",
39
+ "@wordpress/components": "^30.8.1-next.16d95556a.0",
40
+ "@wordpress/compose": "^7.35.1-next.16d95556a.0",
41
+ "@wordpress/core-data": "^7.35.1-next.16d95556a.0",
42
+ "@wordpress/data": "^10.35.1-next.16d95556a.0",
43
+ "@wordpress/editor": "^14.35.1-next.16d95556a.0",
44
+ "@wordpress/element": "^6.35.1-next.16d95556a.0",
45
+ "@wordpress/html-entities": "^4.35.1-next.16d95556a.0",
46
+ "@wordpress/i18n": "^6.8.1-next.16d95556a.0",
47
+ "@wordpress/icons": "^11.2.1-next.16d95556a.0",
48
+ "@wordpress/keyboard-shortcuts": "^5.35.1-next.16d95556a.0",
49
+ "@wordpress/keycodes": "^4.35.1-next.16d95556a.0",
50
+ "@wordpress/lazy-editor": "^1.1.1-next.16d95556a.0",
51
+ "@wordpress/primitives": "^4.35.1-next.16d95556a.0",
52
+ "@wordpress/private-apis": "^1.35.1-next.16d95556a.0",
53
+ "@wordpress/route": "^0.1.1-next.16d95556a.0",
54
+ "@wordpress/theme": "^0.2.1-next.16d95556a.0",
55
+ "@wordpress/url": "^4.35.1-next.16d95556a.0",
57
56
  "clsx": "^2.1.1"
58
57
  },
59
58
  "peerDependencies": {
@@ -63,5 +62,5 @@
63
62
  "publishConfig": {
64
63
  "access": "public"
65
64
  },
66
- "gitHead": "77aa1f194edceafe8ac2a1b9438bf84b557e76e3"
65
+ "gitHead": "59a9383612bbe16e21af84d13b035bfbca7fe833"
67
66
  }
@@ -1,16 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import {
5
- createRouter,
6
- createRootRoute,
7
- createRoute,
8
- RouterProvider,
9
- createBrowserHistory,
10
- type AnyRoute,
11
- redirect,
12
- } from '@tanstack/react-router';
13
- import { parseHref } from '@tanstack/history';
14
4
  import type { ComponentType } from 'react';
15
5
 
16
6
  /**
@@ -19,12 +9,26 @@ import type { ComponentType } from 'react';
19
9
  import { __ } from '@wordpress/i18n';
20
10
  import { lazy, useState, useEffect } from '@wordpress/element';
21
11
  import { Page } from '@wordpress/admin-ui';
12
+ import {
13
+ privateApis as routePrivateApis,
14
+ type AnyRoute,
15
+ } from '@wordpress/route';
22
16
 
23
17
  /**
24
18
  * Internal dependencies
25
19
  */
26
20
  import Root from '../root';
27
21
  import type { Route, RouteLoaderContext } from '../../store/types';
22
+ import { unlock } from '../../lock-unlock';
23
+
24
+ const {
25
+ createRouter,
26
+ createRootRoute,
27
+ createRoute,
28
+ RouterProvider,
29
+ createBrowserHistory,
30
+ parseHref,
31
+ } = unlock( routePrivateApis );
28
32
 
29
33
  // Not found component
30
34
  function NotFoundComponent() {
@@ -89,9 +93,7 @@ async function createRouteFromDefinition(
89
93
 
90
94
  // Load route module for lifecycle functions if specified
91
95
  let routeConfig: {
92
- beforeLoad?: (
93
- context: RouteLoaderContext & { redirect: Function }
94
- ) => void | Promise< void >;
96
+ beforeLoad?: ( context: RouteLoaderContext ) => void | Promise< void >;
95
97
  loader?: ( context: RouteLoaderContext ) => Promise< unknown >;
96
98
  canvas?: ( context: RouteLoaderContext ) => Promise< any >;
97
99
  } = {};
@@ -109,7 +111,6 @@ async function createRouteFromDefinition(
109
111
  routeConfig.beforeLoad!( {
110
112
  params: opts.params || {},
111
113
  search: opts.search || {},
112
- redirect,
113
114
  } )
114
115
  : undefined,
115
116
  loader: async ( opts: any ) => {
@@ -171,7 +172,7 @@ function createPathHistory() {
171
172
  const pathHref = `${ path }${ url.hash }`;
172
173
  return parseHref( pathHref, window.history.state );
173
174
  },
174
- createHref: ( href ) => {
175
+ createHref: ( href: string ) => {
175
176
  const searchParams = new URLSearchParams( window.location.search );
176
177
  searchParams.set( 'p', href );
177
178
  return `${ window.location.pathname }?${ searchParams }`;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { createLink } from '@tanstack/react-router';
5
4
  import type { ForwardedRef } from 'react';
6
5
 
7
6
  /**
@@ -9,6 +8,14 @@ import type { ForwardedRef } from 'react';
9
8
  */
10
9
  import { forwardRef } from '@wordpress/element';
11
10
  import { __experimentalItem as Item } from '@wordpress/components';
11
+ import { privateApis as routePrivateApis } from '@wordpress/route';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import { unlock } from '../../lock-unlock';
17
+
18
+ const { createLink } = unlock( routePrivateApis );
12
19
 
13
20
  function AnchorOnlyItem(
14
21
  props: React.ComponentProps< typeof Item >,
@@ -1,14 +1,17 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { useRouter, useMatches } from '@tanstack/react-router';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
4
+ import { privateApis as routePrivateApis } from '@wordpress/route';
9
5
  import { useEffect, useState } from '@wordpress/element';
10
6
  import { useSelect } from '@wordpress/data';
11
7
 
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { unlock } from '../../lock-unlock';
12
+
13
+ const { useRouter, useMatches } = unlock( routePrivateApis );
14
+
12
15
  /**
13
16
  * Internal dependencies
14
17
  */
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { Outlet, useMatches } from '@tanstack/react-router';
5
4
  import clsx from 'clsx';
6
5
 
7
6
  /**
8
7
  * WordPress dependencies
9
8
  */
9
+ import { privateApis as routePrivateApis } from '@wordpress/route';
10
10
  // @ts-expect-error Commands is not typed properly.
11
11
  import { CommandMenu } from '@wordpress/commands';
12
12
  import { privateApis as themePrivateApis } from '@wordpress/theme';
@@ -22,6 +22,7 @@ import type { CanvasData } from '../../store/types';
22
22
  import './style.scss';
23
23
 
24
24
  const { ThemeProvider } = unlock( themePrivateApis );
25
+ const { useMatches, Outlet } = unlock( routePrivateApis );
25
26
 
26
27
  export default function Root() {
27
28
  const matches = useMatches();
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { Outlet, useMatches } from '@tanstack/react-router';
5
4
  import clsx from 'clsx';
6
5
 
7
6
  /**
8
7
  * WordPress dependencies
9
8
  */
9
+ import { privateApis as routePrivateApis } from '@wordpress/route';
10
10
  // @ts-expect-error Commands is not typed properly.
11
11
  import { CommandMenu } from '@wordpress/commands';
12
12
  import { privateApis as themePrivateApis } from '@wordpress/theme';
@@ -20,6 +20,7 @@ import { unlock } from '../../lock-unlock';
20
20
  import type { CanvasData } from '../../store/types';
21
21
  import './style.scss';
22
22
 
23
+ const { useMatches, Outlet } = unlock( routePrivateApis );
23
24
  const { ThemeProvider } = unlock( themePrivateApis );
24
25
 
25
26
  /**
@@ -1,14 +1,17 @@
1
1
  /**
2
- * External dependencies
2
+ * WordPress dependencies
3
3
  */
4
- import { Link, useCanGoBack, useRouter } from '@tanstack/react-router';
4
+ import { Link, privateApis as routePrivateApis } from '@wordpress/route';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
+ import { unlock } from '../../lock-unlock';
9
10
  import SiteIcon from '../site-icon';
10
11
  import './style.scss';
11
12
 
13
+ const { useCanGoBack, useRouter } = unlock( routePrivateApis );
14
+
12
15
  function SiteIconLink( {
13
16
  to,
14
17
  isBackButton,
package/tsconfig.json CHANGED
@@ -19,6 +19,7 @@
19
19
  { "path": "../lazy-editor" },
20
20
  { "path": "../primitives" },
21
21
  { "path": "../private-apis" },
22
+ { "path": "../route" },
22
23
  { "path": "../theme" },
23
24
  { "path": "../url" }
24
25
  ]