@wordpress/boot 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +4 -0
- package/build-module/components/app/index.mjs.map +2 -2
- package/build-module/components/app/router.mjs +100 -4
- package/build-module/components/app/router.mjs.map +3 -3
- package/build-module/components/app/use-route-title.mjs.map +2 -2
- package/build-module/components/canvas/back-button.mjs.map +2 -2
- package/build-module/components/canvas/index.mjs +72 -13
- package/build-module/components/canvas/index.mjs.map +2 -2
- package/build-module/components/canvas/site-preview.mjs +50 -0
- package/build-module/components/canvas/site-preview.mjs.map +7 -0
- package/build-module/components/canvas/use-navigate-to-entity-record.mjs +122 -0
- package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +7 -0
- package/build-module/components/canvas/viewport.mjs +18 -0
- package/build-module/components/canvas/viewport.mjs.map +7 -0
- package/build-module/components/canvas-renderer/index.mjs.map +2 -2
- package/build-module/components/error-boundary/index.mjs +129 -0
- package/build-module/components/error-boundary/index.mjs.map +7 -0
- package/build-module/components/navigation/drilldown-item/index.mjs +91 -1
- package/build-module/components/navigation/drilldown-item/index.mjs.map +3 -3
- package/build-module/components/navigation/dropdown-item/index.mjs +99 -12
- package/build-module/components/navigation/dropdown-item/index.mjs.map +4 -4
- package/build-module/components/navigation/index.mjs +1 -2
- package/build-module/components/navigation/index.mjs.map +2 -2
- package/build-module/components/navigation/items.mjs.map +2 -2
- package/build-module/components/navigation/navigation-item/index.mjs +88 -15
- package/build-module/components/navigation/navigation-item/index.mjs.map +3 -3
- package/build-module/components/navigation/navigation-screen/index.mjs +111 -38
- package/build-module/components/navigation/navigation-screen/index.mjs.map +3 -3
- package/build-module/components/navigation/path-matching.mjs.map +2 -2
- package/build-module/components/navigation/router-link-item.mjs.map +2 -2
- package/build-module/components/navigation/use-sidebar-parent.mjs +1 -1
- package/build-module/components/navigation/use-sidebar-parent.mjs.map +2 -2
- package/build-module/components/plugin-area/index.mjs +29 -0
- package/build-module/components/plugin-area/index.mjs.map +7 -0
- package/build-module/components/root/index.mjs +220 -122
- package/build-module/components/root/index.mjs.map +3 -3
- package/build-module/components/root/single-page.mjs +139 -47
- package/build-module/components/root/single-page.mjs.map +3 -3
- package/build-module/components/root/use-sync-body-background.mjs.map +2 -2
- package/build-module/components/save-button/index.mjs +127 -16
- package/build-module/components/save-button/index.mjs.map +3 -3
- package/build-module/components/save-panel/index.mjs +91 -1
- package/build-module/components/save-panel/index.mjs.map +3 -3
- package/build-module/components/save-panel/use-save-shortcut.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +90 -10
- package/build-module/components/sidebar/index.mjs.map +3 -3
- package/build-module/index.mjs +0 -16
- package/build-module/index.mjs.map +3 -3
- package/build-module/lock-unlock.mjs.map +2 -2
- package/build-module/store/actions.mjs +8 -0
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/index.mjs.map +2 -2
- package/build-module/store/reducer.mjs +16 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +9 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-types/components/app/index.d.ts.map +1 -1
- package/build-types/components/app/router.d.ts +0 -3
- package/build-types/components/app/router.d.ts.map +1 -1
- package/build-types/components/app/use-route-title.d.ts.map +1 -1
- package/build-types/components/canvas/back-button.d.ts.map +1 -1
- package/build-types/components/canvas/index.d.ts +0 -3
- package/build-types/components/canvas/index.d.ts.map +1 -1
- package/build-types/components/canvas/site-preview.d.ts +10 -0
- package/build-types/components/canvas/site-preview.d.ts.map +1 -0
- package/build-types/components/canvas/use-navigate-to-entity-record.d.ts +40 -0
- package/build-types/components/canvas/use-navigate-to-entity-record.d.ts.map +1 -0
- package/build-types/components/canvas/viewport.d.ts +15 -0
- package/build-types/components/canvas/viewport.d.ts.map +1 -0
- package/build-types/components/canvas-renderer/index.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts +22 -0
- package/build-types/components/error-boundary/index.d.ts.map +1 -0
- package/build-types/components/navigation/drilldown-item/index.d.ts.map +1 -1
- package/build-types/components/navigation/dropdown-item/index.d.ts +0 -1
- package/build-types/components/navigation/dropdown-item/index.d.ts.map +1 -1
- package/build-types/components/navigation/index.d.ts.map +1 -1
- package/build-types/components/navigation/items.d.ts +0 -3
- package/build-types/components/navigation/items.d.ts.map +1 -1
- package/build-types/components/navigation/navigation-item/index.d.ts +0 -1
- package/build-types/components/navigation/navigation-item/index.d.ts.map +1 -1
- package/build-types/components/navigation/navigation-screen/index.d.ts +0 -7
- package/build-types/components/navigation/navigation-screen/index.d.ts.map +1 -1
- package/build-types/components/navigation/path-matching.d.ts +0 -3
- package/build-types/components/navigation/path-matching.d.ts.map +1 -1
- package/build-types/components/navigation/router-link-item.d.ts.map +1 -1
- package/build-types/components/navigation/use-sidebar-parent.d.ts.map +1 -1
- package/build-types/components/plugin-area/index.d.ts +12 -0
- package/build-types/components/plugin-area/index.d.ts.map +1 -0
- package/build-types/components/root/index.d.ts +0 -1
- package/build-types/components/root/index.d.ts.map +1 -1
- package/build-types/components/root/single-page.d.ts +0 -1
- package/build-types/components/root/single-page.d.ts.map +1 -1
- package/build-types/components/root/use-sync-body-background.d.ts +1 -1
- package/build-types/components/root/use-sync-body-background.d.ts.map +1 -1
- package/build-types/components/save-button/index.d.ts +0 -4
- package/build-types/components/save-button/index.d.ts.map +1 -1
- package/build-types/components/save-panel/index.d.ts.map +1 -1
- package/build-types/components/save-panel/use-save-shortcut.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts +0 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/index.d.ts +0 -5
- package/build-types/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +15 -5
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/index.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +0 -3
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +12 -3
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/store/types.d.ts +34 -6
- package/build-types/store/types.d.ts.map +1 -1
- package/package.json +28 -25
- package/src/components/app/index.tsx +0 -7
- package/src/components/app/router.tsx +19 -18
- package/src/components/app/use-route-title.ts +0 -7
- package/src/components/canvas/back-button.tsx +0 -3
- package/src/components/canvas/index.tsx +117 -22
- package/src/components/canvas/site-preview.tsx +64 -0
- package/src/components/canvas/use-navigate-to-entity-record.ts +220 -0
- package/src/components/canvas/viewport.ts +34 -0
- package/src/components/canvas-renderer/index.tsx +0 -7
- package/src/components/error-boundary/index.tsx +71 -0
- package/src/components/error-boundary/style.module.scss +13 -0
- package/src/components/navigation/drilldown-item/index.tsx +2 -13
- package/src/components/navigation/dropdown-item/index.tsx +11 -19
- package/src/components/navigation/dropdown-item/{style.scss → style.module.scss} +6 -2
- package/src/components/navigation/index.tsx +1 -9
- package/src/components/navigation/items.tsx +0 -7
- package/src/components/navigation/navigation-item/index.tsx +3 -18
- package/src/components/navigation/navigation-item/{style.scss → style.module.scss} +7 -14
- package/src/components/navigation/navigation-screen/index.tsx +6 -26
- package/src/components/navigation/navigation-screen/{style.scss → style.module.scss} +10 -9
- package/src/components/navigation/path-matching.ts +0 -3
- package/src/components/navigation/router-link-item.tsx +0 -11
- package/src/components/navigation/use-sidebar-parent.ts +1 -13
- package/src/components/plugin-area/index.tsx +34 -0
- package/src/components/root/{style.scss → _layout.module.scss} +71 -40
- package/src/components/root/_view-transitions.module.scss +205 -0
- package/src/components/root/index.tsx +44 -35
- package/src/components/root/single-page.tsx +15 -18
- package/src/components/root/style.module.scss +2 -0
- package/src/components/root/use-sync-body-background.ts +1 -4
- package/src/components/save-button/index.tsx +36 -21
- package/src/components/save-button/style.module.scss +10 -0
- package/src/components/save-panel/index.tsx +2 -8
- package/src/components/save-panel/style.module.scss +7 -0
- package/src/components/save-panel/use-save-shortcut.ts +0 -3
- package/src/components/sidebar/index.tsx +5 -12
- package/src/components/sidebar/style.module.scss +29 -0
- package/src/index.tsx +0 -5
- package/src/lock-unlock.ts +0 -3
- package/src/store/actions.ts +18 -4
- package/src/store/index.ts +0 -7
- package/src/store/reducer.ts +19 -3
- package/src/store/selectors.ts +28 -3
- package/src/store/types.ts +37 -6
- package/build-style/style-rtl.css +0 -132
- package/build-style/style.css +0 -132
- package/build-style/view-transitions-rtl.css +0 -189
- package/build-style/view-transitions.css +0 -189
- package/build-types/components/site-hub/index.d.ts +0 -4
- package/build-types/components/site-hub/index.d.ts.map +0 -1
- package/build-types/components/site-icon/index.d.ts +0 -9
- package/build-types/components/site-icon/index.d.ts.map +0 -1
- package/build-types/components/site-icon-link/index.d.ts +0 -8
- package/build-types/components/site-icon-link/index.d.ts.map +0 -1
- package/build-types/components/user-theme-provider/index.d.ts +0 -6
- package/build-types/components/user-theme-provider/index.d.ts.map +0 -1
- package/src/components/save-button/style.scss +0 -9
- package/src/components/sidebar/style.scss +0 -23
- package/src/style.scss +0 -33
- package/src/view-transitions.scss +0 -221
|
@@ -10,13 +10,93 @@ import { isRTL, __ } from "@wordpress/i18n";
|
|
|
10
10
|
import { chevronRight, chevronLeft } from "@wordpress/icons";
|
|
11
11
|
import { useReducedMotion } from "@wordpress/compose";
|
|
12
12
|
|
|
13
|
-
// packages/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
// packages/style-runtime/src/index.ts
|
|
14
|
+
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
15
|
+
function getRuntime() {
|
|
16
|
+
const globalScope = globalThis;
|
|
17
|
+
if (globalScope.__wpStyleRuntime) {
|
|
18
|
+
return globalScope.__wpStyleRuntime;
|
|
19
|
+
}
|
|
20
|
+
globalScope.__wpStyleRuntime = {
|
|
21
|
+
documents: /* @__PURE__ */ new Map(),
|
|
22
|
+
styles: /* @__PURE__ */ new Map(),
|
|
23
|
+
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
24
|
+
};
|
|
25
|
+
if (typeof document !== "undefined") {
|
|
26
|
+
registerDocument(document);
|
|
27
|
+
}
|
|
28
|
+
return globalScope.__wpStyleRuntime;
|
|
29
|
+
}
|
|
30
|
+
function documentContainsStyleHash(targetDocument, hash) {
|
|
31
|
+
if (!targetDocument.head) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
for (const style of targetDocument.head.querySelectorAll(
|
|
35
|
+
`style[${STYLE_HASH_ATTRIBUTE}]`
|
|
36
|
+
)) {
|
|
37
|
+
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
function injectStyle(targetDocument, hash, css) {
|
|
44
|
+
if (!targetDocument.head) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const runtime = getRuntime();
|
|
48
|
+
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
49
|
+
if (!injectedStyles) {
|
|
50
|
+
injectedStyles = /* @__PURE__ */ new Set();
|
|
51
|
+
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
52
|
+
}
|
|
53
|
+
if (injectedStyles.has(hash)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (documentContainsStyleHash(targetDocument, hash)) {
|
|
57
|
+
injectedStyles.add(hash);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const style = targetDocument.createElement("style");
|
|
61
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
|
|
62
|
+
style.appendChild(targetDocument.createTextNode(css));
|
|
63
|
+
targetDocument.head.appendChild(style);
|
|
64
|
+
injectedStyles.add(hash);
|
|
65
|
+
}
|
|
66
|
+
function registerDocument(targetDocument) {
|
|
67
|
+
const runtime = getRuntime();
|
|
68
|
+
runtime.documents.set(
|
|
69
|
+
targetDocument,
|
|
70
|
+
(runtime.documents.get(targetDocument) ?? 0) + 1
|
|
71
|
+
);
|
|
72
|
+
for (const [hash, css] of runtime.styles) {
|
|
73
|
+
injectStyle(targetDocument, hash, css);
|
|
74
|
+
}
|
|
75
|
+
return () => {
|
|
76
|
+
const count = runtime.documents.get(targetDocument);
|
|
77
|
+
if (count === void 0) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (count <= 1) {
|
|
81
|
+
runtime.documents.delete(targetDocument);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
runtime.documents.set(targetDocument, count - 1);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function registerStyle(hash, css) {
|
|
88
|
+
const runtime = getRuntime();
|
|
89
|
+
runtime.styles.set(hash, css);
|
|
90
|
+
for (const targetDocument of runtime.documents.keys()) {
|
|
91
|
+
injectStyle(targetDocument, hash, css);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// packages/boot/src/components/navigation/navigation-screen/style.module.scss
|
|
96
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
97
|
+
registerStyle("9bfc8fef50", ".c93eb5f7b870f29c__screen{padding-block-end:4px}.c93eb5f7b870f29c__screen .components-text{color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}.bee113ef4a391bcd__title-icon{padding-block-end:8px;padding-block-start:12px;padding-inline-end:16px;padding-inline-start:16px;position:sticky;top:0}._2f6050d2407c9dee__title{flex-grow:1;overflow-wrap:break-word}._2f6050d2407c9dee__title._2f6050d2407c9dee__title,._2f6050d2407c9dee__title._2f6050d2407c9dee__title ._2f6050d2407c9dee__title{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);line-height:32px}.e78f7a9cf7e91164__actions{display:flex;flex-shrink:0}");
|
|
19
98
|
}
|
|
99
|
+
var style_module_default = { "screen": "c93eb5f7b870f29c__screen", "title-icon": "bee113ef4a391bcd__title-icon", "title": "_2f6050d2407c9dee__title", "actions": "e78f7a9cf7e91164__actions" };
|
|
20
100
|
|
|
21
101
|
// packages/boot/src/components/navigation/navigation-screen/index.tsx
|
|
22
102
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -56,7 +136,7 @@ function NavigationScreen({
|
|
|
56
136
|
return /* @__PURE__ */ jsx(
|
|
57
137
|
"div",
|
|
58
138
|
{
|
|
59
|
-
className:
|
|
139
|
+
className: style_module_default.screen,
|
|
60
140
|
style: {
|
|
61
141
|
overflow: "hidden",
|
|
62
142
|
position: "relative",
|
|
@@ -83,37 +163,30 @@ function NavigationScreen({
|
|
|
83
163
|
gridRow: "1"
|
|
84
164
|
},
|
|
85
165
|
children: [
|
|
86
|
-
/* @__PURE__ */ jsxs(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
actions && /* @__PURE__ */ jsx("div", { className: "boot-navigation-screen__actions", children: actions })
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
),
|
|
116
|
-
description && /* @__PURE__ */ jsx("div", { className: "boot-navigation-screen__description", children: description }),
|
|
166
|
+
/* @__PURE__ */ jsxs(HStack, { spacing: 2, className: style_module_default["title-icon"], children: [
|
|
167
|
+
!isRoot && /* @__PURE__ */ jsx(
|
|
168
|
+
Button,
|
|
169
|
+
{
|
|
170
|
+
ref: backButtonRef,
|
|
171
|
+
icon,
|
|
172
|
+
onClick: handleBackClick,
|
|
173
|
+
label: __("Back"),
|
|
174
|
+
size: "small",
|
|
175
|
+
variant: "tertiary"
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
Heading,
|
|
180
|
+
{
|
|
181
|
+
className: style_module_default.title,
|
|
182
|
+
level: 1,
|
|
183
|
+
size: "15px",
|
|
184
|
+
children: title
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
actions && /* @__PURE__ */ jsx("div", { className: style_module_default.actions, children: actions })
|
|
188
|
+
] }),
|
|
189
|
+
description && /* @__PURE__ */ jsx("div", { children: description }),
|
|
117
190
|
content
|
|
118
191
|
]
|
|
119
192
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/components/navigation/navigation-screen/index.tsx", "../../../../src/components/navigation/navigation-screen/style.scss"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
3
|
+
"sources": ["../../../../src/components/navigation/navigation-screen/index.tsx", "../../../../../style-runtime/src/index.ts", "../../../../src/components/navigation/navigation-screen/style.module.scss"],
|
|
4
|
+
"sourcesContent": ["import type { ReactNode, RefObject } from 'react';\nimport {\n\t__experimentalHeading as Heading,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\tButton,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useReducedMotion } from '@wordpress/compose';\nimport styles from './style.module.scss';\n\nconst ANIMATION_DURATION = 0.3;\nconst slideVariants = {\n\tinitial: ( direction: 'forward' | 'backward' ) => ( {\n\t\tx: direction === 'forward' ? 100 : -100,\n\t\topacity: 0,\n\t} ),\n\tanimate: {\n\t\tx: 0,\n\t\topacity: 1,\n\t},\n\texit: ( direction: 'forward' | 'backward' ) => ( {\n\t\tx: direction === 'forward' ? 100 : -100,\n\t\topacity: 0,\n\t} ),\n};\n\nexport default function NavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\n\tdescription,\n\tanimationDirection,\n\tbackMenuItem,\n\tbackButtonRef,\n\tnavigationKey,\n\tonNavigate,\n}: {\n\tisRoot?: boolean;\n\ttitle: string;\n\tactions?: ReactNode;\n\tcontent: ReactNode;\n\tdescription?: ReactNode;\n\tbackMenuItem?: string;\n\tbackButtonRef?: RefObject< HTMLButtonElement | null >;\n\tanimationDirection?: 'forward' | 'backward';\n\tnavigationKey?: string;\n\tonNavigate: ( {\n\t\tid,\n\t\tdirection,\n\t}: {\n\t\tid?: string;\n\t\tdirection: 'forward' | 'backward';\n\t} ) => void;\n} ) {\n\tconst icon = isRTL() ? chevronRight : chevronLeft;\n\tconst disableMotion = useReducedMotion();\n\n\tconst handleBackClick = ( e: React.MouseEvent ) => {\n\t\te.preventDefault();\n\t\tonNavigate( { id: backMenuItem, direction: 'backward' } );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ styles.screen }\n\t\t\tstyle={ {\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tposition: 'relative',\n\t\t\t\tdisplay: 'grid',\n\t\t\t\tgridTemplateColumns: '1fr',\n\t\t\t\tgridTemplateRows: '1fr',\n\t\t\t} }\n\t\t>\n\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ navigationKey }\n\t\t\t\t\tcustom={ animationDirection }\n\t\t\t\t\tvariants={ slideVariants }\n\t\t\t\t\tinitial=\"initial\"\n\t\t\t\t\tanimate=\"animate\"\n\t\t\t\t\texit=\"exit\"\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\t\t\t\t\tease: [ 0.33, 0, 0, 1 ],\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tgridColumn: '1',\n\t\t\t\t\t\tgridRow: '1',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack spacing={ 2 } className={ styles[ 'title-icon' ] }>\n\t\t\t\t\t\t{ ! isRoot && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tref={ backButtonRef }\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\tonClick={ handleBackClick }\n\t\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\tclassName={ styles.title }\n\t\t\t\t\t\t\tlevel={ 1 }\n\t\t\t\t\t\t\tsize=\"15px\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t{ actions && (\n\t\t\t\t\t\t\t<div className={ styles.actions }>{ actions }</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</HStack>\n\n\t\t\t\t\t{ description && <div>{ description }</div> }\n\n\t\t\t\t\t{ content }\n\t\t\t\t</motion.div>\n\t\t\t</AnimatePresence>\n\t\t</div>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"9bfc8fef50\", \".c93eb5f7b870f29c__screen{padding-block-end:4px}.c93eb5f7b870f29c__screen .components-text{color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}.bee113ef4a391bcd__title-icon{padding-block-end:8px;padding-block-start:12px;padding-inline-end:16px;padding-inline-start:16px;position:sticky;top:0}._2f6050d2407c9dee__title{flex-grow:1;overflow-wrap:break-word}._2f6050d2407c9dee__title._2f6050d2407c9dee__title,._2f6050d2407c9dee__title._2f6050d2407c9dee__title ._2f6050d2407c9dee__title{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);line-height:32px}.e78f7a9cf7e91164__actions{display:flex;flex-shrink:0}\");\n}\nexport default {\"screen\":\"c93eb5f7b870f29c__screen\",\"title-icon\":\"bee113ef4a391bcd__title-icon\",\"title\":\"_2f6050d2407c9dee__title\",\"actions\":\"e78f7a9cf7e91164__actions\"};\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA,EACC,yBAAyB;AAAA,EACzB,oBAAoB;AAAA,EACpB,6BAA6B;AAAA,EAC7B;AAAA,EACA,wBAAwB;AAAA,OAClB;AACP,SAAS,OAAO,UAAU;AAC1B,SAAS,cAAc,mBAAmB;AAC1C,SAAS,wBAAwB;;;ACAjC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;AAC3E,MAAK,CAAE,eAAe,MAAO;AAC5B;AAAA,EACD;AAEA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,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ACZ,SAAS;AAAA,UACV;AAAA,UAEA;AAAA,iCAAC,UAAO,SAAU,GAAI,WAAY,qBAAQ,YAAa,GACpD;AAAA,eAAE,UACH;AAAA,gBAAC;AAAA;AAAA,kBACA,KAAM;AAAA,kBACN;AAAA,kBACA,SAAU;AAAA,kBACV,OAAQ,GAAI,MAAO;AAAA,kBACnB,MAAK;AAAA,kBACL,SAAQ;AAAA;AAAA,cACT;AAAA,cAED;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAY,qBAAO;AAAA,kBACnB,OAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH;AAAA;AAAA,cACH;AAAA,cACE,WACD,oBAAC,SAAI,WAAY,qBAAO,SAAY,mBAAS;AAAA,eAE/C;AAAA,YAEE,eAAe,oBAAC,SAAM,uBAAa;AAAA,YAEnC;AAAA;AAAA;AAAA,QA1CI;AAAA,MA2CP,GACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/navigation/path-matching.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import type { MenuItem } from '../../store/types';\n\n/**\n * Checks if a menu path is a valid parent path of the current path.\n * A valid parent path must be a complete path prefix, not just share segments.\n *\n * @param currentPath - Current page path\n * @param menuPath - Menu item path to check as potential parent\n * @return True if menuPath is a parent of currentPath\n */\nconst isValidParentPath = (\n\tcurrentPath: string,\n\tmenuPath: string\n): boolean => {\n\tif ( ! menuPath || menuPath === currentPath ) {\n\t\treturn false;\n\t}\n\n\t// Normalize paths by removing trailing slashes and ensuring leading slash\n\tconst normalizePath = ( path: string ) => {\n\t\tconst normalized = path.startsWith( '/' ) ? path : '/' + path;\n\t\treturn normalized.endsWith( '/' ) && normalized.length > 1\n\t\t\t? normalized.slice( 0, -1 )\n\t\t\t: normalized;\n\t};\n\n\tconst normalizedCurrent = normalizePath( currentPath );\n\tconst normalizedMenu = normalizePath( menuPath );\n\n\t// Menu path must be shorter and current path must start with menu path + '/'\n\treturn (\n\t\tnormalizedCurrent.startsWith( normalizedMenu ) &&\n\t\t( normalizedCurrent[ normalizedMenu.length ] === '/' ||\n\t\t\tnormalizedMenu === '/' )\n\t);\n};\n\n/**\n * Finds the menu item that is the closest parent of the current path.\n * Only considers menu items that have a 'to' path defined and are valid parents.\n *\n * @param currentPath - Current page path\n * @param menuItems - Array of all menu items\n * @return Menu item that is the closest parent, or null if no valid parent found\n */\nexport const findClosestMenuItem = (\n\tcurrentPath: string,\n\tmenuItems: MenuItem[]\n): MenuItem | null => {\n\tconst exactMatch = menuItems.find( ( item ) => item.to === currentPath );\n\tif ( exactMatch ) {\n\t\treturn exactMatch;\n\t}\n\n\tlet bestMatch: MenuItem | null = null;\n\tlet bestPathLength = 0;\n\n\tfor ( const item of menuItems ) {\n\t\tif ( ! item.to ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Only consider items that are valid parents of the current path\n\t\tif ( isValidParentPath( currentPath, item.to ) ) {\n\t\t\t// Prefer the longest parent path (most specific)\n\t\t\tif ( item.to.length > bestPathLength ) {\n\t\t\t\tbestMatch = item;\n\t\t\t\tbestPathLength = item.to.length;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bestMatch;\n};\n\n/**\n * Finds the drilldown parent of a menu item by traversing up the menu tree.\n *\n * @param id - The ID of the menu item to find the drilldown parent for\n * @param menuItems - Array of all menu items\n * @return The ID of the drilldown parent, or undefined if none found\n */\nexport const findDrilldownParent = (\n\tid: string | undefined,\n\tmenuItems: MenuItem[]\n): string | undefined => {\n\tif ( ! id ) {\n\t\treturn undefined;\n\t}\n\n\tconst currentItem = menuItems.find( ( item ) => item.id === id );\n\tif ( ! currentItem ) {\n\t\treturn undefined;\n\t}\n\n\t// If the item has a parent, check if that parent is a drilldown\n\tif ( currentItem.parent ) {\n\t\tconst parentItem = menuItems.find(\n\t\t\t( item ) => item.id === currentItem.parent\n\t\t);\n\n\t\tif ( parentItem?.parent_type === 'drilldown' ) {\n\t\t\treturn parentItem.id;\n\t\t}\n\n\t\tif ( parentItem ) {\n\t\t\treturn findDrilldownParent( parentItem.id, menuItems );\n\t\t}\n\t}\n\n\treturn undefined;\n};\n\n/**\n * Finds the dropdown parent of a menu item.\n *\n * @param id - The ID of the menu item to find the dropdown parent for\n * @param menuItems - Array of all menu items\n * @return The ID of the dropdown parent, or undefined if none found\n */\nexport const findDropdownParent = (\n\tid: string | undefined,\n\tmenuItems: MenuItem[]\n): string | undefined => {\n\tif ( ! id ) {\n\t\treturn undefined;\n\t}\n\n\tconst currentItem = menuItems.find( ( item ) => item.id === id );\n\tif ( ! currentItem ) {\n\t\treturn undefined;\n\t}\n\n\t// If the item has a parent, check if that parent is a dropdown\n\tif ( currentItem.parent ) {\n\t\tconst parentItem = menuItems.find(\n\t\t\t( item ) => item.id === currentItem.parent\n\t\t);\n\n\t\tif ( parentItem?.parent_type === 'dropdown' ) {\n\t\t\treturn parentItem.id;\n\t\t}\n\t}\n\n\treturn undefined;\n};\n"],
|
|
5
|
+
"mappings": ";AAUA,IAAM,oBAAoB,CACzB,aACA,aACa;AACb,MAAK,CAAE,YAAY,aAAa,aAAc;AAC7C,WAAO;AAAA,EACR;AAGA,QAAM,gBAAgB,CAAE,SAAkB;AACzC,UAAM,aAAa,KAAK,WAAY,GAAI,IAAI,OAAO,MAAM;AACzD,WAAO,WAAW,SAAU,GAAI,KAAK,WAAW,SAAS,IACtD,WAAW,MAAO,GAAG,EAAG,IACxB;AAAA,EACJ;AAEA,QAAM,oBAAoB,cAAe,WAAY;AACrD,QAAM,iBAAiB,cAAe,QAAS;AAG/C,SACC,kBAAkB,WAAY,cAAe,MAC3C,kBAAmB,eAAe,MAAO,MAAM,OAChD,mBAAmB;AAEtB;AAUO,IAAM,sBAAsB,CAClC,aACA,cACqB;AACrB,QAAM,aAAa,UAAU,KAAM,C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|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/navigation/router-link-item.tsx"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import type { ForwardedRef } from 'react';\nimport { forwardRef } from '@wordpress/element';\nimport { __experimentalItem as Item } from '@wordpress/components';\nimport { privateApis as routePrivateApis } from '@wordpress/route';\nimport { unlock } from '../../lock-unlock';\n\nconst { createLink } = unlock( routePrivateApis );\n\nfunction AnchorOnlyItem(\n\tprops: React.ComponentProps< typeof Item >,\n\tforwardedRef: ForwardedRef< HTMLAnchorElement >\n) {\n\treturn <Item as=\"a\" ref={ forwardedRef } { ...props } />;\n}\n\nconst RouterLinkItem = createLink( forwardRef( AnchorOnlyItem ) );\n\nexport default RouterLinkItem;\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB,YAAY;AAC3C,SAAS,eAAe,wBAAwB;AAChD,SAAS,cAAc;AAQf;AANR,IAAM,EAAE,WAAW,IAAI,OAAQ,gBAAiB;AAEhD,SAAS,eACR,OACA,cACC;AACD,SAAO,oBAAC,QAAK,IAAG,KAAI,KAAM,cAAiB,GAAG,OAAQ;AACvD;AAEA,IAAM,iBAAiB,WAAY,WAAY,cAAe,CAAE;AAEhE,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/navigation/use-sidebar-parent.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { privateApis as routePrivateApis } from '@wordpress/route';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { unlock } from '../../lock-unlock';\nconst { useRouter, useMatches } = unlock( routePrivateApis );\nimport { STORE_NAME } from '../../store';\nimport {\n\tfindDrilldownParent,\n\tfindDropdownParent,\n\tfindClosestMenuItem,\n} from './path-matching';\n\n/**\n * The `useSidebarParent` hook returns the ID of the parent menu item\n * to render in the sidebar based on the current route.\n *\n * - It finds the closest matching menu item when exact path matches fail\n * - It allows the user to navigate in the sidebar (local state) without changing the URL.\n * - If the URL changes, it will update the parent ID to ensure the correct drilldown level is displayed.\n *\n * @return The ID of the parent menu item to render in the sidebar.\n */\nexport function useSidebarParent() {\n\tconst matches = useMatches();\n\tconst router = useRouter();\n\tconst menuItems = useSelect(\n\t\t( select ) =>\n\t\t\t// @ts-expect-error Store types are not available when selecting by store name.\n\t\t\tselect( STORE_NAME ).getMenuItems(),\n\t\t[]\n\t);\n\n\tconst currentPath = matches[ matches.length - 1 ].pathname.slice(\n\t\trouter.options.basepath?.length ?? 0\n\t);\n\n\tconst currentMenuItem = findClosestMenuItem( currentPath, menuItems );\n\tconst [ parentId, setParentId ] = useState< string | undefined >(\n\t\tfindDrilldownParent( currentMenuItem?.id, menuItems )\n\t);\n\tconst [ parentDropdownId, setParentDropdownId ] = useState<\n\t\tstring | undefined\n\t>( findDropdownParent( currentMenuItem?.id, menuItems ) );\n\n\t// Effect to update parent IDs when URL or menu items change\n\tuseEffect( () => {\n\t\tconst matchedMenuItem = findClosestMenuItem( currentPath, menuItems );\n\t\t// Find the appropriate parents for the current route\n\t\tconst updatedParentId = findDrilldownParent(\n\t\t\tmatchedMenuItem?.id,\n\t\t\tmenuItems\n\t\t);\n\t\tconst updatedDropdownParent = findDropdownParent(\n\t\t\tmatchedMenuItem?.id,\n\t\t\tmenuItems\n\t\t);\n\n\t\tsetParentId( updatedParentId );\n\t\tsetParentDropdownId( updatedDropdownParent );\n\t}, [ currentPath, menuItems ] );\n\n\treturn [\n\t\tparentId,\n\t\tsetParentId,\n\t\tparentDropdownId,\n\t\tsetParentDropdownId,\n\t] as const;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,eAAe,wBAAwB;AAChD,SAAS,WAAW,gBAAgB;AACpC,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAEvB,SAAS,kBAAkB;AAC3B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AANP,IAAM,EAAE,WAAW,WAAW,IAAI,OAAQ,gBAAiB;AAkBpD,SAAS,mBAAmB;AAClC,QAAM,UAAU,WAAW;AAC3B,QAAM,SAAS,UAAU;AACzB,QAAM,YAAY;AAAA,IACjB,CAAE;AAAA;AAAA,MAED,OAAQ,UAAW,EAAE,aAAa;AAAA;AAAA,IACnC,CAAC;AAAA,EACF;AAEA,QAAM,cAAc,QAAS,QAAQ,SAAS,CAAE,EAAE,SAAS;AAAA,IAC1D,OAAO,QAAQ,UAAU,UAAU;AAAA,EACpC;AAEA,QAAM,kBAAkB,oBAAqB,aAAa,SAAU;AACpE,QAAM,CAAE,UAAU,WAAY,IAAI;AAAA,IACjC,oBAAqB,iBAAiB,IAAI,SAAU;AAAA,EACrD;AACA,QAAM,CAAE,kBAAkB,mBAAoB,IAAI,SAE/C,mBAAoB,iBAAiB,IAAI,SAAU,CAAE;AAGxD,YAAW,MAAM;AAChB,UAAM,kBAAkB,oBAAqB,aAAa,SAAU;AAEpE,UAAM,kBAAkB;AAAA,MACvB,iBAAiB;AAAA,MACjB;AAAA,IACD;AACA,UAAM,wBAAwB;AAAA,MAC7B,iBAAiB;AAAA,MACjB;AAAA,IACD;AAEA,gBAAa,eAAgB;AAC7B,wBAAqB,qBAAsB;AAAA,EAC5C,GAAG,CAAE,aAAa,SAAU,CAAE;AAE9B,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// packages/boot/src/components/plugin-area/index.tsx
|
|
2
|
+
import { useDispatch } from "@wordpress/data";
|
|
3
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
4
|
+
import { store as noticesStore } from "@wordpress/notices";
|
|
5
|
+
import { PluginArea as WPPluginArea } from "@wordpress/plugins";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function PluginArea() {
|
|
8
|
+
const { createErrorNotice } = useDispatch(noticesStore);
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
WPPluginArea,
|
|
11
|
+
{
|
|
12
|
+
onError: (name) => {
|
|
13
|
+
createErrorNotice(
|
|
14
|
+
sprintf(
|
|
15
|
+
/* translators: %s: plugin name */
|
|
16
|
+
__(
|
|
17
|
+
'The "%s" plugin has encountered an error and cannot be rendered.'
|
|
18
|
+
),
|
|
19
|
+
name
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
PluginArea as default
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/plugin-area/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { PluginArea as WPPluginArea } from '@wordpress/plugins';\n\n/**\n * Mounts every plugin registered with `registerPlugin`, so the fills they\n * render reach their slots.\n *\n * Sits at the root rather than with the editor: a plugin's fills mostly target\n * editor slots, but the component holding them is also where it registers\n * commands and extends a list, which the routes without a canvas need too.\n *\n * @return The mount point. Renders whatever the plugins do, and nothing itself.\n */\nexport default function PluginArea() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\treturn (\n\t\t<WPPluginArea\n\t\t\tonError={ ( name ) => {\n\t\t\t\tcreateErrorNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tname\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,mBAAmB;AAC5B,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,oBAAoB;AACtC,SAAS,cAAc,oBAAoB;AAgBzC;AAJa,SAAR,aAA8B;AACpC,QAAM,EAAE,kBAAkB,IAAI,YAAa,YAAa;AAExD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,CAAE,SAAU;AACrB;AAAA,UACC;AAAA;AAAA,YAEC;AAAA,cACC;AAAA,YACD;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|