@wordpress/edit-site 6.49.1 → 6.50.1-next.v.202607070741.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 +2 -0
- package/build/components/editor/index.cjs +33 -101
- package/build/components/editor/index.cjs.map +3 -3
- package/build/components/layout/index.cjs +12 -14
- package/build/components/layout/index.cjs.map +3 -3
- package/build/components/page-patterns/fields.cjs +0 -36
- package/build/components/page-patterns/fields.cjs.map +2 -2
- package/build/components/page-patterns/index.cjs +4 -15
- package/build/components/page-patterns/index.cjs.map +2 -2
- package/build/components/save-panel/index.cjs +1 -2
- package/build/components/save-panel/index.cjs.map +2 -2
- package/build/components/site-hub/index.cjs +24 -155
- package/build/components/site-hub/index.cjs.map +3 -3
- package/build/index.cjs +3 -1
- package/build/index.cjs.map +2 -2
- package/build-module/components/editor/index.mjs +36 -104
- package/build-module/components/editor/index.mjs.map +2 -2
- package/build-module/components/layout/index.mjs +12 -14
- package/build-module/components/layout/index.mjs.map +2 -2
- package/build-module/components/page-patterns/fields.mjs +2 -41
- package/build-module/components/page-patterns/fields.mjs.map +2 -2
- package/build-module/components/page-patterns/index.mjs +5 -16
- package/build-module/components/page-patterns/index.mjs.map +2 -2
- package/build-module/components/save-panel/index.mjs +1 -2
- package/build-module/components/save-panel/index.mjs.map +2 -2
- package/build-module/components/site-hub/index.mjs +27 -158
- package/build-module/components/site-hub/index.mjs.map +2 -2
- package/build-module/index.mjs +3 -1
- package/build-module/index.mjs.map +2 -2
- package/build-style/style-rtl.css +71 -189
- package/build-style/style.css +71 -189
- package/package.json +48 -48
- package/src/components/editor/index.js +18 -101
- package/src/components/editor/style.scss +8 -19
- package/src/components/layout/index.js +12 -15
- package/src/components/layout/style.scss +5 -7
- package/src/components/page-patterns/fields.js +2 -50
- package/src/components/page-patterns/index.js +5 -23
- package/src/components/page-patterns/style.scss +1 -1
- package/src/components/save-panel/index.js +1 -2
- package/src/components/sidebar/style.scss +2 -0
- package/src/components/sidebar-global-styles/style.scss +7 -4
- package/src/components/sidebar-navigation-screen/style.scss +1 -1
- package/src/components/site-hub/index.js +7 -141
- package/src/components/site-hub/style.scss +0 -72
- package/src/index.js +3 -1
- package/src/style.scss +14 -11
- package/build/components/site-icon/index.cjs +0 -73
- package/build/components/site-icon/index.cjs.map +0 -7
- package/build-module/components/site-icon/index.mjs +0 -42
- package/build-module/components/site-icon/index.mjs.map +0 -7
- package/build-style/experimental-omnibar-rtl.css +0 -103
- package/build-style/experimental-omnibar.css +0 -103
- package/src/components/site-icon/index.js +0 -51
- package/src/components/site-icon/style.scss +0 -41
- package/src/experimental-omnibar.scss +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -33,7 +33,6 @@ __export(editor_exports, {
|
|
|
33
33
|
default: () => EditSiteEditor
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(editor_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
36
|
var import_data = require("@wordpress/data");
|
|
38
37
|
var import_components = require("@wordpress/components");
|
|
39
38
|
var import_compose = require("@wordpress/compose");
|
|
@@ -57,7 +56,6 @@ var import_is_previewing_theme = require("../../utils/is-previewing-theme.cjs");
|
|
|
57
56
|
var import_save_button = __toESM(require("../save-button/index.cjs"));
|
|
58
57
|
var import_save_panel = __toESM(require("../save-panel/index.cjs"));
|
|
59
58
|
var import_more_menu = __toESM(require("../more-menu/index.cjs"));
|
|
60
|
-
var import_site_icon = __toESM(require("../site-icon/index.cjs"));
|
|
61
59
|
var import_use_editor_iframe_props = __toESM(require("../block-editor/use-editor-iframe-props.cjs"));
|
|
62
60
|
var import_use_viewport_sync = require("../block-editor/use-viewport-sync.cjs");
|
|
63
61
|
var import_use_editor_title = __toESM(require("./use-editor-title.cjs"));
|
|
@@ -69,28 +67,6 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
69
67
|
var { Editor, BackButton } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
|
|
70
68
|
var { useHistory, useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
71
69
|
var { BlockKeyboardShortcuts } = (0, import_lock_unlock.unlock)(import_block_library.privateApis);
|
|
72
|
-
var toggleHomeIconVariants = {
|
|
73
|
-
edit: {
|
|
74
|
-
opacity: 0,
|
|
75
|
-
scale: 0.2
|
|
76
|
-
},
|
|
77
|
-
hover: {
|
|
78
|
-
opacity: 1,
|
|
79
|
-
scale: 1,
|
|
80
|
-
clipPath: "inset( 22% round 2px )"
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
var siteIconVariants = {
|
|
84
|
-
edit: {
|
|
85
|
-
clipPath: "inset(0% round 0px)"
|
|
86
|
-
},
|
|
87
|
-
hover: {
|
|
88
|
-
clipPath: "inset( 22% round 2px )"
|
|
89
|
-
},
|
|
90
|
-
tap: {
|
|
91
|
-
clipPath: "inset(0% round 0px)"
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
70
|
function getListPathForPostType(postType) {
|
|
95
71
|
switch (postType) {
|
|
96
72
|
case "navigation":
|
|
@@ -123,7 +99,6 @@ function getNavigationPath(location, postType) {
|
|
|
123
99
|
return (0, import_url.addQueryArgs)(path, { canvas: void 0 });
|
|
124
100
|
}
|
|
125
101
|
function EditSiteEditor({ isHomeRoute = false }) {
|
|
126
|
-
const disableMotion = (0, import_compose.useReducedMotion)();
|
|
127
102
|
const location = useLocation();
|
|
128
103
|
const history = useHistory();
|
|
129
104
|
const { canvas = "view" } = location.query;
|
|
@@ -132,14 +107,10 @@ function EditSiteEditor({ isHomeRoute = false }) {
|
|
|
132
107
|
const entity = (0, import_use_resolve_edited_entity.useResolveEditedEntity)();
|
|
133
108
|
(0, import_use_resolve_edited_entity.useSyncDeprecatedEntityIntoState)(entity);
|
|
134
109
|
const { postType, postId, context } = entity;
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
|
|
140
|
-
hasSiteIcon: !!siteData?.site_icon_url
|
|
141
|
-
};
|
|
142
|
-
}, []);
|
|
110
|
+
const isBlockBasedTheme = (0, import_data.useSelect)(
|
|
111
|
+
(select) => select(import_core_data.store).getCurrentTheme()?.is_block_theme,
|
|
112
|
+
[]
|
|
113
|
+
);
|
|
143
114
|
const postWithTemplate = !!context?.postId;
|
|
144
115
|
(0, import_use_editor_title.default)(
|
|
145
116
|
postWithTemplate ? context.postType : postType,
|
|
@@ -207,10 +178,6 @@ function EditSiteEditor({ isHomeRoute = false }) {
|
|
|
207
178
|
]
|
|
208
179
|
);
|
|
209
180
|
const isReady = !isLoading;
|
|
210
|
-
const transition = {
|
|
211
|
-
duration: disableMotion ? 0 : 0.2
|
|
212
|
-
};
|
|
213
|
-
const hasAdminBarInEditor = window.__experimentalAdminBarInEditor;
|
|
214
181
|
return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_site_preview.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
215
182
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor.EditorKeyboardShortcutsRegister, {}),
|
|
216
183
|
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockKeyboardShortcuts, {}),
|
|
@@ -236,71 +203,36 @@ function EditSiteEditor({ isHomeRoute = false }) {
|
|
|
236
203
|
extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_template_setting_panel.default.Slot, {}),
|
|
237
204
|
children: [
|
|
238
205
|
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_use_viewport_sync.ViewportSync, {}),
|
|
239
|
-
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
showTooltip: true,
|
|
255
|
-
tooltipPosition: "middle right",
|
|
256
|
-
onClick: () => {
|
|
257
|
-
resetZoomLevel();
|
|
258
|
-
setCurrentRevisionId(null);
|
|
259
|
-
history.navigate(
|
|
260
|
-
getNavigationPath(
|
|
261
|
-
location,
|
|
262
|
-
postWithTemplate ? context.postType : postType
|
|
263
|
-
),
|
|
264
|
-
{
|
|
265
|
-
transition: "canvas-mode-view-transition"
|
|
266
|
-
}
|
|
267
|
-
);
|
|
268
|
-
},
|
|
269
|
-
children: !hasAdminBarInEditor && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
270
|
-
import_components.__unstableMotion.div,
|
|
271
|
-
{
|
|
272
|
-
variants: !disableMotion && siteIconVariants,
|
|
273
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_site_icon.default, { className: "edit-site-editor__view-mode-toggle-icon" })
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
}
|
|
277
|
-
),
|
|
278
|
-
hasAdminBarInEditor ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "edit-site-editor__back-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
279
|
-
import_icons.Icon,
|
|
280
|
-
{
|
|
281
|
-
icon: (0, import_i18n.isRTL)() ? import_icons.arrowUpRight : import_icons.arrowUpLeft
|
|
282
|
-
}
|
|
283
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
284
|
-
import_components.__unstableMotion.div,
|
|
285
|
-
{
|
|
286
|
-
className: (0, import_clsx.default)(
|
|
287
|
-
"edit-site-editor__back-icon",
|
|
288
|
-
{
|
|
289
|
-
"has-site-icon": hasSiteIcon
|
|
290
|
-
}
|
|
206
|
+
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "edit-site-editor__view-mode-toggle", children: [
|
|
207
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
208
|
+
import_components.Button,
|
|
209
|
+
{
|
|
210
|
+
__next40pxDefaultSize: true,
|
|
211
|
+
label: (0, import_i18n.__)("Open Navigation"),
|
|
212
|
+
showTooltip: true,
|
|
213
|
+
tooltipPosition: "middle right",
|
|
214
|
+
onClick: () => {
|
|
215
|
+
resetZoomLevel();
|
|
216
|
+
setCurrentRevisionId(null);
|
|
217
|
+
history.navigate(
|
|
218
|
+
getNavigationPath(
|
|
219
|
+
location,
|
|
220
|
+
postWithTemplate ? context.postType : postType
|
|
291
221
|
),
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
222
|
+
{
|
|
223
|
+
transition: "canvas-mode-view-transition"
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "edit-site-editor__back-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
230
|
+
import_icons.Icon,
|
|
231
|
+
{
|
|
232
|
+
icon: (0, import_i18n.isRTL)() ? import_icons.chevronRight : import_icons.chevronLeft
|
|
233
|
+
}
|
|
234
|
+
) })
|
|
235
|
+
] }) }),
|
|
304
236
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_more_menu.default, {})
|
|
305
237
|
]
|
|
306
238
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft, arrowUpRight } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport { ViewportSync } from '../block-editor/use-viewport-sync';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( { isHomeRoute = false } ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst { isBlockBasedTheme, hasSiteIcon } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst editorSettings = useSpecificEditorSettings();\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\tconst hasAdminBarInEditor = window.__experimentalAdminBarInEditor;\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && isReady && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && <ViewportSync /> }\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t\t\t\t\tsetCurrentRevisionId( null );\n\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ ! hasAdminBarInEditor && (\n\t\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariants={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsiteIconVariants\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t{ hasAdminBarInEditor ? (\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__back-icon\">\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? arrowUpRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: arrowUpLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={\n\t\t\t\t\t\t\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\t\t\t\t\t\t\ttoggleHomeIconVariants\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? arrowUpRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: arrowUpLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
6
|
-
"names": ["editorPrivateApis", "routerPrivateApis", "blockLibraryPrivateApis", "coreDataStore", "useEditorTitle", "useEditorIframeProps", "CanvasLoader", "blockEditorStore", "editorStore", "noticesStore", "SitePreview", "WelcomeGuide", "SaveButton", "SavePanel", "PluginTemplateSettingPanel", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, chevronLeft, chevronRight } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport { ViewportSync } from '../block-editor/use-viewport-sync';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( { isHomeRoute = false } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreDataStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst editorSettings = useSpecificEditorSettings();\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst isReady = ! isLoading;\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && isReady && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && <ViewportSync /> }\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__view-mode-toggle\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t\t\t\t\tsetCurrentRevisionId( null );\n\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__back-icon\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,wBAAuB;AACvB,qBAA8B;AAC9B,oBAIO;AACP,kBAAmC;AACnC,uBAAuC;AACvC,2BAAuD;AACvD,qBAA4B;AAC5B,qBAAsC;AACtC,oBAAiD;AACjD,2BAA+B;AAC/B,mBAAgD;AAChD,0BAA0C;AAC1C,iBAA6B;AAK7B,2BAAyB;AACzB,2BAAyB;AACzB,yBAAuB;AACvB,sCAA0C;AAC1C,2CAAuC;AACvC,iCAAkC;AAClC,yBAAuB;AACvB,wBAAsB;AACtB,uBAA+B;AAC/B,qCAAiC;AACjC,+BAA6B;AAC7B,8BAA2B;AAC3B,mBAAuC;AACvC,wCAAuC;AACvC,uCAGO;AACP,0BAAwB;AAiItB;AA/HF,IAAM,EAAE,QAAQ,WAAW,QAAI,2BAAQ,cAAAA,WAAkB;AACzD,IAAM,EAAE,YAAY,YAAY,QAA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SAAA,EAAmB;AAAA;AAAA;AAAA,IACrB;AAAA,KAEF;AAEF;",
|
|
6
|
+
"names": ["editorPrivateApis", "routerPrivateApis", "blockLibraryPrivateApis", "coreDataStore", "useEditorTitle", "useEditorIframeProps", "CanvasLoader", "blockEditorStore", "editorStore", "noticesStore", "SitePreview", "WelcomeGuide", "SaveButton", "SavePanel", "PluginTemplateSettingPanel", "SiteEditorMoreMenu"]
|
|
7
7
|
}
|
|
@@ -37,6 +37,7 @@ var import_clsx = __toESM(require("clsx"));
|
|
|
37
37
|
var import_admin_ui = require("@wordpress/admin-ui");
|
|
38
38
|
var import_components = require("@wordpress/components");
|
|
39
39
|
var import_compose = require("@wordpress/compose");
|
|
40
|
+
var import_dom = require("@wordpress/dom");
|
|
40
41
|
var import_i18n = require("@wordpress/i18n");
|
|
41
42
|
var import_element = require("@wordpress/element");
|
|
42
43
|
var import_editor = require("@wordpress/editor");
|
|
@@ -47,7 +48,7 @@ var import_notices = require("@wordpress/notices");
|
|
|
47
48
|
var import_data = require("@wordpress/data");
|
|
48
49
|
var import_preferences = require("@wordpress/preferences");
|
|
49
50
|
var import_ui = require("@wordpress/ui");
|
|
50
|
-
var import_site_hub =
|
|
51
|
+
var import_site_hub = require("../site-hub/index.cjs");
|
|
51
52
|
var import_resizable_frame = __toESM(require("../resizable-frame/index.cjs"));
|
|
52
53
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
53
54
|
var import_save_keyboard_shortcut = __toESM(require("../save-keyboard-shortcut/index.cjs"));
|
|
@@ -64,12 +65,11 @@ var CONTENT_COLOR = { background: "#ffffff" };
|
|
|
64
65
|
function Layout() {
|
|
65
66
|
const { query, name: routeKey, areas, widths } = useLocation();
|
|
66
67
|
const canvas = routeKey === "notfound" ? "view" : query?.canvas ?? "view";
|
|
67
|
-
const
|
|
68
|
-
const showDesktopSiteHub = !hasAdminBarInEditor;
|
|
69
|
-
const showMobileSiteHub = !hasAdminBarInEditor || routeKey !== "home";
|
|
68
|
+
const showMobileSiteHub = !!areas.mobileContent;
|
|
70
69
|
const hasMobileAreas = areas.mobileSidebar || areas.mobileContent || areas.preview;
|
|
71
70
|
const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
|
|
72
|
-
const
|
|
71
|
+
const mobileToggleRef = (0, import_element.useRef)();
|
|
72
|
+
const sidebarRegionRef = (0, import_element.useRef)();
|
|
73
73
|
const navigateRegionsProps = (0, import_components.__unstableUseNavigateRegions)();
|
|
74
74
|
const disableMotion = (0, import_compose.useReducedMotion)();
|
|
75
75
|
const [canvasResizer, canvasSize] = (0, import_compose.useResizeObserver)();
|
|
@@ -91,7 +91,11 @@ function Layout() {
|
|
|
91
91
|
const previousCanvaMode = (0, import_compose.usePrevious)(canvas);
|
|
92
92
|
(0, import_element.useEffect)(() => {
|
|
93
93
|
if (previousCanvaMode === "edit") {
|
|
94
|
-
|
|
94
|
+
const desktopToggle = sidebarRegionRef.current ? (
|
|
95
|
+
// We're typically expecting the `<DashboardBackButton />` component as the first tabbable element.
|
|
96
|
+
import_dom.focus.tabbable.find(sidebarRegionRef.current)[0]
|
|
97
|
+
) : void 0;
|
|
98
|
+
(desktopToggle ?? mobileToggleRef.current)?.focus();
|
|
95
99
|
}
|
|
96
100
|
}, [canvas]);
|
|
97
101
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -114,6 +118,7 @@ function Layout() {
|
|
|
114
118
|
(!isMobileViewport || !hasMobileAreas) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
119
|
import_admin_ui.NavigableRegion,
|
|
116
120
|
{
|
|
121
|
+
ref: sidebarRegionRef,
|
|
117
122
|
ariaLabel: (0, import_i18n.__)("Navigation"),
|
|
118
123
|
className: "edit-site-layout__sidebar-region",
|
|
119
124
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__unstableAnimatePresence, { children: canvas === "view" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -132,13 +137,6 @@ function Layout() {
|
|
|
132
137
|
},
|
|
133
138
|
className: "edit-site-layout__sidebar",
|
|
134
139
|
children: [
|
|
135
|
-
showDesktopSiteHub && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
136
|
-
import_site_hub.default,
|
|
137
|
-
{
|
|
138
|
-
ref: toggleRef,
|
|
139
|
-
isTransparent: isResizableFrameOversized
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
140
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarNavigationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
141
|
import_sidebar.SidebarContent,
|
|
144
142
|
{
|
|
@@ -160,7 +158,7 @@ function Layout() {
|
|
|
160
158
|
showMobileSiteHub && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
161
159
|
import_site_hub.SiteHubMobile,
|
|
162
160
|
{
|
|
163
|
-
ref:
|
|
161
|
+
ref: mobileToggleRef,
|
|
164
162
|
isTransparent: isResizableFrameOversized
|
|
165
163
|
}
|
|
166
164
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/layout/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion, getAdminThemeColors } from '@wordpress/admin-ui';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\tSlotFillProvider,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useRef, useEffect, useMemo } from '@wordpress/element';\nimport {\n\tUnsavedChangesWarning,\n\tErrorBoundary,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { ThemeProvider } from '@wordpress/theme';\nimport { PluginArea } from '@wordpress/plugins';\nimport { SnackbarNotices, store as noticesStore } from '@wordpress/notices';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { default as SiteHub, SiteHubMobile } from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport { unlock } from '../../lock-unlock';\nimport SaveKeyboardShortcut from '../save-keyboard-shortcut';\nimport { useIsSiteEditorLoading } from './hooks';\nimport useMovingAnimation from './animation';\nimport { SidebarContent, SidebarNavigationProvider } from '../sidebar';\nimport SaveHub from '../save-hub';\nimport SavePanel from '../save-panel';\n\nconst { useLocation } = unlock( routerPrivateApis );\nconst { useStyle, UploadProgressSnackbar } = unlock( editorPrivateApis );\n\nconst ANIMATION_DURATION = 0.3;\nconst CONTENT_COLOR = { background: '#ffffff' };\n\nfunction Layout() {\n\tconst { query, name: routeKey, areas, widths } = useLocation();\n\t// Force canvas to 'view' on notfound route to show the error message and allow navigation.\n\tconst canvas = routeKey === 'notfound' ? 'view' : query?.canvas ?? 'view';\n\tconst hasAdminBarInEditor = window.__experimentalAdminBarInEditor;\n\tconst showDesktopSiteHub = ! hasAdminBarInEditor;\n\tconst showMobileSiteHub = ! hasAdminBarInEditor || routeKey !== 'home';\n\tconst hasMobileAreas =\n\t\tareas.mobileSidebar || areas.mobileContent || areas.preview;\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst toggleRef = useRef();\n\tconst navigateRegionsProps = useNavigateRegions();\n\tconst disableMotion = useReducedMotion();\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\tconst [ isResizableFrameOversized, setIsResizableFrameOversized ] =\n\t\tuseState( false );\n\tconst animationRef = useMovingAnimation( {\n\t\ttriggerAnimationOnChange: routeKey + '-' + canvas,\n\t} );\n\n\tconst { showIconLabels } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t} );\n\n\tconst backgroundColor = useStyle( 'color.background' );\n\tconst gradientValue = useStyle( 'color.gradient' );\n\tconst previousCanvaMode = usePrevious( canvas );\n\tuseEffect( () => {\n\t\tif ( previousCanvaMode === 'edit' ) {\n\t\t\ttoggleRef.current?.focus();\n\t\t}\n\t\t// Should not depend on the previous canvas mode value but the next.\n\t}, [ canvas ] );\n\n\treturn (\n\t\t<>\n\t\t\t<UnsavedChangesWarning />\n\t\t\t{ canvas === 'view' && <SaveKeyboardShortcut /> }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'edit-site-layout',\n\t\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-full-canvas': canvas === 'edit',\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tThe NavigableRegion must always be rendered and not use\n\t\t\t\t\t\t`inert` otherwise `useNavigateRegions` will fail.\n\t\t\t\t\t*/ }\n\t\t\t\t\t{ ( ! isMobileViewport || ! hasMobileAreas ) && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tariaLabel={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar-region\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t\t\t{ canvas === 'view' && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t\t// Disable transition in mobile to emulate a full page transition.\n\t\t\t\t\t\t\t\t\t\t\t\tdisableMotion ||\n\t\t\t\t\t\t\t\t\t\t\t\tisMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ showDesktopSiteHub && (\n\t\t\t\t\t\t\t\t\t\t\t<SiteHub\n\t\t\t\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\t\t\t\tisTransparent={\n\t\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\tshouldAnimate={\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'styles' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'identity'\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ areas.sidebar }\n\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SnackbarNotices className=\"edit-site-layout__snackbar\" />\n\t\t\t\t\t<UploadProgressSnackbar />\n\n\t\t\t\t\t{ isMobileViewport && hasMobileAreas && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__mobile\">\n\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t{ canvas !== 'edit' ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ showMobileSiteHub && (\n\t\t\t\t\t\t\t\t\t\t\t<SiteHubMobile\n\t\t\t\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\t\t\t\tisTransparent={\n\t\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ areas.mobileContent ? (\n\t\t\t\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\t\t\t * ThemeProvider wraps SidebarContent (rather than\n\t\t\t\t\t\t\t\t\t\t\t * just the content) so the scroll wrapper it renders\n\t\t\t\t\t\t\t\t\t\t\t * inherits the content background tokens. See\n\t\t\t\t\t\t\t\t\t\t\t * `.edit-site-sidebar__screen-wrapper` in style.scss.\n\t\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\t\t<ThemeProvider\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={ CONTENT_COLOR }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-layout__mobile-content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tareas.mobileContent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ areas.mobileSidebar }\n\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport &&\n\t\t\t\t\t\tareas.content &&\n\t\t\t\t\t\tcanvas !== 'edit' && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tmaxWidth: widths?.content,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t{ areas.content }\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.edit && canvas !== 'edit' && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: widths?.edit,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t<ErrorBoundary>{ areas.edit }</ErrorBoundary>\n\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.preview && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__canvas-container\">\n\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'edit-site-layout__canvas',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-right-aligned':\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tref={ animationRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\tisReady={ ! isEditorLoading }\n\t\t\t\t\t\t\t\t\t\t\tisFullWidth={ canvas === 'edit' }\n\t\t\t\t\t\t\t\t\t\t\tdefaultSize={ {\n\t\t\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t\t\tcanvasSize.width -\n\t\t\t\t\t\t\t\t\t\t\t\t\t24 /* $canvas-padding */,\n\t\t\t\t\t\t\t\t\t\t\t\theight: canvasSize.height,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tisOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetIsOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\t\t\tgradientValue ??\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ThemeProvider\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={ CONTENT_COLOR }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default function LayoutWithGlobalStylesProvider( props ) {\n\tconst themeColors = useMemo( getAdminThemeColors, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<Tooltip.Provider>\n\t\t\t\t{ /** This needs to be within the SlotFillProvider */ }\n\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t<ThemeProvider color={ themeColors }>\n\t\t\t\t\t<Layout { ...props } />\n\t\t\t\t</ThemeProvider>\n\t\t\t</Tooltip.Provider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,sBAAqD;AACrD,wBAKO;AACP,qBAKO;AACP,kBAA4B;AAC5B,qBAAqD;AACrD,oBAIO;AACP,oBAAiD;AACjD,mBAA8B;AAC9B,qBAA2B;AAC3B,qBAAuD;AACvD,kBAAuC;AACvC,yBAA0C;AAC1C,gBAAwB;AAKxB,
|
|
6
|
-
"names": ["routerPrivateApis", "editorPrivateApis", "useNavigateRegions", "useMovingAnimation", "preferencesStore", "SaveKeyboardShortcut", "clsx", "AnimatePresence", "motion", "
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion, getAdminThemeColors } from '@wordpress/admin-ui';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\tSlotFillProvider,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useRef, useEffect, useMemo } from '@wordpress/element';\nimport {\n\tUnsavedChangesWarning,\n\tErrorBoundary,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { ThemeProvider } from '@wordpress/theme';\nimport { PluginArea } from '@wordpress/plugins';\nimport { SnackbarNotices, store as noticesStore } from '@wordpress/notices';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { SiteHubMobile } from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport { unlock } from '../../lock-unlock';\nimport SaveKeyboardShortcut from '../save-keyboard-shortcut';\nimport { useIsSiteEditorLoading } from './hooks';\nimport useMovingAnimation from './animation';\nimport { SidebarContent, SidebarNavigationProvider } from '../sidebar';\nimport SaveHub from '../save-hub';\nimport SavePanel from '../save-panel';\n\nconst { useLocation } = unlock( routerPrivateApis );\nconst { useStyle, UploadProgressSnackbar } = unlock( editorPrivateApis );\n\nconst ANIMATION_DURATION = 0.3;\nconst CONTENT_COLOR = { background: '#ffffff' };\n\nfunction Layout() {\n\tconst { query, name: routeKey, areas, widths } = useLocation();\n\t// Force canvas to 'view' on notfound route to show the error message and allow navigation.\n\tconst canvas = routeKey === 'notfound' ? 'view' : query?.canvas ?? 'view';\n\tconst showMobileSiteHub = !! areas.mobileContent;\n\tconst hasMobileAreas =\n\t\tareas.mobileSidebar || areas.mobileContent || areas.preview;\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst mobileToggleRef = useRef();\n\tconst sidebarRegionRef = useRef();\n\tconst navigateRegionsProps = useNavigateRegions();\n\tconst disableMotion = useReducedMotion();\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\tconst [ isResizableFrameOversized, setIsResizableFrameOversized ] =\n\t\tuseState( false );\n\tconst animationRef = useMovingAnimation( {\n\t\ttriggerAnimationOnChange: routeKey + '-' + canvas,\n\t} );\n\n\tconst { showIconLabels } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t} );\n\n\tconst backgroundColor = useStyle( 'color.background' );\n\tconst gradientValue = useStyle( 'color.gradient' );\n\tconst previousCanvaMode = usePrevious( canvas );\n\tuseEffect( () => {\n\t\tif ( previousCanvaMode === 'edit' ) {\n\t\t\tconst desktopToggle = sidebarRegionRef.current\n\t\t\t\t? // We're typically expecting the `<DashboardBackButton />` component as the first tabbable element.\n\t\t\t\t focus.tabbable.find( sidebarRegionRef.current )[ 0 ]\n\t\t\t\t: undefined;\n\t\t\t( desktopToggle ?? mobileToggleRef.current )?.focus();\n\t\t}\n\t\t// Should not depend on the previous canvas mode value but the next.\n\t}, [ canvas ] );\n\n\treturn (\n\t\t<>\n\t\t\t<UnsavedChangesWarning />\n\t\t\t{ canvas === 'view' && <SaveKeyboardShortcut /> }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'edit-site-layout',\n\t\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-full-canvas': canvas === 'edit',\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tThe NavigableRegion must always be rendered and not use\n\t\t\t\t\t\t`inert` otherwise `useNavigateRegions` will fail.\n\t\t\t\t\t*/ }\n\t\t\t\t\t{ ( ! isMobileViewport || ! hasMobileAreas ) && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tref={ sidebarRegionRef }\n\t\t\t\t\t\t\tariaLabel={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar-region\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t\t\t{ canvas === 'view' && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t\t// Disable transition in mobile to emulate a full page transition.\n\t\t\t\t\t\t\t\t\t\t\t\tdisableMotion ||\n\t\t\t\t\t\t\t\t\t\t\t\tisMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\tshouldAnimate={\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'styles' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'identity'\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ areas.sidebar }\n\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SnackbarNotices className=\"edit-site-layout__snackbar\" />\n\t\t\t\t\t<UploadProgressSnackbar />\n\n\t\t\t\t\t{ isMobileViewport && hasMobileAreas && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__mobile\">\n\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t{ canvas !== 'edit' ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ showMobileSiteHub && (\n\t\t\t\t\t\t\t\t\t\t\t<SiteHubMobile\n\t\t\t\t\t\t\t\t\t\t\t\tref={ mobileToggleRef }\n\t\t\t\t\t\t\t\t\t\t\t\tisTransparent={\n\t\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ areas.mobileContent ? (\n\t\t\t\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\t\t\t * ThemeProvider wraps SidebarContent (rather than\n\t\t\t\t\t\t\t\t\t\t\t * just the content) so the scroll wrapper it renders\n\t\t\t\t\t\t\t\t\t\t\t * inherits the content background tokens. See\n\t\t\t\t\t\t\t\t\t\t\t * `.edit-site-sidebar__screen-wrapper` in style.scss.\n\t\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\t\t<ThemeProvider\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={ CONTENT_COLOR }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-layout__mobile-content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tareas.mobileContent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ areas.mobileSidebar }\n\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport &&\n\t\t\t\t\t\tareas.content &&\n\t\t\t\t\t\tcanvas !== 'edit' && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tmaxWidth: widths?.content,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t{ areas.content }\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.edit && canvas !== 'edit' && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: widths?.edit,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t<ErrorBoundary>{ areas.edit }</ErrorBoundary>\n\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.preview && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__canvas-container\">\n\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'edit-site-layout__canvas',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-right-aligned':\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tref={ animationRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\tisReady={ ! isEditorLoading }\n\t\t\t\t\t\t\t\t\t\t\tisFullWidth={ canvas === 'edit' }\n\t\t\t\t\t\t\t\t\t\t\tdefaultSize={ {\n\t\t\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t\t\tcanvasSize.width -\n\t\t\t\t\t\t\t\t\t\t\t\t\t24 /* $canvas-padding */,\n\t\t\t\t\t\t\t\t\t\t\t\theight: canvasSize.height,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tisOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetIsOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\t\t\tgradientValue ??\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ThemeProvider\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={ CONTENT_COLOR }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default function LayoutWithGlobalStylesProvider( props ) {\n\tconst themeColors = useMemo( getAdminThemeColors, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<Tooltip.Provider>\n\t\t\t\t{ /** This needs to be within the SlotFillProvider */ }\n\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t<ThemeProvider color={ themeColors }>\n\t\t\t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E;AACrD,QAAM,EAAE,kBAAkB,QAAI,yBAAa,eAAAC,KAAa;AACxD,WAAS,kBAAmB,MAAO;AAClC;AAAA,UACC;AAAA;AAAA,YAEC;AAAA,UACC;AAAA,QACD;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,SACC,4CAAC,sCACA,uDAAC,kBAAQ,UAAR,EAEA;AAAA,gDAAC,6BAAW,SAAU,mBAAoB;AAAA,IAC1C,4CAAC,8BAAc,OAAQ,aACtB,sDAAC,UAAS,GAAG,OAAQ,GACtB;AAAA,KACD,GACD;AAEF;",
|
|
6
|
+
"names": ["routerPrivateApis", "editorPrivateApis", "useNavigateRegions", "useMovingAnimation", "preferencesStore", "SaveKeyboardShortcut", "clsx", "AnimatePresence", "motion", "SaveHub", "SavePanel", "ResizableFrame", "noticesStore"]
|
|
7
7
|
}
|
|
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// packages/edit-site/src/components/page-patterns/fields.js
|
|
21
21
|
var fields_exports = {};
|
|
22
22
|
__export(fields_exports, {
|
|
23
|
-
patternStatusField: () => patternStatusField,
|
|
24
23
|
previewField: () => previewField
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(fields_exports);
|
|
@@ -71,43 +70,8 @@ var previewField = {
|
|
|
71
70
|
render: PreviewField,
|
|
72
71
|
enableSorting: false
|
|
73
72
|
};
|
|
74
|
-
var SYNC_FILTERS = [
|
|
75
|
-
{
|
|
76
|
-
value: import_constants.PATTERN_SYNC_TYPES.full,
|
|
77
|
-
label: (0, import_i18n._x)("Synced", "pattern (singular)"),
|
|
78
|
-
description: (0, import_i18n.__)("Patterns that are kept in sync across the site.")
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
value: import_constants.PATTERN_SYNC_TYPES.unsynced,
|
|
82
|
-
label: (0, import_i18n._x)("Not synced", "pattern (singular)"),
|
|
83
|
-
description: (0, import_i18n.__)(
|
|
84
|
-
"Patterns that can be changed freely without affecting the site."
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
];
|
|
88
|
-
var patternStatusField = {
|
|
89
|
-
label: (0, import_i18n.__)("Sync status"),
|
|
90
|
-
id: "sync-status",
|
|
91
|
-
render: ({ item }) => {
|
|
92
|
-
const syncStatus = "wp_pattern_sync_status" in item ? item.wp_pattern_sync_status || import_constants.PATTERN_SYNC_TYPES.full : import_constants.PATTERN_SYNC_TYPES.unsynced;
|
|
93
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
-
"span",
|
|
95
|
-
{
|
|
96
|
-
className: `edit-site-patterns__field-sync-status-${syncStatus}`,
|
|
97
|
-
children: SYNC_FILTERS.find(({ value }) => value === syncStatus).label
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
},
|
|
101
|
-
elements: SYNC_FILTERS,
|
|
102
|
-
filterBy: {
|
|
103
|
-
operators: [import_constants.OPERATOR_IS],
|
|
104
|
-
isPrimary: true
|
|
105
|
-
},
|
|
106
|
-
enableSorting: false
|
|
107
|
-
};
|
|
108
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
109
74
|
0 && (module.exports = {
|
|
110
|
-
patternStatusField,
|
|
111
75
|
previewField
|
|
112
76
|
});
|
|
113
77
|
//# sourceMappingURL=fields.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-patterns/fields.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useId } from '@wordpress/element';\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { parse } from '@wordpress/blocks';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useStyle } = unlock( editorPrivateApis );\n\nfunction PreviewField( { item } ) {\n\tconst descriptionId = useId();\n\tconst description = item.description || item?.excerpt?.raw;\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\tconst backgroundColor = useStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn (\n\t\t\titem.blocks ??\n\t\t\tparse( item.content.raw, {\n\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t} )\n\t\t);\n\t}, [ item?.content?.raw, item.blocks ] );\n\tconst isEmpty = ! blocks?.length;\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"page-patterns-preview-field\"\n\t\t\tstyle={ { backgroundColor } }\n\t\t\taria-describedby={ !! description ? descriptionId : undefined }\n\t\t>\n\t\t\t{ isEmpty && isTemplatePart && __( 'Empty template part' ) }\n\t\t\t{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\tviewportWidth={ item.viewportWidth }\n\t\t\t\t\t/>\n\t\t\t\t</BlockPreview.Async>\n\t\t\t) }\n\t\t\t{ !! description && (\n\t\t\t\t<div hidden id={ descriptionId }>\n\t\t\t\t\t{ description }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const previewField = {\n\tlabel: __( 'Preview' ),\n\tid: 'preview',\n\trender: PreviewField,\n\tenableSorting: false,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,qBAA+B;AAC/B,0BAA6B;AAC7B,oBAAsB;AACtB,oBAAiD;AAKjD,uBAAwC;AACxC,yBAAuB;AAoBrB;AAlBF,IAAM,EAAE,SAAS,QAAI,2BAAQ,cAAAA,WAAkB;AAE/C,SAAS,aAAc,EAAE,KAAK,GAAI;AACjC,QAAM,oBAAgB,sBAAM;AAC5B,QAAM,cAAc,KAAK,eAAe,MAAM,SAAS;AACvD,QAAM,iBAAiB,KAAK,SAAS;AACrC,QAAM,kBAAkB,SAAU,kBAAmB;AACrD,QAAM,aAAS,wBAAS,MAAM;AAC7B,WACC,KAAK,cACL,qBAAO,KAAK,QAAQ,KAAK;AAAA,MACxB,6BAA6B;AAAA,IAC9B,CAAE;AAAA,EAEJ,GAAG,CAAE,MAAM,SAAS,KAAK,KAAK,MAAO,CAAE;AACvC,QAAM,UAAU,CAAE,QAAQ;AAE1B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,OAAQ,EAAE,gBAAgB;AAAA,MAC1B,oBAAmB,CAAC,CAAE,cAAc,gBAAgB;AAAA,MAElD;AAAA,mBAAW,sBAAkB,gBAAI,qBAAsB;AAAA,QACvD,WAAW,CAAE,sBAAkB,gBAAI,eAAgB;AAAA,QACnD,CAAE,WACH,4CAAC,iCAAa,OAAb,EACA;AAAA,UAAC;AAAA;AAAA,YACA;AAAA,YACA,eAAgB,KAAK;AAAA;AAAA,QACtB,GACD;AAAA,QAEC,CAAC,CAAE,eACJ,4CAAC,SAAI,QAAM,MAAC,IAAK,eACd,uBACH;AAAA;AAAA;AAAA,EAEF;AAEF;AAEO,IAAM,eAAe;AAAA,EAC3B,WAAO,gBAAI,SAAU;AAAA,EACrB,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,eAAe;AAChB;",
|
|
6
6
|
"names": ["editorPrivateApis"]
|
|
7
7
|
}
|
|
@@ -54,7 +54,7 @@ var import_fields = require("./fields.cjs");
|
|
|
54
54
|
var import_use_pattern_categories = __toESM(require("../sidebar-navigation-screen-patterns/use-pattern-categories.cjs"));
|
|
55
55
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
56
|
var { ExperimentalBlockEditorProvider } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
57
|
-
var { usePostActions, usePostFields
|
|
57
|
+
var { usePostActions, usePostFields } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
|
|
58
58
|
var { useLocation, useHistory } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
59
59
|
var EMPTY_ARRAY = [];
|
|
60
60
|
var VIEW_CONFIG_FIELDS = ["default_view", "default_layouts"];
|
|
@@ -117,21 +117,10 @@ function DataviewsPatterns() {
|
|
|
117
117
|
search: view.search,
|
|
118
118
|
syncStatus: viewSyncStatus
|
|
119
119
|
});
|
|
120
|
-
const
|
|
121
|
-
postType: import_constants.TEMPLATE_PART_POST_TYPE
|
|
122
|
-
});
|
|
123
|
-
const templatePartAuthorField = templatePartFields.find(
|
|
124
|
-
(field) => field.id === "author"
|
|
125
|
-
);
|
|
120
|
+
const postTypeFields = usePostFields({ postType });
|
|
126
121
|
const fields = (0, import_element.useMemo)(() => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_fields.push(import_fields.patternStatusField);
|
|
130
|
-
} else if (postType === import_constants.TEMPLATE_PART_POST_TYPE && templatePartAuthorField) {
|
|
131
|
-
_fields.push(templatePartAuthorField);
|
|
132
|
-
}
|
|
133
|
-
return _fields;
|
|
134
|
-
}, [postType, templatePartAuthorField]);
|
|
122
|
+
return [import_fields.previewField, ...postTypeFields || []];
|
|
123
|
+
}, [postTypeFields]);
|
|
135
124
|
const { data, paginationInfo } = (0, import_element.useMemo)(() => {
|
|
136
125
|
const viewWithoutFilters = { ...view };
|
|
137
126
|
delete viewWithoutFilters.search;
|