@wordpress/edit-site 5.33.0 → 5.34.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/add-new-page/index.js +3 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +8 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +20 -5
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +3 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +28 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +9 -3
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +8 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/index.js +33 -49
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +3 -97
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -49
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +7 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +9 -38
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +4 -3
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +3 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +20 -49
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/hooks.js.map +1 -0
- package/build/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/pattern-modal/duplicate.js +7 -5
- package/build/components/pattern-modal/duplicate.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +9 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +9 -6
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +40 -9
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +24 -17
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +2 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +39 -8
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +34 -28
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/index.js +1 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/deprecated.js +55 -0
- package/build/deprecated.js.map +1 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +35 -4
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +18 -18
- package/build/index.js.map +1 -1
- package/build/utils/constants.js +1 -2
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/add-new-page/index.js +3 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +21 -6
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +28 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +9 -3
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +8 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +39 -55
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -49
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +7 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +9 -38
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +5 -4
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +3 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +22 -51
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/hooks.js.map +1 -0
- package/build-module/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/pattern-modal/duplicate.js +7 -5
- package/build-module/components/pattern-modal/duplicate.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +8 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +9 -6
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -3
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +43 -12
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +25 -17
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +3 -6
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +35 -29
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +1 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/deprecated.js +45 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +34 -4
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +2 -4
- package/build-module/index.js.map +1 -1
- package/build-module/utils/constants.js +0 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +79 -125
- package/build-style/style.css +79 -125
- package/package.json +42 -42
- package/src/components/add-new-page/index.js +7 -1
- package/src/components/add-new-pattern/index.js +15 -12
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/src/components/block-editor/resize-handle.js +30 -11
- package/src/components/block-editor/style.scss +10 -15
- package/src/components/create-template-part-modal/index.js +3 -0
- package/src/components/editor/index.js +42 -3
- package/src/components/editor/style.scss +6 -1
- package/src/components/global-styles/font-library-modal/context.js +9 -3
- package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
- package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
- package/src/components/global-styles/font-library-modal/style.scss +17 -0
- package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/src/components/global-styles/style-variations-container.js +11 -2
- package/src/components/header-edit-mode/index.js +56 -76
- package/src/components/header-edit-mode/more-menu/index.js +8 -145
- package/src/components/header-edit-mode/style.scss +13 -85
- package/src/components/keyboard-shortcuts/register.js +0 -58
- package/src/components/layout/index.js +11 -2
- package/src/components/layout/router.js +9 -49
- package/src/components/page-pages/index.js +14 -4
- package/src/components/page-pages/style.scss +11 -0
- package/src/components/page-patterns/dataviews-pattern-actions.js +8 -9
- package/src/components/page-patterns/header.js +3 -1
- package/src/components/page-patterns/index.js +17 -76
- package/src/components/page-patterns/style.scss +14 -1
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/{page-templates-template-parts → page-templates}/index.js +23 -46
- package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
- package/src/components/pattern-modal/duplicate.js +4 -3
- package/src/components/plugin-template-setting-panel/index.js +8 -0
- package/src/components/resizable-frame/index.js +4 -3
- package/src/components/sidebar-edit-mode/index.js +13 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +49 -21
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +31 -19
- package/src/components/sidebar-edit-mode/template-panel/index.js +2 -12
- package/src/components/sidebar-navigation-screen-page/index.js +48 -9
- package/src/components/sidebar-navigation-screen-pattern/index.js +6 -11
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +30 -38
- package/src/components/sidebar-navigation-screen-template/index.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +7 -39
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
- package/src/components/template-actions/index.js +1 -1
- package/src/deprecated.js +42 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +69 -16
- package/src/index.js +2 -9
- package/src/style.scss +1 -5
- package/src/utils/constants.js +1 -1
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
- package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build/components/page-templates-template-parts/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build-module/components/page-templates-template-parts/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
- package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
- /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
|
@@ -26,10 +26,9 @@ import Page from '../page';
|
|
|
26
26
|
import { default as Link, useLink } from '../routes/link';
|
|
27
27
|
import AddNewTemplate from '../add-new-template';
|
|
28
28
|
import { useAddedBy } from './hooks';
|
|
29
|
-
import { TEMPLATE_POST_TYPE,
|
|
29
|
+
import { TEMPLATE_POST_TYPE, OPERATOR_IS_ANY, LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST } from '../../utils/constants';
|
|
30
30
|
import usePatternSettings from '../page-patterns/use-pattern-settings';
|
|
31
31
|
import { unlock } from '../../lock-unlock';
|
|
32
|
-
import AddNewTemplatePart from './add-new-template-part';
|
|
33
32
|
const {
|
|
34
33
|
usePostActions
|
|
35
34
|
} = unlock(editorPrivateApis);
|
|
@@ -157,14 +156,12 @@ function Preview({
|
|
|
157
156
|
type: "button",
|
|
158
157
|
onClick: onClick,
|
|
159
158
|
"aria-label": item.title?.rendered || item.title
|
|
160
|
-
}, isEmpty &&
|
|
159
|
+
}, isEmpty && __('Empty template'), !isEmpty && createElement(Async, null, createElement(BlockPreview, {
|
|
161
160
|
blocks: blocks
|
|
162
161
|
})))));
|
|
163
162
|
}
|
|
164
163
|
const TEMPLATE_ACTIONS = ['edit-post', 'reset-template', 'rename-template', 'view-post-revisions', 'delete-template'];
|
|
165
|
-
export default function
|
|
166
|
-
postType
|
|
167
|
-
}) {
|
|
164
|
+
export default function PageTemplates() {
|
|
168
165
|
const {
|
|
169
166
|
params
|
|
170
167
|
} = useLocation();
|
|
@@ -199,7 +196,7 @@ export default function PageTemplatesTemplateParts({
|
|
|
199
196
|
const {
|
|
200
197
|
records,
|
|
201
198
|
isResolving: isLoadingData
|
|
202
|
-
} = useEntityRecords('postType',
|
|
199
|
+
} = useEntityRecords('postType', TEMPLATE_POST_TYPE, {
|
|
203
200
|
per_page: -1
|
|
204
201
|
});
|
|
205
202
|
const history = useHistory();
|
|
@@ -224,79 +221,69 @@ export default function PageTemplatesTemplateParts({
|
|
|
224
221
|
label: author
|
|
225
222
|
}));
|
|
226
223
|
}, [records]);
|
|
227
|
-
const fields = useMemo(() => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return createElement(Preview, {
|
|
235
|
-
item: item,
|
|
236
|
-
viewType: view.type
|
|
237
|
-
});
|
|
238
|
-
},
|
|
239
|
-
minWidth: 120,
|
|
240
|
-
maxWidth: 120,
|
|
241
|
-
enableSorting: false
|
|
242
|
-
}, {
|
|
243
|
-
header: postType === TEMPLATE_POST_TYPE ? __('Template') : __('Template Part'),
|
|
244
|
-
id: 'title',
|
|
245
|
-
getValue: ({
|
|
246
|
-
item
|
|
247
|
-
}) => item.title?.rendered,
|
|
248
|
-
render: ({
|
|
249
|
-
item
|
|
250
|
-
}) => createElement(Title, {
|
|
224
|
+
const fields = useMemo(() => [{
|
|
225
|
+
header: __('Preview'),
|
|
226
|
+
id: 'preview',
|
|
227
|
+
render: ({
|
|
228
|
+
item
|
|
229
|
+
}) => {
|
|
230
|
+
return createElement(Preview, {
|
|
251
231
|
item: item,
|
|
252
232
|
viewType: view.type
|
|
253
|
-
}),
|
|
254
|
-
maxWidth: 400,
|
|
255
|
-
enableHiding: false,
|
|
256
|
-
enableGlobalSearch: true
|
|
257
|
-
}];
|
|
258
|
-
if (postType === TEMPLATE_POST_TYPE) {
|
|
259
|
-
_fields.push({
|
|
260
|
-
header: __('Description'),
|
|
261
|
-
id: 'description',
|
|
262
|
-
render: ({
|
|
263
|
-
item
|
|
264
|
-
}) => {
|
|
265
|
-
return item.description ? createElement("span", {
|
|
266
|
-
className: "page-templates-description"
|
|
267
|
-
}, decodeEntities(item.description)) : view.type === LAYOUT_TABLE && createElement(Fragment, null, createElement(Text, {
|
|
268
|
-
variant: "muted",
|
|
269
|
-
"aria-hidden": "true"
|
|
270
|
-
}, "\u2014"), createElement(VisuallyHidden, null, __('No description.')));
|
|
271
|
-
},
|
|
272
|
-
maxWidth: 400,
|
|
273
|
-
minWidth: 320,
|
|
274
|
-
enableSorting: false,
|
|
275
|
-
enableGlobalSearch: true
|
|
276
233
|
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
234
|
+
},
|
|
235
|
+
minWidth: 120,
|
|
236
|
+
maxWidth: 120,
|
|
237
|
+
enableSorting: false
|
|
238
|
+
}, {
|
|
239
|
+
header: __('Template'),
|
|
240
|
+
id: 'title',
|
|
241
|
+
getValue: ({
|
|
242
|
+
item
|
|
243
|
+
}) => item.title?.rendered,
|
|
244
|
+
render: ({
|
|
245
|
+
item
|
|
246
|
+
}) => createElement(Title, {
|
|
247
|
+
item: item,
|
|
248
|
+
viewType: view.type
|
|
249
|
+
}),
|
|
250
|
+
maxWidth: 400,
|
|
251
|
+
enableHiding: false,
|
|
252
|
+
enableGlobalSearch: true
|
|
253
|
+
}, {
|
|
254
|
+
header: __('Description'),
|
|
255
|
+
id: 'description',
|
|
256
|
+
render: ({
|
|
257
|
+
item
|
|
258
|
+
}) => {
|
|
259
|
+
return item.description ? createElement("span", {
|
|
260
|
+
className: "page-templates-description"
|
|
261
|
+
}, decodeEntities(item.description)) : view.type === LAYOUT_TABLE && createElement(Fragment, null, createElement(Text, {
|
|
262
|
+
variant: "muted",
|
|
263
|
+
"aria-hidden": "true"
|
|
264
|
+
}, "\u2014"), createElement(VisuallyHidden, null, __('No description.')));
|
|
265
|
+
},
|
|
266
|
+
maxWidth: 400,
|
|
267
|
+
minWidth: 320,
|
|
268
|
+
enableSorting: false,
|
|
269
|
+
enableGlobalSearch: true
|
|
270
|
+
}, {
|
|
271
|
+
header: __('Author'),
|
|
272
|
+
id: 'author',
|
|
273
|
+
getValue: ({
|
|
274
|
+
item
|
|
275
|
+
}) => item.author_text,
|
|
276
|
+
render: ({
|
|
277
|
+
item
|
|
278
|
+
}) => {
|
|
279
|
+
return createElement(AuthorField, {
|
|
280
|
+
viewType: view.type,
|
|
281
|
+
item: item
|
|
282
|
+
});
|
|
283
|
+
},
|
|
284
|
+
elements: authors,
|
|
285
|
+
width: '1%'
|
|
286
|
+
}], [authors, view.type]);
|
|
300
287
|
const {
|
|
301
288
|
data,
|
|
302
289
|
paginationInfo
|
|
@@ -330,9 +317,9 @@ export default function PageTemplatesTemplateParts({
|
|
|
330
317
|
setView(newView);
|
|
331
318
|
}, [view.type, setView, history, params]);
|
|
332
319
|
return createElement(Page, {
|
|
333
|
-
className: "edit-site-page-
|
|
334
|
-
title:
|
|
335
|
-
actions:
|
|
320
|
+
className: "edit-site-page-templates",
|
|
321
|
+
title: __('Templates'),
|
|
322
|
+
actions: createElement(AddNewTemplate, null)
|
|
336
323
|
}, createElement(DataViews, {
|
|
337
324
|
paginationInfo: paginationInfo,
|
|
338
325
|
fields: fields,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["classnames","Icon","__experimentalText","Text","__experimentalHStack","HStack","VisuallyHidden","__","useState","useMemo","useCallback","useEffect","useEntityRecords","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","DataViews","filterSortAndPaginate","routerPrivateApis","editorPrivateApis","Async","Page","default","Link","useLink","AddNewTemplate","useAddedBy","TEMPLATE_POST_TYPE","OPERATOR_IS_ANY","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","usePatternSettings","unlock","usePostActions","ExperimentalBlockEditorProvider","useGlobalStyle","useHistory","useLocation","EMPTY_ARRAY","defaultConfigPerViewType","primaryField","mediaField","columnFields","DEFAULT_VIEW","type","search","page","perPage","sort","field","direction","hiddenFields","layout","filters","Title","item","viewType","title","rendered","linkProps","params","postId","id","postType","canvas","createElement","AuthorField","isImageLoaded","setIsImageLoaded","text","icon","imageUrl","withIcon","alignment","spacing","className","onLoad","alt","src","Preview","settings","backgroundColor","blocks","content","raw","onClick","isEmpty","length","style","TEMPLATE_ACTIONS","PageTemplates","activeView","defaultView","usedType","operator","value","view","setView","currentView","records","isResolving","isLoadingData","per_page","history","onSelectionChange","items","push","undefined","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","author","label","fields","header","render","minWidth","maxWidth","enableSorting","getValue","enableHiding","enableGlobalSearch","description","Fragment","variant","elements","width","data","paginationInfo","onActionPerformed","actionId","post","actions","onChangeView","newView","isLoading"],"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { Async } from '../async';\nimport Page from '../page';\nimport { default as Link, useLink } from '../routes/link';\nimport AddNewTemplate from '../add-new-template';\nimport { useAddedBy } from './hooks';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tOPERATOR_IS_ANY,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\n\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { usePostActions } = unlock( editorPrivateApis );\n\nconst { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(\n\tblockEditorPrivateApis\n);\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nconst defaultConfigPerViewType = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'preview',\n\t\tprimaryField: 'title',\n\t\tcolumnFields: [ 'description' ],\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'preview',\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'preview' ],\n\tlayout: defaultConfigPerViewType[ LAYOUT_GRID ],\n\tfilters: [],\n};\n\nfunction Title( { item, viewType } ) {\n\tif ( viewType === LAYOUT_LIST ) {\n\t\treturn decodeEntities( item.title?.rendered ) || __( '(no title)' );\n\t}\n\tconst linkProps = {\n\t\tparams: {\n\t\t\tpostId: item.id,\n\t\t\tpostType: item.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t};\n\treturn (\n\t\t<Link { ...linkProps }>\n\t\t\t{ decodeEntities( item.title?.rendered ) || __( '(no title)' ) }\n\t\t</Link>\n\t);\n}\n\nfunction AuthorField( { item, viewType } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\tconst withIcon = viewType !== LAYOUT_LIST;\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ withIcon && imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'page-templates-author-field__avatar',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ withIcon && ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction Preview( { item, viewType } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( item.content.raw );\n\t}, [ item.content.raw ] );\n\tconst { onClick } = useLink( {\n\t\tpostId: item.id,\n\t\tpostType: item.type,\n\t\tcanvas: 'edit',\n\t} );\n\n\tconst isEmpty = ! blocks?.length;\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName={ `page-templates-preview-field is-viewtype-${ viewType }` }\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t{ viewType === LAYOUT_LIST && ! isEmpty && (\n\t\t\t\t\t<Async>\n\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t</Async>\n\t\t\t\t) }\n\t\t\t\t{ viewType !== LAYOUT_LIST && (\n\t\t\t\t\t<button\n\t\t\t\t\t\tclassName=\"page-templates-preview-field__button\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\taria-label={ item.title?.rendered || item.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEmpty && __( 'Empty template' ) }\n\t\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t\t<Async>\n\t\t\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t\t\t</Async>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\nconst TEMPLATE_ACTIONS = [\n\t'edit-post',\n\t'reset-template',\n\t'rename-template',\n\t'view-post-revisions',\n\t'delete-template',\n];\n\nexport default function PageTemplates() {\n\tconst { params } = useLocation();\n\tconst { activeView = 'all', layout } = params;\n\tconst defaultView = useMemo( () => {\n\t\tconst usedType = layout ?? DEFAULT_VIEW.type;\n\t\treturn {\n\t\t\t...DEFAULT_VIEW,\n\t\t\ttype: usedType,\n\t\t\tlayout: defaultConfigPerViewType[ usedType ],\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t};\n\t}, [ layout, activeView ] );\n\tconst [ view, setView ] = useState( defaultView );\n\tuseEffect( () => {\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t} ) );\n\t}, [ activeView ] );\n\n\tconst { records, isResolving: isLoadingData } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst history = useHistory();\n\tconst onSelectionChange = useCallback(\n\t\t( items ) => {\n\t\t\tif ( view?.type === LAYOUT_LIST ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ].id : undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history, params, view?.type ]\n\t);\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\theader: __( 'Preview' ),\n\t\t\t\tid: 'preview',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn <Preview item={ item } viewType={ view.type } />;\n\t\t\t\t},\n\t\t\t\tminWidth: 120,\n\t\t\t\tmaxWidth: 120,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Template' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered,\n\t\t\t\trender: ( { item } ) => (\n\t\t\t\t\t<Title item={ item } viewType={ view.type } />\n\t\t\t\t),\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tenableHiding: false,\n\t\t\t\tenableGlobalSearch: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Description' ),\n\t\t\t\tid: 'description',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn item.description ? (\n\t\t\t\t\t\t<span className=\"page-templates-description\">\n\t\t\t\t\t\t\t{ decodeEntities( item.description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tview.type === LAYOUT_TABLE && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<Text variant=\"muted\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t—\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'No description.' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\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},\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tminWidth: 320,\n\t\t\t\tenableSorting: false,\n\t\t\t\tenableGlobalSearch: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item.author_text,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn <AuthorField viewType={ view.type } item={ item } />;\n\t\t\t\t},\n\t\t\t\telements: authors,\n\t\t\t\twidth: '1%',\n\t\t\t},\n\t\t],\n\t\t[ authors, view.type ]\n\t);\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tif ( actionId === 'edit-post' ) {\n\t\t\t\tconst post = items[ 0 ];\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst actions = usePostActions( onActionPerformed, TEMPLATE_ACTIONS );\n\n\tconst onChangeView = useCallback(\n\t\t( newView ) => {\n\t\t\tif ( newView.type !== view.type ) {\n\t\t\t\tnewView = {\n\t\t\t\t\t...newView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...defaultConfigPerViewType[ newView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tsetView( newView );\n\t\t},\n\t\t[ view.type, setView, history, params ]\n\t);\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={ <AddNewTemplate /> }\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonSelectionChange={ onSelectionChange }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,IAAI,EACJC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,cAAc,QACR,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,QAAQ,oBAAoB;AAC9E,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SACCC,YAAY,EACZC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,SAAS,EAAE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AAI,CAAC9F,IAAI;QACnBoB,MAAM,EAAE;MACT,CAAE,CAAC;IACJ;EACD,CAAC,EACD,CAAEuC,OAAO,CACV,CAAC;EAED,MAAMoC,OAAO,GAAG1G,cAAc,CAAEuG,iBAAiB,EAAE/C,gBAAiB,CAAC;EAErE,MAAMmD,YAAY,GAAGrI,WAAW,CAC7BsI,OAAO,IAAM;IACd,IAAKA,OAAO,CAACjG,IAAI,KAAKoD,IAAI,CAACpD,IAAI,EAAG;MACjCiG,OAAO,GAAG;QACT,GAAGA,OAAO;QACVzF,MAAM,EAAE;UACP,GAAGb,wBAAwB,CAAEsG,OAAO,CAACjG,IAAI;QAC1C;MACD,CAAC;MAED2D,OAAO,CAACG,IAAI,CAAE;QACb,GAAG9C,MAAM;QACTR,MAAM,EAAEyF,OAAO,CAACjG;MACjB,CAAE,CAAC;IACJ;IAEAqD,OAAO,CAAE4C,OAAQ,CAAC;EACnB,CAAC,EACD,CAAE7C,IAAI,CAACpD,IAAI,EAAEqD,OAAO,EAAEM,OAAO,EAAE3C,MAAM,CACtC,CAAC;EAED,OACCK,aAAA,CAAC7C,IAAI;IACJuD,SAAS,EAAC,0BAA0B;IACpClB,KAAK,EAAGrD,EAAE,CAAE,WAAY,CAAG;IAC3BuI,OAAO,EAAG1E,aAAA,CAACzC,cAAc,MAAE;EAAG,GAE9ByC,aAAA,CAAClD,SAAS;IACTwH,cAAc,EAAGA,cAAgB;IACjCf,MAAM,EAAGA,MAAQ;IACjBmB,OAAO,EAAGA,OAAS;IACnBL,IAAI,EAAGA,IAAM;IACbQ,SAAS,EAAGzC,aAAe;IAC3BL,IAAI,EAAGA,IAAM;IACb4C,YAAY,EAAGA,YAAc;IAC7BpC,iBAAiB,EAAGA;EAAmB,CACvC,CACI,CAAC;AAET","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ import { createElement } from "react";
|
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
6
|
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
|
|
7
7
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
8
|
-
import { getQueryArgs } from '@wordpress/url';
|
|
9
8
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -19,7 +18,8 @@ const {
|
|
|
19
18
|
DuplicatePatternModal
|
|
20
19
|
} = unlock(patternsPrivateApis);
|
|
21
20
|
const {
|
|
22
|
-
useHistory
|
|
21
|
+
useHistory,
|
|
22
|
+
useLocation
|
|
23
23
|
} = unlock(routerPrivateApis);
|
|
24
24
|
const {
|
|
25
25
|
interfaceStore
|
|
@@ -29,9 +29,11 @@ export default function PatternDuplicateModal() {
|
|
|
29
29
|
record
|
|
30
30
|
} = useEditedEntityRecord();
|
|
31
31
|
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
params: {
|
|
33
|
+
categoryType,
|
|
34
|
+
categoryId
|
|
35
|
+
}
|
|
36
|
+
} = useLocation();
|
|
35
37
|
const {
|
|
36
38
|
closeModal
|
|
37
39
|
} = useDispatch(interfaceStore);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","privateApis","patternsPrivateApis","routerPrivateApis","
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","privateApis","patternsPrivateApis","routerPrivateApis","editorPrivateApis","PATTERN_MODALS","PATTERN_TYPES","unlock","useEditedEntityRecord","DuplicatePatternModal","useHistory","useLocation","interfaceStore","PatternDuplicateModal","record","params","categoryType","categoryId","closeModal","history","isActive","select","isModalActive","duplicate","onSuccess","pattern","newPattern","push","postType","user","postId","id","createElement","onClose"],"sources":["@wordpress/edit-site/src/components/pattern-modal/duplicate.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { PATTERN_MODALS } from './';\nimport { PATTERN_TYPES } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\nconst { DuplicatePatternModal } = unlock( patternsPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { interfaceStore } = unlock( editorPrivateApis );\n\nexport default function PatternDuplicateModal() {\n\tconst { record } = useEditedEntityRecord();\n\tconst {\n\t\tparams: { categoryType, categoryId },\n\t} = useLocation();\n\tconst { closeModal } = useDispatch( interfaceStore );\n\tconst history = useHistory();\n\n\tconst isActive = useSelect( ( select ) =>\n\t\tselect( interfaceStore ).isModalActive( PATTERN_MODALS.duplicate )\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\tfunction onSuccess( { pattern: newPattern } ) {\n\t\thistory.push( {\n\t\t\tcategoryType,\n\t\t\tcategoryId,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tpostId: newPattern.id,\n\t\t} );\n\n\t\tcloseModal();\n\t}\n\n\treturn (\n\t\t<DuplicatePatternModal\n\t\t\tonClose={ closeModal }\n\t\t\tonSuccess={ onSuccess }\n\t\t\tpattern={ record }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASF,WAAW,IAAIG,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,cAAc,QAAQ,IAAI;AACnC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,qBAAqB,MAAM,6BAA6B;AAE/D,MAAM;EAAEC;AAAsB,CAAC,GAAGF,MAAM,CAAEL,mBAAoB,CAAC;AAC/D,MAAM;EAAEQ,UAAU;EAAEC;AAAY,CAAC,GAAGJ,MAAM,CAAEJ,iBAAkB,CAAC;AAC/D,MAAM;EAAES;AAAe,CAAC,GAAGL,MAAM,CAAEH,iBAAkB,CAAC;AAEtD,eAAe,SAASS,qBAAqBA,CAAA,EAAG;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAGN,qBAAqB,CAAC,CAAC;EAC1C,MAAM;IACLO,MAAM,EAAE;MAAEC,YAAY;MAAEC;IAAW;EACpC,CAAC,GAAGN,WAAW,CAAC,CAAC;EACjB,MAAM;IAAEO;EAAW,CAAC,GAAGnB,WAAW,CAAEa,cAAe,CAAC;EACpD,MAAMO,OAAO,GAAGT,UAAU,CAAC,CAAC;EAE5B,MAAMU,QAAQ,GAAGpB,SAAS,CAAIqB,MAAM,IACnCA,MAAM,CAAET,cAAe,CAAC,CAACU,aAAa,CAAEjB,cAAc,CAACkB,SAAU,CAClE,CAAC;EAED,IAAK,CAAEH,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,SAASI,SAASA,CAAE;IAAEC,OAAO,EAAEC;EAAW,CAAC,EAAG;IAC7CP,OAAO,CAACQ,IAAI,CAAE;MACbX,YAAY;MACZC,UAAU;MACVW,QAAQ,EAAEtB,aAAa,CAACuB,IAAI;MAC5BC,MAAM,EAAEJ,UAAU,CAACK;IACpB,CAAE,CAAC;IAEHb,UAAU,CAAC,CAAC;EACb;EAEA,OACCc,aAAA,CAACvB,qBAAqB;IACrBwB,OAAO,EAAGf,UAAY;IACtBM,SAAS,EAAGA,SAAW;IACvBC,OAAO,EAAGX;EAAQ,CAClB,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ import { createElement } from "react";
|
|
|
9
9
|
import { store as editorStore } from '@wordpress/editor';
|
|
10
10
|
import { useSelect } from '@wordpress/data';
|
|
11
11
|
import { createSlotFill } from '@wordpress/components';
|
|
12
|
+
import deprecated from '@wordpress/deprecated';
|
|
12
13
|
const {
|
|
13
14
|
Fill,
|
|
14
15
|
Slot
|
|
@@ -16,6 +17,11 @@ const {
|
|
|
16
17
|
const PluginTemplateSettingPanel = ({
|
|
17
18
|
children
|
|
18
19
|
}) => {
|
|
20
|
+
deprecated('wp.editSite.PluginTemplateSettingPanel', {
|
|
21
|
+
since: '6.6',
|
|
22
|
+
version: '6.8',
|
|
23
|
+
alternative: 'wp.editor.PluginDocumentSettingPanel'
|
|
24
|
+
});
|
|
19
25
|
const isCurrentEntityTemplate = useSelect(select => select(editorStore).getCurrentPostType() === 'wp_template', []);
|
|
20
26
|
if (!isCurrentEntityTemplate) {
|
|
21
27
|
return null;
|
|
@@ -28,6 +34,8 @@ PluginTemplateSettingPanel.Slot = Slot;
|
|
|
28
34
|
* Renders items in the Template Sidebar below the main information
|
|
29
35
|
* like the Template Card.
|
|
30
36
|
*
|
|
37
|
+
* @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead.
|
|
38
|
+
*
|
|
31
39
|
* @example
|
|
32
40
|
* ```jsx
|
|
33
41
|
* // Using ESNext syntax
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","editorStore","useSelect","createSlotFill","Fill","Slot","PluginTemplateSettingPanel","children","isCurrentEntityTemplate","select","getCurrentPostType","createElement"],"sources":["@wordpress/edit-site/src/components/plugin-template-setting-panel/index.js"],"sourcesContent":["/**\n * Defines an extensibility slot for the Template sidebar.\n */\n\n/**\n * WordPress dependencies\n */\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill, Slot } = createSlotFill( 'PluginTemplateSettingPanel' );\n\nconst PluginTemplateSettingPanel = ( { children } ) => {\n\tconst isCurrentEntityTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\tif ( ! isCurrentEntityTemplate ) {\n\t\treturn null;\n\t}\n\treturn <Fill>{ children }</Fill>;\n};\n\nPluginTemplateSettingPanel.Slot = Slot;\n\n/**\n * Renders items in the Template Sidebar below the main information\n * like the Template Card.\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { PluginTemplateSettingPanel } from '@wordpress/edit-site';\n *\n * const MyTemplateSettingTest = () => (\n * \t\t<PluginTemplateSettingPanel>\n *\t\t\t<p>Hello, World!</p>\n *\t\t</PluginTemplateSettingPanel>\n *\t);\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nexport default PluginTemplateSettingPanel;\n"],"mappings":";AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,uBAAuB;
|
|
1
|
+
{"version":3,"names":["store","editorStore","useSelect","createSlotFill","deprecated","Fill","Slot","PluginTemplateSettingPanel","children","since","version","alternative","isCurrentEntityTemplate","select","getCurrentPostType","createElement"],"sources":["@wordpress/edit-site/src/components/plugin-template-setting-panel/index.js"],"sourcesContent":["/**\n * Defines an extensibility slot for the Template sidebar.\n */\n\n/**\n * WordPress dependencies\n */\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { createSlotFill } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\nconst { Fill, Slot } = createSlotFill( 'PluginTemplateSettingPanel' );\n\nconst PluginTemplateSettingPanel = ( { children } ) => {\n\tdeprecated( 'wp.editSite.PluginTemplateSettingPanel', {\n\t\tsince: '6.6',\n\t\tversion: '6.8',\n\t\talternative: 'wp.editor.PluginDocumentSettingPanel',\n\t} );\n\tconst isCurrentEntityTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\tif ( ! isCurrentEntityTemplate ) {\n\t\treturn null;\n\t}\n\treturn <Fill>{ children }</Fill>;\n};\n\nPluginTemplateSettingPanel.Slot = Slot;\n\n/**\n * Renders items in the Template Sidebar below the main information\n * like the Template Card.\n *\n * @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead.\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { PluginTemplateSettingPanel } from '@wordpress/edit-site';\n *\n * const MyTemplateSettingTest = () => (\n * \t\t<PluginTemplateSettingPanel>\n *\t\t\t<p>Hello, World!</p>\n *\t\t</PluginTemplateSettingPanel>\n *\t);\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nexport default PluginTemplateSettingPanel;\n"],"mappings":";AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,OAAOC,UAAU,MAAM,uBAAuB;AAE9C,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGH,cAAc,CAAE,4BAA6B,CAAC;AAErE,MAAMI,0BAA0B,GAAGA,CAAE;EAAEC;AAAS,CAAC,KAAM;EACtDJ,UAAU,CAAE,wCAAwC,EAAE;IACrDK,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE,KAAK;IACdC,WAAW,EAAE;EACd,CAAE,CAAC;EACH,MAAMC,uBAAuB,GAAGV,SAAS,CACtCW,MAAM,IACPA,MAAM,CAAEZ,WAAY,CAAC,CAACa,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EACD,IAAK,CAAEF,uBAAuB,EAAG;IAChC,OAAO,IAAI;EACZ;EACA,OAAOG,aAAA,CAACV,IAAI,QAAGG,QAAgB,CAAC;AACjC,CAAC;AAEDD,0BAA0B,CAACD,IAAI,GAAGA,IAAI;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,0BAA0B","ignoreList":[]}
|
|
@@ -161,11 +161,12 @@ function ResizableFrame({
|
|
|
161
161
|
},
|
|
162
162
|
visible: {
|
|
163
163
|
opacity: 1,
|
|
164
|
-
left: -
|
|
164
|
+
left: -14 // Account for the handle's width.
|
|
165
165
|
},
|
|
166
166
|
active: {
|
|
167
167
|
opacity: 1,
|
|
168
|
-
left: -
|
|
168
|
+
left: -14,
|
|
169
|
+
// Account for the handle's width.
|
|
169
170
|
scaleY: 1.3
|
|
170
171
|
}
|
|
171
172
|
};
|
|
@@ -182,10 +183,12 @@ function ResizableFrame({
|
|
|
182
183
|
variants: frameAnimationVariants,
|
|
183
184
|
animate: isFullWidth ? 'fullWidth' : 'default',
|
|
184
185
|
onAnimationComplete: definition => {
|
|
185
|
-
if (definition === 'fullWidth')
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
if (definition === 'fullWidth') {
|
|
187
|
+
setFrameSize({
|
|
188
|
+
width: '100%',
|
|
189
|
+
height: '100%'
|
|
190
|
+
});
|
|
191
|
+
}
|
|
189
192
|
},
|
|
190
193
|
transition: FRAME_TRANSITION,
|
|
191
194
|
size: frameSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useState","useRef","ResizableBox","Tooltip","__unstableMotion","motion","useInstanceId","useDispatch","useSelect","__","unlock","store","editSiteStore","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","INITIAL_FRAME_SIZE","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isOversized","setIsOversized","isReady","children","defaultSize","innerContentStyle","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","canvasMode","select","getCanvasMode","setCanvasMode","FRAME_TRANSITION","type","duration","frameRef","resizableHandleHelpId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","createElement","as","div","initial","variants","animate","onAnimationComplete","definition","transition","size","enable","topRight","bottomRight","bottomLeft","topLeft","handleClasses","handleStyles","minWidth","maxWidth","maxHeight","onFocus","onBlur","onMouseOver","onMouseOut","handleComponent","Fragment","text","button","role","className","onKeyDown","exit","whileFocus","whileHover","id","onResizeStart","onResize","onResizeStop","showHandle","style"],"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta = step * ( event.key === 'ArrowLeft' ? 1 : -1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\tleft: 0,\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' )\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t} }\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\tleft: isReady,\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight={ '100%' }\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: canvasMode === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t\t\t\t{ /* Disable reason: role=\"separator\" does in fact support aria-valuenow */ }\n\t\t\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }\n\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\tframeRef.current?.resizable?.offsetWidth ||\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResizableHandleKeyDown }\n\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\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),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ classnames( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,OAAO,EACPC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;;AAEpD;AACA,MAAMC,sBAAsB,GAAG;EAC9BC,QAAQ,EAAEC,SAAS;EACnBC,UAAU,EAAED,SAAS;EACrBE,MAAM,EAAEF,SAAS;EACjBG,KAAK,EAAEH,SAAS;EAChBI,MAAM,EAAEJ,SAAS;EACjBK,GAAG,EAAEL,SAAS;EACdM,KAAK,EAAEN,SAAS;EAChBO,MAAM,EAAEP,SAAS;EACjBQ,IAAI,EAAER;AACP,CAAC;;AAED;AACA,MAAMS,eAAe,GAAG,GAAG;AAC3B;AACA,MAAMC,qBAAqB,GAAG,IAAI;AAClC;AACA,MAAMC,yBAAyB,GAAG,CAAC,GAAG,IAAI;AAC1C;AACA;AACA;AACA,MAAMC,kCAAkC,GAAG,GAAG;AAC9C;AACA,MAAMC,kBAAkB,GAAG;EAAEV,KAAK,EAAE,MAAM;EAAEC,MAAM,EAAE;AAAO,CAAC;AAE5D,SAASU,kBAAkBA,CAAEX,KAAK,EAAEY,kBAAkB,EAAG;EACxD,MAAMC,IAAI,GAAGA,C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AAC+B,OAAO,EAAEC,SAAS,EAAEzB,WAAW,IACxCzD,SACA;QACD,iBAAgBS,eAAiB;QACjC,iBAAgBsB,WAAW,CAAC5B,KAAO;QACnCyH,SAAS,EAAGnD,4BAA8B;QAC1CwB,OAAO,EAAC,QAAQ;QAChB4B,IAAI,EAAC,QAAQ;QACbC,UAAU,EAAC,QAAQ;QACnBC,UAAU,EAAC;MAAQ,CACnB,CACO,CAAC,EACVjC,aAAA;QAAKN,MAAM;QAACwC,EAAE,EAAG7E;MAAuB,GACrCzD,EAAE,CACH,gGACD,CACI,CACJ;IAEJ,CAAG;IACHuI,aAAa,EAAG5E,iBAAmB;IACnC6E,QAAQ,EAAGxE,YAAc;IACzByE,YAAY,EAAG9D,gBAAkB;IACjCsD,SAAS,EAAG3I,UAAU,CAAE,kCAAkC,EAAE;MAC3D,aAAa,EAAEqD;IAChB,CAAE,CAAG;IACL+F,UAAU,EAAG,KAAO,CAAC;EAAA,GAErBtC,aAAA;IACC6B,SAAS,EAAC,0CAA0C;IACpDU,KAAK,EAAGrG;EAAmB,GAEzBF,QACE,CACQ,CAAC;AAEjB;AAEA,eAAeL,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["classnames","useState","useRef","ResizableBox","Tooltip","__unstableMotion","motion","useInstanceId","useDispatch","useSelect","__","unlock","store","editSiteStore","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","INITIAL_FRAME_SIZE","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isOversized","setIsOversized","isReady","children","defaultSize","innerContentStyle","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","canvasMode","select","getCanvasMode","setCanvasMode","FRAME_TRANSITION","type","duration","frameRef","resizableHandleHelpId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","createElement","as","div","initial","variants","animate","onAnimationComplete","definition","transition","size","enable","topRight","bottomRight","bottomLeft","topLeft","handleClasses","handleStyles","minWidth","maxWidth","maxHeight","onFocus","onBlur","onMouseOver","onMouseOut","handleComponent","Fragment","text","button","role","className","onKeyDown","exit","whileFocus","whileHover","id","onResizeStart","onResize","onResizeStop","showHandle","style"],"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta = step * ( event.key === 'ArrowLeft' ? 1 : -1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\tleft: 0,\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\tleft: -14, // Account for the handle's width.\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\tleft: -14, // Account for the handle's width.\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' ) {\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t\t}\n\t\t\t} }\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\tleft: isReady,\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight={ '100%' }\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: canvasMode === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t\t\t\t{ /* Disable reason: role=\"separator\" does in fact support aria-valuenow */ }\n\t\t\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }\n\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\tframeRef.current?.resizable?.offsetWidth ||\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResizableHandleKeyDown }\n\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\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),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ classnames( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,OAAO,EACPC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;;AAEpD;AACA,MAAMC,sBAAsB,GAAG;EAC9BC,QAAQ,EAAEC,SAAS;EACnBC,UAAU,EAAED,SAAS;EACrBE,MAAM,EAAEF,SAAS;EACjBG,KAAK,EAAEH,SAAS;EAChBI,MAAM,EAAEJ,SAAS;EACjBK,GAAG,EAAEL,SAAS;EACdM,KAAK,EAAEN,SAAS;EAChBO,MAAM,EAAEP,SAAS;EACjBQ,IAAI,EAAER;AACP,CAAC;;AAED;AACA,MAAMS,eAAe,GAAG,GAAG;AAC3B;AACA,MAAMC,qBAAqB,GAAG,IAAI;AAClC;AACA,MAAMC,yBAAyB,GAAG,CAAC,GAAG,IAAI;AAC1C;AACA;AACA;AACA,MAAMC,kCAAkC,GAAG,GAAG;AAC9C;AACA,MAAMC,kBAAkB,GAAG;EAAEV,KAAK,EAAE,MAAM;EAAEC,MAAM,EAAE;AAAO,CAAC;AAE5D,SAASU,kBAAkBA,CAAEX,KAAK,EAAEY,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AAE,CAAE,gBAAiB,CAAG;QACrC,oBAAmByD,qBAAuB;QAC1C,iBACCD,QAAQ,CAAC+B,OAAO,EAAEC,SAAS,EAAEzB,WAAW,IACxCzD,SACA;QACD,iBAAgBS,eAAiB;QACjC,iBAAgBsB,WAAW,CAAC5B,KAAO;QACnCyH,SAAS,EAAGnD,4BAA8B;QAC1CwB,OAAO,EAAC,QAAQ;QAChB4B,IAAI,EAAC,QAAQ;QACbC,UAAU,EAAC,QAAQ;QACnBC,UAAU,EAAC;MAAQ,CACnB,CACO,CAAC,EACVjC,aAAA;QAAKN,MAAM;QAACwC,EAAE,EAAG7E;MAAuB,GACrCzD,EAAE,CACH,gGACD,CACI,CACJ;IAEJ,CAAG;IACHuI,aAAa,EAAG5E,iBAAmB;IACnC6E,QAAQ,EAAGxE,YAAc;IACzByE,YAAY,EAAG9D,gBAAkB;IACjCsD,SAAS,EAAG3I,UAAU,CAAE,kCAAkC,EAAE;MAC3D,aAAa,EAAEqD;IAChB,CAAE,CAAG;IACL+F,UAAU,EAAG,KAAO,CAAC;EAAA,GAErBtC,aAAA;IACC6B,SAAS,EAAC,0CAA0C;IACpDU,KAAK,EAAGrG;EAAmB,GAEzBF,QACE,CACQ,CAAC;AAEjB;AAEA,eAAeL,cAAc","ignoreList":[]}
|
|
@@ -9,7 +9,7 @@ import { useCallback, useContext, useEffect, useRef } from '@wordpress/element';
|
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
10
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
12
|
+
import { PageAttributesPanel, PostDiscussionPanel, PostLastRevisionPanel, PostTaxonomiesPanel, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -26,7 +26,8 @@ const {
|
|
|
26
26
|
} = unlock(componentsPrivateApis);
|
|
27
27
|
const {
|
|
28
28
|
interfaceStore,
|
|
29
|
-
useAutoSwitchEditorSidebars
|
|
29
|
+
useAutoSwitchEditorSidebars,
|
|
30
|
+
PatternOverridesPanel
|
|
30
31
|
} = unlock(editorPrivateApis);
|
|
31
32
|
const {
|
|
32
33
|
Slot: InspectorSlot,
|
|
@@ -85,7 +86,7 @@ const FillContents = ({
|
|
|
85
86
|
}, createElement(Tabs.TabPanel, {
|
|
86
87
|
tabId: "edit-post/document",
|
|
87
88
|
focusable: false
|
|
88
|
-
}, isEditingPage ? createElement(PagePanels, null) : createElement(TemplatePanel, null)), createElement(Tabs.TabPanel, {
|
|
89
|
+
}, isEditingPage ? createElement(PagePanels, null) : createElement(TemplatePanel, null), createElement(PostLastRevisionPanel, null), createElement(PostTaxonomiesPanel, null), createElement(PostDiscussionPanel, null), createElement(PageAttributesPanel, null), createElement(PatternOverridesPanel, null)), createElement(Tabs.TabPanel, {
|
|
89
90
|
tabId: "edit-post/block",
|
|
90
91
|
focusable: false
|
|
91
92
|
}, createElement(InspectorSlot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createSlotFill","privateApis","componentsPrivateApis","isRTL","__","drawerLeft","drawerRight","useCallback","useContext","useEffect","useRef","useSelect","useDispatch","store","blockEditorStore","coreStore","editorPrivateApis","DefaultSidebar","GlobalStylesSidebar","SettingsHeader","PagePanels","TemplatePanel","editSiteStore","unlock","Tabs","interfaceStore","useAutoSwitchEditorSidebars","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","FillContents","tabName","isEditingPage","supportsGlobalStyles","tabListRef","tabsContextValue","Context","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","createElement","Fragment","identifier","title","icon","closeLabel","header","Provider","value","ref","headerClassName","className","isActiveByDefault","TabPanel","tabId","focusable","bubblesVirtually","SidebarComplementaryAreaFills","select","sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","getBlockSelectionStart","getCurrentTheme","is_block_theme","isPage","enableComplementaryArea","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\nconst { interfaceStore, useAutoSwitchEditorSidebars } =\n\tunlock( editorPrivateApis );\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( { tabName, isEditingPage, supportsGlobalStyles } ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ tabName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t\tisActiveByDefault\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId=\"edit-post/document\"\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId=\"edit-post/block\" focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, supportsGlobalStyles, isEditingPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\t'edit-post/block',\n\t\t\t\t'edit-post/document',\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? 'edit-post/block'\n\t\t\t\t\t: 'edit-post/document';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tsupportsGlobalStyles:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\ttabName={ tabName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASd,WAAW,IAAIe,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASR,KAAK,IAAIS,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAK,CAAC,GAAGD,MAAM,CAAErB,qBAAsB,CAAC;AAChD,MAAM;EAAEuB,cAAc;EAAEC;AAA4B,CAAC,GACpDH,MAAM,CAAEP,iBAAkB,CAAC;AAC5B,MAAM;EAAEW,IAAI,EAAEC,aAAa;EAAEC,IAAI,EAAEC;AAAc,CAAC,GAAG9B,cAAc,CAClE,0BACD,CAAC;A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AM,CACnB1D,gBACD,CAAC,CAACgE,sBAAsB,CAAC,CAAC,GACvB,iBAAiB,GACjB,oBAAoB;IACxB;IAEA,OAAO;MACN7C,OAAO,EAAE4C,QAAQ;MACjB1C,oBAAoB,EACnBqC,MAAM,CAAEzD,SAAU,CAAC,CAACgE,eAAe,CAAC,CAAC,EAAEC,cAAc;MACtD9C,aAAa,EAAEsC,MAAM,CAAElD,aAAc,CAAC,CAAC2D,MAAM,CAAC;IAC/C,CAAC;EACF,CAAC,EACD,EACD,CAAC;EACD,MAAM;IAAEC;EAAwB,CAAC,GAAGtE,WAAW,CAAEa,cAAe,CAAC;;EAEjE;EACA;EACA;EACA;EACA,MAAM0D,WAAW,GAAG5E,WAAW,CAC5B6E,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BF,uBAAuB,CAAE,MAAM,EAAEE,gBAAiB,CAAC;IACpD;EACD,CAAC,EACD,CAAEF,uBAAuB,CAC1B,CAAC;EAED,OACC5B,aAAA,CAAC9B,IAAI;IACJ6D,aAAa,EAAGpD,OAAS;IACzBqD,QAAQ,EAAGH,WAAa;IACxBI,YAAY,EAAG;EAAO,GAEtBjC,aAAA,CAACtB,YAAY;IACZC,OAAO,EAAGA,OAAS;IACnBC,aAAa,EAAGA,aAAe;IAC/BC,oBAAoB,EAAGA;EAAsB,CAC7C,CACI,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createSlotFill","privateApis","componentsPrivateApis","isRTL","__","drawerLeft","drawerRight","useCallback","useContext","useEffect","useRef","useSelect","useDispatch","store","blockEditorStore","coreStore","PageAttributesPanel","PostDiscussionPanel","PostLastRevisionPanel","PostTaxonomiesPanel","editorPrivateApis","DefaultSidebar","GlobalStylesSidebar","SettingsHeader","PagePanels","TemplatePanel","editSiteStore","unlock","Tabs","interfaceStore","useAutoSwitchEditorSidebars","PatternOverridesPanel","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","FillContents","tabName","isEditingPage","supportsGlobalStyles","tabListRef","tabsContextValue","Context","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","createElement","Fragment","identifier","title","icon","closeLabel","header","Provider","value","ref","headerClassName","className","isActiveByDefault","TabPanel","tabId","focusable","bubblesVirtually","SidebarComplementaryAreaFills","select","sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","getBlockSelectionStart","getCurrentTheme","is_block_theme","isPage","enableComplementaryArea","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPageAttributesPanel,\n\tPostDiscussionPanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\nconst { interfaceStore, useAutoSwitchEditorSidebars, PatternOverridesPanel } =\n\tunlock( editorPrivateApis );\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( { tabName, isEditingPage, supportsGlobalStyles } ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ tabName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t\tisActiveByDefault\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId=\"edit-post/document\"\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t\t<PostLastRevisionPanel />\n\t\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId=\"edit-post/block\" focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, supportsGlobalStyles, isEditingPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\t'edit-post/block',\n\t\t\t\t'edit-post/document',\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? 'edit-post/block'\n\t\t\t\t\t: 'edit-post/document';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tsupportsGlobalStyles:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\ttabName={ tabName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SACCC,mBAAmB,EACnBC,mBAAmB,EACnBC,qBAAqB,EACrBC,mBAAm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