@wordpress/boot 0.17.0 → 0.18.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 (76) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build-module/components/canvas/back-button.mjs +9 -67
  3. package/build-module/components/canvas/back-button.mjs.map +3 -3
  4. package/build-module/components/navigation/navigation-item/index.mjs +3 -3
  5. package/build-module/components/navigation/navigation-item/index.mjs.map +2 -2
  6. package/build-module/components/root/index.mjs +6 -3
  7. package/build-module/components/root/index.mjs.map +2 -2
  8. package/build-module/components/root/single-page.mjs +6 -3
  9. package/build-module/components/root/single-page.mjs.map +2 -2
  10. package/build-module/components/root/use-sync-body-background.mjs +26 -0
  11. package/build-module/components/root/use-sync-body-background.mjs.map +7 -0
  12. package/build-module/components/sidebar/index.mjs +4 -6
  13. package/build-module/components/sidebar/index.mjs.map +2 -2
  14. package/build-module/index.mjs +6 -6
  15. package/build-module/index.mjs.map +2 -2
  16. package/build-style/style-rtl.css +6 -453
  17. package/build-style/style.css +6 -453
  18. package/build-style/view-transitions-rtl.css +0 -13
  19. package/build-style/view-transitions.css +0 -13
  20. package/build-types/components/app/index.d.ts +2 -2
  21. package/build-types/components/app/index.d.ts.map +1 -1
  22. package/build-types/components/app/router.d.ts +1 -1
  23. package/build-types/components/app/router.d.ts.map +1 -1
  24. package/build-types/components/canvas/back-button.d.ts +1 -8
  25. package/build-types/components/canvas/back-button.d.ts.map +1 -1
  26. package/build-types/components/canvas-renderer/index.d.ts +1 -1
  27. package/build-types/components/canvas-renderer/index.d.ts.map +1 -1
  28. package/build-types/components/navigation/drilldown-item/index.d.ts +2 -2
  29. package/build-types/components/navigation/drilldown-item/index.d.ts.map +1 -1
  30. package/build-types/components/navigation/dropdown-item/index.d.ts +1 -1
  31. package/build-types/components/navigation/dropdown-item/index.d.ts.map +1 -1
  32. package/build-types/components/navigation/navigation-item/index.d.ts +1 -1
  33. package/build-types/components/navigation/navigation-item/index.d.ts.map +1 -1
  34. package/build-types/components/navigation/navigation-screen/index.d.ts +2 -2
  35. package/build-types/components/navigation/navigation-screen/index.d.ts.map +1 -1
  36. package/build-types/components/root/index.d.ts.map +1 -1
  37. package/build-types/components/root/single-page.d.ts.map +1 -1
  38. package/build-types/components/root/use-sync-body-background.d.ts +13 -0
  39. package/build-types/components/root/use-sync-body-background.d.ts.map +1 -0
  40. package/build-types/components/save-panel/use-save-shortcut.d.ts +1 -1
  41. package/build-types/components/save-panel/use-save-shortcut.d.ts.map +1 -1
  42. package/build-types/components/sidebar/index.d.ts +0 -5
  43. package/build-types/components/sidebar/index.d.ts.map +1 -1
  44. package/package.json +28 -28
  45. package/src/components/canvas/back-button.tsx +9 -77
  46. package/src/components/navigation/navigation-item/style.scss +2 -2
  47. package/src/components/root/index.tsx +4 -0
  48. package/src/components/root/single-page.tsx +4 -0
  49. package/src/components/root/style.scss +15 -1
  50. package/src/components/root/use-sync-body-background.ts +41 -0
  51. package/src/components/sidebar/index.tsx +1 -9
  52. package/src/components/sidebar/style.scss +1 -1
  53. package/src/style.scss +0 -2
  54. package/src/view-transitions.scss +0 -18
  55. package/build-module/components/site-hub/index.mjs +0 -78
  56. package/build-module/components/site-hub/index.mjs.map +0 -7
  57. package/build-module/components/site-icon/index.mjs +0 -57
  58. package/build-module/components/site-icon/index.mjs.map +0 -7
  59. package/build-module/components/site-icon-link/index.mjs +0 -53
  60. package/build-module/components/site-icon-link/index.mjs.map +0 -7
  61. package/build-style/experimental-omnibar-rtl.css +0 -37
  62. package/build-style/experimental-omnibar.css +0 -37
  63. package/build-types/components/site-hub/index.d.ts +0 -4
  64. package/build-types/components/site-hub/index.d.ts.map +0 -1
  65. package/build-types/components/site-icon/index.d.ts +0 -9
  66. package/build-types/components/site-icon/index.d.ts.map +0 -1
  67. package/build-types/components/site-icon-link/index.d.ts +0 -8
  68. package/build-types/components/site-icon-link/index.d.ts.map +0 -1
  69. package/src/components/canvas/back-button.scss +0 -67
  70. package/src/components/site-hub/index.tsx +0 -77
  71. package/src/components/site-hub/style.scss +0 -69
  72. package/src/components/site-icon/index.tsx +0 -60
  73. package/src/components/site-icon/style.scss +0 -19
  74. package/src/components/site-icon-link/index.tsx +0 -57
  75. package/src/components/site-icon-link/style.scss +0 -24
  76. package/src/experimental-omnibar.scss +0 -48
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/navigation-item/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,cAAc,CAAC;AAEtB,UAAU,mBAAmB;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAE,EACvC,SAAS,EACT,IAAI,EACJ,qBAA4B,EAC5B,QAAQ,EACR,EAAE,EACF,EAAE,mBAAmB,+BAkCrB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/navigation-item/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,cAAc,CAAC;AAEtB,UAAU,mBAAmB;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAE,EACvC,SAAS,EACT,IAAI,EACJ,qBAA4B,EAC5B,QAAQ,EACR,EAAE,GACF,EAAE,mBAAmB,+BAkCrB"}
@@ -6,7 +6,7 @@ import type { ReactNode, RefObject } from 'react';
6
6
  * Internal dependencies
7
7
  */
8
8
  import './style.scss';
9
- export default function NavigationScreen({ isRoot, title, actions, content, description, animationDirection, backMenuItem, backButtonRef, navigationKey, onNavigate }: {
9
+ export default function NavigationScreen({ isRoot, title, actions, content, description, animationDirection, backMenuItem, backButtonRef, navigationKey, onNavigate, }: {
10
10
  isRoot?: boolean;
11
11
  title: string;
12
12
  actions?: ReactNode;
@@ -16,7 +16,7 @@ export default function NavigationScreen({ isRoot, title, actions, content, desc
16
16
  backButtonRef?: RefObject<HTMLButtonElement | null>;
17
17
  animationDirection?: 'forward' | 'backward';
18
18
  navigationKey?: string;
19
- onNavigate: ({ id, direction }: {
19
+ onNavigate: ({ id, direction, }: {
20
20
  id?: string;
21
21
  direction: 'forward' | 'backward';
22
22
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/navigation-screen/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBlD;;GAEG;AACH,OAAO,cAAc,CAAC;AAkBtB,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,EACzC,MAAM,EACN,KAAK,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,EAAE;IACF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAE,iBAAiB,GAAG,IAAI,CAAE,CAAC;IACtD,kBAAkB,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,CAAE,EACb,EAAE,EACF,SAAS,EACT,EAAE;QACF,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;KAClC,KAAM,IAAI,CAAC;CACZ,+BA8EA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/navigation-screen/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBlD;;GAEG;AACH,OAAO,cAAc,CAAC;AAkBtB,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,EACzC,MAAM,EACN,KAAK,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,GACV,EAAE;IACF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAE,iBAAiB,GAAG,IAAI,CAAE,CAAC;IACtD,kBAAkB,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,CAAE,EACb,EAAE,EACF,SAAS,GACT,EAAE;QACF,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;KAClC,KAAM,IAAI,CAAC;CACZ,+BA8EA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/root/index.tsx"],"names":[],"mappings":"AAiCA,OAAO,cAAc,CAAC;AAItB,MAAM,CAAC,OAAO,UAAU,IAAI,gCAyK3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/root/index.tsx"],"names":[],"mappings":"AAkCA,OAAO,cAAc,CAAC;AAItB,MAAM,CAAC,OAAO,UAAU,IAAI,gCA4K3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"single-page.d.ts","sourceRoot":"","sources":["../../../src/components/root/single-page.tsx"],"names":[],"mappings":"AAsBA,OAAO,cAAc,CAAC;AAKtB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,gCA2DrC"}
1
+ {"version":3,"file":"single-page.d.ts","sourceRoot":"","sources":["../../../src/components/root/single-page.tsx"],"names":[],"mappings":"AAuBA,OAAO,cAAc,CAAC;AAKtB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,gCA8DrC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Reads the boot layout's computed background-color and mirrors it onto
3
+ * `document.body` to avoid a jarring flash on macOS elastic-scroll bounce.
4
+ * Snapshots and restores the previous inline value on unmount.
5
+ *
6
+ * TODO: Once the two top-level `ThemeProvider` instances can be merged, this
7
+ * hook can be replaced with a CSS rule on `<body>`.
8
+ * See https://github.com/WordPress/gutenberg/pull/78587#discussion_r3481698286
9
+ *
10
+ * @return Ref to attach to the `.boot-layout` div.
11
+ */
12
+ export default function useSyncBodyBackground(): import("react").MutableRefObject<HTMLDivElement | null>;
13
+ //# sourceMappingURL=use-sync-body-background.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-sync-body-background.d.ts","sourceRoot":"","sources":["../../../src/components/root/use-sync-body-background.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,4DAuB5C"}
@@ -4,7 +4,7 @@
4
4
  * @param param0 Object containing the function to open the save panel.
5
5
  * @param param0.openSavePanel Function to open the save panel.
6
6
  */
7
- export default function useSaveShortcut({ openSavePanel }: {
7
+ export default function useSaveShortcut({ openSavePanel, }: {
8
8
  openSavePanel: () => void;
9
9
  }): void;
10
10
  //# sourceMappingURL=use-save-shortcut.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-save-shortcut.d.ts","sourceRoot":"","sources":["../../../src/components/save-panel/use-save-shortcut.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,EACxC,aAAa,EACb,EAAE;IACF,aAAa,EAAE,MAAM,IAAI,CAAC;CAC1B,QAwCA"}
1
+ {"version":3,"file":"use-save-shortcut.d.ts","sourceRoot":"","sources":["../../../src/components/save-panel/use-save-shortcut.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,EACxC,aAAa,GACb,EAAE;IACF,aAAa,EAAE,MAAM,IAAI,CAAC;CAC1B,QAwCA"}
@@ -1,8 +1,3 @@
1
1
  import './style.scss';
2
- declare global {
3
- interface Window {
4
- __experimentalAdminBarInEditor?: boolean;
5
- }
6
- }
7
2
  export default function Sidebar(): import("react").JSX.Element;
8
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/index.tsx"],"names":[],"mappings":"AAeA,OAAO,cAAc,CAAC;AAEtB,OAAO,CAAC,MAAM,CAAC,CAAC;IACf,UAAU,MAAM;QACf,8BAA8B,CAAC,EAAE,OAAO,CAAC;KACzC;CACD;AAoBD,MAAM,CAAC,OAAO,UAAU,OAAO,gCAa9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/index.tsx"],"names":[],"mappings":"AAcA,OAAO,cAAc,CAAC;AAoBtB,MAAM,CAAC,OAAO,UAAU,OAAO,gCAY9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/boot",
3
- "version": "0.17.0",
3
+ "version": "0.18.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",
@@ -40,35 +40,35 @@
40
40
  "wpScriptModuleExports": "./build-module/index.mjs",
41
41
  "types": "build-types",
42
42
  "dependencies": {
43
- "@wordpress/a11y": "^4.50.0",
44
- "@wordpress/admin-ui": "^2.5.0",
45
- "@wordpress/base-styles": "^10.2.0",
46
- "@wordpress/commands": "^1.50.0",
47
- "@wordpress/components": "^36.1.0",
48
- "@wordpress/compose": "^8.3.0",
49
- "@wordpress/core-data": "^7.50.0",
50
- "@wordpress/data": "^10.50.0",
51
- "@wordpress/editor": "^14.50.0",
52
- "@wordpress/element": "^8.2.0",
53
- "@wordpress/html-entities": "^4.50.0",
54
- "@wordpress/i18n": "^6.23.0",
55
- "@wordpress/icons": "^15.1.0",
56
- "@wordpress/keyboard-shortcuts": "^5.50.0",
57
- "@wordpress/keycodes": "^4.50.0",
58
- "@wordpress/lazy-editor": "^1.16.0",
59
- "@wordpress/notices": "^5.50.0",
60
- "@wordpress/primitives": "^4.50.0",
61
- "@wordpress/private-apis": "^1.50.0",
62
- "@wordpress/route": "^0.16.0",
63
- "@wordpress/theme": "^0.17.0",
64
- "@wordpress/ui": "^0.17.0",
65
- "@wordpress/url": "^4.50.0",
43
+ "@wordpress/a11y": "^4.51.0",
44
+ "@wordpress/admin-ui": "^2.6.0",
45
+ "@wordpress/base-styles": "^11.0.0",
46
+ "@wordpress/commands": "^1.51.0",
47
+ "@wordpress/components": "^37.0.0",
48
+ "@wordpress/compose": "^8.4.0",
49
+ "@wordpress/core-data": "^7.51.0",
50
+ "@wordpress/data": "^10.51.0",
51
+ "@wordpress/editor": "^14.51.0",
52
+ "@wordpress/element": "^8.3.0",
53
+ "@wordpress/html-entities": "^4.51.0",
54
+ "@wordpress/i18n": "^6.24.0",
55
+ "@wordpress/icons": "^15.2.0",
56
+ "@wordpress/keyboard-shortcuts": "^5.51.0",
57
+ "@wordpress/keycodes": "^4.51.0",
58
+ "@wordpress/lazy-editor": "^1.17.0",
59
+ "@wordpress/notices": "^5.51.0",
60
+ "@wordpress/primitives": "^4.51.0",
61
+ "@wordpress/private-apis": "^1.51.0",
62
+ "@wordpress/route": "^0.17.0",
63
+ "@wordpress/theme": "^1.0.0",
64
+ "@wordpress/ui": "^0.18.0",
65
+ "@wordpress/url": "^4.51.0",
66
66
  "clsx": "^2.1.1"
67
67
  },
68
68
  "peerDependencies": {
69
- "@types/react": "^18.3.27",
70
- "react": "^18.0.0",
71
- "react-dom": "^18.0.0"
69
+ "@types/react": "^18 || ^19",
70
+ "react": "^18 || ^19",
71
+ "react-dom": "^18 || ^19"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "@types/react": {
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "fee6e24e8e63d36f6bbcf487c193461e9bd79753"
81
+ "gitHead": "e9a74f9c14095a34398ecd4d1f7a908e55051205"
82
82
  }
@@ -1,55 +1,18 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- Button,
6
- Icon as WCIcon,
7
- __unstableMotion as motion,
8
- } from '@wordpress/components';
9
- import { arrowUpLeft, arrowUpRight } from '@wordpress/icons';
10
- import { useReducedMotion } from '@wordpress/compose';
4
+ import { Button } from '@wordpress/components';
5
+ import { chevronLeft, chevronRight } from '@wordpress/icons';
11
6
  import { __, isRTL } from '@wordpress/i18n';
12
7
 
13
- /**
14
- * Internal dependencies
15
- */
16
- import SiteIcon from '../site-icon';
17
- import './back-button.scss';
18
-
19
- declare global {
20
- interface Window {
21
- __experimentalAdminBarInEditor?: boolean;
22
- }
23
- }
24
-
25
- /**
26
- * Overlay arrow animation that appears on hover.
27
- * Matches next-admin implementation with clip-path.
28
- */
29
- const toggleHomeIconVariants = {
30
- edit: {
31
- opacity: 0,
32
- scale: 0.2,
33
- },
34
- hover: {
35
- opacity: 1,
36
- scale: 1,
37
- clipPath: 'inset( 22% round 2px )',
38
- },
39
- };
40
-
41
8
  /**
42
9
  * Back button component that appears in full-screen canvas mode.
43
- * Matches next-admin's SiteIconBackButton design.
44
10
  *
45
11
  * @param {Object} props Component props
46
12
  * @param {number} props.length Number of BackButton fills (from Slot)
47
- * @return Back button with slide and hover animations
13
+ * @return Back button
48
14
  */
49
15
  export default function BootBackButton( { length }: { length: number } ) {
50
- const disableMotion = useReducedMotion();
51
- const hasAdminBarInEditor = window.__experimentalAdminBarInEditor;
52
-
53
16
  const handleBack = () => {
54
17
  window.history.back();
55
18
  };
@@ -59,43 +22,12 @@ export default function BootBackButton( { length }: { length: number } ) {
59
22
  return null;
60
23
  }
61
24
 
62
- const transition = {
63
- duration: disableMotion ? 0 : 0.3,
64
- };
65
-
66
- const arrowIcon = isRTL() ? arrowUpRight : arrowUpLeft;
67
-
68
25
  return (
69
- <motion.div
70
- className="boot-canvas-back-button"
71
- animate="edit"
72
- initial="edit"
73
- whileHover="hover"
74
- whileTap="tap"
75
- transition={ transition }
76
- >
77
- <Button
78
- className="boot-canvas-back-button__link"
79
- onClick={ handleBack }
80
- aria-label={ __( 'Go back' ) }
81
- __next40pxDefaultSize
82
- >
83
- { ! hasAdminBarInEditor && <SiteIcon /> }
84
- </Button>
85
-
86
- { hasAdminBarInEditor ? (
87
- <div className="boot-canvas-back-button__icon">
88
- <WCIcon icon={ arrowIcon } />
89
- </div>
90
- ) : (
91
- /* Overlay arrow that appears on hover */
92
- <motion.div
93
- className="boot-canvas-back-button__icon"
94
- variants={ toggleHomeIconVariants }
95
- >
96
- <WCIcon icon={ arrowIcon } />
97
- </motion.div>
98
- ) }
99
- </motion.div>
26
+ <Button
27
+ size="compact"
28
+ onClick={ handleBack }
29
+ label={ __( 'Go back' ) }
30
+ icon={ isRTL() ? chevronRight : chevronLeft }
31
+ />
100
32
  );
101
33
  }
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  &.active {
32
- font-weight: variables.$font-weight-medium;
32
+ font-weight: var(--wpds-typography-font-weight-emphasis);
33
33
  }
34
34
 
35
35
  svg:last-child {
@@ -38,7 +38,7 @@
38
38
 
39
39
  &[aria-current="true"] {
40
40
  color: var(--wpds-color-foreground-interactive-brand-active);
41
- font-weight: variables.$font-weight-medium;
41
+ font-weight: var(--wpds-typography-font-weight-emphasis);
42
42
  }
43
43
 
44
44
  // Make sure the focus style is drawn on top of the current item background.
@@ -31,6 +31,7 @@ import CanvasRenderer from '../canvas-renderer';
31
31
  import useRouteTitle from '../app/use-route-title';
32
32
  import { unlock } from '../../lock-unlock';
33
33
  import type { CanvasData } from '../../store/types';
34
+ import useSyncBodyBackground from './use-sync-body-background';
34
35
  import './style.scss';
35
36
 
36
37
  const { useLocation, useMatches, Outlet } = unlock( routePrivateApis );
@@ -60,6 +61,8 @@ export default function Root() {
60
61
 
61
62
  const themeColors = useMemo( getAdminThemeColors, [] );
62
63
 
64
+ const layoutRef = useSyncBodyBackground();
65
+
63
66
  return (
64
67
  <SlotFillProvider>
65
68
  <Tooltip.Provider>
@@ -69,6 +72,7 @@ export default function Root() {
69
72
  >
70
73
  <ThemeProvider color={ themeColors }>
71
74
  <div
75
+ ref={ layoutRef }
72
76
  className={ clsx( 'boot-layout', {
73
77
  'has-canvas': !! canvas || canvas === null,
74
78
  'has-full-canvas': isFullScreen,
@@ -20,6 +20,7 @@ import SavePanel from '../save-panel';
20
20
  import CanvasRenderer from '../canvas-renderer';
21
21
  import { unlock } from '../../lock-unlock';
22
22
  import type { CanvasData } from '../../store/types';
23
+ import useSyncBodyBackground from './use-sync-body-background';
23
24
  import './style.scss';
24
25
  import useRouteTitle from '../app/use-route-title';
25
26
 
@@ -44,6 +45,8 @@ export default function RootSinglePage() {
44
45
 
45
46
  const themeColors = useMemo( getAdminThemeColors, [] );
46
47
 
48
+ const layoutRef = useSyncBodyBackground();
49
+
47
50
  return (
48
51
  <SlotFillProvider>
49
52
  <ThemeProvider
@@ -52,6 +55,7 @@ export default function RootSinglePage() {
52
55
  >
53
56
  <ThemeProvider color={ themeColors }>
54
57
  <div
58
+ ref={ layoutRef }
55
59
  className={ clsx(
56
60
  'boot-layout boot-layout--single-page',
57
61
  {
@@ -1,3 +1,4 @@
1
+ @use "@wordpress/base-styles/breakpoints";
1
2
  @use "@wordpress/base-styles/variables";
2
3
  @use "@wordpress/base-styles/mixins";
3
4
 
@@ -203,7 +204,7 @@
203
204
 
204
205
  .boot-layout.has-full-canvas .boot-layout__canvas {
205
206
  position: fixed;
206
- top: 0;
207
+ top: var(--wp-admin--admin-bar--height, 0);
207
208
  left: 0;
208
209
  right: 0;
209
210
  bottom: 0;
@@ -223,3 +224,16 @@
223
224
  }
224
225
  }
225
226
  }
227
+
228
+ @media (max-width: #{breakpoints.$break-medium}) {
229
+ .boot-layout__stage,
230
+ .boot-layout__inspector,
231
+ .boot-layout__canvas:not(.has-mobile-drawer) {
232
+ top: var(--wp-admin--admin-bar--height, 0);
233
+ height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
234
+ }
235
+
236
+ .boot-layout__mobile-sidebar-drawer {
237
+ top: var(--wp-admin--admin-bar--height, 0);
238
+ }
239
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useRef } from '@wordpress/element';
5
+ import { useIsomorphicLayoutEffect } from '@wordpress/compose';
6
+
7
+ /**
8
+ * Reads the boot layout's computed background-color and mirrors it onto
9
+ * `document.body` to avoid a jarring flash on macOS elastic-scroll bounce.
10
+ * Snapshots and restores the previous inline value on unmount.
11
+ *
12
+ * TODO: Once the two top-level `ThemeProvider` instances can be merged, this
13
+ * hook can be replaced with a CSS rule on `<body>`.
14
+ * See https://github.com/WordPress/gutenberg/pull/78587#discussion_r3481698286
15
+ *
16
+ * @return Ref to attach to the `.boot-layout` div.
17
+ */
18
+ export default function useSyncBodyBackground() {
19
+ const layoutRef = useRef< HTMLDivElement | null >( null );
20
+
21
+ useIsomorphicLayoutEffect( () => {
22
+ if ( ! layoutRef.current ) {
23
+ return;
24
+ }
25
+
26
+ const body = layoutRef.current.ownerDocument.body;
27
+ const bg = getComputedStyle( layoutRef.current ).backgroundColor;
28
+ if ( ! bg ) {
29
+ return;
30
+ }
31
+
32
+ const previousBackground = body.style.background;
33
+ body.style.background = bg;
34
+
35
+ return () => {
36
+ body.style.background = previousBackground;
37
+ };
38
+ }, [] );
39
+
40
+ return layoutRef;
41
+ }
@@ -9,18 +9,11 @@ import { chevronLeft, chevronRight } from '@wordpress/icons';
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
- import SiteHub from '../site-hub';
13
12
  import Navigation from '../navigation';
14
13
  import SaveButton from '../save-button';
15
14
  import { store as bootStore } from '../../store';
16
15
  import './style.scss';
17
16
 
18
- declare global {
19
- interface Window {
20
- __experimentalAdminBarInEditor?: boolean;
21
- }
22
- }
23
-
24
17
  function DashboardBackButton() {
25
18
  const dashboardLink = useSelect(
26
19
  ( select ) => select( bootStore ).getDashboardLink(),
@@ -40,10 +33,9 @@ function DashboardBackButton() {
40
33
  }
41
34
 
42
35
  export default function Sidebar() {
43
- const hasAdminBarInEditor = window.__experimentalAdminBarInEditor;
44
36
  return (
45
37
  <div className="boot-sidebar__scrollable">
46
- { hasAdminBarInEditor ? <DashboardBackButton /> : <SiteHub /> }
38
+ <DashboardBackButton />
47
39
  <div className="boot-sidebar__content">
48
40
  <Navigation />
49
41
  </div>
@@ -19,5 +19,5 @@
19
19
  }
20
20
 
21
21
  .boot-sidebar__back-button {
22
- margin: variables.$grid-unit-10 variables.$grid-unit-15;
22
+ margin: variables.$grid-unit-20 variables.$grid-unit-15 variables.$grid-unit-10 variables.$grid-unit-15;
23
23
  }
package/src/style.scss CHANGED
@@ -1,7 +1,5 @@
1
- @use "@wordpress/theme/src/prebuilt/css/design-tokens.css" as *;
2
1
  @use "@wordpress/base-styles/mixins" as *;
3
2
  @use "@wordpress/base-styles/variables" as *;
4
- @use "./experimental-omnibar.scss" as *;
5
3
 
6
4
  .boot-layout-container .boot-layout {
7
5
  // On mobile the main content area has to scroll, otherwise you can invoke
@@ -22,15 +22,6 @@
22
22
  view-transition-name: boot--canvas-sidebar;
23
23
  }
24
24
 
25
- .boot-layout.has-full-canvas
26
- .boot-layout__canvas
27
- .boot-site-icon-link,
28
- .boot-layout:not(.has-full-canvas)
29
- .boot-site-hub
30
- .boot-site-icon-link {
31
- view-transition-name: boot--site-icon-link;
32
- }
33
-
34
25
  // Default (non-Safari) view transition names
35
26
  .boot-layout__stage {
36
27
  view-transition-name: boot--stage;
@@ -78,15 +69,6 @@
78
69
  z-index: 1;
79
70
  }
80
71
 
81
- ::view-transition-group(boot--site-icon-link) {
82
- z-index: 2;
83
- }
84
-
85
- ::view-transition-new(boot--site-icon-link),
86
- ::view-transition-old(boot--site-icon-link) {
87
- animation: none;
88
- }
89
-
90
72
  // Safari-specific pseudo-element styles with width: auto fix
91
73
  ::view-transition-new(boot-safari--canvas),
92
74
  ::view-transition-old(boot-safari--canvas),
@@ -1,78 +0,0 @@
1
- // packages/boot/src/components/site-hub/index.tsx
2
- import { useSelect, useDispatch } from "@wordpress/data";
3
- import {
4
- ExternalLink,
5
- Button,
6
- __experimentalHStack as HStack
7
- } from "@wordpress/components";
8
- import { __ } from "@wordpress/i18n";
9
- import { store as coreStore } from "@wordpress/core-data";
10
- import { decodeEntities } from "@wordpress/html-entities";
11
- import { search } from "@wordpress/icons";
12
- import { displayShortcut } from "@wordpress/keycodes";
13
- import { store as commandsStore } from "@wordpress/commands";
14
- import { filterURLForDisplay } from "@wordpress/url";
15
- import SiteIconLink from "../site-icon-link/index.mjs";
16
- import { store as bootStore } from "../../store/index.mjs";
17
-
18
- // packages/boot/src/components/site-hub/style.scss
19
- if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='74d234ae17']")) {
20
- const style = document.createElement("style");
21
- style.setAttribute("data-wp-hash", "74d234ae17");
22
- style.appendChild(document.createTextNode(".boot-site-hub{align-items:center;background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);display:grid;flex-shrink:0;grid-template-columns:60px 1fr auto;padding-right:16px;position:sticky;top:0;z-index:1}.boot-site-hub__actions{flex-shrink:0}.boot-site-hub__title{align-items:center;display:flex;text-decoration:none}.boot-site-hub__title .components-external-link__contents{margin-inline-start:4px;max-width:140px;overflow:hidden;text-decoration:none}.boot-site-hub__title .components-external-link__icon{opacity:0;transition:opacity .1s ease-out}.boot-site-hub__title:hover .components-external-link__icon{opacity:1}@media not (prefers-reduced-motion){.boot-site-hub__title{transition:outline .1s ease-out}}.boot-site-hub__title:focus:not(:active){outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}.boot-site-hub__title-text{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-size:13px;font-weight:499}.boot-site-hub__title-text,.boot-site-hub__url{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.boot-site-hub__url{color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-size:12px}"));
23
- document.head.appendChild(style);
24
- }
25
-
26
- // packages/boot/src/components/site-hub/index.tsx
27
- import { jsx, jsxs } from "react/jsx-runtime";
28
- function SiteHub() {
29
- const { dashboardLink, homeUrl, siteTitle } = useSelect((select) => {
30
- const { getEntityRecord } = select(coreStore);
31
- const _base = getEntityRecord(
32
- "root",
33
- "__unstableBase"
34
- );
35
- return {
36
- dashboardLink: select(bootStore).getDashboardLink(),
37
- homeUrl: _base?.home,
38
- siteTitle: !_base?.name && !!_base?.url ? filterURLForDisplay(_base?.url) : _base?.name
39
- };
40
- }, []);
41
- const { open: openCommandCenter } = useDispatch(commandsStore);
42
- return /* @__PURE__ */ jsxs("div", { className: "boot-site-hub", children: [
43
- /* @__PURE__ */ jsx(
44
- SiteIconLink,
45
- {
46
- to: dashboardLink || "/",
47
- "aria-label": __("Go to the Dashboard")
48
- }
49
- ),
50
- /* @__PURE__ */ jsxs(
51
- ExternalLink,
52
- {
53
- href: homeUrl ?? "/",
54
- className: "boot-site-hub__title",
55
- children: [
56
- /* @__PURE__ */ jsx("div", { className: "boot-site-hub__title-text", children: siteTitle && decodeEntities(siteTitle) }),
57
- /* @__PURE__ */ jsx("div", { className: "boot-site-hub__url", children: filterURLForDisplay(homeUrl ?? "") })
58
- ]
59
- }
60
- ),
61
- /* @__PURE__ */ jsx(HStack, { className: "boot-site-hub__actions", children: /* @__PURE__ */ jsx(
62
- Button,
63
- {
64
- variant: "tertiary",
65
- icon: search,
66
- onClick: () => openCommandCenter(),
67
- size: "compact",
68
- label: __("Open command palette"),
69
- shortcut: displayShortcut.primary("k")
70
- }
71
- ) })
72
- ] });
73
- }
74
- var site_hub_default = SiteHub;
75
- export {
76
- site_hub_default as default
77
- };
78
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/site-hub/index.tsx", "../../../src/components/site-hub/style.scss"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tExternalLink,\n\tButton,\n\t// @ts-ignore\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { search } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\n// @ts-expect-error Commands is not typed properly.\nimport { store as commandsStore } from '@wordpress/commands';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport type { UnstableBase } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SiteIconLink from '../site-icon-link';\nimport { store as bootStore } from '../../store';\nimport './style.scss';\n\nfunction SiteHub() {\n\tconst { dashboardLink, homeUrl, siteTitle } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst _base = getEntityRecord< UnstableBase >(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t);\n\t\treturn {\n\t\t\tdashboardLink: select( bootStore ).getDashboardLink(),\n\t\t\thomeUrl: _base?.home,\n\t\t\tsiteTitle:\n\t\t\t\t! _base?.name && !! _base?.url\n\t\t\t\t\t? filterURLForDisplay( _base?.url )\n\t\t\t\t\t: _base?.name,\n\t\t};\n\t}, [] );\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\treturn (\n\t\t<div className=\"boot-site-hub\">\n\t\t\t<SiteIconLink\n\t\t\t\tto={ dashboardLink || '/' }\n\t\t\t\taria-label={ __( 'Go to the Dashboard' ) }\n\t\t\t/>\n\t\t\t<ExternalLink\n\t\t\t\thref={ homeUrl ?? '/' }\n\t\t\t\tclassName=\"boot-site-hub__title\"\n\t\t\t>\n\t\t\t\t<div className=\"boot-site-hub__title-text\">\n\t\t\t\t\t{ siteTitle && decodeEntities( siteTitle ) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"boot-site-hub__url\">\n\t\t\t\t\t{ filterURLForDisplay( homeUrl ?? '' ) }\n\t\t\t\t</div>\n\t\t\t</ExternalLink>\n\t\t\t<HStack className=\"boot-site-hub__actions\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\ticon={ search }\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tlabel={ __( 'Open command palette' ) }\n\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n\nexport default SiteHub;\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='74d234ae17']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"74d234ae17\");\n\tstyle.appendChild(document.createTextNode(\".boot-site-hub{align-items:center;background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);display:grid;flex-shrink:0;grid-template-columns:60px 1fr auto;padding-right:16px;position:sticky;top:0;z-index:1}.boot-site-hub__actions{flex-shrink:0}.boot-site-hub__title{align-items:center;display:flex;text-decoration:none}.boot-site-hub__title .components-external-link__contents{margin-inline-start:4px;max-width:140px;overflow:hidden;text-decoration:none}.boot-site-hub__title .components-external-link__icon{opacity:0;transition:opacity .1s ease-out}.boot-site-hub__title:hover .components-external-link__icon{opacity:1}@media not (prefers-reduced-motion){.boot-site-hub__title{transition:outline .1s ease-out}}.boot-site-hub__title:focus:not(:active){outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}.boot-site-hub__title-text{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-size:13px;font-weight:499}.boot-site-hub__title-text,.boot-site-hub__url{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.boot-site-hub__url{color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-size:12px}\"));\n\tdocument.head.appendChild(style);\n}\n"],
5
- "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EAEA,wBAAwB;AAAA,OAClB;AACP,SAAS,UAAU;AACnB,SAAS,SAAS,iBAAiB;AACnC,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAEhC,SAAS,SAAS,qBAAqB;AACvC,SAAS,2BAA2B;AAMpC,OAAO,kBAAkB;AACzB,SAAS,SAAS,iBAAiB;;;ACxBnC,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,2zCAA2zC,CAAC;AACt2C,WAAS,KAAK,YAAY,KAAK;AAChC;;;AD0CG,cAIA,YAJA;AApBH,SAAS,UAAU;AAClB,QAAM,EAAE,eAAe,SAAS,UAAU,IAAI,UAAW,CAAE,WAAY;AACtE,UAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAC9C,UAAM,QAAQ;AAAA,MACb;AAAA,MACA;AAAA,IACD;AACA,WAAO;AAAA,MACN,eAAe,OAAQ,SAAU,EAAE,iBAAiB;AAAA,MACpD,SAAS,OAAO;AAAA,MAChB,WACC,CAAE,OAAO,QAAQ,CAAC,CAAE,OAAO,MACxB,oBAAqB,OAAO,GAAI,IAChC,OAAO;AAAA,IACZ;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,EAAE,MAAM,kBAAkB,IAAI,YAAa,aAAc;AAE/D,SACC,qBAAC,SAAI,WAAU,iBACd;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,IAAK,iBAAiB;AAAA,QACtB,cAAa,GAAI,qBAAsB;AAAA;AAAA,IACxC;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,WAAW;AAAA,QAClB,WAAU;AAAA,QAEV;AAAA,8BAAC,SAAI,WAAU,6BACZ,uBAAa,eAAgB,SAAU,GAC1C;AAAA,UACA,oBAAC,SAAI,WAAU,sBACZ,8BAAqB,WAAW,EAAG,GACtC;AAAA;AAAA;AAAA,IACD;AAAA,IACA,oBAAC,UAAO,WAAU,0BACjB;AAAA,MAAC;AAAA;AAAA,QACA,SAAQ;AAAA,QACR,MAAO;AAAA,QACP,SAAU,MAAM,kBAAkB;AAAA,QAClC,MAAK;AAAA,QACL,OAAQ,GAAI,sBAAuB;AAAA,QACnC,UAAW,gBAAgB,QAAS,GAAI;AAAA;AAAA,IACzC,GACD;AAAA,KACD;AAEF;AAEA,IAAO,mBAAQ;",
6
- "names": []
7
- }