@wordpress/edit-site 5.13.0 → 5.15.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 +2 -13
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +29 -15
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +2 -2
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/new-template.js +69 -14
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +10 -8
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/constants.js +1 -1
- package/build/components/block-editor/constants.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +0 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +1 -22
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +29 -32
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +90 -19
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/canvas-spinner/index.js +1 -18
- package/build/components/canvas-spinner/index.js.map +1 -1
- package/build/components/code-editor/index.js +60 -28
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +15 -11
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +1 -1
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +11 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +49 -14
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +47 -17
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +32 -1
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +9 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +110 -28
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page/index.js +3 -1
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-actions/index.js +2 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -15
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-main/index.js +8 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js +163 -0
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +218 -0
- package/build/components/page-patterns/grid-item.js.map +1 -0
- package/build/components/{page-library → page-patterns}/grid.js +6 -19
- package/build/components/page-patterns/grid.js.map +1 -0
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/{page-library → page-patterns}/index.js +9 -7
- package/build/components/page-patterns/index.js.map +1 -0
- package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build/components/page-patterns/no-patterns.js.map +1 -0
- package/build/components/page-patterns/pagination.js +63 -0
- package/build/components/page-patterns/pagination.js.map +1 -0
- package/build/components/page-patterns/patterns-list.js +175 -0
- package/build/components/page-patterns/patterns-list.js.map +1 -0
- package/build/components/page-patterns/rename-menu-item.js +109 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -0
- package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build/components/page-patterns/use-patterns.js +185 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/utils.js +3 -3
- package/build/components/page-patterns/utils.js.map +1 -0
- package/build/components/page-template-parts/add-new-template-part.js +74 -0
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-template-parts/index.js +82 -0
- package/build/components/page-template-parts/index.js.map +1 -0
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/preferences-modal/enable-feature.js +5 -1
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/index.js +43 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +78 -36
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-panel/index.js +5 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +6 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +4 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +21 -11
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +69 -5
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +5 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +7 -16
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -10
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +10 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +9 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +29 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +27 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +11 -4
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +2 -35
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +20 -13
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +28 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js +173 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +34 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -19
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +52 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +25 -12
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
- 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 +16 -13
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +25 -7
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +12 -8
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -1
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +70 -0
- package/build/components/welcome-guide/page.js.map +1 -0
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +71 -0
- package/build/components/welcome-guide/template.js.map +1 -0
- package/build/hooks/commands/use-common-commands.js +115 -20
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +195 -44
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +56 -10
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +9 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +2 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +2 -2
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/normalize-record-key.js +19 -0
- package/build/utils/normalize-record-key.js.map +1 -0
- package/build/utils/template-part-create.js +2 -2
- package/build/utils/template-part-create.js.map +1 -1
- package/build/utils/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-page/index.js +2 -12
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +28 -16
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +72 -17
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +9 -6
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/constants.js +1 -1
- package/build-module/components/block-editor/constants.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +0 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +1 -22
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +29 -32
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +92 -20
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/canvas-spinner/index.js +1 -15
- package/build-module/components/canvas-spinner/index.js.map +1 -1
- package/build-module/components/code-editor/index.js +62 -30
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +14 -11
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -1
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +11 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/ui.js +8 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +51 -16
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +44 -20
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +29 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +9 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +110 -28
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page/index.js +2 -1
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-actions/index.js +2 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-main/index.js +6 -3
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +195 -0
- package/build-module/components/page-patterns/grid-item.js.map +1 -0
- package/build-module/components/page-patterns/grid.js +26 -0
- package/build-module/components/page-patterns/grid.js.map +1 -0
- package/build-module/components/page-patterns/header.js +54 -0
- package/build-module/components/page-patterns/header.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/index.js +8 -6
- package/build-module/components/page-patterns/index.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build-module/components/page-patterns/no-patterns.js.map +1 -0
- package/build-module/components/page-patterns/pagination.js +54 -0
- package/build-module/components/page-patterns/pagination.js.map +1 -0
- package/build-module/components/page-patterns/patterns-list.js +152 -0
- package/build-module/components/page-patterns/patterns-list.js.map +1 -0
- package/build-module/components/page-patterns/rename-menu-item.js +97 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -0
- package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build-module/components/page-patterns/use-patterns.js +167 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
- package/build-module/components/page-patterns/utils.js.map +1 -0
- package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +63 -0
- package/build-module/components/page-template-parts/index.js.map +1 -0
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/preferences-modal/enable-feature.js +5 -1
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +38 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +79 -39
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +5 -5
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +5 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -2
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +22 -12
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +67 -5
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +5 -4
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +8 -17
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +9 -10
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +11 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +8 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +20 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +26 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -4
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -33
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +34 -26
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +18 -12
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +25 -2
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +148 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -17
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +43 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +25 -12
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
- 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 +17 -13
- 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 +26 -8
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +11 -8
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +3 -1
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +59 -0
- package/build-module/components/welcome-guide/page.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +60 -0
- package/build-module/components/welcome-guide/template.js.map +1 -0
- package/build-module/hooks/commands/use-common-commands.js +111 -21
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +193 -46
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +57 -10
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +2 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +2 -2
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/normalize-record-key.js +12 -0
- package/build-module/utils/normalize-record-key.js.map +1 -0
- package/build-module/utils/template-part-create.js +1 -1
- package/build-module/utils/template-part-create.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +383 -109
- package/build-style/style.css +383 -109
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +1 -9
- package/src/components/add-new-pattern/index.js +30 -21
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
- package/src/components/add-new-template/new-template.js +120 -24
- package/src/components/add-new-template/style.scss +30 -2
- package/src/components/add-new-template/utils.js +9 -6
- package/src/components/block-editor/constants.js +5 -1
- package/src/components/block-editor/editor-canvas.js +3 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/inserter-media-categories.js +1 -21
- package/src/components/block-editor/site-editor-canvas.js +7 -1
- package/src/components/block-editor/use-site-editor-settings.js +100 -25
- package/src/components/canvas-spinner/index.js +1 -11
- package/src/components/canvas-spinner/style.scss +18 -0
- package/src/components/code-editor/index.js +51 -33
- package/src/components/create-pattern-modal/index.js +15 -13
- package/src/components/create-template-part-modal/index.js +1 -1
- package/src/components/editor/index.js +16 -1
- package/src/components/editor/style.scss +4 -0
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/global-styles/stories/index.js +1 -0
- package/src/components/global-styles/ui.js +34 -24
- package/src/components/header-edit-mode/document-actions/index.js +9 -1
- package/src/components/header-edit-mode/document-actions/style.scss +12 -0
- package/src/components/header-edit-mode/index.js +136 -79
- package/src/components/header-edit-mode/more-menu/index.js +74 -30
- package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
- package/src/components/keyboard-shortcuts/edit-mode.js +35 -2
- package/src/components/keyboard-shortcuts/register.js +10 -0
- package/src/components/layout/index.js +156 -78
- package/src/components/layout/style.scss +49 -2
- package/src/components/page/header.js +1 -1
- package/src/components/page/index.js +5 -1
- package/src/components/page-actions/index.js +2 -2
- package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -21
- package/src/components/page-content-focus-manager/back-to-page-notification.js +7 -2
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-main/index.js +6 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +284 -0
- package/src/components/page-patterns/grid.js +22 -0
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/{page-library → page-patterns}/index.js +11 -6
- package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/src/components/page-patterns/pagination.js +80 -0
- package/src/components/page-patterns/patterns-list.js +206 -0
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +219 -0
- package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
- package/src/components/page-patterns/use-patterns.js +177 -0
- package/src/components/{page-library → page-patterns}/utils.js +3 -3
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +86 -0
- package/src/components/page-templates/index.js +1 -1
- package/src/components/preferences-modal/enable-feature.js +5 -2
- package/src/components/preferences-modal/index.js +35 -4
- package/src/components/resizable-frame/index.js +102 -34
- package/src/components/resizable-frame/style.scss +9 -9
- package/src/components/save-panel/index.js +10 -4
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/index.js +4 -2
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
- package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
- package/src/components/sidebar-navigation-item/style.scss +7 -13
- package/src/components/sidebar-navigation-screen/index.js +18 -9
- package/src/components/sidebar-navigation-screen/style.scss +21 -2
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +14 -35
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +13 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +12 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +16 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +20 -6
- package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +24 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +39 -8
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-page/page-details.js +8 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +2 -36
- package/src/components/sidebar-navigation-screen-pages/index.js +40 -30
- package/src/components/sidebar-navigation-screen-pattern/index.js +18 -8
- package/src/components/sidebar-navigation-screen-pattern/style.scss +29 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +12 -2
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +48 -3
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/src/components/sidebar-navigation-screen-patterns/index.js +194 -0
- package/src/components/sidebar-navigation-screen-patterns/style.scss +23 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +9 -17
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +55 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +3 -2
- package/src/components/sidebar-navigation-screen-template/style.scss +15 -15
- package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
- package/src/components/site-hub/index.js +46 -29
- package/src/components/site-hub/style.scss +17 -3
- package/src/components/start-template-options/style.scss +0 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
- package/src/components/template-actions/index.js +40 -9
- package/src/components/template-actions/rename-menu-item.js +17 -10
- package/src/components/use-edited-entity-record/index.js +6 -1
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/index.js +4 -0
- package/src/components/welcome-guide/page.js +75 -0
- package/src/components/welcome-guide/style.scss +15 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/components/welcome-guide/template.js +82 -0
- package/src/hooks/commands/use-common-commands.js +88 -24
- package/src/hooks/commands/use-edit-mode-commands.js +182 -38
- package/src/hooks/push-changes-to-global-styles/index.js +63 -9
- package/src/index.js +4 -0
- package/src/store/actions.js +8 -1
- package/src/store/private-actions.js +5 -1
- package/src/store/selectors.js +5 -0
- package/src/store/test/selectors.js +2 -0
- package/src/style.scss +13 -14
- package/src/utils/get-is-list-page.js +4 -3
- package/src/utils/normalize-record-key.js +11 -0
- package/src/utils/template-part-create.js +1 -1
- package/src/utils/use-activate-theme.js +1 -1
- package/build/components/code-editor/code-editor-text-area.js +0 -96
- package/build/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build/components/keyboard-shortcuts/index.js +0 -148
- package/build/components/keyboard-shortcuts/index.js.map +0 -1
- package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build/components/page-library/grid-item.js +0 -165
- package/build/components/page-library/grid-item.js.map +0 -1
- package/build/components/page-library/grid.js.map +0 -1
- package/build/components/page-library/index.js.map +0 -1
- package/build/components/page-library/no-patterns.js.map +0 -1
- package/build/components/page-library/patterns-list.js +0 -108
- package/build/components/page-library/patterns-list.js.map +0 -1
- package/build/components/page-library/search-items.js.map +0 -1
- package/build/components/page-library/use-library-settings.js.map +0 -1
- package/build/components/page-library/use-patterns.js +0 -194
- package/build/components/page-library/use-patterns.js.map +0 -1
- package/build/components/page-library/utils.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/index.js +0 -112
- package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -41
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/build-module/components/code-editor/code-editor-text-area.js +0 -84
- package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -132
- package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/page-library/grid-item.js +0 -145
- package/build-module/components/page-library/grid-item.js.map +0 -1
- package/build-module/components/page-library/grid.js +0 -38
- package/build-module/components/page-library/grid.js.map +0 -1
- package/build-module/components/page-library/index.js.map +0 -1
- package/build-module/components/page-library/no-patterns.js.map +0 -1
- package/build-module/components/page-library/patterns-list.js +0 -87
- package/build-module/components/page-library/patterns-list.js.map +0 -1
- package/build-module/components/page-library/search-items.js.map +0 -1
- package/build-module/components/page-library/use-library-settings.js.map +0 -1
- package/build-module/components/page-library/use-patterns.js +0 -176
- package/build-module/components/page-library/use-patterns.js.map +0 -1
- package/build-module/components/page-library/utils.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/index.js +0 -87
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -34
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/src/components/code-editor/code-editor-text-area.js +0 -84
- package/src/components/keyboard-shortcuts/index.js +0 -137
- package/src/components/page-content-focus-manager/constants.js +0 -5
- package/src/components/page-library/grid-item.js +0 -179
- package/src/components/page-library/grid.js +0 -39
- package/src/components/page-library/patterns-list.js +0 -114
- package/src/components/page-library/style.scss +0 -105
- package/src/components/page-library/use-patterns.js +0 -238
- package/src/components/sidebar-navigation-screen-library/index.js +0 -136
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -7
- package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -33
- /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
|
@@ -9,13 +9,15 @@ exports.default = SidebarNavigationScreenPattern;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
13
|
|
|
14
14
|
var _data = require("@wordpress/data");
|
|
15
15
|
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
16
18
|
var _icons = require("@wordpress/icons");
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _url = require("@wordpress/url");
|
|
19
21
|
|
|
20
22
|
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
21
23
|
|
|
@@ -25,12 +27,12 @@ var _useInitEditedEntityFromUrl = _interopRequireDefault(require("../sync-state-
|
|
|
25
27
|
|
|
26
28
|
var _usePatternDetails = _interopRequireDefault(require("./use-pattern-details"));
|
|
27
29
|
|
|
28
|
-
var _useNavigationMenuContent = _interopRequireDefault(require("./use-navigation-menu-content"));
|
|
29
|
-
|
|
30
30
|
var _store = require("../../store");
|
|
31
31
|
|
|
32
32
|
var _lockUnlock = require("../../lock-unlock");
|
|
33
33
|
|
|
34
|
+
var _normalizeRecordKey = _interopRequireDefault(require("../../utils/normalize-record-key"));
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* WordPress dependencies
|
|
36
38
|
*/
|
|
@@ -39,27 +41,32 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
39
41
|
* Internal dependencies
|
|
40
42
|
*/
|
|
41
43
|
function SidebarNavigationScreenPattern() {
|
|
44
|
+
const {
|
|
45
|
+
categoryType
|
|
46
|
+
} = (0, _url.getQueryArgs)(window.location.href);
|
|
47
|
+
const {
|
|
48
|
+
setCanvasMode
|
|
49
|
+
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
42
50
|
const {
|
|
43
51
|
params
|
|
44
52
|
} = (0, _components.__experimentalUseNavigator)();
|
|
45
53
|
const {
|
|
46
|
-
postType
|
|
47
|
-
postId
|
|
54
|
+
postType
|
|
48
55
|
} = params;
|
|
49
|
-
const
|
|
50
|
-
setCanvasMode
|
|
51
|
-
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
56
|
+
const postId = (0, _normalizeRecordKey.default)(params?.postId);
|
|
52
57
|
(0, _useInitEditedEntityFromUrl.default)();
|
|
53
|
-
const patternDetails = (0, _usePatternDetails.default)(postType, postId);
|
|
54
|
-
|
|
58
|
+
const patternDetails = (0, _usePatternDetails.default)(postType, postId); // The absence of a category type in the query params for template parts
|
|
59
|
+
// indicates the user has arrived at the template part via the "manage all"
|
|
60
|
+
// page and the back button should return them to that list page.
|
|
61
|
+
|
|
62
|
+
const backPath = !categoryType && postType === 'wp_template_part' ? '/wp_template_part/all' : '/patterns';
|
|
55
63
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
56
64
|
actions: (0, _element.createElement)(_sidebarButton.default, {
|
|
57
65
|
onClick: () => setCanvasMode('edit'),
|
|
58
66
|
label: (0, _i18n.__)('Edit'),
|
|
59
67
|
icon: _icons.pencil
|
|
60
68
|
}),
|
|
61
|
-
backPath:
|
|
62
|
-
content: content,
|
|
69
|
+
backPath: backPath,
|
|
63
70
|
...patternDetails
|
|
64
71
|
});
|
|
65
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["SidebarNavigationScreenPattern","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["SidebarNavigationScreenPattern","categoryType","window","location","href","setCanvasMode","editSiteStore","params","postType","postId","patternDetails","backPath","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAOA;AACA;AACA;AASe,SAASA,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAmB,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAAzB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,wBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAa,6CAAnB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAeD,MAArB;AACA,QAAME,MAAM,GAAG,iCAAoBF,MAAM,EAAEE,MAA5B,CAAf;AAEA;AAEA,QAAMC,cAAc,GAAG,gCAAmBF,QAAnB,EAA6BC,MAA7B,CAAvB,CAVwD,CAYxD;AACA;AACA;;AACA,QAAME,QAAQ,GACb,CAAEV,YAAF,IAAkBO,QAAQ,KAAK,kBAA/B,GACG,uBADH,GAEG,WAHJ;AAKA,SACC,4BAAC,gCAAD;AACC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAMH,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGO;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAGD,QARZ;AAAA,OASMD;AATN,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport usePatternDetails from './use-pattern-details';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport normalizeRecordKey from '../../utils/normalize-record-key';\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst { categoryType } = getQueryArgs( window.location.href );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst { params } = useNavigator();\n\tconst { postType } = params;\n\tconst postId = normalizeRecordKey( params?.postId );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\n\t// The absence of a category type in the query params for template parts\n\t// indicates the user has arrived at the template part via the \"manage all\"\n\t// page and the back button should return them to that list page.\n\tconst backPath =\n\t\t! categoryType && postType === 'wp_template_part'\n\t\t\t? '/wp_template_part/all'\n\t\t\t: '/patterns';\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tbackPath={ backPath }\n\t\t\t{ ...patternDetails }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -31,9 +31,10 @@ function TemplatePartNavigationMenu({
|
|
|
31
31
|
if (!id) return null;
|
|
32
32
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
33
33
|
className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
|
|
34
|
-
size: "
|
|
35
|
-
upperCase: true
|
|
36
|
-
|
|
34
|
+
size: "11",
|
|
35
|
+
upperCase: true,
|
|
36
|
+
weight: 500
|
|
37
|
+
}, title?.rendered || title || (0, _i18n.__)('Navigation')), (0, _element.createElement)(_navigationMenuEditor.default, {
|
|
37
38
|
navigationMenuId: id
|
|
38
39
|
}));
|
|
39
40
|
}
|
package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"names":["TemplatePartNavigationMenu","id","title","rendered"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAA8C;AAC5D,QAAM,CAAEC,KAAF,IAAY,6BAAe,UAAf,EAA2B,eAA3B,EAA4C,OAA5C,EAAqDD,EAArD,CAAlB;AAEA,MAAK,CAAEA,EAAP,EAAY,OAAO,IAAP;AAEZ,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"names":["TemplatePartNavigationMenu","id","title","rendered"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAA8C;AAC5D,QAAM,CAAEC,KAAF,IAAY,6BAAe,UAAf,EAA2B,eAA3B,EAA4C,OAA5C,EAAqDD,EAArD,CAAlB;AAEA,MAAK,CAAEA,EAAP,EAAY,OAAO,IAAP;AAEZ,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG,IAHb;AAIC,IAAA,MAAM,EAAG;AAJV,KAMGC,KAAK,EAAEC,QAAP,IAAmBD,KAAnB,IAA4B,cAAI,YAAJ,CAN/B,CADD,EASC,4BAAC,6BAAD;AAAsB,IAAA,gBAAgB,EAAGD;AAAzC,IATD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuEditor from '../sidebar-navigation-screen-navigation-menu/navigation-menu-editor';\n\nexport default function TemplatePartNavigationMenu( { id } ) {\n\tconst [ title ] = useEntityProp( 'postType', 'wp_navigation', 'title', id );\n\n\tif ( ! id ) return null;\n\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase={ true }\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ title?.rendered || title || __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<NavigationMenuEditor navigationMenuId={ id } />\n\t\t</>\n\t);\n}\n"]}
|
package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js
CHANGED
|
@@ -38,8 +38,9 @@ function TemplatePartNavigationMenus({
|
|
|
38
38
|
|
|
39
39
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
40
40
|
className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
|
|
41
|
-
size: "
|
|
42
|
-
upperCase: true
|
|
41
|
+
size: "11",
|
|
42
|
+
upperCase: true,
|
|
43
|
+
weight: 500
|
|
43
44
|
}, (0, _i18n.__)('Navigation')), (0, _element.createElement)(_templatePartNavigationMenuList.default, {
|
|
44
45
|
menus: menus
|
|
45
46
|
}));
|
package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"names":["TemplatePartNavigationMenus","menus","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,2BAAT,CAAsC;AAAEC,EAAAA;AAAF,CAAtC,EAAkD;AAChE,MAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB,OAAO,IAAP,CAD0C,CAGhE;;AACA,MAAKD,KAAK,CAACC,MAAN,KAAiB,CAAtB,EAA0B;AACzB,WAAO,4BAAC,mCAAD;AAA4B,MAAA,EAAE,EAAGD,KAAK,CAAE,CAAF;AAAtC,MAAP;AACA,GAN+D,CAQhE;;;AACA,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"names":["TemplatePartNavigationMenus","menus","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,2BAAT,CAAsC;AAAEC,EAAAA;AAAF,CAAtC,EAAkD;AAChE,MAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB,OAAO,IAAP,CAD0C,CAGhE;;AACA,MAAKD,KAAK,CAACC,MAAN,KAAiB,CAAtB,EAA0B;AACzB,WAAO,4BAAC,mCAAD;AAA4B,MAAA,EAAE,EAAGD,KAAK,CAAE,CAAF;AAAtC,MAAP;AACA,GAN+D,CAQhE;;;AACA,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG,IAHb;AAIC,IAAA,MAAM,EAAG;AAJV,KAMG,cAAI,YAAJ,CANH,CADD,EASC,4BAAC,uCAAD;AAAgC,IAAA,KAAK,EAAGA;AAAxC,IATD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) return null;\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase={ true }\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -69,14 +69,22 @@ function useNavigationMenuContent(postType, postId) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
const navigationBlocks = getBlocksOfTypeFromBlocks('core/navigation', record?.blocks);
|
|
72
|
-
const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref);
|
|
73
72
|
|
|
74
|
-
if (!
|
|
73
|
+
if (!navigationBlocks.length) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref); // Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.
|
|
78
|
+
// Also, filter out undefined values, as blocks don't have an id when initially added.
|
|
79
|
+
|
|
80
|
+
const uniqueNavigationMenuIds = [...new Set(navigationMenuIds)].filter(menuId => menuId);
|
|
81
|
+
|
|
82
|
+
if (!uniqueNavigationMenuIds?.length) {
|
|
75
83
|
return;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
return (0, _element.createElement)(_templatePartNavigationMenus.default, {
|
|
79
|
-
menus:
|
|
87
|
+
menus: uniqueNavigationMenuIds
|
|
80
88
|
});
|
|
81
89
|
}
|
|
82
90
|
//# sourceMappingURL=use-navigation-menu-content.js.map
|
package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js"],"names":["getBlocksOfTypeFromBlocks","targetBlockType","blocks","length","findInBlocks","_blocks","navigationBlocks","block","name","push","innerBlocks","innerNavigationBlocks","useNavigationMenuContent","postType","postId","record","navigationMenuIds","map","attributes","ref"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAT,CAAoCC,eAApC,EAAqDC,MAArD,EAA8D;AAC7D,MAAK,CAAED,eAAF,IAAqB,CAAEC,MAAM,EAAEC,MAApC,EAA6C;AAC5C,WAAO,EAAP;AACA;;AAED,QAAMC,YAAY,GAAKC,OAAF,IAAe;AACnC,QAAK,CAAEA,OAAP,EAAiB;AAChB,aAAO,EAAP;AACA;;AAED,UAAMC,gBAAgB,GAAG,EAAzB;;AAEA,SAAM,MAAMC,KAAZ,IAAqBF,OAArB,EAA+B;AAC9B,UAAKE,KAAK,CAACC,IAAN,KAAeP,eAApB,EAAsC;AACrCK,QAAAA,gBAAgB,CAACG,IAAjB,CAAuBF,KAAvB;AACA;;AAED,UAAKA,KAAK,EAAEG,WAAZ,EAA0B;AACzB,cAAMC,qBAAqB,GAAGP,YAAY,CAAEG,KAAK,CAACG,WAAR,CAA1C;;AAEA,YAAKC,qBAAqB,CAACR,MAA3B,EAAoC;AACnCG,UAAAA,gBAAgB,CAACG,IAAjB,CAAuB,GAAGE,qBAA1B;AACA;AACD;AACD;;AAED,WAAOL,gBAAP;AACA,GAtBD;;AAwBA,SAAOF,YAAY,CAAEF,MAAF,CAAnB;AACA;;AAEc,SAASU,wBAAT,CAAmCC,QAAnC,EAA6CC,MAA7C,EAAsD;AACpE,QAAM;AAAEC,IAAAA;AAAF,MAAa,oCAAuBF,QAAvB,EAAiCC,MAAjC,CAAnB,CADoE,CAGpE;AACA;AACA;;AACA,MAAKD,QAAQ,KAAK,kBAAlB,EAAuC;AACtC;AACA;;AAED,QAAMP,gBAAgB,GAAGN,yBAAyB,CACjD,iBADiD,EAEjDe,MAAM,EAAEb,MAFyC,CAAlD
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js"],"names":["getBlocksOfTypeFromBlocks","targetBlockType","blocks","length","findInBlocks","_blocks","navigationBlocks","block","name","push","innerBlocks","innerNavigationBlocks","useNavigationMenuContent","postType","postId","record","navigationMenuIds","map","attributes","ref","uniqueNavigationMenuIds","Set","filter","menuId"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAT,CAAoCC,eAApC,EAAqDC,MAArD,EAA8D;AAC7D,MAAK,CAAED,eAAF,IAAqB,CAAEC,MAAM,EAAEC,MAApC,EAA6C;AAC5C,WAAO,EAAP;AACA;;AAED,QAAMC,YAAY,GAAKC,OAAF,IAAe;AACnC,QAAK,CAAEA,OAAP,EAAiB;AAChB,aAAO,EAAP;AACA;;AAED,UAAMC,gBAAgB,GAAG,EAAzB;;AAEA,SAAM,MAAMC,KAAZ,IAAqBF,OAArB,EAA+B;AAC9B,UAAKE,KAAK,CAACC,IAAN,KAAeP,eAApB,EAAsC;AACrCK,QAAAA,gBAAgB,CAACG,IAAjB,CAAuBF,KAAvB;AACA;;AAED,UAAKA,KAAK,EAAEG,WAAZ,EAA0B;AACzB,cAAMC,qBAAqB,GAAGP,YAAY,CAAEG,KAAK,CAACG,WAAR,CAA1C;;AAEA,YAAKC,qBAAqB,CAACR,MAA3B,EAAoC;AACnCG,UAAAA,gBAAgB,CAACG,IAAjB,CAAuB,GAAGE,qBAA1B;AACA;AACD;AACD;;AAED,WAAOL,gBAAP;AACA,GAtBD;;AAwBA,SAAOF,YAAY,CAAEF,MAAF,CAAnB;AACA;;AAEc,SAASU,wBAAT,CAAmCC,QAAnC,EAA6CC,MAA7C,EAAsD;AACpE,QAAM;AAAEC,IAAAA;AAAF,MAAa,oCAAuBF,QAAvB,EAAiCC,MAAjC,CAAnB,CADoE,CAGpE;AACA;AACA;;AACA,MAAKD,QAAQ,KAAK,kBAAlB,EAAuC;AACtC;AACA;;AAED,QAAMP,gBAAgB,GAAGN,yBAAyB,CACjD,iBADiD,EAEjDe,MAAM,EAAEb,MAFyC,CAAlD;;AAKA,MAAK,CAAEI,gBAAgB,CAACH,MAAxB,EAAiC;AAChC;AACA;;AAED,QAAMa,iBAAiB,GAAGV,gBAAgB,EAAEW,GAAlB,CACvBV,KAAF,IAAaA,KAAK,CAACW,UAAN,CAAiBC,GADL,CAA1B,CAnBoE,CAuBpE;AACA;;AACA,QAAMC,uBAAuB,GAAG,CAAE,GAAG,IAAIC,GAAJ,CAASL,iBAAT,CAAL,EAAoCM,MAApC,CAC7BC,MAAF,IAAcA,MADiB,CAAhC;;AAIA,MAAK,CAAEH,uBAAuB,EAAEjB,MAAhC,EAAyC;AACxC;AACA;;AAED,SAAO,4BAAC,oCAAD;AAA6B,IAAA,KAAK,EAAGiB;AAArC,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenus from './template-part-navigation-menus';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\n/**\n * Retrieves a list of specific blocks from a given tree of blocks.\n *\n * @param {string} targetBlockType The name of the block type to find.\n * @param {Array} blocks A list of blocks from a template part entity.\n *\n * @return {Array} A list of any navigation blocks found in the blocks.\n */\nfunction getBlocksOfTypeFromBlocks( targetBlockType, blocks ) {\n\tif ( ! targetBlockType || ! blocks?.length ) {\n\t\treturn [];\n\t}\n\n\tconst findInBlocks = ( _blocks ) => {\n\t\tif ( ! _blocks ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst navigationBlocks = [];\n\n\t\tfor ( const block of _blocks ) {\n\t\t\tif ( block.name === targetBlockType ) {\n\t\t\t\tnavigationBlocks.push( block );\n\t\t\t}\n\n\t\t\tif ( block?.innerBlocks ) {\n\t\t\t\tconst innerNavigationBlocks = findInBlocks( block.innerBlocks );\n\n\t\t\t\tif ( innerNavigationBlocks.length ) {\n\t\t\t\t\tnavigationBlocks.push( ...innerNavigationBlocks );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn navigationBlocks;\n\t};\n\n\treturn findInBlocks( blocks );\n}\n\nexport default function useNavigationMenuContent( postType, postId ) {\n\tconst { record } = useEditedEntityRecord( postType, postId );\n\n\t// Only managing navigation menus in template parts is supported\n\t// to match previous behaviour. This could potentially be expanded\n\t// to patterns as well.\n\tif ( postType !== 'wp_template_part' ) {\n\t\treturn;\n\t}\n\n\tconst navigationBlocks = getBlocksOfTypeFromBlocks(\n\t\t'core/navigation',\n\t\trecord?.blocks\n\t);\n\n\tif ( ! navigationBlocks.length ) {\n\t\treturn;\n\t}\n\n\tconst navigationMenuIds = navigationBlocks?.map(\n\t\t( block ) => block.attributes.ref\n\t);\n\n\t// Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.\n\t// Also, filter out undefined values, as blocks don't have an id when initially added.\n\tconst uniqueNavigationMenuIds = [ ...new Set( navigationMenuIds ) ].filter(\n\t\t( menuId ) => menuId\n\t);\n\n\tif ( ! uniqueNavigationMenuIds?.length ) {\n\t\treturn;\n\t}\n\n\treturn <TemplatePartNavigationMenus menus={ uniqueNavigationMenuIds } />;\n}\n"]}
|
|
@@ -21,8 +21,14 @@ var _addedBy = require("../list/added-by");
|
|
|
21
21
|
|
|
22
22
|
var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
|
|
23
23
|
|
|
24
|
+
var _useNavigationMenuContent = _interopRequireDefault(require("./use-navigation-menu-content"));
|
|
25
|
+
|
|
24
26
|
var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
|
|
25
27
|
|
|
28
|
+
var _sidebarNavigationScreenDetailsPanel = require("../sidebar-navigation-screen-details-panel");
|
|
29
|
+
|
|
30
|
+
var _normalizeRecordKey = _interopRequireDefault(require("../../utils/normalize-record-key"));
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* WordPress dependencies
|
|
28
34
|
*/
|
|
@@ -31,6 +37,7 @@ var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../s
|
|
|
31
37
|
* Internal dependencies
|
|
32
38
|
*/
|
|
33
39
|
function usePatternDetails(postType, postId) {
|
|
40
|
+
postId = (0, _normalizeRecordKey.default)(postId);
|
|
34
41
|
const {
|
|
35
42
|
getDescription,
|
|
36
43
|
getTitle,
|
|
@@ -44,12 +51,12 @@ function usePatternDetails(postType, postId) {
|
|
|
44
51
|
|
|
45
52
|
if (!descriptionText && addedBy.text) {
|
|
46
53
|
descriptionText = (0, _i18n.sprintf)( // translators: %s: pattern title e.g: "Header".
|
|
47
|
-
(0, _i18n.__)('This is
|
|
54
|
+
(0, _i18n.__)('This is the %s pattern.'), getTitle());
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
if (!descriptionText && postType === 'wp_block' && record?.title) {
|
|
51
58
|
descriptionText = (0, _i18n.sprintf)( // translators: %s: user created pattern title e.g. "Footer".
|
|
52
|
-
(0, _i18n.__)('This is
|
|
59
|
+
(0, _i18n.__)('This is the %s pattern.'), record.title);
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
const description = (0, _element.createElement)(_element.Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && (0, _element.createElement)("span", {
|
|
@@ -71,9 +78,28 @@ function usePatternDetails(postType, postId) {
|
|
|
71
78
|
const footer = !!record?.modified ? (0, _element.createElement)(_sidebarNavigationScreenDetailsFooter.default, {
|
|
72
79
|
lastModifiedDateTime: record.modified
|
|
73
80
|
}) : null;
|
|
81
|
+
const details = [];
|
|
82
|
+
|
|
83
|
+
if (postType === 'wp_block') {
|
|
84
|
+
details.push({
|
|
85
|
+
label: (0, _i18n.__)('Syncing'),
|
|
86
|
+
value: record.wp_pattern_sync_status === 'unsynced' ? (0, _i18n.__)('Not synced') : (0, _i18n.__)('Fully synced')
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const content = (0, _element.createElement)(_element.Fragment, null, !!details.length && (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanel, {
|
|
91
|
+
spacing: 5,
|
|
92
|
+
title: (0, _i18n.__)('Details')
|
|
93
|
+
}, details.map(({
|
|
94
|
+
label,
|
|
95
|
+
value
|
|
96
|
+
}) => (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelRow, {
|
|
97
|
+
key: label
|
|
98
|
+
}, (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelLabel, null, label), (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelValue, null, value)))), (0, _useNavigationMenuContent.default)(postType, postId));
|
|
74
99
|
return {
|
|
75
100
|
title,
|
|
76
101
|
description,
|
|
102
|
+
content,
|
|
77
103
|
footer
|
|
78
104
|
};
|
|
79
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified","details","push","label","value","wp_pattern_sync_status","content","length","map"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../list/added-by';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport normalizeRecordKey from '../../utils/normalize-record-key';\n\nexport default function usePatternDetails( postType, postId ) {\n\tpostId = normalizeRecordKey( postId );\n\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\tgetTitle()\n\t\t);\n\t}\n\n\tif ( ! descriptionText && postType === 'wp_block' && record?.title ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'pattern' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tconst footer = !! record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\tlastModifiedDateTime={ record.modified }\n\t\t/>\n\t) : null;\n\n\tconst details = [];\n\n\tif ( postType === 'wp_block' ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"]}
|
|
@@ -25,14 +25,14 @@ function CategoryItem({
|
|
|
25
25
|
type
|
|
26
26
|
}) {
|
|
27
27
|
const linkInfo = (0, _link.useLink)({
|
|
28
|
-
path: '/
|
|
28
|
+
path: '/patterns',
|
|
29
29
|
categoryType: type,
|
|
30
30
|
categoryId: id
|
|
31
31
|
}, {
|
|
32
32
|
// Keep a record of where we came from in state so we can
|
|
33
|
-
// use the browser's back button to go back to
|
|
33
|
+
// use the browser's back button to go back to Patterns.
|
|
34
34
|
// See the implementation of the back button in patterns-list.
|
|
35
|
-
backPath: '/
|
|
35
|
+
backPath: '/patterns'
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
if (!count) {
|
|
@@ -42,7 +42,7 @@ function CategoryItem({
|
|
|
42
42
|
return (0, _element.createElement)(_sidebarNavigationItem.default, { ...linkInfo,
|
|
43
43
|
icon: icon,
|
|
44
44
|
suffix: (0, _element.createElement)("span", null, count),
|
|
45
|
-
|
|
45
|
+
"aria-current": isActive ? 'true' : undefined
|
|
46
46
|
}, label);
|
|
47
47
|
}
|
|
48
48
|
//# sourceMappingURL=category-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"names":["CategoryItem","count","icon","id","isActive","label","type","linkInfo","path","categoryType","categoryId","backPath","undefined"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,YAAT,CAAuB;AACrCC,EAAAA,KADqC;AAErCC,EAAAA,IAFqC;AAGrCC,EAAAA,EAHqC;AAIrCC,EAAAA,QAJqC;AAKrCC,EAAAA,KALqC;AAMrCC,EAAAA;AANqC,CAAvB,EAOX;AACH,QAAMC,QAAQ,GAAG,mBAChB;AACCC,IAAAA,IAAI,EAAE,WADP;AAECC,IAAAA,YAAY,EAAEH,IAFf;AAGCI,IAAAA,UAAU,EAAEP;AAHb,GADgB,EAMhB;AACC;AACA;AACA;AACAQ,IAAAA,QAAQ,EAAE;AAJX,GANgB,CAAjB;;AAcA,MAAK,CAAEV,KAAP,EAAe;AACd;AACA;;AAED,SACC,4BAAC,8BAAD,OACMM,QADN;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,MAAM,EAAG,0CAAQD,KAAR,CAHV;AAIC,oBAAeG,QAAQ,GAAG,MAAH,GAAYQ;AAJpC,KAMGP,KANH,CADD;AAUA","sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpath: '/patterns',\n\t\t\tcategoryType: type,\n\t\t\tcategoryId: id,\n\t\t},\n\t\t{\n\t\t\t// Keep a record of where we came from in state so we can\n\t\t\t// use the browser's back button to go back to Patterns.\n\t\t\t// See the implementation of the back button in patterns-list.\n\t\t\tbackPath: '/patterns',\n\t\t}\n\t);\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,173 @@
|
|
|
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 = SidebarNavigationScreenPatterns;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _compose = require("@wordpress/compose");
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _editor = require("@wordpress/editor");
|
|
19
|
+
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
22
|
+
var _url = require("@wordpress/url");
|
|
23
|
+
|
|
24
|
+
var _icons = require("@wordpress/icons");
|
|
25
|
+
|
|
26
|
+
var _addNewPattern = _interopRequireDefault(require("../add-new-pattern"));
|
|
27
|
+
|
|
28
|
+
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
29
|
+
|
|
30
|
+
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
31
|
+
|
|
32
|
+
var _categoryItem = _interopRequireDefault(require("./category-item"));
|
|
33
|
+
|
|
34
|
+
var _utils = require("../page-patterns/utils");
|
|
35
|
+
|
|
36
|
+
var _store = require("../../store");
|
|
37
|
+
|
|
38
|
+
var _link = require("../routes/link");
|
|
39
|
+
|
|
40
|
+
var _usePatternCategories = _interopRequireDefault(require("./use-pattern-categories"));
|
|
41
|
+
|
|
42
|
+
var _useMyPatterns = _interopRequireDefault(require("./use-my-patterns"));
|
|
43
|
+
|
|
44
|
+
var _useTemplatePartAreas = _interopRequireDefault(require("./use-template-part-areas"));
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* WordPress dependencies
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Internal dependencies
|
|
52
|
+
*/
|
|
53
|
+
function TemplatePartGroup({
|
|
54
|
+
areas,
|
|
55
|
+
currentArea,
|
|
56
|
+
currentType
|
|
57
|
+
}) {
|
|
58
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
59
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group-header"
|
|
60
|
+
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
61
|
+
level: 2
|
|
62
|
+
}, (0, _i18n.__)('Template parts'))), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
63
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
64
|
+
}, Object.entries(areas).map(([area, {
|
|
65
|
+
label,
|
|
66
|
+
templateParts
|
|
67
|
+
}]) => (0, _element.createElement)(_categoryItem.default, {
|
|
68
|
+
key: area,
|
|
69
|
+
count: templateParts?.length,
|
|
70
|
+
icon: (0, _editor.getTemplatePartIcon)(area),
|
|
71
|
+
label: label,
|
|
72
|
+
id: area,
|
|
73
|
+
type: "wp_template_part",
|
|
74
|
+
isActive: currentArea === area && currentType === 'wp_template_part'
|
|
75
|
+
}))));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function ThemePatternsGroup({
|
|
79
|
+
categories,
|
|
80
|
+
currentCategory,
|
|
81
|
+
currentType
|
|
82
|
+
}) {
|
|
83
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
84
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
85
|
+
}, categories.map(category => (0, _element.createElement)(_categoryItem.default, {
|
|
86
|
+
key: category.name,
|
|
87
|
+
count: category.count,
|
|
88
|
+
label: (0, _element.createElement)(_components.Flex, {
|
|
89
|
+
justify: "left",
|
|
90
|
+
align: "center",
|
|
91
|
+
gap: 0
|
|
92
|
+
}, category.label, (0, _element.createElement)(_components.Tooltip, {
|
|
93
|
+
position: "top center",
|
|
94
|
+
text: (0, _i18n.sprintf)( // translators: %s: The pattern category name.
|
|
95
|
+
'"%s" patterns cannot be edited.', category.label)
|
|
96
|
+
}, (0, _element.createElement)("span", {
|
|
97
|
+
className: "edit-site-sidebar-navigation-screen-pattern__lock-icon"
|
|
98
|
+
}, (0, _element.createElement)(_components.Icon, {
|
|
99
|
+
icon: _icons.lockSmall,
|
|
100
|
+
size: 24
|
|
101
|
+
})))),
|
|
102
|
+
icon: _icons.file,
|
|
103
|
+
id: category.name,
|
|
104
|
+
type: "pattern",
|
|
105
|
+
isActive: currentCategory === `${category.name}` && currentType === 'pattern'
|
|
106
|
+
}))));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function SidebarNavigationScreenPatterns() {
|
|
110
|
+
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
111
|
+
const {
|
|
112
|
+
categoryType,
|
|
113
|
+
categoryId
|
|
114
|
+
} = (0, _url.getQueryArgs)(window.location.href);
|
|
115
|
+
const currentCategory = categoryId || _utils.DEFAULT_CATEGORY;
|
|
116
|
+
const currentType = categoryType || _utils.DEFAULT_TYPE;
|
|
117
|
+
const {
|
|
118
|
+
templatePartAreas,
|
|
119
|
+
hasTemplateParts,
|
|
120
|
+
isLoading
|
|
121
|
+
} = (0, _useTemplatePartAreas.default)();
|
|
122
|
+
const {
|
|
123
|
+
patternCategories,
|
|
124
|
+
hasPatterns
|
|
125
|
+
} = (0, _usePatternCategories.default)();
|
|
126
|
+
const {
|
|
127
|
+
myPatterns
|
|
128
|
+
} = (0, _useMyPatterns.default)();
|
|
129
|
+
const isTemplatePartsMode = (0, _data.useSelect)(select => {
|
|
130
|
+
const settings = select(_store.store).getSettings();
|
|
131
|
+
return !!settings.supportsTemplatePartsMode;
|
|
132
|
+
}, []);
|
|
133
|
+
const templatePartsLink = (0, _link.useLink)({
|
|
134
|
+
path: '/wp_template_part/all'
|
|
135
|
+
});
|
|
136
|
+
const footer = !isMobileViewport ? (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_sidebarNavigationItem.default, {
|
|
137
|
+
as: "a",
|
|
138
|
+
href: "edit.php?post_type=wp_block",
|
|
139
|
+
withChevron: true
|
|
140
|
+
}, (0, _i18n.__)('Manage all of my patterns')), (0, _element.createElement)(_sidebarNavigationItem.default, {
|
|
141
|
+
withChevron: true,
|
|
142
|
+
...templatePartsLink
|
|
143
|
+
}, (0, _i18n.__)('Manage all template parts'))) : undefined;
|
|
144
|
+
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
145
|
+
isRoot: isTemplatePartsMode,
|
|
146
|
+
title: (0, _i18n.__)('Patterns'),
|
|
147
|
+
description: (0, _i18n.__)('Manage what patterns are available when editing the site.'),
|
|
148
|
+
actions: (0, _element.createElement)(_addNewPattern.default, null),
|
|
149
|
+
footer: footer,
|
|
150
|
+
content: (0, _element.createElement)(_element.Fragment, null, isLoading && (0, _i18n.__)('Loading patterns'), !isLoading && (0, _element.createElement)(_element.Fragment, null, !hasTemplateParts && !hasPatterns && (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
151
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
152
|
+
}, (0, _element.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No template parts or patterns found'))), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
153
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
154
|
+
}, (0, _element.createElement)(_categoryItem.default, {
|
|
155
|
+
key: myPatterns.name,
|
|
156
|
+
count: !myPatterns.count ? '0' : myPatterns.count,
|
|
157
|
+
label: myPatterns.label,
|
|
158
|
+
icon: _icons.starFilled,
|
|
159
|
+
id: myPatterns.name,
|
|
160
|
+
type: "wp_block",
|
|
161
|
+
isActive: currentCategory === `${myPatterns.name}` && currentType === 'wp_block'
|
|
162
|
+
})), hasPatterns && (0, _element.createElement)(ThemePatternsGroup, {
|
|
163
|
+
categories: patternCategories,
|
|
164
|
+
currentCategory: currentCategory,
|
|
165
|
+
currentType: currentType
|
|
166
|
+
}), hasTemplateParts && (0, _element.createElement)(TemplatePartGroup, {
|
|
167
|
+
areas: templatePartAreas,
|
|
168
|
+
currentArea: currentCategory,
|
|
169
|
+
currentType: currentType
|
|
170
|
+
})))
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"names":["TemplatePartGroup","areas","currentArea","currentType","Object","entries","map","area","label","templateParts","length","ThemePatternsGroup","categories","currentCategory","category","name","count","lockSmall","file","SidebarNavigationScreenPatterns","isMobileViewport","categoryType","categoryId","window","location","href","DEFAULT_CATEGORY","DEFAULT_TYPE","templatePartAreas","hasTemplateParts","isLoading","patternCategories","hasPatterns","myPatterns","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","templatePartsLink","path","footer","undefined","starFilled"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\tFlex,\n\tIcon,\n\tTooltip,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getQueryArgs } from '@wordpress/url';\nimport { file, starFilled, lockSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\nimport usePatternCategories from './use-pattern-categories';\nimport useMyPatterns from './use-my-patterns';\nimport useTemplatePartAreas from './use-template-part-areas';\n\nfunction TemplatePartGroup( { areas, currentArea, currentType } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__group-header\">\n\t\t\t\t<Heading level={ 2 }>{ __( 'Template parts' ) }</Heading>\n\t\t\t</div>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ Object.entries( areas ).map(\n\t\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\t\ttype=\"wp_template_part\"\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === area &&\n\t\t\t\t\t\t\t\tcurrentType === 'wp_template_part'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nfunction ThemePatternsGroup( { categories, currentCategory, currentType } ) {\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\tcount={ category.count }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t<Flex justify=\"left\" align=\"center\" gap={ 0 }>\n\t\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\t\ttext={ sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The pattern category name.\n\t\t\t\t\t\t\t\t\t\t'\"%s\" patterns cannot be edited.',\n\t\t\t\t\t\t\t\t\t\tcategory.label\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__lock-icon\">\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ lockSmall } size={ 24 } />\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ticon={ file }\n\t\t\t\t\t\tid={ category.name }\n\t\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t\tcurrentType === 'pattern'\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst currentCategory = categoryId || DEFAULT_CATEGORY;\n\tconst currentType = categoryType || DEFAULT_TYPE;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst { myPatterns } = useMyPatterns();\n\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst templatePartsLink = useLink( { path: '/wp_template_part/all' } );\n\tconst footer = ! isMobileViewport ? (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tas=\"a\"\n\t\t\t\thref=\"edit.php?post_type=wp_block\"\n\t\t\t\twithChevron\n\t\t\t>\n\t\t\t\t{ __( 'Manage all of my patterns' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem withChevron { ...templatePartsLink }>\n\t\t\t\t{ __( 'Manage all template parts' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t) : undefined;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tfooter={ footer }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading patterns' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No template parts or patterns found'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\t\t\tkey={ myPatterns.name }\n\t\t\t\t\t\t\t\t\tcount={\n\t\t\t\t\t\t\t\t\t\t! myPatterns.count\n\t\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t\t: myPatterns.count\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlabel={ myPatterns.label }\n\t\t\t\t\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\t\t\t\t\tid={ myPatterns.name }\n\t\t\t\t\t\t\t\t\ttype=\"wp_block\"\n\t\t\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t\t\tcurrentCategory ===\n\t\t\t\t\t\t\t\t\t\t\t`${ myPatterns.name }` &&\n\t\t\t\t\t\t\t\t\t\tcurrentType === 'wp_block'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t\t\t\t<ThemePatternsGroup\n\t\t\t\t\t\t\t\t\tcategories={ patternCategories }\n\t\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasTemplateParts && (\n\t\t\t\t\t\t\t\t<TemplatePartGroup\n\t\t\t\t\t\t\t\t\tareas={ templatePartAreas }\n\t\t\t\t\t\t\t\t\tcurrentArea={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js"],"names":["useDefaultPatternCategories","blockPatternCategories","select","getSettings","editSiteStore","settings","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatternCategories","coreStore","getBlockPatternCategories"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,2BAAT,GAAuC;AACrD,QAAMC,sBAAsB,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAAkB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AACA,UAAMC,QAAQ,GAAGF,WAAW,EAA5B;AAEA,oCACCE,QAAQ,CAACC,8CADV,yEAECD,QAAQ,CAACE,oCAFV;AAIA,GAR8B,CAA/B;AAUA,QAAMC,0BAA0B,GAAG,qBAAaN,MAAF,IAC7CA,MAAM,CAAEO,eAAF,CAAN,CAAoBC,yBAApB,EADkC,CAAnC;AAIA,SAAO,CACN,IAAKT,sBAAsB,IAAI,EAA/B,CADM,EAEN,IAAKO,0BAA0B,IAAI,EAAnC,CAFM,CAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useDefaultPatternCategories() {\n\tconst blockPatternCategories = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\tconst settings = getSettings();\n\n\t\treturn (\n\t\t\tsettings.__experimentalAdditionalBlockPatternCategories ??\n\t\t\tsettings.__experimentalBlockPatternCategories\n\t\t);\n\t} );\n\n\tconst restBlockPatternCategories = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatternCategories()\n\t);\n\n\treturn [\n\t\t...( blockPatternCategories || [] ),\n\t\t...( restBlockPatternCategories || [] ),\n\t];\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useMyPatterns;
|
|
7
|
+
|
|
8
|
+
var _coreData = require("@wordpress/core-data");
|
|
9
|
+
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
function useMyPatterns() {
|
|
18
|
+
const myPatternsCount = (0, _data.useSelect)(select => {
|
|
19
|
+
var _select$getEntityReco;
|
|
20
|
+
|
|
21
|
+
return (_select$getEntityReco = select(_coreData.store).getEntityRecords('postType', 'wp_block', {
|
|
22
|
+
per_page: -1
|
|
23
|
+
})?.length) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : 0;
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
myPatterns: {
|
|
27
|
+
count: myPatternsCount,
|
|
28
|
+
name: 'my-patterns',
|
|
29
|
+
label: (0, _i18n.__)('My patterns')
|
|
30
|
+
},
|
|
31
|
+
hasPatterns: myPatternsCount > 0
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=use-my-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js"],"names":["useMyPatterns","myPatternsCount","select","coreStore","getEntityRecords","per_page","length","myPatterns","count","name","label","hasPatterns"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKe,SAASA,aAAT,GAAyB;AACvC,QAAMC,eAAe,GAAG,qBACrBC,MAAF;AAAA;;AAAA,oCACCA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,gBAApB,CAAsC,UAAtC,EAAkD,UAAlD,EAA8D;AAC7DC,MAAAA,QAAQ,EAAE,CAAC;AADkD,KAA9D,GAEKC,MAHN,yEAGgB,CAHhB;AAAA,GADuB,CAAxB;AAOA,SAAO;AACNC,IAAAA,UAAU,EAAE;AACXC,MAAAA,KAAK,EAAEP,eADI;AAEXQ,MAAAA,IAAI,EAAE,aAFK;AAGXC,MAAAA,KAAK,EAAE,cAAI,aAAJ;AAHI,KADN;AAMNC,IAAAA,WAAW,EAAEV,eAAe,GAAG;AANzB,GAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\nexport default function useMyPatterns() {\n\tconst myPatternsCount = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t\t} )?.length ?? 0\n\t);\n\n\treturn {\n\t\tmyPatterns: {\n\t\t\tcount: myPatternsCount,\n\t\t\tname: 'my-patterns',\n\t\t\tlabel: __( 'My patterns' ),\n\t\t},\n\t\thasPatterns: myPatternsCount > 0,\n\t};\n}\n"]}
|