@wordpress/boot 0.24.0 → 0.26.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 (75) hide show
  1. package/build-module/components/app/index.mjs +29 -53
  2. package/build-module/components/app/index.mjs.map +1 -7
  3. package/build-module/components/app/router.mjs +238 -214
  4. package/build-module/components/app/router.mjs.map +1 -7
  5. package/build-module/components/app/use-route-title.mjs +35 -42
  6. package/build-module/components/app/use-route-title.mjs.map +1 -7
  7. package/build-module/components/canvas/back-button.mjs +21 -20
  8. package/build-module/components/canvas/back-button.mjs.map +1 -7
  9. package/build-module/components/canvas/index.mjs +103 -129
  10. package/build-module/components/canvas/index.mjs.map +1 -7
  11. package/build-module/components/canvas/site-preview.mjs +36 -43
  12. package/build-module/components/canvas/site-preview.mjs.map +1 -7
  13. package/build-module/components/canvas/use-navigate-to-entity-record.mjs +109 -113
  14. package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +1 -7
  15. package/build-module/components/canvas/viewport.mjs +25 -13
  16. package/build-module/components/canvas/viewport.mjs.map +1 -7
  17. package/build-module/components/canvas-renderer/index.mjs +40 -32
  18. package/build-module/components/canvas-renderer/index.mjs.map +1 -7
  19. package/build-module/components/error-boundary/index.mjs +160 -108
  20. package/build-module/components/error-boundary/index.mjs.map +1 -7
  21. package/build-module/components/navigation/drilldown-item/index.mjs +124 -127
  22. package/build-module/components/navigation/drilldown-item/index.mjs.map +1 -7
  23. package/build-module/components/navigation/dropdown-item/index.mjs +156 -173
  24. package/build-module/components/navigation/dropdown-item/index.mjs.map +1 -7
  25. package/build-module/components/navigation/index.mjs +55 -90
  26. package/build-module/components/navigation/index.mjs.map +1 -7
  27. package/build-module/components/navigation/items.mjs +51 -53
  28. package/build-module/components/navigation/items.mjs.map +1 -7
  29. package/build-module/components/navigation/navigation-item/index.mjs +120 -114
  30. package/build-module/components/navigation/navigation-item/index.mjs.map +1 -7
  31. package/build-module/components/navigation/navigation-screen/index.mjs +192 -185
  32. package/build-module/components/navigation/navigation-screen/index.mjs.map +1 -7
  33. package/build-module/components/navigation/path-matching.mjs +74 -73
  34. package/build-module/components/navigation/path-matching.mjs.map +1 -7
  35. package/build-module/components/navigation/router-link-item.mjs +13 -11
  36. package/build-module/components/navigation/router-link-item.mjs.map +1 -7
  37. package/build-module/components/navigation/use-sidebar-parent.mjs +37 -48
  38. package/build-module/components/navigation/use-sidebar-parent.mjs.map +1 -7
  39. package/build-module/components/plugin-area/index.mjs +20 -24
  40. package/build-module/components/plugin-area/index.mjs.map +1 -7
  41. package/build-module/components/root/index.mjs +227 -242
  42. package/build-module/components/root/index.mjs.map +1 -7
  43. package/build-module/components/root/single-page.mjs +174 -148
  44. package/build-module/components/root/single-page.mjs.map +1 -7
  45. package/build-module/components/root/use-sync-body-background.mjs +28 -22
  46. package/build-module/components/root/use-sync-body-background.mjs.map +1 -7
  47. package/build-module/components/save-button/index.mjs +170 -214
  48. package/build-module/components/save-button/index.mjs.map +1 -7
  49. package/build-module/components/save-panel/index.mjs +110 -106
  50. package/build-module/components/save-panel/index.mjs.map +1 -7
  51. package/build-module/components/save-panel/use-save-shortcut.mjs +42 -51
  52. package/build-module/components/save-panel/use-save-shortcut.mjs.map +1 -7
  53. package/build-module/components/sidebar/index.mjs +126 -104
  54. package/build-module/components/sidebar/index.mjs.map +1 -7
  55. package/build-module/index.mjs +1 -7
  56. package/build-module/lock-unlock.mjs +5 -10
  57. package/build-module/lock-unlock.mjs.map +1 -7
  58. package/build-module/store/actions.mjs +34 -31
  59. package/build-module/store/actions.mjs.map +1 -7
  60. package/build-module/store/index.mjs +9 -11
  61. package/build-module/store/index.mjs.map +1 -7
  62. package/build-module/store/reducer.mjs +48 -55
  63. package/build-module/store/reducer.mjs.map +1 -7
  64. package/build-module/store/selectors.mjs +21 -16
  65. package/build-module/store/selectors.mjs.map +1 -7
  66. package/build-module/store/types.mjs +0 -1
  67. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  68. package/build-types/store/types.d.ts +1 -1
  69. package/package.json +30 -31
  70. package/src/components/canvas/index.tsx +2 -2
  71. package/src/components/error-boundary/index.tsx +50 -4
  72. package/src/store/types.ts +1 -1
  73. package/CHANGELOG.md +0 -81
  74. package/build-module/index.mjs.map +0 -7
  75. package/build-module/store/types.mjs.map +0 -7
@@ -1,16 +1,10 @@
1
- // packages/boot/src/components/root/index.tsx
2
1
  import clsx from "clsx";
3
- import { privateApis as routePrivateApis } from "@wordpress/route";
2
+ import { privateApis } from "@wordpress/route";
4
3
  import { SnackbarNotices } from "@wordpress/notices";
5
- import { useViewportMatch, useReducedMotion } from "@wordpress/compose";
6
- import {
7
- __unstableMotion as motion,
8
- __unstableAnimatePresence as AnimatePresence,
9
- Button,
10
- SlotFillProvider
11
- } from "@wordpress/components";
4
+ import { useReducedMotion, useViewportMatch } from "@wordpress/compose";
5
+ import { Button, SlotFillProvider, __unstableAnimatePresence, __unstableMotion } from "@wordpress/components";
12
6
  import { menu } from "@wordpress/icons";
13
- import { useState, useEffect, useMemo } from "@wordpress/element";
7
+ import { useEffect, useMemo, useState } from "@wordpress/element";
14
8
  import { __ } from "@wordpress/i18n";
15
9
  import { UnsavedChangesWarning } from "@wordpress/editor";
16
10
  import { Page, getAdminThemeColors } from "@wordpress/admin-ui";
@@ -24,250 +18,241 @@ import PluginArea from "../plugin-area/index.mjs";
24
18
  import useRouteTitle from "../app/use-route-title.mjs";
25
19
  import { unlock } from "../../lock-unlock.mjs";
26
20
  import useSyncBodyBackground from "./use-sync-body-background.mjs";
27
-
21
+ import { jsx, jsxs } from "react/jsx-runtime";
28
22
  // packages/style-runtime/src/index.ts
29
- var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
23
+ const STYLE_HASH_ATTRIBUTE = "data-wp-hash";
24
+ /**
25
+ * Returns the shared style runtime registry.
26
+ *
27
+ * The registry is stored on `globalThis` so separately bundled copies of this
28
+ * package can coordinate through the same document and style maps.
29
+ *
30
+ * @return The shared runtime registry.
31
+ */
30
32
  function getRuntime() {
31
- const globalScope = globalThis;
32
- if (globalScope.__wpStyleRuntime) {
33
- return globalScope.__wpStyleRuntime;
34
- }
35
- globalScope.__wpStyleRuntime = {
36
- documents: /* @__PURE__ */ new Map(),
37
- styles: /* @__PURE__ */ new Map(),
38
- injectedStyles: /* @__PURE__ */ new WeakMap()
39
- };
40
- if (typeof document !== "undefined") {
41
- registerDocument(document);
42
- }
43
- return globalScope.__wpStyleRuntime;
33
+ const globalScope = globalThis;
34
+ if (globalScope.__wpStyleRuntime) return globalScope.__wpStyleRuntime;
35
+ globalScope.__wpStyleRuntime = {
36
+ documents: /* @__PURE__ */ new Map(),
37
+ styles: /* @__PURE__ */ new Map(),
38
+ injectedStyles: /* @__PURE__ */ new WeakMap()
39
+ };
40
+ if (typeof document !== "undefined") registerDocument(document);
41
+ return globalScope.__wpStyleRuntime;
44
42
  }
43
+ /**
44
+ * Checks whether a document already contains a style tag for a hash.
45
+ *
46
+ * @param targetDocument Document to inspect.
47
+ * @param hash Stable hash for the transformed CSS.
48
+ *
49
+ * @return Whether the style hash already exists in the document.
50
+ */
45
51
  function documentContainsStyleHash(targetDocument, hash) {
46
- if (!targetDocument.head) {
47
- return false;
48
- }
49
- for (const style of targetDocument.head.querySelectorAll(
50
- `style[${STYLE_HASH_ATTRIBUTE}]`
51
- )) {
52
- if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
53
- return true;
54
- }
55
- }
56
- return false;
52
+ if (!targetDocument.head) return false;
53
+ for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) return true;
54
+ return false;
57
55
  }
56
+ /**
57
+ * Injects a registered style into a document, unless that document already
58
+ * contains a style tag for the same hash.
59
+ *
60
+ * @param targetDocument Document to inject the style into.
61
+ * @param hash Stable hash for the transformed CSS.
62
+ * @param css CSS text to inject.
63
+ */
58
64
  function injectStyle(targetDocument, hash, css) {
59
- if (!targetDocument.head) {
60
- return;
61
- }
62
- const runtime = getRuntime();
63
- let injectedStyles = runtime.injectedStyles.get(targetDocument);
64
- if (!injectedStyles) {
65
- injectedStyles = /* @__PURE__ */ new Set();
66
- runtime.injectedStyles.set(targetDocument, injectedStyles);
67
- }
68
- if (injectedStyles.has(hash)) {
69
- return;
70
- }
71
- if (documentContainsStyleHash(targetDocument, hash)) {
72
- injectedStyles.add(hash);
73
- return;
74
- }
75
- const style = targetDocument.createElement("style");
76
- style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
77
- style.appendChild(targetDocument.createTextNode(css));
78
- targetDocument.head.appendChild(style);
79
- injectedStyles.add(hash);
65
+ if (!targetDocument.head) return;
66
+ const runtime = getRuntime();
67
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
68
+ if (!injectedStyles) {
69
+ injectedStyles = /* @__PURE__ */ new Set();
70
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
71
+ }
72
+ if (injectedStyles.has(hash)) return;
73
+ if (documentContainsStyleHash(targetDocument, hash)) {
74
+ injectedStyles.add(hash);
75
+ return;
76
+ }
77
+ const style = targetDocument.createElement("style");
78
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
79
+ style.appendChild(targetDocument.createTextNode(css));
80
+ targetDocument.head.appendChild(style);
81
+ injectedStyles.add(hash);
80
82
  }
83
+ /**
84
+ * Registers a document as a style injection target.
85
+ *
86
+ * Existing registered styles are replayed into the document immediately.
87
+ * Documents are reference-counted so multiple providers can safely register the
88
+ * same document without one cleanup removing it while another registration is
89
+ * still active.
90
+ *
91
+ * @param targetDocument Document to receive registered styles.
92
+ * @return Cleanup function that unregisters this document registration.
93
+ */
81
94
  function registerDocument(targetDocument) {
82
- const runtime = getRuntime();
83
- runtime.documents.set(
84
- targetDocument,
85
- (runtime.documents.get(targetDocument) ?? 0) + 1
86
- );
87
- for (const [hash, css] of runtime.styles) {
88
- injectStyle(targetDocument, hash, css);
89
- }
90
- return () => {
91
- const count = runtime.documents.get(targetDocument);
92
- if (count === void 0) {
93
- return;
94
- }
95
- if (count <= 1) {
96
- runtime.documents.delete(targetDocument);
97
- return;
98
- }
99
- runtime.documents.set(targetDocument, count - 1);
100
- };
95
+ const runtime = getRuntime();
96
+ runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
97
+ for (const [hash, css] of runtime.styles) injectStyle(targetDocument, hash, css);
98
+ return () => {
99
+ const count = runtime.documents.get(targetDocument);
100
+ if (count === void 0) return;
101
+ if (count <= 1) {
102
+ runtime.documents.delete(targetDocument);
103
+ return;
104
+ }
105
+ runtime.documents.set(targetDocument, count - 1);
106
+ };
101
107
  }
108
+ /**
109
+ * Registers a style and injects it into all registered documents.
110
+ *
111
+ * The hash is used as the deduplication key, so calling this repeatedly with
112
+ * the same hash will not add duplicate style tags to a document.
113
+ * Registered styles are retained for the lifetime of the page so they can be
114
+ * replayed into documents that are registered later.
115
+ *
116
+ * @param hash Stable hash for the transformed CSS.
117
+ * @param css CSS text to inject.
118
+ */
102
119
  function registerStyle(hash, css) {
103
- const runtime = getRuntime();
104
- runtime.styles.set(hash, css);
105
- for (const targetDocument of runtime.documents.keys()) {
106
- injectStyle(targetDocument, hash, css);
107
- }
120
+ const runtime = getRuntime();
121
+ runtime.styles.set(hash, css);
122
+ for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
108
123
  }
109
-
110
124
  // packages/boot/src/components/root/style.module.scss
111
- if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
112
- registerStyle("b215aa5eaa", ".c8317e9ebb034cfa__layout{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:row;height:100%;isolation:isolate;width:100%}@media (min-width:600px){.c8317e9ebb034cfa__layout{bottom:0;inset-inline-end:0;inset-inline-start:0;min-height:calc(100vh - 46px);position:absolute;top:0}}@media (min-width:782px){.c8317e9ebb034cfa__layout{min-height:calc(100vh - 32px)}body:has(.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas) .c8317e9ebb034cfa__layout{min-height:100vh}}:where(.c8317e9ebb034cfa__layout) img{height:auto;max-width:100%}.c8317e9ebb034cfa__layout .b8f8c6cf9ae266bf__notices-snackbar{bottom:var(--wpds-dimension-size-md,32px);box-sizing:border-box;display:flex;flex-direction:column;left:0;padding-inline:16px;pointer-events:none;position:fixed;right:0}.c8317e9ebb034cfa__layout .b8f8c6cf9ae266bf__notices-snackbar ._94ac6b8f274ce2f6__components-snackbar,.c8317e9ebb034cfa__layout .b8f8c6cf9ae266bf__notices-snackbar .components-snackbar{margin-inline:auto}.bfc3fedf39b1cf71__sidebar-backdrop{background-color:rgba(0,0,0,.5);bottom:0;cursor:var(--wpds-cursor-control,pointer);inset-inline-end:0;inset-inline-start:0;position:fixed;top:0;z-index:100002}.bb4f70cd030be0a3__sidebar{flex-shrink:0;height:100%;overflow:hidden;position:relative;width:240px}.bb4f70cd030be0a3__sidebar._27e6d590dc5963c9__is-mobile{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);bottom:0;box-shadow:2px 0 8px rgba(0,0,0,.2);inset-inline-start:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}._0eb5d3a3e94d6273__mobile-sidebar-drawer{inset-inline-end:0;inset-inline-start:0;position:fixed;top:0}._26789cb167e9f578__layout-single-page ._0eb5d3a3e94d6273__mobile-sidebar-drawer{top:46px}._0eb5d3a3e94d6273__mobile-sidebar-drawer{align-items:center;background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-bottom:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);display:flex;justify-content:flex-start;padding:16px;z-index:3}.fb03501e629fd04e__canvas.fa94dab2ab1e36f3__has-mobile-drawer{padding-top:65px;position:relative}.a03baddce3ef2026__surfaces{display:flex;flex-grow:1;gap:8px;margin:0}@media (min-width:782px){.a03baddce3ef2026__surfaces{margin:8px}._26789cb167e9f578__layout-single-page .a03baddce3ef2026__surfaces{margin-top:0;margin-inline-start:0}}._7ffe3a3db6f69647__inspector,.d12c9efe707e6cb3__stage{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-radius:0;bottom:0;color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw}._26789cb167e9f578__layout-single-page ._7ffe3a3db6f69647__inspector,._26789cb167e9f578__layout-single-page .d12c9efe707e6cb3__stage{height:calc(100vh - 46px);top:46px}@media (min-width:782px){._7ffe3a3db6f69647__inspector,.d12c9efe707e6cb3__stage{border-radius:var(--wpds-border-radius-xl,12px);height:auto;margin:0;position:static;width:auto}._26789cb167e9f578__layout-single-page ._7ffe3a3db6f69647__inspector,._26789cb167e9f578__layout-single-page .d12c9efe707e6cb3__stage{height:auto}}.d12c9efe707e6cb3__stage{z-index:2}@media (min-width:782px){.d12c9efe707e6cb3__stage{z-index:auto}}._7ffe3a3db6f69647__inspector{z-index:3}@media (min-width:782px){._7ffe3a3db6f69647__inspector{z-index:auto}}.fb03501e629fd04e__canvas{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:0;bottom:0;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw;z-index:1}._26789cb167e9f578__layout-single-page .fb03501e629fd04e__canvas{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.fb03501e629fd04e__canvas{border-radius:var(--wpds-border-radius-xl,12px);height:auto;position:static;width:auto;z-index:auto}._26789cb167e9f578__layout-single-page .fb03501e629fd04e__canvas{height:auto}._7ffe3a3db6f69647__inspector,.c8317e9ebb034cfa__layout.f7fe42ef8c67e96f__has-canvas .d12c9efe707e6cb3__stage{max-width:400px}}.fb03501e629fd04e__canvas .interface-interface-skeleton{height:100%;inset-inline-start:0!important;position:relative;top:0!important}.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .a03baddce3ef2026__surfaces{gap:0;margin:0}.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas ._7ffe3a3db6f69647__inspector,.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .d12c9efe707e6cb3__stage{display:none}.c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .fb03501e629fd04e__canvas{border:none;border-radius:0;bottom:0;box-shadow:none;inset-inline-end:0;inset-inline-start:0;margin:0;max-width:none;overflow:hidden;position:fixed;top:var(--wp-admin--admin-bar--height,0)}._26789cb167e9f578__layout-single-page .c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .fb03501e629fd04e__canvas{top:46px}@media (min-width:782px){._26789cb167e9f578__layout-single-page .c8317e9ebb034cfa__layout.e97bb2807a9c4687__has-full-canvas .fb03501e629fd04e__canvas{top:32px}}@media (max-width:782px){._7ffe3a3db6f69647__inspector,.d12c9efe707e6cb3__stage,.fb03501e629fd04e__canvas:not(.fa94dab2ab1e36f3__has-mobile-drawer){height:calc(100vh - var(--wp-admin--admin-bar--height, 0px));top:var(--wp-admin--admin-bar--height,0)}._0eb5d3a3e94d6273__mobile-sidebar-drawer{top:var(--wp-admin--admin-bar--height,0)}}@media not (prefers-reduced-motion:reduce){.fb03501e629fd04e__canvas .interface-interface-skeleton__header{view-transition-name:boot--canvas-header}.fb03501e629fd04e__canvas .interface-interface-skeleton__sidebar{view-transition-name:boot--canvas-sidebar}.d12c9efe707e6cb3__stage{view-transition-name:boot--stage}._7ffe3a3db6f69647__inspector{view-transition-name:boot--inspector}.fb03501e629fd04e__canvas{view-transition-name:boot--canvas}@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.d12c9efe707e6cb3__stage{view-transition-name:boot-safari--stage}._7ffe3a3db6f69647__inspector{view-transition-name:boot-safari--inspector}.fb03501e629fd04e__canvas{view-transition-name:boot-safari--canvas}}}@media (max-width:782px){:root:has(.c8317e9ebb034cfa__layout) *{view-transition-name:none!important}}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(root),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(root){animation-duration:.25s}@media not (prefers-reduced-motion:reduce){:root:has(.c8317e9ebb034cfa__layout) .components-popover:first-of-type{view-transition-name:boot--components-popover}}:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot--canvas-header),:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot--canvas-sidebar),:root:has(.c8317e9ebb034cfa__layout)::view-transition-group(boot-safari--canvas){z-index:1}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--stage),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--stage){width:auto}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--stage),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--inspector),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--stage){background:#fff;border-radius:var(--wpds-border-radius-xl,12px);height:100%;object-fit:none;object-position:left top;overflow:hidden;width:100%}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas),:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas){object-position:center top}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--stage):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--stage):only-child{animation-name:ef68027ea03aa34b__zoomOut;will-change:transform,opacity}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--stage):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--inspector):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--stage):only-child{animation-name:_0752ac81dff4c432__zoomIn;will-change:transform,opacity}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot-safari--canvas):only-child{animation-name:_3a2e4dc465681136__slideFromRight;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas):only-child,:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot-safari--canvas):only-child{animation-name:_86a367ac26a1b61e__slideToRight;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas-header):only-child{animation-name:_462399c0e9d64199__slideHeaderFromTop;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas-header):only-child{animation-name:_8b272f30d43c9f38__slideHeaderToTop;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-new(boot--canvas-sidebar):only-child{animation-name:_69ed6a71d53a2e0c__slideSidebarFromRight;will-change:transform}:root:has(.c8317e9ebb034cfa__layout)::view-transition-old(boot--canvas-sidebar):only-child{animation-name:bf0697a36b00caad__slideSidebarToRight;will-change:transform}@keyframes ef68027ea03aa34b__zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}@keyframes _0752ac81dff4c432__zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes _3a2e4dc465681136__slideFromRight{0%{transform:translateX(100vw)}to{transform:translateX(0)}}@keyframes _86a367ac26a1b61e__slideToRight{0%{transform:translateX(0)}to{transform:translateX(100vw)}}@keyframes _462399c0e9d64199__slideHeaderFromTop{0%{transform:translateY(-100%)}}@keyframes _8b272f30d43c9f38__slideHeaderToTop{to{transform:translateY(-100%)}}@keyframes _69ed6a71d53a2e0c__slideSidebarFromRight{0%{transform:translateX(100%)}}@keyframes bf0697a36b00caad__slideSidebarToRight{to{transform:translateX(100%)}}");
113
- }
114
- var style_module_default = { "layout": "c8317e9ebb034cfa__layout", "has-full-canvas": "e97bb2807a9c4687__has-full-canvas", "notices-snackbar": "b8f8c6cf9ae266bf__notices-snackbar", "components-snackbar": "_94ac6b8f274ce2f6__components-snackbar", "sidebar-backdrop": "bfc3fedf39b1cf71__sidebar-backdrop", "sidebar": "bb4f70cd030be0a3__sidebar", "is-mobile": "_27e6d590dc5963c9__is-mobile", "mobile-sidebar-drawer": "_0eb5d3a3e94d6273__mobile-sidebar-drawer", "layout-single-page": "_26789cb167e9f578__layout-single-page", "canvas": "fb03501e629fd04e__canvas", "has-mobile-drawer": "fa94dab2ab1e36f3__has-mobile-drawer", "surfaces": "a03baddce3ef2026__surfaces", "stage": "d12c9efe707e6cb3__stage", "inspector": "_7ffe3a3db6f69647__inspector", "has-canvas": "f7fe42ef8c67e96f__has-canvas", "zoomOut": "ef68027ea03aa34b__zoomOut", "zoomIn": "_0752ac81dff4c432__zoomIn", "slideFromRight": "_3a2e4dc465681136__slideFromRight", "slideToRight": "_86a367ac26a1b61e__slideToRight", "slideHeaderFromTop": "_462399c0e9d64199__slideHeaderFromTop", "slideHeaderToTop": "_8b272f30d43c9f38__slideHeaderToTop", "slideSidebarFromRight": "_69ed6a71d53a2e0c__slideSidebarFromRight", "slideSidebarToRight": "bf0697a36b00caad__slideSidebarToRight" };
115
-
125
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("fed1a7ec24", "._5c711a1cecefd5e8__layout{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:row;height:100%;isolation:isolate;width:100%}@media (min-width:600px){._5c711a1cecefd5e8__layout{bottom:0;inset-inline-end:0;inset-inline-start:0;min-height:calc(100vh - 46px);position:absolute;top:0}}@media (min-width:782px){._5c711a1cecefd5e8__layout{min-height:calc(100vh - 32px)}body:has(._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas) ._5c711a1cecefd5e8__layout{min-height:100vh}}:where(._5c711a1cecefd5e8__layout) img{height:auto;max-width:100%}._5c711a1cecefd5e8__layout .eeebb116829e2f94__notices-snackbar{bottom:var(--wpds-dimension-size-md,32px);box-sizing:border-box;display:flex;flex-direction:column;left:0;padding-inline:16px;pointer-events:none;position:fixed;right:0}._5c711a1cecefd5e8__layout .eeebb116829e2f94__notices-snackbar .cb865dcda5233b3b__components-snackbar,._5c711a1cecefd5e8__layout .eeebb116829e2f94__notices-snackbar .components-snackbar{margin-inline:auto}._04b3b4e8346a2b7b__sidebar-backdrop{background-color:rgba(0,0,0,.5);bottom:0;cursor:var(--wpds-cursor-control,pointer);inset-inline-end:0;inset-inline-start:0;position:fixed;top:0;z-index:100002}._615b052cf60fcff2__sidebar{flex-shrink:0;height:100%;overflow:hidden;position:relative;width:240px}._615b052cf60fcff2__sidebar._6be5d95ddf25e57f__is-mobile{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);bottom:0;box-shadow:2px 0 8px rgba(0,0,0,.2);inset-inline-start:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}.fd8d6491146392ce__mobile-sidebar-drawer{inset-inline-end:0;inset-inline-start:0;position:fixed;top:0}.f37b94fd2c1f6020__layout-single-page .fd8d6491146392ce__mobile-sidebar-drawer{top:46px}.fd8d6491146392ce__mobile-sidebar-drawer{align-items:center;background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-bottom:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);display:flex;justify-content:flex-start;padding:16px;z-index:3}._6da399dd0a232c1f__canvas._5568e036ddaba310__has-mobile-drawer{padding-top:65px;position:relative}.ff37ba01b23d0bcb__surfaces{display:flex;flex-grow:1;gap:8px;margin:0}@media (min-width:782px){.ff37ba01b23d0bcb__surfaces{margin:8px}.f37b94fd2c1f6020__layout-single-page .ff37ba01b23d0bcb__surfaces{margin-top:0;margin-inline-start:0}}.b37b199f2111c5f8__inspector,.e323e272b8b8ed4f__stage{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-radius:0;bottom:0;color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw}.f37b94fd2c1f6020__layout-single-page .b37b199f2111c5f8__inspector,.f37b94fd2c1f6020__layout-single-page .e323e272b8b8ed4f__stage{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.b37b199f2111c5f8__inspector,.e323e272b8b8ed4f__stage{border-radius:var(--wpds-border-radius-xl,12px);height:auto;margin:0;position:static;width:auto}.f37b94fd2c1f6020__layout-single-page .b37b199f2111c5f8__inspector,.f37b94fd2c1f6020__layout-single-page .e323e272b8b8ed4f__stage{height:auto}}.e323e272b8b8ed4f__stage{z-index:2}@media (min-width:782px){.e323e272b8b8ed4f__stage{z-index:auto}}.b37b199f2111c5f8__inspector{z-index:3}@media (min-width:782px){.b37b199f2111c5f8__inspector{z-index:auto}}._6da399dd0a232c1f__canvas{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:0;bottom:0;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;inset-inline-end:0;inset-inline-start:0;margin:0;overflow-y:auto;position:relative;position:fixed;top:0;width:100vw;z-index:1}.f37b94fd2c1f6020__layout-single-page ._6da399dd0a232c1f__canvas{height:calc(100vh - 46px);top:46px}@media (min-width:782px){._6da399dd0a232c1f__canvas{border-radius:var(--wpds-border-radius-xl,12px);height:auto;position:static;width:auto;z-index:auto}.f37b94fd2c1f6020__layout-single-page ._6da399dd0a232c1f__canvas{height:auto}._5c711a1cecefd5e8__layout.bbaf96f69377ab55__has-canvas .e323e272b8b8ed4f__stage,.b37b199f2111c5f8__inspector{max-width:400px}}._6da399dd0a232c1f__canvas .interface-interface-skeleton{height:100%;inset-inline-start:0!important;position:relative;top:0!important}._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas .ff37ba01b23d0bcb__surfaces{gap:0;margin:0}._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas .b37b199f2111c5f8__inspector,._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas .e323e272b8b8ed4f__stage{display:none}._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas ._6da399dd0a232c1f__canvas{border:none;border-radius:0;bottom:0;box-shadow:none;inset-inline-end:0;inset-inline-start:0;margin:0;max-width:none;overflow:hidden;position:fixed;top:var(--wp-admin--admin-bar--height,0)}.f37b94fd2c1f6020__layout-single-page ._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas ._6da399dd0a232c1f__canvas{top:46px}@media (min-width:782px){.f37b94fd2c1f6020__layout-single-page ._5c711a1cecefd5e8__layout._52e00bad88ace7ce__has-full-canvas ._6da399dd0a232c1f__canvas{top:32px}}@media (max-width:782px){._6da399dd0a232c1f__canvas:not(._5568e036ddaba310__has-mobile-drawer),.b37b199f2111c5f8__inspector,.e323e272b8b8ed4f__stage{height:calc(100vh - var(--wp-admin--admin-bar--height, 0px));top:var(--wp-admin--admin-bar--height,0)}.fd8d6491146392ce__mobile-sidebar-drawer{top:var(--wp-admin--admin-bar--height,0)}}@media not (prefers-reduced-motion:reduce){._6da399dd0a232c1f__canvas .interface-interface-skeleton__header{view-transition-name:boot--canvas-header}._6da399dd0a232c1f__canvas .interface-interface-skeleton__sidebar{view-transition-name:boot--canvas-sidebar}.e323e272b8b8ed4f__stage{view-transition-name:boot--stage}.b37b199f2111c5f8__inspector{view-transition-name:boot--inspector}._6da399dd0a232c1f__canvas{view-transition-name:boot--canvas}@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.e323e272b8b8ed4f__stage{view-transition-name:boot-safari--stage}.b37b199f2111c5f8__inspector{view-transition-name:boot-safari--inspector}._6da399dd0a232c1f__canvas{view-transition-name:boot-safari--canvas}}}@media (max-width:782px){:root:has(._5c711a1cecefd5e8__layout) *{view-transition-name:none!important}}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(root),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(root){animation-duration:.25s}@media not (prefers-reduced-motion:reduce){:root:has(._5c711a1cecefd5e8__layout) .components-popover:first-of-type{view-transition-name:boot--components-popover}}:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot--canvas-header),:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot--canvas-sidebar),:root:has(._5c711a1cecefd5e8__layout)::view-transition-group(boot-safari--canvas){z-index:1}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--stage),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--stage){width:auto}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--stage),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--inspector),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--stage){background:#fff;border-radius:var(--wpds-border-radius-xl,12px);height:100%;object-fit:none;object-position:left top;overflow:hidden;width:100%}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas),:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas){object-position:center top}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--stage):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--stage):only-child{animation-name:_2e385023a338e4a9__zoomOut;will-change:transform,opacity}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--stage):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--inspector):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--stage):only-child{animation-name:e245c2f64b6256de__zoomIn;will-change:transform,opacity}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot-safari--canvas):only-child{animation-name:_9aa5832f67721dd4__slideFromRight;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas):only-child,:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot-safari--canvas):only-child{animation-name:_4d20ae2879ce77c4__slideToRight;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas-header):only-child{animation-name:e56b4b1bb9ff1176__slideHeaderFromTop;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas-header):only-child{animation-name:e54b49876d2b7dc3__slideHeaderToTop;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-new(boot--canvas-sidebar):only-child{animation-name:f74156de1cf32837__slideSidebarFromRight;will-change:transform}:root:has(._5c711a1cecefd5e8__layout)::view-transition-old(boot--canvas-sidebar):only-child{animation-name:_157f548b8629f8b5__slideSidebarToRight;will-change:transform}@keyframes _2e385023a338e4a9__zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}@keyframes e245c2f64b6256de__zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes _9aa5832f67721dd4__slideFromRight{0%{transform:translateX(100vw)}to{transform:translateX(0)}}@keyframes _4d20ae2879ce77c4__slideToRight{0%{transform:translateX(0)}to{transform:translateX(100vw)}}@keyframes e56b4b1bb9ff1176__slideHeaderFromTop{0%{transform:translateY(-100%)}}@keyframes e54b49876d2b7dc3__slideHeaderToTop{to{transform:translateY(-100%)}}@keyframes f74156de1cf32837__slideSidebarFromRight{0%{transform:translateX(100%)}}@keyframes _157f548b8629f8b5__slideSidebarToRight{to{transform:translateX(100%)}}");
126
+ var style_module_default = {
127
+ "layout": "_5c711a1cecefd5e8__layout",
128
+ "has-full-canvas": "_52e00bad88ace7ce__has-full-canvas",
129
+ "notices-snackbar": "eeebb116829e2f94__notices-snackbar",
130
+ "components-snackbar": "cb865dcda5233b3b__components-snackbar",
131
+ "sidebar-backdrop": "_04b3b4e8346a2b7b__sidebar-backdrop",
132
+ "sidebar": "_615b052cf60fcff2__sidebar",
133
+ "is-mobile": "_6be5d95ddf25e57f__is-mobile",
134
+ "mobile-sidebar-drawer": "fd8d6491146392ce__mobile-sidebar-drawer",
135
+ "layout-single-page": "f37b94fd2c1f6020__layout-single-page",
136
+ "canvas": "_6da399dd0a232c1f__canvas",
137
+ "has-mobile-drawer": "_5568e036ddaba310__has-mobile-drawer",
138
+ "surfaces": "ff37ba01b23d0bcb__surfaces",
139
+ "stage": "e323e272b8b8ed4f__stage",
140
+ "inspector": "b37b199f2111c5f8__inspector",
141
+ "has-canvas": "bbaf96f69377ab55__has-canvas",
142
+ "zoomOut": "_2e385023a338e4a9__zoomOut",
143
+ "zoomIn": "e245c2f64b6256de__zoomIn",
144
+ "slideFromRight": "_9aa5832f67721dd4__slideFromRight",
145
+ "slideToRight": "_4d20ae2879ce77c4__slideToRight",
146
+ "slideHeaderFromTop": "e56b4b1bb9ff1176__slideHeaderFromTop",
147
+ "slideHeaderToTop": "e54b49876d2b7dc3__slideHeaderToTop",
148
+ "slideSidebarFromRight": "f74156de1cf32837__slideSidebarFromRight",
149
+ "slideSidebarToRight": "_157f548b8629f8b5__slideSidebarToRight"
150
+ };
116
151
  // packages/boot/src/components/root/index.tsx
117
- import { jsx, jsxs } from "react/jsx-runtime";
118
- var { useLocation, useMatches, Outlet } = unlock(routePrivateApis);
152
+ const { useLocation, useMatches, Outlet } = unlock(privateApis);
119
153
  function Root() {
120
- const matches = useMatches();
121
- const location = useLocation();
122
- const currentMatch = matches[matches.length - 1];
123
- const canvas = currentMatch?.loaderData?.canvas;
124
- const routeContentModule = currentMatch?.loaderData?.routeContentModule;
125
- const isFullScreen = canvas && !canvas.isPreview;
126
- useRouteTitle();
127
- const isMobileViewport = useViewportMatch("medium", "<");
128
- const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false);
129
- const disableMotion = useReducedMotion();
130
- useEffect(() => {
131
- setIsMobileSidebarOpen(false);
132
- }, [location.pathname, isMobileViewport]);
133
- const themeColors = useMemo(getAdminThemeColors, []);
134
- const layoutRef = useSyncBodyBackground();
135
- return /* @__PURE__ */ jsx(SlotFillProvider, { children: /* @__PURE__ */ jsxs(Tooltip.Provider, { children: [
136
- /* @__PURE__ */ jsx(PluginArea, {}),
137
- /* @__PURE__ */ jsx(
138
- ThemeProvider,
139
- {
140
- isRoot: true,
141
- color: { ...themeColors, background: "#f8f8f8" },
142
- children: /* @__PURE__ */ jsx(ThemeProvider, { color: themeColors, children: /* @__PURE__ */ jsxs(
143
- "div",
144
- {
145
- ref: layoutRef,
146
- className: clsx(style_module_default.layout, {
147
- [style_module_default["has-canvas"]]: !!canvas || canvas === null,
148
- [style_module_default["has-full-canvas"]]: isFullScreen
149
- }),
150
- children: [
151
- /* @__PURE__ */ jsx(UnsavedChangesWarning, {}),
152
- /* @__PURE__ */ jsx(SavePanel, {}),
153
- /* @__PURE__ */ jsx(
154
- SnackbarNotices,
155
- {
156
- className: style_module_default["notices-snackbar"]
157
- }
158
- ),
159
- isMobileViewport && /* @__PURE__ */ jsx(Page.SidebarToggleFill, { children: /* @__PURE__ */ jsx(
160
- Button,
161
- {
162
- icon: menu,
163
- onClick: () => setIsMobileSidebarOpen(true),
164
- label: __("Open navigation panel"),
165
- size: "compact"
166
- }
167
- ) }),
168
- /* @__PURE__ */ jsx(AnimatePresence, { children: isMobileViewport && isMobileSidebarOpen && !isFullScreen && /* @__PURE__ */ jsx(
169
- motion.div,
170
- {
171
- initial: { opacity: 0 },
172
- animate: { opacity: 1 },
173
- exit: { opacity: 0 },
174
- transition: {
175
- type: "tween",
176
- duration: disableMotion ? 0 : 0.2,
177
- ease: "easeOut"
178
- },
179
- className: style_module_default["sidebar-backdrop"],
180
- onClick: () => setIsMobileSidebarOpen(false),
181
- onKeyDown: (event) => {
182
- if (event.key === "Escape") {
183
- setIsMobileSidebarOpen(
184
- false
185
- );
186
- }
187
- },
188
- role: "button",
189
- tabIndex: -1,
190
- "aria-label": __(
191
- "Close navigation panel"
192
- )
193
- }
194
- ) }),
195
- /* @__PURE__ */ jsx(AnimatePresence, { children: isMobileViewport && isMobileSidebarOpen && !isFullScreen && /* @__PURE__ */ jsx(
196
- motion.div,
197
- {
198
- initial: { x: "-100%" },
199
- animate: { x: 0 },
200
- exit: { x: "-100%" },
201
- transition: {
202
- type: "tween",
203
- duration: disableMotion ? 0 : 0.2,
204
- ease: "easeOut"
205
- },
206
- className: clsx(
207
- style_module_default.sidebar,
208
- style_module_default["is-mobile"]
209
- ),
210
- children: /* @__PURE__ */ jsx(Sidebar, {})
211
- }
212
- ) }),
213
- !isMobileViewport && !isFullScreen && /* @__PURE__ */ jsx("div", { className: style_module_default.sidebar, children: /* @__PURE__ */ jsx(Sidebar, {}) }),
214
- /* @__PURE__ */ jsx("div", { className: style_module_default.surfaces, children: /* @__PURE__ */ jsxs(
215
- ThemeProvider,
216
- {
217
- color: {
218
- ...themeColors,
219
- // Reset to the default background color.
220
- background: "#fcfcfc"
221
- },
222
- children: [
223
- /* @__PURE__ */ jsx(Outlet, {}),
224
- (canvas || canvas === null) && /* @__PURE__ */ jsxs(
225
- "div",
226
- {
227
- className: clsx(style_module_default.canvas, {
228
- [style_module_default["has-mobile-drawer"]]: canvas?.isPreview && isMobileViewport
229
- }),
230
- children: [
231
- canvas?.isPreview && isMobileViewport && /* @__PURE__ */ jsx(
232
- "div",
233
- {
234
- className: style_module_default["mobile-sidebar-drawer"],
235
- children: /* @__PURE__ */ jsx(
236
- Button,
237
- {
238
- icon: menu,
239
- onClick: () => setIsMobileSidebarOpen(
240
- true
241
- ),
242
- label: __(
243
- "Open navigation panel"
244
- ),
245
- size: "compact"
246
- }
247
- )
248
- }
249
- ),
250
- /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(
251
- CanvasRenderer,
252
- {
253
- canvas,
254
- routeContentModule
255
- }
256
- ) })
257
- ]
258
- }
259
- )
260
- ]
261
- }
262
- ) })
263
- ]
264
- }
265
- ) })
266
- }
267
- )
268
- ] }) });
154
+ const matches = useMatches();
155
+ const location = useLocation();
156
+ const currentMatch = matches[matches.length - 1];
157
+ const canvas = (currentMatch?.loaderData)?.canvas;
158
+ const routeContentModule = (currentMatch?.loaderData)?.routeContentModule;
159
+ const isFullScreen = canvas && !canvas.isPreview;
160
+ useRouteTitle();
161
+ const isMobileViewport = useViewportMatch("medium", "<");
162
+ const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false);
163
+ const disableMotion = useReducedMotion();
164
+ useEffect(() => {
165
+ setIsMobileSidebarOpen(false);
166
+ }, [location.pathname, isMobileViewport]);
167
+ const themeColors = useMemo(getAdminThemeColors, []);
168
+ const layoutRef = useSyncBodyBackground();
169
+ return /* @__PURE__ */ jsx(SlotFillProvider, { children: /* @__PURE__ */ jsxs(Tooltip.Provider, { children: [/* @__PURE__ */ jsx(PluginArea, {}), /* @__PURE__ */ jsx(ThemeProvider, {
170
+ isRoot: true,
171
+ color: {
172
+ ...themeColors,
173
+ background: "#f8f8f8"
174
+ },
175
+ children: /* @__PURE__ */ jsx(ThemeProvider, {
176
+ color: themeColors,
177
+ children: /* @__PURE__ */ jsxs("div", {
178
+ ref: layoutRef,
179
+ className: clsx(style_module_default.layout, {
180
+ [style_module_default["has-canvas"]]: !!canvas || canvas === null,
181
+ [style_module_default["has-full-canvas"]]: isFullScreen
182
+ }),
183
+ children: [
184
+ /* @__PURE__ */ jsx(UnsavedChangesWarning, {}),
185
+ /* @__PURE__ */ jsx(SavePanel, {}),
186
+ /* @__PURE__ */ jsx(SnackbarNotices, { className: style_module_default["notices-snackbar"] }),
187
+ isMobileViewport && /* @__PURE__ */ jsx(Page.SidebarToggleFill, { children: /* @__PURE__ */ jsx(Button, {
188
+ icon: menu,
189
+ onClick: () => setIsMobileSidebarOpen(true),
190
+ label: __("Open navigation panel"),
191
+ size: "compact"
192
+ }) }),
193
+ /* @__PURE__ */ jsx(__unstableAnimatePresence, { children: isMobileViewport && isMobileSidebarOpen && !isFullScreen && /* @__PURE__ */ jsx(__unstableMotion.div, {
194
+ initial: { opacity: 0 },
195
+ animate: { opacity: 1 },
196
+ exit: { opacity: 0 },
197
+ transition: {
198
+ type: "tween",
199
+ duration: disableMotion ? 0 : .2,
200
+ ease: "easeOut"
201
+ },
202
+ className: style_module_default["sidebar-backdrop"],
203
+ onClick: () => setIsMobileSidebarOpen(false),
204
+ onKeyDown: (event) => {
205
+ if (event.key === "Escape") setIsMobileSidebarOpen(false);
206
+ },
207
+ role: "button",
208
+ tabIndex: -1,
209
+ "aria-label": __("Close navigation panel")
210
+ }) }),
211
+ /* @__PURE__ */ jsx(__unstableAnimatePresence, { children: isMobileViewport && isMobileSidebarOpen && !isFullScreen && /* @__PURE__ */ jsx(__unstableMotion.div, {
212
+ initial: { x: "-100%" },
213
+ animate: { x: 0 },
214
+ exit: { x: "-100%" },
215
+ transition: {
216
+ type: "tween",
217
+ duration: disableMotion ? 0 : .2,
218
+ ease: "easeOut"
219
+ },
220
+ className: clsx(style_module_default.sidebar, style_module_default["is-mobile"]),
221
+ children: /* @__PURE__ */ jsx(Sidebar, {})
222
+ }) }),
223
+ !isMobileViewport && !isFullScreen && /* @__PURE__ */ jsx("div", {
224
+ className: style_module_default.sidebar,
225
+ children: /* @__PURE__ */ jsx(Sidebar, {})
226
+ }),
227
+ /* @__PURE__ */ jsx("div", {
228
+ className: style_module_default.surfaces,
229
+ children: /* @__PURE__ */ jsxs(ThemeProvider, {
230
+ color: {
231
+ ...themeColors,
232
+ background: "#fcfcfc"
233
+ },
234
+ children: [/* @__PURE__ */ jsx(Outlet, {}), (canvas || canvas === null) && /* @__PURE__ */ jsxs("div", {
235
+ className: clsx(style_module_default.canvas, { [style_module_default["has-mobile-drawer"]]: canvas?.isPreview && isMobileViewport }),
236
+ children: [canvas?.isPreview && isMobileViewport && /* @__PURE__ */ jsx("div", {
237
+ className: style_module_default["mobile-sidebar-drawer"],
238
+ children: /* @__PURE__ */ jsx(Button, {
239
+ icon: menu,
240
+ onClick: () => setIsMobileSidebarOpen(true),
241
+ label: __("Open navigation panel"),
242
+ size: "compact"
243
+ })
244
+ }), /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(CanvasRenderer, {
245
+ canvas,
246
+ routeContentModule
247
+ }) })]
248
+ })]
249
+ })
250
+ })
251
+ ]
252
+ })
253
+ })
254
+ })] }) });
269
255
  }
270
- export {
271
- Root as default
272
- };
273
- //# sourceMappingURL=index.mjs.map
256
+ export { Root as default };
257
+
258
+ //# sourceMappingURL=index.mjs.map