@wordpress/edit-site 5.10.0 → 5.12.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 +4 -0
- package/build/components/add-new-page/index.js +105 -0
- package/build/components/add-new-page/index.js.map +1 -0
- package/build/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +9 -25
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +28 -41
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/index.js +4 -5
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +9 -12
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +106 -80
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +71 -120
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/back-button.js +1 -3
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/block-inspector-button.js +3 -4
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +6 -7
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +14 -13
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +25 -42
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +6 -7
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +5 -7
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +5 -6
- package/build/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +30 -35
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +37 -53
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +15 -9
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +8 -10
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +7 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +4 -5
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +3 -4
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +1 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +8 -10
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +3 -4
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +4 -5
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +4 -5
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +5 -6
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +10 -14
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +41 -51
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -7
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +88 -12
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +3 -4
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +10 -17
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +26 -33
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +20 -35
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +5 -5
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +3 -4
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +11 -16
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/subtitle.js +4 -5
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +4 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +5 -6
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +49 -30
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +5 -6
- package/build/components/global-styles/variations-panel.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +99 -95
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +16 -7
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +49 -53
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +5 -14
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +41 -51
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/hooks.js +54 -0
- package/build/components/layout/hooks.js.map +1 -0
- package/build/components/layout/index.js +33 -94
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +13 -23
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/header.js +4 -7
- package/build/components/list/header.js.map +1 -1
- package/build/components/list/index.js +2 -4
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +35 -40
- package/build/components/list/table.js.map +1 -1
- package/build/components/page-actions/delete-page-menu-item.js +70 -0
- package/build/components/page-actions/delete-page-menu-item.js.map +1 -0
- package/build/components/page-actions/index.js +43 -0
- package/build/components/page-actions/index.js.map +1 -0
- package/build/components/page-content-lock/constants.js +9 -0
- package/build/components/page-content-lock/constants.js.map +1 -0
- package/build/components/page-content-lock/index.js +29 -0
- package/build/components/page-content-lock/index.js.map +1 -0
- package/build/components/page-content-lock/use-disable-non-content-blocks.js +49 -0
- package/build/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
- package/build/components/page-content-lock/use-page-content-lock-notifications.js +112 -0
- package/build/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
- package/build/components/preferences-modal/index.js +4 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +250 -0
- package/build/components/resizable-frame/index.js.map +1 -0
- package/build/components/revisions/index.js +13 -15
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +8 -12
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +1 -5
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +13 -7
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +97 -5
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +63 -17
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +12 -6
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +11 -9
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +11 -12
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +13 -10
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js +79 -0
- package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js +86 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +39 -21
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +46 -0
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -18
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
- package/build/components/sidebar-navigation-item/index.js +7 -8
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +21 -14
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +166 -12
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +24 -33
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +159 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +51 -107
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +84 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +16 -74
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +52 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build/components/sidebar-navigation-screen-page/index.js +81 -10
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +148 -0
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
- package/build/components/sidebar-navigation-screen-page/status-label.js +110 -0
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pages/index.js +128 -17
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +22 -16
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template-part/index.js +105 -0
- package/build/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +44 -24
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-subtitle/index.js +3 -4
- package/build/components/sidebar-navigation-subtitle/index.js.map +1 -1
- package/build/components/site-hub/index.js +20 -15
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +4 -5
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +15 -21
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +107 -37
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/{list/actions → template-actions}/index.js +39 -33
- package/build/components/template-actions/index.js.map +1 -0
- package/build/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
- package/build/components/template-actions/rename-menu-item.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +4 -5
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +8 -10
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +12 -18
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +8 -4
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/components/welcome-guide/image.js +4 -5
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +103 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +11 -8
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +5 -6
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +3 -6
- package/build/index.js.map +1 -1
- package/build/store/actions.js +131 -125
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +7 -10
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +32 -33
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +35 -11
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +1 -3
- package/build/store/utils.js.map +1 -1
- package/build/utils/get-is-list-page.js +3 -4
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/is-previewing-theme.js +1 -3
- package/build/utils/is-previewing-theme.js.map +1 -1
- package/build/utils/is-template-revertable.js +1 -1
- package/build/utils/is-template-revertable.js.map +1 -1
- package/build-module/components/add-new-page/index.js +93 -0
- package/build-module/components/add-new-page/index.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +10 -23
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +30 -42
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/index.js +4 -5
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +9 -12
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +105 -82
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +71 -120
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +1 -3
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/block-inspector-button.js +3 -4
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +6 -7
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +13 -13
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +25 -42
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +6 -7
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +5 -7
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +5 -6
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +31 -36
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +38 -56
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +12 -9
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +8 -10
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +7 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +4 -5
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +3 -4
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +1 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +8 -10
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +3 -4
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +4 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +4 -5
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +5 -6
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +10 -14
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +41 -51
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +4 -7
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +90 -13
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +3 -4
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +10 -17
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +26 -34
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +20 -34
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +5 -5
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +3 -4
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +12 -17
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +4 -5
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +4 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +5 -6
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +50 -31
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +5 -6
- package/build-module/components/global-styles/variations-panel.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +99 -97
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +16 -8
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +49 -53
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +5 -13
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +39 -49
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/hooks.js +41 -0
- package/build-module/components/layout/hooks.js.map +1 -0
- package/build-module/components/layout/index.js +34 -97
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +13 -23
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/header.js +4 -7
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/list/index.js +2 -4
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +34 -39
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/page-actions/delete-page-menu-item.js +58 -0
- package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -0
- package/build-module/components/page-actions/index.js +30 -0
- package/build-module/components/page-actions/index.js.map +1 -0
- package/build-module/components/page-content-lock/constants.js +2 -0
- package/build-module/components/page-content-lock/constants.js.map +1 -0
- package/build-module/components/page-content-lock/index.js +14 -0
- package/build-module/components/page-content-lock/index.js.map +1 -0
- package/build-module/components/page-content-lock/use-disable-non-content-blocks.js +36 -0
- package/build-module/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
- package/build-module/components/page-content-lock/use-page-content-lock-notifications.js +98 -0
- package/build-module/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +4 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +236 -0
- package/build-module/components/resizable-frame/index.js.map +1 -0
- package/build-module/components/revisions/index.js +13 -14
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +8 -12
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +1 -5
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +13 -7
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +95 -8
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +62 -19
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +12 -6
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +9 -8
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +11 -12
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +14 -11
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js +67 -0
- package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +67 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +36 -22
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +35 -0
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/index.js +20 -19
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
- package/build-module/components/sidebar-navigation-item/index.js +7 -8
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +22 -15
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +161 -15
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +21 -32
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +138 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +49 -106
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +68 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -74
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +39 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-page/index.js +79 -14
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +131 -0
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +97 -0
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js +125 -19
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +22 -17
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template-part/index.js +86 -0
- package/build-module/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +43 -24
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +3 -4
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +21 -16
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +4 -5
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +15 -21
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +107 -38
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +92 -0
- package/build-module/components/template-actions/index.js.map +1 -0
- package/build-module/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +4 -5
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +8 -10
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +12 -18
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +8 -4
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +4 -5
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +84 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +11 -8
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +5 -6
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +3 -6
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +127 -126
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +7 -10
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +30 -33
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +31 -11
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +1 -3
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +3 -4
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +1 -3
- package/build-module/utils/is-previewing-theme.js.map +1 -1
- package/build-module/utils/is-template-revertable.js +1 -1
- package/build-module/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +477 -232
- package/build-style/style.css +478 -232
- package/package.json +40 -37
- package/src/components/add-new-page/index.js +105 -0
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
- package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +13 -26
- package/src/components/add-new-template/new-template.js +141 -154
- package/src/components/add-new-template/style.scss +79 -66
- package/src/components/block-editor/index.js +27 -17
- package/src/components/create-template-part-modal/index.js +19 -25
- package/src/components/editor/index.js +30 -53
- package/src/components/editor/style.scss +11 -1
- package/src/components/editor-canvas-container/index.js +28 -19
- package/src/components/global-styles/screen-block.js +74 -3
- package/src/components/global-styles/screen-revisions/index.js +3 -11
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +33 -25
- package/src/components/global-styles/screen-revisions/style.scss +3 -2
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +16 -3
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +22 -24
- package/src/components/global-styles/screen-root.js +5 -3
- package/src/components/global-styles/style-variations-container.js +13 -18
- package/src/components/global-styles/style.scss +3 -0
- package/src/components/global-styles/ui.js +39 -9
- package/src/components/header-edit-mode/document-actions/index.js +112 -121
- package/src/components/header-edit-mode/document-actions/style.scss +78 -54
- package/src/components/header-edit-mode/index.js +18 -0
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +1 -6
- package/src/components/layout/hooks.js +46 -0
- package/src/components/layout/index.js +47 -122
- package/src/components/layout/style.scss +8 -2
- package/src/components/list/style.scss +1 -0
- package/src/components/list/table.js +6 -2
- package/src/components/page-actions/delete-page-menu-item.js +71 -0
- package/src/components/page-actions/index.js +36 -0
- package/src/components/page-content-lock/constants.js +5 -0
- package/src/components/page-content-lock/index.js +14 -0
- package/src/components/page-content-lock/use-disable-non-content-blocks.js +44 -0
- package/src/components/page-content-lock/use-page-content-lock-notifications.js +128 -0
- package/src/components/resizable-frame/index.js +263 -0
- package/src/components/resizable-frame/style.scss +71 -0
- package/src/components/revisions/index.js +7 -7
- package/src/components/save-button/index.js +6 -0
- package/src/components/save-hub/index.js +143 -38
- package/src/components/save-hub/style.scss +6 -0
- package/src/components/save-panel/index.js +62 -15
- package/src/components/secondary-sidebar/list-view-sidebar.js +10 -2
- package/src/components/sidebar/index.js +10 -8
- package/src/components/sidebar/style.scss +3 -4
- package/src/components/sidebar-edit-mode/index.js +16 -14
- package/src/components/sidebar-edit-mode/page-panels/content-blocks-list.js +77 -0
- package/src/components/sidebar-edit-mode/page-panels/index.js +89 -0
- package/src/components/sidebar-edit-mode/page-panels/style.scss +10 -0
- package/src/components/sidebar-edit-mode/settings-header/index.js +51 -28
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +34 -0
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +34 -0
- package/src/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -19
- package/src/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +1 -2
- package/src/components/sidebar-edit-mode/{template-card → template-panel}/style.scss +2 -32
- package/src/components/sidebar-navigation-item/style.scss +9 -0
- package/src/components/sidebar-navigation-screen/index.js +74 -50
- package/src/components/sidebar-navigation-screen/style.scss +46 -6
- package/src/components/sidebar-navigation-screen-global-styles/index.js +212 -21
- package/src/components/sidebar-navigation-screen-global-styles/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +35 -52
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -117
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +6 -72
- package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +7 -21
- package/src/components/sidebar-navigation-screen-page/index.js +137 -24
- package/src/components/sidebar-navigation-screen-page/page-details.js +163 -0
- package/src/components/sidebar-navigation-screen-page/status-label.js +101 -0
- package/src/components/sidebar-navigation-screen-page/style.scss +80 -0
- package/src/components/sidebar-navigation-screen-pages/index.js +180 -44
- package/src/components/sidebar-navigation-screen-template/index.js +25 -22
- package/src/components/sidebar-navigation-screen-template-part/index.js +103 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +52 -13
- package/src/components/sidebar-navigation-subtitle/style.scss +2 -2
- package/src/components/site-hub/index.js +29 -15
- package/src/components/site-hub/style.scss +26 -0
- package/src/components/start-template-options/style.scss +20 -21
- package/src/components/style-book/index.js +132 -43
- package/src/components/style-book/style.scss +19 -0
- package/src/components/{list/actions → template-actions}/index.js +31 -11
- package/src/components/use-edited-entity-record/index.js +12 -3
- package/src/hooks/commands/use-edit-mode-commands.js +79 -0
- package/src/hooks/push-changes-to-global-styles/index.js +13 -7
- package/src/store/actions.js +24 -6
- package/src/store/reducer.js +20 -0
- package/src/store/selectors.js +24 -0
- package/src/store/test/actions.js +31 -0
- package/src/store/test/reducer.js +44 -0
- package/src/store/test/selectors.js +57 -0
- package/src/store/test/utils.js +15 -5
- package/src/style.scss +6 -3
- package/src/utils/is-previewing-theme.js +1 -4
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build/components/global-styles/border-panel.js +0 -135
- package/build/components/global-styles/border-panel.js.map +0 -1
- package/build/components/list/actions/index.js.map +0 -1
- package/build/components/list/actions/rename-menu-item.js.map +0 -1
- package/build/components/navigate-to-link/index.js +0 -51
- package/build/components/navigate-to-link/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build/components/template-details/edit-template-title.js +0 -42
- package/build/components/template-details/edit-template-title.js.map +0 -1
- package/build/components/template-details/index.js +0 -103
- package/build/components/template-details/index.js.map +0 -1
- package/build/components/template-details/template-areas.js +0 -166
- package/build/components/template-details/template-areas.js.map +0 -1
- package/build/components/template-details/template-part-area-selector.js +0 -48
- package/build/components/template-details/template-part-area-selector.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build-module/components/global-styles/border-panel.js +0 -125
- package/build-module/components/global-styles/border-panel.js.map +0 -1
- package/build-module/components/list/actions/index.js +0 -86
- package/build-module/components/list/actions/index.js.map +0 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +0 -1
- package/build-module/components/navigate-to-link/index.js +0 -39
- package/build-module/components/navigate-to-link/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build-module/components/template-details/edit-template-title.js +0 -33
- package/build-module/components/template-details/edit-template-title.js.map +0 -1
- package/build-module/components/template-details/index.js +0 -83
- package/build-module/components/template-details/index.js.map +0 -1
- package/build-module/components/template-details/template-areas.js +0 -145
- package/build-module/components/template-details/template-areas.js.map +0 -1
- package/build-module/components/template-details/template-part-area-selector.js +0 -36
- package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
- package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
- package/src/components/global-styles/border-panel.js +0 -114
- package/src/components/navigate-to-link/index.js +0 -46
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
- package/src/components/sidebar-navigation-screen-pages/style.scss +0 -4
- package/src/components/template-details/edit-template-title.js +0 -41
- package/src/components/template-details/index.js +0 -113
- package/src/components/template-details/style.scss +0 -72
- package/src/components/template-details/template-areas.js +0 -167
- package/src/components/template-details/template-part-area-selector.js +0 -39
- /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +0 -0
- /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +0 -0
- /package/src/components/{list/actions → template-actions}/rename-menu-item.js +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = EditTemplateTitle;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _coreData = require("@wordpress/core-data");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
function EditTemplateTitle(_ref) {
|
|
20
|
-
let {
|
|
21
|
-
template
|
|
22
|
-
} = _ref;
|
|
23
|
-
const [forceEmpty, setForceEmpty] = (0, _element.useState)(false);
|
|
24
|
-
const [title, setTitle] = (0, _coreData.useEntityProp)('postType', template.type, 'title', template.id);
|
|
25
|
-
return (0, _element.createElement)(_components.TextControl, {
|
|
26
|
-
__nextHasNoMarginBottom: true,
|
|
27
|
-
label: (0, _i18n.__)('Title'),
|
|
28
|
-
value: forceEmpty ? '' : title,
|
|
29
|
-
help: template.type !== 'wp_template_part' ? (0, _i18n.__)('Give the template a title that indicates its purpose, e.g. "Full Width".') : null,
|
|
30
|
-
onChange: newTitle => {
|
|
31
|
-
if (!newTitle && !forceEmpty) {
|
|
32
|
-
setForceEmpty(true);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setForceEmpty(false);
|
|
37
|
-
setTitle(newTitle);
|
|
38
|
-
},
|
|
39
|
-
onBlur: () => setForceEmpty(false)
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=edit-template-title.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/edit-template-title.js"],"names":["EditTemplateTitle","template","forceEmpty","setForceEmpty","title","setTitle","type","id","newTitle"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AALA;AACA;AACA;AAMe,SAASA,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,KAAV,CAAtC;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,6BAC3B,UAD2B,EAE3BJ,QAAQ,CAACK,IAFkB,EAG3B,OAH2B,EAI3BL,QAAQ,CAACM,EAJkB,CAA5B;AAOA,SACC,4BAAC,uBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,KAAK,EAAGL,UAAU,GAAG,EAAH,GAAQE,KAH3B;AAIC,IAAA,IAAI,EACHH,QAAQ,CAACK,IAAT,KAAkB,kBAAlB,GACG,cACA,0EADA,CADH,GAIG,IATL;AAWC,IAAA,QAAQ,EAAKE,QAAF,IAAgB;AAC1B,UAAK,CAAEA,QAAF,IAAc,CAAEN,UAArB,EAAkC;AACjCC,QAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AACA;;AACDA,MAAAA,aAAa,CAAE,KAAF,CAAb;AACAE,MAAAA,QAAQ,CAAEG,QAAF,CAAR;AACA,KAlBF;AAmBC,IAAA,MAAM,EAAG,MAAML,aAAa,CAAE,KAAF;AAnB7B,IADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\nexport default function EditTemplateTitle( { template } ) {\n\tconst [ forceEmpty, setForceEmpty ] = useState( false );\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\ttemplate.type,\n\t\t'title',\n\t\ttemplate.id\n\t);\n\n\treturn (\n\t\t<TextControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ forceEmpty ? '' : title }\n\t\t\thelp={\n\t\t\t\ttemplate.type !== 'wp_template_part'\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t\t\t )\n\t\t\t\t\t: null\n\t\t\t}\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tif ( ! newTitle && ! forceEmpty ) {\n\t\t\t\t\tsetForceEmpty( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetForceEmpty( false );\n\t\t\t\tsetTitle( newTitle );\n\t\t\t} }\n\t\t\tonBlur={ () => setForceEmpty( false ) }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = TemplateDetails;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
|
|
16
|
-
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
|
-
var _data = require("@wordpress/data");
|
|
19
|
-
|
|
20
|
-
var _editor = require("@wordpress/editor");
|
|
21
|
-
|
|
22
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
23
|
-
|
|
24
|
-
var _isTemplateRevertable = _interopRequireDefault(require("../../utils/is-template-revertable"));
|
|
25
|
-
|
|
26
|
-
var _store = require("../../store");
|
|
27
|
-
|
|
28
|
-
var _editTemplateTitle = _interopRequireDefault(require("./edit-template-title"));
|
|
29
|
-
|
|
30
|
-
var _link = require("../routes/link");
|
|
31
|
-
|
|
32
|
-
var _templatePartAreaSelector = _interopRequireDefault(require("./template-part-area-selector"));
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* WordPress dependencies
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Internal dependencies
|
|
40
|
-
*/
|
|
41
|
-
function TemplateDetails(_ref) {
|
|
42
|
-
let {
|
|
43
|
-
template,
|
|
44
|
-
onClose
|
|
45
|
-
} = _ref;
|
|
46
|
-
const {
|
|
47
|
-
title,
|
|
48
|
-
description
|
|
49
|
-
} = (0, _data.useSelect)(select => select(_editor.store).__experimentalGetTemplateInfo(template), []);
|
|
50
|
-
const {
|
|
51
|
-
revertTemplate
|
|
52
|
-
} = (0, _data.useDispatch)(_store.store); // TODO: We should update this to filter by template part's areas as well.
|
|
53
|
-
|
|
54
|
-
const browseAllLinkProps = (0, _link.useLink)({
|
|
55
|
-
path: '/' + template.type + '/all'
|
|
56
|
-
});
|
|
57
|
-
const isTemplatePart = template.type === 'wp_template_part'; // Only user-created and non-default templates can change the name.
|
|
58
|
-
// But any user-created template part can be renamed.
|
|
59
|
-
|
|
60
|
-
const canEditTitle = isTemplatePart ? !template.has_theme_file : template.is_custom && !template.has_theme_file;
|
|
61
|
-
|
|
62
|
-
if (!template) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const revert = () => {
|
|
67
|
-
revertTemplate(template);
|
|
68
|
-
onClose();
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (0, _element.createElement)("div", {
|
|
72
|
-
className: "edit-site-template-details"
|
|
73
|
-
}, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
74
|
-
className: "edit-site-template-details__group",
|
|
75
|
-
spacing: 3
|
|
76
|
-
}, canEditTitle ? (0, _element.createElement)(_editTemplateTitle.default, {
|
|
77
|
-
template: template
|
|
78
|
-
}) : (0, _element.createElement)(_components.__experimentalText, {
|
|
79
|
-
size: 16,
|
|
80
|
-
weight: 600,
|
|
81
|
-
className: "edit-site-template-details__title",
|
|
82
|
-
as: "p"
|
|
83
|
-
}, (0, _htmlEntities.decodeEntities)(title)), description && (0, _element.createElement)(_components.__experimentalText, {
|
|
84
|
-
size: "body",
|
|
85
|
-
className: "edit-site-template-details__description",
|
|
86
|
-
as: "p"
|
|
87
|
-
}, (0, _htmlEntities.decodeEntities)(description))), isTemplatePart && (0, _element.createElement)("div", {
|
|
88
|
-
className: "edit-site-template-details__group"
|
|
89
|
-
}, (0, _element.createElement)(_templatePartAreaSelector.default, {
|
|
90
|
-
id: template.id
|
|
91
|
-
})), (0, _isTemplateRevertable.default)(template) && (0, _element.createElement)(_components.MenuGroup, {
|
|
92
|
-
className: "edit-site-template-details__group edit-site-template-details__revert"
|
|
93
|
-
}, (0, _element.createElement)(_components.MenuItem, {
|
|
94
|
-
className: "edit-site-template-details__revert-button",
|
|
95
|
-
info: (0, _i18n.__)('Use the template as supplied by the theme.'),
|
|
96
|
-
onClick: revert
|
|
97
|
-
}, (0, _i18n.__)('Clear customizations'))), (0, _element.createElement)(_components.Button, (0, _extends2.default)({
|
|
98
|
-
className: "edit-site-template-details__show-all-button"
|
|
99
|
-
}, browseAllLinkProps, {
|
|
100
|
-
onClick: () => onClose()
|
|
101
|
-
}), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? (0, _i18n.__)('Manage all templates') : (0, _i18n.__)('Manage all template parts')));
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","path","type","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAaA;AACA;AACA;AAOe,SAASA,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyB,qBAC5BC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,6BAAtB,CAAqDN,QAArD,CAF6B,EAG9B,EAH8B,CAA/B;AAKA,QAAM;AAAEO,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B,CANgE,CAQhE;;AACA,QAAMC,kBAAkB,GAAG,mBAAS;AACnCC,IAAAA,IAAI,EAAE,MAAMV,QAAQ,CAACW,IAAf,GAAsB;AADO,GAAT,CAA3B;AAIA,QAAMC,cAAc,GAAGZ,QAAQ,CAACW,IAAT,KAAkB,kBAAzC,CAbgE,CAehE;AACA;;AACA,QAAME,YAAY,GAAGD,cAAc,GAChC,CAAEZ,QAAQ,CAACc,cADqB,GAEhCd,QAAQ,CAACe,SAAT,IAAsB,CAAEf,QAAQ,CAACc,cAFpC;;AAIA,MAAK,CAAEd,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAMgB,MAAM,GAAG,MAAM;AACpBT,IAAAA,cAAc,CAAEP,QAAF,CAAd;AACAC,IAAAA,OAAO;AACP,GAHD;;AAKA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gCAAD;AAAQ,IAAA,SAAS,EAAC,mCAAlB;AAAsD,IAAA,OAAO,EAAG;AAAhE,KACGY,YAAY,GACb,4BAAC,0BAAD;AAAmB,IAAA,QAAQ,EAAGb;AAA9B,IADa,GAGb,4BAAC,8BAAD;AACC,IAAA,IAAI,EAAG,EADR;AAEC,IAAA,MAAM,EAAG,GAFV;AAGC,IAAA,SAAS,EAAC,mCAHX;AAIC,IAAA,EAAE,EAAC;AAJJ,KAMG,kCAAgBE,KAAhB,CANH,CAJF,EAcGC,WAAW,IACZ,4BAAC,8BAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC,yCAFX;AAGC,IAAA,EAAE,EAAC;AAHJ,KAKG,kCAAgBA,WAAhB,CALH,CAfF,CADD,EA0BGS,cAAc,IACf;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iCAAD;AAA0B,IAAA,EAAE,EAAGZ,QAAQ,CAACiB;AAAxC,IADD,CA3BF,EAgCG,mCAAsBjB,QAAtB,KACD,4BAAC,qBAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,cACN,4CADM,CAFR;AAKC,IAAA,OAAO,EAAGgB;AALX,KAOG,cAAI,sBAAJ,CAPH,CADD,CAjCF,EA8CC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC;AADX,KAEMP,kBAFN;AAGC,IAAA,OAAO,EAAG,MAAMR,OAAO;AAHxB,MAKG,CAAAD,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEW,IAAV,MAAmB,aAAnB,GACC,cAAI,sBAAJ,CADD,GAEC,cAAI,2BAAJ,CAPJ,CA9CD,CADD;AA0DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\t// TODO: We should update this to filter by template part's areas as well.\n\tconst browseAllLinkProps = useLink( {\n\t\tpath: '/' + template.type + '/all',\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t\tonClick={ () => onClose() }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Manage all templates' )\n\t\t\t\t\t: __( 'Manage all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = TemplateAreas;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
|
|
16
|
-
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
|
-
var _data = require("@wordpress/data");
|
|
19
|
-
|
|
20
|
-
var _editor = require("@wordpress/editor");
|
|
21
|
-
|
|
22
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
23
|
-
|
|
24
|
-
var _icons = require("@wordpress/icons");
|
|
25
|
-
|
|
26
|
-
var _router = require("@wordpress/router");
|
|
27
|
-
|
|
28
|
-
var _store = require("../../store");
|
|
29
|
-
|
|
30
|
-
var _isTemplateRevertable = _interopRequireDefault(require("../../utils/is-template-revertable"));
|
|
31
|
-
|
|
32
|
-
var _link = require("../routes/link");
|
|
33
|
-
|
|
34
|
-
var _privateApis = require("../../private-apis");
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* WordPress dependencies
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Internal dependencies
|
|
42
|
-
*/
|
|
43
|
-
const {
|
|
44
|
-
useLocation
|
|
45
|
-
} = (0, _privateApis.unlock)(_router.privateApis);
|
|
46
|
-
|
|
47
|
-
function TemplatePartItemMore(_ref) {
|
|
48
|
-
var _templatePart$title;
|
|
49
|
-
|
|
50
|
-
let {
|
|
51
|
-
onClose,
|
|
52
|
-
templatePart,
|
|
53
|
-
closeTemplateDetailsDropdown
|
|
54
|
-
} = _ref;
|
|
55
|
-
const {
|
|
56
|
-
revertTemplate
|
|
57
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
58
|
-
const {
|
|
59
|
-
params
|
|
60
|
-
} = useLocation();
|
|
61
|
-
const editLinkProps = (0, _link.useLink)({
|
|
62
|
-
postId: templatePart.id,
|
|
63
|
-
postType: templatePart.type
|
|
64
|
-
}, {
|
|
65
|
-
fromTemplateId: params.postId
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
function editTemplatePart(event) {
|
|
69
|
-
editLinkProps.onClick(event);
|
|
70
|
-
onClose();
|
|
71
|
-
closeTemplateDetailsDropdown();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function clearCustomizations() {
|
|
75
|
-
revertTemplate(templatePart);
|
|
76
|
-
onClose();
|
|
77
|
-
closeTemplateDetailsDropdown();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, (0, _extends2.default)({}, editLinkProps, {
|
|
81
|
-
onClick: editTemplatePart
|
|
82
|
-
}), (0, _i18n.sprintf)(
|
|
83
|
-
/* translators: %s: template part title */
|
|
84
|
-
(0, _i18n.__)('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), (0, _isTemplateRevertable.default)(templatePart) && (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
85
|
-
info: (0, _i18n.__)('Use the template part as supplied by the theme.'),
|
|
86
|
-
onClick: clearCustomizations
|
|
87
|
-
}, (0, _i18n.__)('Clear customizations'))));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function TemplatePartItem(_ref2) {
|
|
91
|
-
let {
|
|
92
|
-
templatePart,
|
|
93
|
-
clientId,
|
|
94
|
-
closeTemplateDetailsDropdown
|
|
95
|
-
} = _ref2;
|
|
96
|
-
const {
|
|
97
|
-
selectBlock,
|
|
98
|
-
toggleBlockHighlight
|
|
99
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
100
|
-
const templatePartArea = (0, _data.useSelect)(select => {
|
|
101
|
-
const defaultAreas = select(_editor.store).__experimentalGetDefaultTemplatePartAreas();
|
|
102
|
-
|
|
103
|
-
return defaultAreas.find(defaultArea => defaultArea.area === templatePart.area);
|
|
104
|
-
}, [templatePart.area]);
|
|
105
|
-
|
|
106
|
-
const highlightBlock = () => toggleBlockHighlight(clientId, true);
|
|
107
|
-
|
|
108
|
-
const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
|
|
109
|
-
|
|
110
|
-
return (0, _element.createElement)("div", {
|
|
111
|
-
role: "menuitem",
|
|
112
|
-
className: "edit-site-template-details__template-areas-item"
|
|
113
|
-
}, (0, _element.createElement)(_components.MenuItem, {
|
|
114
|
-
role: "button",
|
|
115
|
-
icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon,
|
|
116
|
-
iconPosition: "left",
|
|
117
|
-
onClick: () => {
|
|
118
|
-
selectBlock(clientId);
|
|
119
|
-
},
|
|
120
|
-
onMouseOver: highlightBlock,
|
|
121
|
-
onMouseLeave: cancelHighlightBlock,
|
|
122
|
-
onFocus: highlightBlock,
|
|
123
|
-
onBlur: cancelHighlightBlock
|
|
124
|
-
}, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label), (0, _element.createElement)(_components.DropdownMenu, {
|
|
125
|
-
icon: _icons.moreVertical,
|
|
126
|
-
label: (0, _i18n.__)('More options'),
|
|
127
|
-
className: "edit-site-template-details__template-areas-item-more"
|
|
128
|
-
}, _ref3 => {
|
|
129
|
-
let {
|
|
130
|
-
onClose
|
|
131
|
-
} = _ref3;
|
|
132
|
-
return (0, _element.createElement)(TemplatePartItemMore, {
|
|
133
|
-
onClose: onClose,
|
|
134
|
-
templatePart: templatePart,
|
|
135
|
-
closeTemplateDetailsDropdown: closeTemplateDetailsDropdown
|
|
136
|
-
});
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function TemplateAreas(_ref4) {
|
|
141
|
-
let {
|
|
142
|
-
closeTemplateDetailsDropdown
|
|
143
|
-
} = _ref4;
|
|
144
|
-
const templateParts = (0, _data.useSelect)(select => select(_store.store).getCurrentTemplateTemplateParts(), []);
|
|
145
|
-
|
|
146
|
-
if (!templateParts.length) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return (0, _element.createElement)(_components.MenuGroup, {
|
|
151
|
-
label: (0, _i18n.__)('Areas'),
|
|
152
|
-
className: "edit-site-template-details__group edit-site-template-details__template-areas"
|
|
153
|
-
}, templateParts.map(_ref5 => {
|
|
154
|
-
let {
|
|
155
|
-
templatePart,
|
|
156
|
-
block
|
|
157
|
-
} = _ref5;
|
|
158
|
-
return (0, _element.createElement)(TemplatePartItem, {
|
|
159
|
-
key: templatePart.slug,
|
|
160
|
-
clientId: block.clientId,
|
|
161
|
-
templatePart: templatePart,
|
|
162
|
-
closeTemplateDetailsDropdown: closeTemplateDetailsDropdown
|
|
163
|
-
});
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=template-areas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["useLocation","routerPrivateApis","TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","revertTemplate","editSiteStore","params","editLinkProps","postId","id","postType","type","fromTemplateId","editTemplatePart","event","onClick","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","blockEditorStore","templatePartArea","select","defaultAreas","editorStore","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","area","highlightBlock","cancelHighlightBlock","icon","label","moreVertical","TemplateAreas","templateParts","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AASA;AACA;AACA;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,yBAAQC,mBAAR,CAAxB;;AAEA,SAASC,oBAAT,OAII;AAAA;;AAAA,MAJ2B;AAC9BC,IAAAA,OAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA;AAH8B,GAI3B;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAaR,WAAW,EAA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AFqB,CAAtB;;AAKA,MAAK,CAAED,aAAa,CAACE,MAArB,EAA8B;AAC7B,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGF,aAAa,CAACG,GAAd,CAAmB;AAAA,QAAE;AAAEvC,MAAAA,YAAF;AAAgBwC,MAAAA;AAAhB,KAAF;AAAA,WACpB,4BAAC,gBAAD;AACC,MAAA,GAAG,EAAGxC,YAAY,CAACyC,IADpB;AAEC,MAAA,QAAQ,EAAGD,KAAK,CAACtB,QAFlB;AAGC,MAAA,YAAY,EAAGlB,YAHhB;AAIC,MAAA,4BAA4B,EAC3BC;AALF,MADoB;AAAA,GAAnB,CAJH,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { moreVertical } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { useLink } from '../routes/link';\nimport { unlock } from '../../private-apis';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction TemplatePartItemMore( {\n\tonClose,\n\ttemplatePart,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { params } = useLocation();\n\tconst editLinkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: templatePart.type,\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tfunction editTemplatePart( event ) {\n\t\teditLinkProps.onClick( event );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\tfunction clearCustomizations() {\n\t\trevertTemplate( templatePart );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem { ...editLinkProps } onClick={ editTemplatePart }>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\t\ttemplatePart.title?.rendered\n\t\t\t\t\t) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t\t{ isTemplateRevertable( templatePart ) && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template part as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ clearCustomizations }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction TemplatePartItem( {\n\ttemplatePart,\n\tclientId,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { selectBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\tconst templatePartArea = useSelect(\n\t\t( select ) => {\n\t\t\tconst defaultAreas =\n\t\t\t\tselect(\n\t\t\t\t\teditorStore\n\t\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\treturn defaultAreas.find(\n\t\t\t\t( defaultArea ) => defaultArea.area === templatePart.area\n\t\t\t);\n\t\t},\n\t\t[ templatePart.area ]\n\t);\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<div\n\t\t\trole=\"menuitem\"\n\t\t\tclassName=\"edit-site-template-details__template-areas-item\"\n\t\t>\n\t\t\t<MenuItem\n\t\t\t\trole=\"button\"\n\t\t\t\ticon={ templatePartArea?.icon }\n\t\t\t\ticonPosition=\"left\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} }\n\t\t\t\tonMouseOver={ highlightBlock }\n\t\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\t\tonFocus={ highlightBlock }\n\t\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\t>\n\t\t\t\t{ templatePartArea?.label }\n\t\t\t</MenuItem>\n\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\tclassName=\"edit-site-template-details__template-areas-item-more\"\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<TemplatePartItemMore\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</div>\n\t);\n}\n\nexport default function TemplateAreas( { closeTemplateDetailsDropdown } ) {\n\tconst templateParts = useSelect(\n\t\t( select ) => select( editSiteStore ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup\n\t\t\tlabel={ __( 'Areas' ) }\n\t\t\tclassName=\"edit-site-template-details__group edit-site-template-details__template-areas\"\n\t\t>\n\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t<TemplatePartItem\n\t\t\t\t\tkey={ templatePart.slug }\n\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = TemplatePartAreaSelector;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _coreData = require("@wordpress/core-data");
|
|
15
|
-
|
|
16
|
-
var _data = require("@wordpress/data");
|
|
17
|
-
|
|
18
|
-
var _editor = require("@wordpress/editor");
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* WordPress dependencies
|
|
22
|
-
*/
|
|
23
|
-
function TemplatePartAreaSelector(_ref) {
|
|
24
|
-
let {
|
|
25
|
-
id
|
|
26
|
-
} = _ref;
|
|
27
|
-
const [area, setArea] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'area', id);
|
|
28
|
-
const definedAreas = (0, _data.useSelect)(select => select(_editor.store).__experimentalGetDefaultTemplatePartAreas(), []);
|
|
29
|
-
const areaOptions = definedAreas.map(_ref2 => {
|
|
30
|
-
let {
|
|
31
|
-
label,
|
|
32
|
-
area: _area
|
|
33
|
-
} = _ref2;
|
|
34
|
-
return {
|
|
35
|
-
label,
|
|
36
|
-
value: _area
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
return (0, _element.createElement)(_components.SelectControl, {
|
|
40
|
-
__nextHasNoMarginBottom: true,
|
|
41
|
-
label: (0, _i18n.__)('Area'),
|
|
42
|
-
labelPosition: "top",
|
|
43
|
-
options: areaOptions,
|
|
44
|
-
value: area,
|
|
45
|
-
onChange: setArea
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=template-part-area-selector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-part-area-selector.js"],"names":["TemplatePartAreaSelector","id","area","setArea","definedAreas","select","editorStore","__experimentalGetDefaultTemplatePartAreas","areaOptions","map","label","_area","value"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOe,SAASA,wBAAT,OAA4C;AAAA,MAAT;AAAEC,IAAAA;AAAF,GAAS;AAC1D,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,6BACzB,UADyB,EAEzB,kBAFyB,EAGzB,MAHyB,EAIzBF,EAJyB,CAA1B;AAOA,QAAMG,YAAY,GAAG,qBAClBC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,yCAAtB,EAFmB,EAGpB,EAHoB,CAArB;AAMA,QAAMC,WAAW,GAAGJ,YAAY,CAACK,GAAb,CAAkB;AAAA,QAAE;AAAEC,MAAAA,KAAF;AAASR,MAAAA,IAAI,EAAES;AAAf,KAAF;AAAA,WAAgC;AACrED,MAAAA,KADqE;AAErEE,MAAAA,KAAK,EAAED;AAF8D,KAAhC;AAAA,GAAlB,CAApB;AAKA,SACC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,IAAA,aAAa,EAAC,KAHf;AAIC,IAAA,OAAO,EAAGH,WAJX;AAKC,IAAA,KAAK,EAAGN,IALT;AAMC,IAAA,QAAQ,EAAGC;AANZ,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function TemplatePartAreaSelector( { id } ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\tid\n\t);\n\n\tconst definedAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tconst areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {\n\t\tlabel,\n\t\tvalue: _area,\n\t} ) );\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Area' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\toptions={ areaOptions }\n\t\t\tvalue={ area }\n\t\t\tonChange={ setArea }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-generic-template-modal.js"],"names":["kebabCase","useState","__","Button","Modal","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","TemplateActionsLoadingScreen","AddCustomGenericTemplateModal","onClose","createTemplate","isCreatingTemplate","title","setTitle","defaultTitle","isBusy","setIsBusy","onCreateTemplate","event","preventDefault","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,KAFD,EAGCC,WAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,QAMO,uBANP;AAQA;AACA;AACA;;AACA,OAAOC,4BAAP,MAAyC,mCAAzC;;AAEA,SAASC,6BAAT,OAII;AAAA,MAJoC;AACvCC,IAAAA,OADuC;AAEvCC,IAAAA,cAFuC;AAGvCC,IAAAA;AAHuC,GAIpC;AACH,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBf,QAAQ,CAAE,EAAF,CAApC;;AACA,QAAMgB,YAAY,GAAGf,EAAE,CAAE,iBAAF,CAAvB;;AACA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AE,CAAE,QAAF,CANL,CAJD,EAYC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGgB,MAHV;AAIC,qBAAgBA;AAJjB,KAMGhB,EAAE,CAAE,QAAF,CANL,CAZD,CAZD,CADD,CARD,CADD;AA+CA;;AAED,eAAeS,6BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tModal,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\n\nfunction AddCustomGenericTemplateModal( {\n\tonClose,\n\tcreateTemplate,\n\tisCreatingTemplate,\n} ) {\n\tconst [ title, setTitle ] = useState( '' );\n\tconst defaultTitle = __( 'Custom Template' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\tasync function onCreateTemplate( event ) {\n\t\tevent.preventDefault();\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsBusy( true );\n\t\ttry {\n\t\t\tawait createTemplate(\n\t\t\t\t{\n\t\t\t\t\tslug:\n\t\t\t\t\t\t'wp-custom-template-' +\n\t\t\t\t\t\tkebabCase( title || defaultTitle ),\n\t\t\t\t\ttitle: title || defaultTitle,\n\t\t\t\t},\n\t\t\t\tfalse\n\t\t\t);\n\t\t} finally {\n\t\t\tsetIsBusy( false );\n\t\t}\n\t}\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ () => {\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\toverlayClassName=\"edit-site-custom-generic-template__modal\"\n\t\t>\n\t\t\t{ isCreatingTemplate && <TemplateActionsLoadingScreen /> }\n\t\t\t<form onSubmit={ onCreateTemplate }>\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ defaultTitle }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\".'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"edit-site-custom-generic-template__modal-actions\"\n\t\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nexport default AddCustomGenericTemplateModal;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-template-modal.js"],"names":["useState","useMemo","useEffect","__","sprintf","Button","Flex","FlexItem","Modal","SearchControl","TextHighlight","__experimentalText","Text","__experimentalVStack","VStack","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","useDebounce","useEntityRecords","decodeEntities","TemplateActionsLoadingScreen","mapToIHasNameAndId","EMPTY_ARRAY","SuggestionListItem","suggestion","search","onSelect","entityForSuggestions","composite","baseCssClass","config","getSpecificTemplate","name","link","useDebouncedInput","input","setInput","debounced","setter","setDebounced","useSearchSuggestions","query","order","context","per_page","queryArgs","records","searchResults","hasResolved","searchHasResolved","type","slug","suggestions","setSuggestions","newSuggestions","length","recordNamePath","SuggestionList","orientation","setSearch","debouncedSearch","labels","showSearchControl","setShowSearchControl","search_items","map","not_found","AddCustomTemplateModal","onClose","isCreatingTemplate","showSearchEntities","setShowSearchEntities","hasGeneralTemplate","singular_name","title","description","templatePrefix","template","all_items"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,EAA4BC,SAA5B,QAA6C,oBAA7C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,QAHD,EAICC,KAJD,EAKCC,aALD,EAMCC,aAND,EAOCC,kBAAkB,IAAIC,IAPvB,EAQCC,oBAAoB,IAAIC,MARzB,EASCC,mBAAmB,IAAIC,SATxB,EAUCC,2BAA2B,IAAIC,iBAVhC,EAWCC,uBAAuB,IAAIC,aAX5B,QAYO,uBAZP;AAaA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,4BAAP,MAAyC,mCAAzC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AAEA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,kBAAT,OAMI;AAAA,MANyB;AAC5BC,IAAAA,UAD4B;AAE5BC,IAAAA,MAF4B;AAG5BC,IAAAA,QAH4B;AAI5BC,IAAAA,oBAJ4B;AAK5BC,IAAAA;AAL4B,GAMzB;AACH,QAAMC,YAAY,GACjB,8DADD;AAE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sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tModal,\n\tSearchControl,\n\tTextHighlight,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\nimport { mapToIHasNameAndId } from './utils';\n\nconst EMPTY_ARRAY = [];\n\nfunction SuggestionListItem( {\n\tsuggestion,\n\tsearch,\n\tonSelect,\n\tentityForSuggestions,\n\tcomposite,\n} ) {\n\tconst baseCssClass =\n\t\t'edit-site-custom-template-modal__suggestions_list__list-item';\n\treturn (\n\t\t<CompositeItem\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonClick={ () =>\n\t\t\t\tonSelect(\n\t\t\t\t\tentityForSuggestions.config.getSpecificTemplate(\n\t\t\t\t\t\tsuggestion\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<Text\n\t\t\t\tsize=\"body\"\n\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\tweight={ 500 }\n\t\t\t\tclassName={ `${ baseCssClass }__title` }\n\t\t\t>\n\t\t\t\t<TextHighlight\n\t\t\t\t\ttext={ decodeEntities( suggestion.name ) }\n\t\t\t\t\thighlight={ search }\n\t\t\t\t/>\n\t\t\t</Text>\n\t\t\t{ suggestion.link && (\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\tclassName={ `${ baseCssClass }__info` }\n\t\t\t\t>\n\t\t\t\t\t{ suggestion.link }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</CompositeItem>\n\t);\n}\n\nfunction useDebouncedInput() {\n\tconst [ input, setInput ] = useState( '' );\n\tconst [ debounced, setter ] = useState( '' );\n\tconst setDebounced = useDebounce( setter, 250 );\n\tuseEffect( () => {\n\t\tif ( debounced !== input ) {\n\t\t\tsetDebounced( input );\n\t\t}\n\t}, [ debounced, input ] );\n\treturn [ input, setInput, debounced ];\n}\n\nfunction useSearchSuggestions( entityForSuggestions, search ) {\n\tconst { config } = entityForSuggestions;\n\tconst query = useMemo(\n\t\t() => ( {\n\t\t\torder: 'asc',\n\t\t\tcontext: 'view',\n\t\t\tsearch,\n\t\t\tper_page: search ? 20 : 10,\n\t\t\t...config.queryArgs( search ),\n\t\t} ),\n\t\t[ search, config ]\n\t);\n\tconst { records: searchResults, hasResolved: searchHasResolved } =\n\t\tuseEntityRecords(\n\t\t\tentityForSuggestions.type,\n\t\t\tentityForSuggestions.slug,\n\t\t\tquery\n\t\t);\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) return;\n\t\tlet newSuggestions = EMPTY_ARRAY;\n\t\tif ( searchResults?.length ) {\n\t\t\tnewSuggestions = searchResults;\n\t\t\tif ( config.recordNamePath ) {\n\t\t\t\tnewSuggestions = mapToIHasNameAndId(\n\t\t\t\t\tnewSuggestions,\n\t\t\t\t\tconfig.recordNamePath\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// Update suggestions only when the query has resolved, so as to keep\n\t\t// the previous results in the UI.\n\t\tsetSuggestions( newSuggestions );\n\t}, [ searchResults, searchHasResolved ] );\n\treturn suggestions;\n}\n\nfunction SuggestionList( { entityForSuggestions, onSelect } ) {\n\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\tconst [ search, setSearch, debouncedSearch ] = useDebouncedInput();\n\tconst suggestions = useSearchSuggestions(\n\t\tentityForSuggestions,\n\t\tdebouncedSearch\n\t);\n\tconst { labels } = entityForSuggestions;\n\tconst [ showSearchControl, setShowSearchControl ] = useState( false );\n\tif ( ! showSearchControl && suggestions?.length > 9 ) {\n\t\tsetShowSearchControl( true );\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ showSearchControl && (\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tonChange={ setSearch }\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tlabel={ labels.search_items }\n\t\t\t\t\tplaceholder={ labels.search_items }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! suggestions?.length && (\n\t\t\t\t<Composite\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__suggestions_list\"\n\t\t\t\t\taria-label={ __( 'Suggestions list' ) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion ) => (\n\t\t\t\t\t\t<SuggestionListItem\n\t\t\t\t\t\t\tkey={ suggestion.slug }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tsearch={ debouncedSearch }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</Composite>\n\t\t\t) }\n\t\t\t{ debouncedSearch && ! suggestions?.length && (\n\t\t\t\t<Text\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__no-results\"\n\t\t\t\t>\n\t\t\t\t\t{ labels.not_found }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction AddCustomTemplateModal( {\n\tonClose,\n\tonSelect,\n\tentityForSuggestions,\n\tisCreatingTemplate,\n} ) {\n\tconst [ showSearchEntities, setShowSearchEntities ] = useState(\n\t\tentityForSuggestions.hasGeneralTemplate\n\t);\n\tconst baseCssClass = 'edit-site-custom-template-modal';\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t__( 'Add template: %s' ),\n\t\t\t\tentityForSuggestions.labels.singular_name\n\t\t\t) }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t{ isCreatingTemplate && <TemplateActionsLoadingScreen /> }\n\t\t\t{ ! showSearchEntities && (\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select whether to create a single template for all items or a specific one.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Flex\n\t\t\t\t\t\tclassName={ `${ baseCssClass }__contents` }\n\t\t\t\t\t\tgap=\"4\"\n\t\t\t\t\t\talign=\"initial\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\n\t\t\t\t\t\t\t\t} = entityForSuggestions.template;\n\t\t\t\t\t\t\t\tonSelect( {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.all_items }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For all items' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetShowSearchEntities( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.singular_name }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For a specific item' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ showSearchEntities && (\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This template will be used only for the specific item chosen.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<SuggestionList\n\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nexport default AddCustomTemplateModal;\n"]}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
|
-
import { __experimentalHasSplitBorders as hasSplitBorders } from '@wordpress/components';
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { unlock } from '../../private-apis';
|
|
13
|
-
const {
|
|
14
|
-
useGlobalStyle,
|
|
15
|
-
useGlobalSetting,
|
|
16
|
-
useSettingsForBlockElement,
|
|
17
|
-
BorderPanel: StylesBorderPanel
|
|
18
|
-
} = unlock(blockEditorPrivateApis);
|
|
19
|
-
|
|
20
|
-
function applyFallbackStyle(border) {
|
|
21
|
-
if (!border) {
|
|
22
|
-
return border;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const hasColorOrWidth = border.color || border.width;
|
|
26
|
-
|
|
27
|
-
if (!border.style && hasColorOrWidth) {
|
|
28
|
-
return { ...border,
|
|
29
|
-
style: 'solid'
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (border.style && !hasColorOrWidth) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return border;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function applyAllFallbackStyles(border) {
|
|
41
|
-
if (!border) {
|
|
42
|
-
return border;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (hasSplitBorders(border)) {
|
|
46
|
-
return {
|
|
47
|
-
top: applyFallbackStyle(border.top),
|
|
48
|
-
right: applyFallbackStyle(border.right),
|
|
49
|
-
bottom: applyFallbackStyle(border.bottom),
|
|
50
|
-
left: applyFallbackStyle(border.left)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return applyFallbackStyle(border);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default function BorderPanel(_ref) {
|
|
58
|
-
let {
|
|
59
|
-
name,
|
|
60
|
-
variation = ''
|
|
61
|
-
} = _ref;
|
|
62
|
-
let prefixParts = [];
|
|
63
|
-
|
|
64
|
-
if (variation) {
|
|
65
|
-
prefixParts = ['variations', variation].concat(prefixParts);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const prefix = prefixParts.join('.');
|
|
69
|
-
const [style] = useGlobalStyle(prefix, name, 'user', {
|
|
70
|
-
shouldDecodeEncode: false
|
|
71
|
-
});
|
|
72
|
-
const [inheritedStyle, setStyle] = useGlobalStyle(prefix, name, 'all', {
|
|
73
|
-
shouldDecodeEncode: false
|
|
74
|
-
});
|
|
75
|
-
const [rawSettings] = useGlobalSetting('', name);
|
|
76
|
-
const settings = useSettingsForBlockElement(rawSettings, name);
|
|
77
|
-
|
|
78
|
-
const onChange = newStyle => {
|
|
79
|
-
if (!(newStyle !== null && newStyle !== void 0 && newStyle.border)) {
|
|
80
|
-
setStyle(newStyle);
|
|
81
|
-
return;
|
|
82
|
-
} // As Global Styles can't conditionally generate styles based on if
|
|
83
|
-
// other style properties have been set, we need to force split
|
|
84
|
-
// border definitions for user set global border styles. Border
|
|
85
|
-
// radius is derived from the same property i.e. `border.radius` if
|
|
86
|
-
// it is a string that is used. The longhand border radii styles are
|
|
87
|
-
// only generated if that property is an object.
|
|
88
|
-
//
|
|
89
|
-
// For borders (color, style, and width) those are all properties on
|
|
90
|
-
// the `border` style property. This means if the theme.json defined
|
|
91
|
-
// split borders and the user condenses them into a flat border or
|
|
92
|
-
// vice-versa we'd get both sets of styles which would conflict.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const {
|
|
96
|
-
radius,
|
|
97
|
-
...newBorder
|
|
98
|
-
} = newStyle.border;
|
|
99
|
-
const border = applyAllFallbackStyles(newBorder);
|
|
100
|
-
const updatedBorder = !hasSplitBorders(border) ? {
|
|
101
|
-
top: border,
|
|
102
|
-
right: border,
|
|
103
|
-
bottom: border,
|
|
104
|
-
left: border
|
|
105
|
-
} : {
|
|
106
|
-
color: null,
|
|
107
|
-
style: null,
|
|
108
|
-
width: null,
|
|
109
|
-
...border
|
|
110
|
-
};
|
|
111
|
-
setStyle({ ...newStyle,
|
|
112
|
-
border: { ...updatedBorder,
|
|
113
|
-
radius
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
return createElement(StylesBorderPanel, {
|
|
119
|
-
inheritedValue: inheritedStyle,
|
|
120
|
-
value: style,
|
|
121
|
-
onChange: onChange,
|
|
122
|
-
settings: settings
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
//# sourceMappingURL=border-panel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["privateApis","blockEditorPrivateApis","__experimentalHasSplitBorders","hasSplitBorders","unlock","useGlobalStyle","useGlobalSetting","useSettingsForBlockElement","BorderPanel","StylesBorderPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","rawSettings","settings","onChange","newStyle","radius","newBorder","updatedBorder"],"mappings":";;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AAER,MAFP;AAGAS,MAAAA,MAAM,EAAET,MAHR;AAIAU,MAAAA,IAAI,EAAEV;AAJN,KADmB,GAOnB;AACAE,MAAAA,KAAK,EAAE,IADP;AAEAE,MAAAA,KAAK,EAAE,IAFP;AAGAD,MAAAA,KAAK,EAAE,IAHP;AAIA,SAAGH;AAJH,KAPH;AAcAmB,IAAAA,QAAQ,CAAE,EAAE,GAAGI,QAAL;AAAevB,MAAAA,MAAM,EAAE,EAAE,GAAG0B,aAAL;AAAoBF,QAAAA;AAApB;AAAvB,KAAF,CAAR;AACA,GAlCD;;AAoCA,SACC,cAAC,iBAAD;AACC,IAAA,cAAc,EAAGN,cADlB;AAEC,IAAA,KAAK,EAAGd,KAFT;AAGC,IAAA,QAAQ,EAAGkB,QAHZ;AAIC,IAAA,QAAQ,EAAGD;AAJZ,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { __experimentalHasSplitBorders as hasSplitBorders } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseGlobalStyle,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tBorderPanel: StylesBorderPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nexport default function BorderPanel( { name, variation = '' } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\n\tconst onChange = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<StylesBorderPanel\n\t\t\tinheritedValue={ inheritedStyle }\n\t\t\tvalue={ style }\n\t\t\tonChange={ onChange }\n\t\t\tsettings={ settings }\n\t\t/>\n\t);\n}\n"]}
|