@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
package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js
CHANGED
|
@@ -18,9 +18,10 @@ export default function TemplatePartNavigationMenu({
|
|
|
18
18
|
if (!id) return null;
|
|
19
19
|
return createElement(Fragment, null, createElement(Heading, {
|
|
20
20
|
className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
|
|
21
|
-
size: "
|
|
22
|
-
upperCase: true
|
|
23
|
-
|
|
21
|
+
size: "11",
|
|
22
|
+
upperCase: true,
|
|
23
|
+
weight: 500
|
|
24
|
+
}, title?.rendered || title || __('Navigation')), createElement(NavigationMenuEditor, {
|
|
24
25
|
navigationMenuId: id
|
|
25
26
|
}));
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"names":["__","__experimentalHeading","Heading","useEntityProp","NavigationMenuEditor","TemplatePartNavigationMenu","id","title","rendered"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,uBAAjD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,qEAAjC;AAEA,eAAe,SAASC,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAA8C;AAC5D,QAAM,CAAEC,KAAF,IAAYJ,aAAa,CAAE,UAAF,EAAc,eAAd,EAA+B,OAA/B,EAAwCG,EAAxC,CAA/B;AAEA,MAAK,CAAEA,EAAP,EAAY,OAAO,IAAP;AAEZ,SACC,8BACC,cAAC,OAAD;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":["__","__experimentalHeading","Heading","useEntityProp","NavigationMenuEditor","TemplatePartNavigationMenu","id","title","rendered"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,uBAAjD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,qEAAjC;AAEA,eAAe,SAASC,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAA8C;AAC5D,QAAM,CAAEC,KAAF,IAAYJ,aAAa,CAAE,UAAF,EAAc,eAAd,EAA+B,OAA/B,EAAwCG,EAAxC,CAA/B;AAEA,MAAK,CAAEA,EAAP,EAAY,OAAO,IAAP;AAEZ,SACC,8BACC,cAAC,OAAD;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,IAA4BP,EAAE,CAAE,YAAF,CANjC,CADD,EASC,cAAC,oBAAD;AAAsB,IAAA,gBAAgB,EAAGM;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-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js
CHANGED
|
@@ -25,8 +25,9 @@ export default function TemplatePartNavigationMenus({
|
|
|
25
25
|
|
|
26
26
|
return createElement(Fragment, null, createElement(Heading, {
|
|
27
27
|
className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
|
|
28
|
-
size: "
|
|
29
|
-
upperCase: true
|
|
28
|
+
size: "11",
|
|
29
|
+
upperCase: true,
|
|
30
|
+
weight: 500
|
|
30
31
|
}, __('Navigation')), createElement(TemplatePartNavigationMenuList, {
|
|
31
32
|
menus: menus
|
|
32
33
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"names":["__","__experimentalHeading","Heading","TemplatePartNavigationMenu","TemplatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,uBAAjD;AACA;AACA;AACA;;AACA,OAAOC,0BAAP,MAAuC,iCAAvC;AACA,OAAOC,8BAAP,MAA2C,sCAA3C;AAEA,eAAe,SAASC,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,cAAC,0BAAD;AAA4B,MAAA,EAAE,EAAGD,KAAK,CAAE,CAAF;AAAtC,MAAP;AACA,GAN+D,CAQhE;;;AACA,SACC,8BACC,cAAC,OAAD;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":["__","__experimentalHeading","Heading","TemplatePartNavigationMenu","TemplatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,uBAAjD;AACA;AACA;AACA;;AACA,OAAOC,0BAAP,MAAuC,iCAAvC;AACA,OAAOC,8BAAP,MAA2C,sCAA3C;AAEA,eAAe,SAASC,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,cAAC,0BAAD;AAA4B,MAAA,EAAE,EAAGD,KAAK,CAAE,CAAF;AAAtC,MAAP;AACA,GAN+D,CAQhE;;;AACA,SACC,8BACC,cAAC,OAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG,IAHb;AAIC,IAAA,MAAM,EAAG;AAJV,KAMGN,EAAE,CAAE,YAAF,CANL,CADD,EASC,cAAC,8BAAD;AAAgC,IAAA,KAAK,EAAGM;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"]}
|
package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js
CHANGED
|
@@ -58,14 +58,22 @@ export default function useNavigationMenuContent(postType, postId) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const navigationBlocks = getBlocksOfTypeFromBlocks('core/navigation', record?.blocks);
|
|
61
|
-
const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref);
|
|
62
61
|
|
|
63
|
-
if (!
|
|
62
|
+
if (!navigationBlocks.length) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref); // Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.
|
|
67
|
+
// Also, filter out undefined values, as blocks don't have an id when initially added.
|
|
68
|
+
|
|
69
|
+
const uniqueNavigationMenuIds = [...new Set(navigationMenuIds)].filter(menuId => menuId);
|
|
70
|
+
|
|
71
|
+
if (!uniqueNavigationMenuIds?.length) {
|
|
64
72
|
return;
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
return createElement(TemplatePartNavigationMenus, {
|
|
68
|
-
menus:
|
|
76
|
+
menus: uniqueNavigationMenuIds
|
|
69
77
|
});
|
|
70
78
|
}
|
|
71
79
|
//# sourceMappingURL=use-navigation-menu-content.js.map
|
package/build-module/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":["TemplatePartNavigationMenus","useEditedEntityRecord","getBlocksOfTypeFromBlocks","targetBlockType","blocks","length","findInBlocks","_blocks","navigationBlocks","block","name","push","innerBlocks","innerNavigationBlocks","useNavigationMenuContent","postType","postId","record","navigationMenuIds","map","attributes","ref"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,2BAAP,MAAwC,kCAAxC;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,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;;AAED,eAAe,SAASU,wBAAT,CAAmCC,QAAnC,EAA6CC,MAA7C,EAAsD;AACpE,QAAM;AAAEC,IAAAA;AAAF,MAAahB,qBAAqB,CAAEc,QAAF,EAAYC,MAAZ,CAAxC,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":["TemplatePartNavigationMenus","useEditedEntityRecord","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":";;AAAA;AACA;AACA;AACA,OAAOA,2BAAP,MAAwC,kCAAxC;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,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;;AAED,eAAe,SAASU,wBAAT,CAAmCC,QAAnC,EAA6CC,MAA7C,EAAsD;AACpE,QAAM;AAAEC,IAAAA;AAAF,MAAahB,qBAAqB,CAAEc,QAAF,EAAYC,MAAZ,CAAxC,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,cAAC,2BAAD;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"]}
|
|
@@ -13,8 +13,12 @@ import { Icon } from '@wordpress/components';
|
|
|
13
13
|
|
|
14
14
|
import { useAddedBy } from '../list/added-by';
|
|
15
15
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
16
|
+
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
16
17
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
18
|
+
import { SidebarNavigationScreenDetailsPanel, SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
|
|
19
|
+
import normalizeRecordKey from '../../utils/normalize-record-key';
|
|
17
20
|
export default function usePatternDetails(postType, postId) {
|
|
21
|
+
postId = normalizeRecordKey(postId);
|
|
18
22
|
const {
|
|
19
23
|
getDescription,
|
|
20
24
|
getTitle,
|
|
@@ -28,12 +32,12 @@ export default function usePatternDetails(postType, postId) {
|
|
|
28
32
|
|
|
29
33
|
if (!descriptionText && addedBy.text) {
|
|
30
34
|
descriptionText = sprintf( // translators: %s: pattern title e.g: "Header".
|
|
31
|
-
__('This is
|
|
35
|
+
__('This is the %s pattern.'), getTitle());
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
if (!descriptionText && postType === 'wp_block' && record?.title) {
|
|
35
39
|
descriptionText = sprintf( // translators: %s: user created pattern title e.g. "Footer".
|
|
36
|
-
__('This is
|
|
40
|
+
__('This is the %s pattern.'), record.title);
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
const description = createElement(Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && createElement("span", {
|
|
@@ -55,9 +59,28 @@ export default function usePatternDetails(postType, postId) {
|
|
|
55
59
|
const footer = !!record?.modified ? createElement(SidebarNavigationScreenDetailsFooter, {
|
|
56
60
|
lastModifiedDateTime: record.modified
|
|
57
61
|
}) : null;
|
|
62
|
+
const details = [];
|
|
63
|
+
|
|
64
|
+
if (postType === 'wp_block') {
|
|
65
|
+
details.push({
|
|
66
|
+
label: __('Syncing'),
|
|
67
|
+
value: record.wp_pattern_sync_status === 'unsynced' ? __('Not synced') : __('Fully synced')
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const content = createElement(Fragment, null, !!details.length && createElement(SidebarNavigationScreenDetailsPanel, {
|
|
72
|
+
spacing: 5,
|
|
73
|
+
title: __('Details')
|
|
74
|
+
}, details.map(({
|
|
75
|
+
label,
|
|
76
|
+
value
|
|
77
|
+
}) => createElement(SidebarNavigationScreenDetailsPanelRow, {
|
|
78
|
+
key: label
|
|
79
|
+
}, createElement(SidebarNavigationScreenDetailsPanelLabel, null, label), createElement(SidebarNavigationScreenDetailsPanelValue, null, value)))), useNavigationMenuContent(postType, postId));
|
|
58
80
|
return {
|
|
59
81
|
title,
|
|
60
82
|
description,
|
|
83
|
+
content,
|
|
61
84
|
footer
|
|
62
85
|
};
|
|
63
86
|
}
|
package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["__","sprintf","_x","store","coreStore","useSelect","Icon","useAddedBy","useEditedEntityRecord","SidebarNavigationScreenDetailsFooter","usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,oCAAP,MAAiD,6CAAjD;AAEA,eAAe,SAASC,iBAAT,CAA4BC,QAA5B,EAAsCC,MAAtC,EAA+C;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["__","sprintf","_x","store","coreStore","useSelect","Icon","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","normalizeRecordKey","usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","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"]}
|
|
@@ -14,14 +14,14 @@ export default function CategoryItem({
|
|
|
14
14
|
type
|
|
15
15
|
}) {
|
|
16
16
|
const linkInfo = useLink({
|
|
17
|
-
path: '/
|
|
17
|
+
path: '/patterns',
|
|
18
18
|
categoryType: type,
|
|
19
19
|
categoryId: id
|
|
20
20
|
}, {
|
|
21
21
|
// Keep a record of where we came from in state so we can
|
|
22
|
-
// use the browser's back button to go back to
|
|
22
|
+
// use the browser's back button to go back to Patterns.
|
|
23
23
|
// See the implementation of the back button in patterns-list.
|
|
24
|
-
backPath: '/
|
|
24
|
+
backPath: '/patterns'
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
if (!count) {
|
|
@@ -31,7 +31,7 @@ export default function CategoryItem({
|
|
|
31
31
|
return createElement(SidebarNavigationItem, { ...linkInfo,
|
|
32
32
|
icon: icon,
|
|
33
33
|
suffix: createElement("span", null, count),
|
|
34
|
-
|
|
34
|
+
"aria-current": isActive ? 'true' : undefined
|
|
35
35
|
}, label);
|
|
36
36
|
}
|
|
37
37
|
//# 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":["SidebarNavigationItem","useLink","CategoryItem","count","icon","id","isActive","label","type","linkInfo","path","categoryType","categoryId","backPath","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,qBAAP,MAAkC,4BAAlC;AACA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,eAAe,SAASC,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,GAAGR,OAAO,CACvB;AACCS,IAAAA,IAAI,EAAE,WADP;AAECC,IAAAA,YAAY,EAAEH,IAFf;AAGCI,IAAAA,UAAU,EAAEP;AAHb,GADuB,EAMvB;AACC;AACA;AACA;AACAQ,IAAAA,QAAQ,EAAE;AAJX,GANuB,CAAxB;;AAcA,MAAK,CAAEV,KAAP,EAAe;AACd;AACA;;AAED,SACC,cAAC,qBAAD,OACMM,QADN;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,MAAM,EAAG,4BAAQD,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,148 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, Flex, Icon, Tooltip, __experimentalHeading as Heading } from '@wordpress/components';
|
|
7
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
10
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
+
import { getQueryArgs } from '@wordpress/url';
|
|
12
|
+
import { file, starFilled, lockSmall } from '@wordpress/icons';
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import AddNewPattern from '../add-new-pattern';
|
|
18
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
20
|
+
import CategoryItem from './category-item';
|
|
21
|
+
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';
|
|
22
|
+
import { store as editSiteStore } from '../../store';
|
|
23
|
+
import { useLink } from '../routes/link';
|
|
24
|
+
import usePatternCategories from './use-pattern-categories';
|
|
25
|
+
import useMyPatterns from './use-my-patterns';
|
|
26
|
+
import useTemplatePartAreas from './use-template-part-areas';
|
|
27
|
+
|
|
28
|
+
function TemplatePartGroup({
|
|
29
|
+
areas,
|
|
30
|
+
currentArea,
|
|
31
|
+
currentType
|
|
32
|
+
}) {
|
|
33
|
+
return createElement(Fragment, null, createElement("div", {
|
|
34
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group-header"
|
|
35
|
+
}, createElement(Heading, {
|
|
36
|
+
level: 2
|
|
37
|
+
}, __('Template parts'))), createElement(ItemGroup, {
|
|
38
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
39
|
+
}, Object.entries(areas).map(([area, {
|
|
40
|
+
label,
|
|
41
|
+
templateParts
|
|
42
|
+
}]) => createElement(CategoryItem, {
|
|
43
|
+
key: area,
|
|
44
|
+
count: templateParts?.length,
|
|
45
|
+
icon: getTemplatePartIcon(area),
|
|
46
|
+
label: label,
|
|
47
|
+
id: area,
|
|
48
|
+
type: "wp_template_part",
|
|
49
|
+
isActive: currentArea === area && currentType === 'wp_template_part'
|
|
50
|
+
}))));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function ThemePatternsGroup({
|
|
54
|
+
categories,
|
|
55
|
+
currentCategory,
|
|
56
|
+
currentType
|
|
57
|
+
}) {
|
|
58
|
+
return createElement(Fragment, null, createElement(ItemGroup, {
|
|
59
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
60
|
+
}, categories.map(category => createElement(CategoryItem, {
|
|
61
|
+
key: category.name,
|
|
62
|
+
count: category.count,
|
|
63
|
+
label: createElement(Flex, {
|
|
64
|
+
justify: "left",
|
|
65
|
+
align: "center",
|
|
66
|
+
gap: 0
|
|
67
|
+
}, category.label, createElement(Tooltip, {
|
|
68
|
+
position: "top center",
|
|
69
|
+
text: sprintf( // translators: %s: The pattern category name.
|
|
70
|
+
'"%s" patterns cannot be edited.', category.label)
|
|
71
|
+
}, createElement("span", {
|
|
72
|
+
className: "edit-site-sidebar-navigation-screen-pattern__lock-icon"
|
|
73
|
+
}, createElement(Icon, {
|
|
74
|
+
icon: lockSmall,
|
|
75
|
+
size: 24
|
|
76
|
+
})))),
|
|
77
|
+
icon: file,
|
|
78
|
+
id: category.name,
|
|
79
|
+
type: "pattern",
|
|
80
|
+
isActive: currentCategory === `${category.name}` && currentType === 'pattern'
|
|
81
|
+
}))));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default function SidebarNavigationScreenPatterns() {
|
|
85
|
+
const isMobileViewport = useViewportMatch('medium', '<');
|
|
86
|
+
const {
|
|
87
|
+
categoryType,
|
|
88
|
+
categoryId
|
|
89
|
+
} = getQueryArgs(window.location.href);
|
|
90
|
+
const currentCategory = categoryId || DEFAULT_CATEGORY;
|
|
91
|
+
const currentType = categoryType || DEFAULT_TYPE;
|
|
92
|
+
const {
|
|
93
|
+
templatePartAreas,
|
|
94
|
+
hasTemplateParts,
|
|
95
|
+
isLoading
|
|
96
|
+
} = useTemplatePartAreas();
|
|
97
|
+
const {
|
|
98
|
+
patternCategories,
|
|
99
|
+
hasPatterns
|
|
100
|
+
} = usePatternCategories();
|
|
101
|
+
const {
|
|
102
|
+
myPatterns
|
|
103
|
+
} = useMyPatterns();
|
|
104
|
+
const isTemplatePartsMode = useSelect(select => {
|
|
105
|
+
const settings = select(editSiteStore).getSettings();
|
|
106
|
+
return !!settings.supportsTemplatePartsMode;
|
|
107
|
+
}, []);
|
|
108
|
+
const templatePartsLink = useLink({
|
|
109
|
+
path: '/wp_template_part/all'
|
|
110
|
+
});
|
|
111
|
+
const footer = !isMobileViewport ? createElement(ItemGroup, null, createElement(SidebarNavigationItem, {
|
|
112
|
+
as: "a",
|
|
113
|
+
href: "edit.php?post_type=wp_block",
|
|
114
|
+
withChevron: true
|
|
115
|
+
}, __('Manage all of my patterns')), createElement(SidebarNavigationItem, {
|
|
116
|
+
withChevron: true,
|
|
117
|
+
...templatePartsLink
|
|
118
|
+
}, __('Manage all template parts'))) : undefined;
|
|
119
|
+
return createElement(SidebarNavigationScreen, {
|
|
120
|
+
isRoot: isTemplatePartsMode,
|
|
121
|
+
title: __('Patterns'),
|
|
122
|
+
description: __('Manage what patterns are available when editing the site.'),
|
|
123
|
+
actions: createElement(AddNewPattern, null),
|
|
124
|
+
footer: footer,
|
|
125
|
+
content: createElement(Fragment, null, isLoading && __('Loading patterns'), !isLoading && createElement(Fragment, null, !hasTemplateParts && !hasPatterns && createElement(ItemGroup, {
|
|
126
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
127
|
+
}, createElement(Item, null, __('No template parts or patterns found'))), createElement(ItemGroup, {
|
|
128
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
129
|
+
}, createElement(CategoryItem, {
|
|
130
|
+
key: myPatterns.name,
|
|
131
|
+
count: !myPatterns.count ? '0' : myPatterns.count,
|
|
132
|
+
label: myPatterns.label,
|
|
133
|
+
icon: starFilled,
|
|
134
|
+
id: myPatterns.name,
|
|
135
|
+
type: "wp_block",
|
|
136
|
+
isActive: currentCategory === `${myPatterns.name}` && currentType === 'wp_block'
|
|
137
|
+
})), hasPatterns && createElement(ThemePatternsGroup, {
|
|
138
|
+
categories: patternCategories,
|
|
139
|
+
currentCategory: currentCategory,
|
|
140
|
+
currentType: currentType
|
|
141
|
+
}), hasTemplateParts && createElement(TemplatePartGroup, {
|
|
142
|
+
areas: templatePartAreas,
|
|
143
|
+
currentArea: currentCategory,
|
|
144
|
+
currentType: currentType
|
|
145
|
+
})))
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","Flex","Icon","Tooltip","__experimentalHeading","Heading","useViewportMatch","useSelect","getTemplatePartIcon","__","sprintf","getQueryArgs","file","starFilled","lockSmall","AddNewPattern","SidebarNavigationItem","SidebarNavigationScreen","CategoryItem","DEFAULT_CATEGORY","DEFAULT_TYPE","store","editSiteStore","useLink","usePatternCategories","useMyPatterns","useTemplatePartAreas","TemplatePartGroup","areas","currentArea","currentType","Object","entries","map","area","label","templateParts","length","ThemePatternsGroup","categories","currentCategory","category","name","count","SidebarNavigationScreenPatterns","isMobileViewport","categoryType","categoryId","window","location","href","templatePartAreas","hasTemplateParts","isLoading","patternCategories","hasPatterns","myPatterns","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","templatePartsLink","path","footer","undefined"],"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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js"],"names":["store","coreStore","useSelect","unlock","editSiteStore","useDefaultPatternCategories","blockPatternCategories","select","getSettings","settings","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatternCategories","getBlockPatternCategories"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAMC,sBAAsB,GAAGJ,SAAS,CAAIK,MAAF,IAAc;AAAA;;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEI,MAAM,CAAEH,aAAF,CAAR,CAA9B;AACA,UAAMK,QAAQ,GAAGD,WAAW,EAA5B;AAEA,oCACCC,QAAQ,CAACC,8CADV,yEAECD,QAAQ,CAACE,oCAFV;AAIA,GARuC,CAAxC;AAUA,QAAMC,0BAA0B,GAAGV,SAAS,CAAIK,MAAF,IAC7CA,MAAM,CAAEN,SAAF,CAAN,CAAoBY,yBAApB,EAD2C,CAA5C;AAIA,SAAO,CACN,IAAKP,sBAAsB,IAAI,EAA/B,CADM,EAEN,IAAKM,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,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
export default function useMyPatterns() {
|
|
8
|
+
const myPatternsCount = useSelect(select => {
|
|
9
|
+
var _select$getEntityReco;
|
|
10
|
+
|
|
11
|
+
return (_select$getEntityReco = select(coreStore).getEntityRecords('postType', 'wp_block', {
|
|
12
|
+
per_page: -1
|
|
13
|
+
})?.length) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : 0;
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
myPatterns: {
|
|
17
|
+
count: myPatternsCount,
|
|
18
|
+
name: 'my-patterns',
|
|
19
|
+
label: __('My patterns')
|
|
20
|
+
},
|
|
21
|
+
hasPatterns: myPatternsCount > 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# 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":["store","coreStore","useSelect","__","useMyPatterns","myPatternsCount","select","getEntityRecords","per_page","length","myPatterns","count","name","label","hasPatterns"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAMC,eAAe,GAAGH,SAAS,CAC9BI,MAAF;AAAA;;AAAA,oCACCA,MAAM,CAAEL,SAAF,CAAN,CAAoBM,gBAApB,CAAsC,UAAtC,EAAkD,UAAlD,EAA8D;AAC7DC,MAAAA,QAAQ,EAAE,CAAC;AADkD,KAA9D,GAEKC,MAHN,yEAGgB,CAHhB;AAAA,GADgC,CAAjC;AAOA,SAAO;AACNC,IAAAA,UAAU,EAAE;AACXC,MAAAA,KAAK,EAAEN,eADI;AAEXO,MAAAA,IAAI,EAAE,aAFK;AAGXC,MAAAA,KAAK,EAAEV,EAAE,CAAE,aAAF;AAHE,KADN;AAMNW,IAAAA,WAAW,EAAET,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"]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
4
|
import { useMemo } from '@wordpress/element';
|
|
7
5
|
import { __ } from '@wordpress/i18n';
|
|
8
6
|
/**
|
|
@@ -13,10 +11,11 @@ import useDefaultPatternCategories from './use-default-pattern-categories';
|
|
|
13
11
|
import useThemePatterns from './use-theme-patterns';
|
|
14
12
|
export default function usePatternCategories() {
|
|
15
13
|
const defaultCategories = useDefaultPatternCategories();
|
|
14
|
+
defaultCategories.push({
|
|
15
|
+
name: 'uncategorized',
|
|
16
|
+
label: __('Uncategorized')
|
|
17
|
+
});
|
|
16
18
|
const themePatterns = useThemePatterns();
|
|
17
|
-
const userPatterns = useSelect(select => select(coreStore).getEntityRecords('postType', 'wp_block', {
|
|
18
|
-
per_page: -1
|
|
19
|
-
}));
|
|
20
19
|
const patternCategories = useMemo(() => {
|
|
21
20
|
const categoryMap = {};
|
|
22
21
|
const categoriesWithCounts = []; // Create a map for easier counting of patterns in categories.
|
|
@@ -34,25 +33,20 @@ export default function usePatternCategories() {
|
|
|
34
33
|
if (categoryMap[category]) {
|
|
35
34
|
categoryMap[category].count += 1;
|
|
36
35
|
}
|
|
37
|
-
});
|
|
36
|
+
}); // If the pattern has no categories, add it to uncategorized.
|
|
37
|
+
|
|
38
|
+
if (!pattern.categories?.length) {
|
|
39
|
+
categoryMap.uncategorized.count += 1;
|
|
40
|
+
}
|
|
38
41
|
}); // Filter categories so we only have those containing patterns.
|
|
39
42
|
|
|
40
43
|
defaultCategories.forEach(category => {
|
|
41
44
|
if (categoryMap[category.name].count) {
|
|
42
45
|
categoriesWithCounts.push(categoryMap[category.name]);
|
|
43
46
|
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (userPatterns?.length) {
|
|
47
|
-
categoriesWithCounts.push({
|
|
48
|
-
count: userPatterns.length || 0,
|
|
49
|
-
name: 'custom-patterns',
|
|
50
|
-
label: __('Custom patterns')
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
47
|
+
});
|
|
54
48
|
return categoriesWithCounts;
|
|
55
|
-
}, [defaultCategories, themePatterns
|
|
49
|
+
}, [defaultCategories, themePatterns]);
|
|
56
50
|
return {
|
|
57
51
|
patternCategories,
|
|
58
52
|
hasPatterns: !!patternCategories.length
|
package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"names":["useMemo","__","useDefaultPatternCategories","useThemePatterns","usePatternCategories","defaultCategories","push","name","label","themePatterns","patternCategories","categoryMap","categoriesWithCounts","forEach","category","count","pattern","categories","length","uncategorized","hasPatterns"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,kCAAxC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AAEA,eAAe,SAASC,oBAAT,GAAgC;AAC9C,QAAMC,iBAAiB,GAAGH,2BAA2B,EAArD;AACAG,EAAAA,iBAAiB,CAACC,IAAlB,CAAwB;AACvBC,IAAAA,IAAI,EAAE,eADiB;AAEvBC,IAAAA,KAAK,EAAEP,EAAE,CAAE,eAAF;AAFc,GAAxB;AAIA,QAAMQ,aAAa,GAAGN,gBAAgB,EAAtC;AAEA,QAAMO,iBAAiB,GAAGV,OAAO,CAAE,MAAM;AACxC,UAAMW,WAAW,GAAG,EAApB;AACA,UAAMC,oBAAoB,GAAG,EAA7B,CAFwC,CAIxC;;AACAP,IAAAA,iBAAiB,CAACQ,OAAlB,CAA6BC,QAAF,IAAgB;AAC1C,UAAK,CAAEH,WAAW,CAAEG,QAAQ,CAACP,IAAX,CAAlB,EAAsC;AACrCI,QAAAA,WAAW,CAAEG,QAAQ,CAACP,IAAX,CAAX,GAA+B,EAAE,GAAGO,QAAL;AAAeC,UAAAA,KAAK,EAAE;AAAtB,SAA/B;AACA;AACD,KAJD,EALwC,CAWxC;;AACAN,IAAAA,aAAa,CAACI,OAAd,CAAyBG,OAAF,IAAe;AACrCA,MAAAA,OAAO,CAACC,UAAR,EAAoBJ,OAApB,CAA+BC,QAAF,IAAgB;AAC5C,YAAKH,WAAW,CAAEG,QAAF,CAAhB,EAA+B;AAC9BH,UAAAA,WAAW,CAAEG,QAAF,CAAX,CAAwBC,KAAxB,IAAiC,CAAjC;AACA;AACD,OAJD,EADqC,CAMrC;;AACA,UAAK,CAAEC,OAAO,CAACC,UAAR,EAAoBC,MAA3B,EAAoC;AACnCP,QAAAA,WAAW,CAACQ,aAAZ,CAA0BJ,KAA1B,IAAmC,CAAnC;AACA;AACD,KAVD,EAZwC,CAwBxC;;AACAV,IAAAA,iBAAiB,CAACQ,OAAlB,CAA6BC,QAAF,IAAgB;AAC1C,UAAKH,WAAW,CAAEG,QAAQ,CAACP,IAAX,CAAX,CAA6BQ,KAAlC,EAA0C;AACzCH,QAAAA,oBAAoB,CAACN,IAArB,CAA2BK,WAAW,CAAEG,QAAQ,CAACP,IAAX,CAAtC;AACA;AACD,KAJD;AAMA,WAAOK,oBAAP;AACA,GAhCgC,EAgC9B,CAAEP,iBAAF,EAAqBI,aAArB,CAhC8B,CAAjC;AAkCA,SAAO;AAAEC,IAAAA,iBAAF;AAAqBU,IAAAA,WAAW,EAAE,CAAC,CAAEV,iBAAiB,CAACQ;AAAvD,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tdefaultCategories.push( {\n\t\tname: 'uncategorized',\n\t\tlabel: __( 'Uncategorized' ),\n\t} );\n\tconst themePatterns = useThemePatterns();\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif ( ! pattern.categories?.length ) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Filter categories so we only have those containing patterns.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( categoryMap[ category.name ].count ) {\n\t\t\t\tcategoriesWithCounts.push( categoryMap[ category.name ] );\n\t\t\t}\n\t\t} );\n\n\t\treturn categoriesWithCounts;\n\t}, [ defaultCategories, themePatterns ] );\n\n\treturn { patternCategories, hasPatterns: !! patternCategories.length };\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
+
|
|
8
|
+
const useTemplatePartsGroupedByArea = items => {
|
|
9
|
+
const allItems = items || [];
|
|
10
|
+
const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []); // Create map of template areas ensuring that default areas are displayed before
|
|
11
|
+
// any custom registered template part areas.
|
|
12
|
+
|
|
13
|
+
const knownAreas = {
|
|
14
|
+
header: {},
|
|
15
|
+
footer: {},
|
|
16
|
+
sidebar: {},
|
|
17
|
+
uncategorized: {}
|
|
18
|
+
};
|
|
19
|
+
templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { ...templatePartArea,
|
|
20
|
+
templateParts: []
|
|
21
|
+
});
|
|
22
|
+
const groupedByArea = allItems.reduce((accumulator, item) => {
|
|
23
|
+
const key = accumulator[item.area] ? item.area : 'uncategorized';
|
|
24
|
+
accumulator[key].templateParts.push(item);
|
|
25
|
+
return accumulator;
|
|
26
|
+
}, knownAreas);
|
|
27
|
+
return groupedByArea;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default function useTemplatePartAreas() {
|
|
31
|
+
const {
|
|
32
|
+
records: templateParts,
|
|
33
|
+
isResolving: isLoading
|
|
34
|
+
} = useEntityRecords('postType', 'wp_template_part', {
|
|
35
|
+
per_page: -1
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
hasTemplateParts: templateParts ? !!templateParts.length : false,
|
|
39
|
+
isLoading,
|
|
40
|
+
templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=use-template-part-areas.js.map
|
package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"names":["useEntityRecords","useSelect","store","editorStore","useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","knownAreas","header","footer","sidebar","uncategorized","forEach","templatePartArea","area","templateParts","groupedByArea","reduce","accumulator","item","key","push","useTemplatePartAreas","records","isResolving","isLoading","per_page","hasTemplateParts","length"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,sBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;;AAEA,MAAMC,6BAA6B,GAAKC,KAAF,IAAa;AAClD,QAAMC,QAAQ,GAAGD,KAAK,IAAI,EAA1B;AAEA,QAAME,iBAAiB,GAAGN,SAAS,CAChCO,MAAF,IACCA,MAAM,CAAEL,WAAF,CAAN,CAAsBM,yCAAtB,EAFiC,EAGlC,EAHkC,CAAnC,CAHkD,CASlD;AACA;;AACA,QAAMC,UAAU,GAAG;AAClBC,IAAAA,MAAM,EAAE,EADU;AAElBC,IAAAA,MAAM,EAAE,EAFU;AAGlBC,IAAAA,OAAO,EAAE,EAHS;AAIlBC,IAAAA,aAAa,EAAE;AAJG,GAAnB;AAOAP,EAAAA,iBAAiB,CAACQ,OAAlB,CACGC,gBAAF,IACGN,UAAU,CAAEM,gBAAgB,CAACC,IAAnB,CAAV,GAAsC,EACvC,GAAGD,gBADoC;AAEvCE,IAAAA,aAAa,EAAE;AAFwB,GAF1C;AAQA,QAAMC,aAAa,GAAGb,QAAQ,CAACc,MAAT,CAAiB,CAAEC,WAAF,EAAeC,IAAf,KAAyB;AAC/D,UAAMC,GAAG,GAAGF,WAAW,CAAEC,IAAI,CAACL,IAAP,CAAX,GAA2BK,IAAI,CAACL,IAAhC,GAAuC,eAAnD;AACAI,IAAAA,WAAW,CAAEE,GAAF,CAAX,CAAmBL,aAAnB,CAAiCM,IAAjC,CAAuCF,IAAvC;AACA,WAAOD,WAAP;AACA,GAJqB,EAInBX,UAJmB,CAAtB;AAMA,SAAOS,aAAP;AACA,CAjCD;;AAmCA,eAAe,SAASM,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA,OAAO,EAAER,aAAX;AAA0BS,IAAAA,WAAW,EAAEC;AAAvC,MAAqD5B,gBAAgB,CAC1E,UAD0E,EAE1E,kBAF0E,EAG1E;AAAE6B,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAH0E,CAA3E;AAMA,SAAO;AACNC,IAAAA,gBAAgB,EAAEZ,aAAa,GAAG,CAAC,CAAEA,aAAa,CAACa,MAApB,GAA6B,KADtD;AAENH,IAAAA,SAFM;AAGNrB,IAAAA,iBAAiB,EAAEH,6BAA6B,CAAEc,aAAF;AAH1C,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst useTemplatePartsGroupedByArea = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\t// Create map of template areas ensuring that default areas are displayed before\n\t// any custom registered template part areas.\n\tconst knownAreas = {\n\t\theader: {},\n\t\tfooter: {},\n\t\tsidebar: {},\n\t\tuncategorized: {},\n\t};\n\n\ttemplatePartAreas.forEach(\n\t\t( templatePartArea ) =>\n\t\t\t( knownAreas[ templatePartArea.area ] = {\n\t\t\t\t...templatePartArea,\n\t\t\t\ttemplateParts: [],\n\t\t\t} )\n\t);\n\n\tconst groupedByArea = allItems.reduce( ( accumulator, item ) => {\n\t\tconst key = accumulator[ item.area ] ? item.area : 'uncategorized';\n\t\taccumulator[ key ].templateParts.push( item );\n\t\treturn accumulator;\n\t}, knownAreas );\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: useTemplatePartsGroupedByArea( templateParts ),\n\t};\n}\n"]}
|
|
@@ -8,7 +8,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { CORE_PATTERN_SOURCES, filterOutDuplicatesByName } from '../page-
|
|
11
|
+
import { CORE_PATTERN_SOURCES, filterOutDuplicatesByName } from '../page-patterns/utils';
|
|
12
12
|
import { unlock } from '../../lock-unlock';
|
|
13
13
|
import { store as editSiteStore } from '../../store';
|
|
14
14
|
export default function useThemePatterns() {
|
|
@@ -21,7 +21,7 @@ export default function useThemePatterns() {
|
|
|
21
21
|
return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns;
|
|
22
22
|
});
|
|
23
23
|
const restBlockPatterns = useSelect(select => select(coreStore).getBlockPatterns());
|
|
24
|
-
const patterns = useMemo(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !CORE_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName), [blockPatterns, restBlockPatterns]);
|
|
24
|
+
const patterns = useMemo(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !CORE_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]);
|
|
25
25
|
return patterns;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=use-theme-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js"],"names":["store","coreStore","useSelect","useMemo","CORE_PATTERN_SOURCES","filterOutDuplicatesByName","unlock","editSiteStore","useThemePatterns","blockPatterns","select","getSettings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","patterns","filter","pattern","includes","source","inserter"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SACCC,oBADD,EAECC,yBAFD,QAGO,wBAHP;AAIA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,gBAAT,GAA4B;AAC1C,QAAMC,aAAa,GAAGP,SAAS,CAAIQ,MAAF,IAAc;AAAA;;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEI,MAAM,CAAEH,aAAF,CAAR,CAA9B;AAEA,oCACCI,WAAW,GAAGC,qCADf,yEAECD,WAAW,GAAGE,2BAFf;AAIA,GAP8B,CAA/B;AASA,QAAMC,iBAAiB,GAAGZ,SAAS,CAAIQ,MAAF,IACpCA,MAAM,CAAET,SAAF,CAAN,CAAoBc,gBAApB,EADkC,CAAnC;AAIA,QAAMC,QAAQ,GAAGb,OAAO,CACvB,MACC,CAAE,IAAKM,aAAa,IAAI,EAAtB,CAAF,EAA8B,IAAKK,iBAAiB,IAAI,EAA1B,CAA9B,EACEG,MADF,CAEIC,OAAF,IACC,CAAEd,oBAAoB,CAACe,QAArB,CAA+BD,OAAO,CAACE,MAAvC,CAHL,EAKEH,MALF,CAKUZ,yBALV,EAMEY,MANF,CAMYC,OAAF,IAAeA,OAAO,CAACG,QAAR,KAAqB,KAN9C,CAFsB,EASvB,CAAEZ,aAAF,EAAiBK,iBAAjB,CATuB,CAAxB;AAYA,SAAOE,QAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCORE_PATTERN_SOURCES,\n\tfilterOutDuplicatesByName,\n} from '../page-patterns/utils';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useThemePatterns() {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn (\n\t\t\tgetSettings().__experimentalAdditionalBlockPatterns ??\n\t\t\tgetSettings().__experimentalBlockPatterns\n\t\t);\n\t} );\n\n\tconst restBlockPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatterns()\n\t);\n\n\tconst patterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]\n\t\t\t\t.filter(\n\t\t\t\t\t( pattern ) =>\n\t\t\t\t\t\t! CORE_PATTERN_SOURCES.includes( pattern.source )\n\t\t\t\t)\n\t\t\t\t.filter( filterOutDuplicatesByName )\n\t\t\t\t.filter( ( pattern ) => pattern.inserter !== false ),\n\t\t[ blockPatterns, restBlockPatterns ]\n\t);\n\n\treturn patterns;\n}\n"]}
|