@wordpress/edit-site 5.14.0 → 5.16.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 +1 -6
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +22 -7
- package/build/components/add-new-pattern/index.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/use-site-editor-settings.js +114 -13
- package/build/components/block-editor/use-site-editor-settings.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 +7 -3
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/editor/index.js +5 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +12 -7
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-block.js +16 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +12 -5
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +32 -25
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -3
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +4 -2
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +13 -9
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/layout/index.js +17 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/index.js +3 -3
- 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 -16
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- 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-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 +83 -58
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/grid.js +5 -18
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/page-patterns/index.js +3 -1
- package/build/components/page-patterns/index.js.map +1 -1
- 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 +110 -31
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- 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/use-patterns.js +116 -118
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- 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 +3 -25
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +1 -16
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +85 -51
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +10 -4
- package/build/components/save-hub/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-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/template-panel/index.js +15 -8
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +31 -15
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- 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/index.js +4 -4
- 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/single-navigation-menu.js +3 -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 +5 -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/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 +4 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.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/status-label.js +1 -34
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +35 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +9 -7
- 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 +19 -4
- 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 +55 -28
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +72 -60
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +29 -13
- 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-canvas-mode-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +3 -1
- 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/hooks/commands/use-common-commands.js +120 -32
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +65 -7
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +138 -57
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +9 -2
- package/build/store/private-actions.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/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build/utils/use-debounced-input.js +5 -7
- package/build/utils/use-debounced-input.js.map +1 -1
- package/build-module/components/add-new-page/index.js +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +20 -7
- package/build-module/components/add-new-pattern/index.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/use-site-editor-settings.js +116 -14
- package/build-module/components/block-editor/use-site-editor-settings.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 +6 -3
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +5 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +12 -7
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +16 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +13 -6
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +28 -21
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -3
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +6 -4
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +13 -9
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/layout/index.js +17 -5
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/index.js +3 -3
- 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 -17
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- 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-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 +84 -64
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +5 -17
- package/build-module/components/page-patterns/grid.js.map +1 -1
- 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-patterns/index.js +3 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- 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 +111 -34
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- 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/use-patterns.js +116 -119
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- 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 +4 -24
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +2 -15
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +87 -55
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-button/index.js +4 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +10 -4
- package/build-module/components/save-hub/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-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/template-panel/index.js +15 -9
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +29 -16
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- 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/index.js +4 -4
- 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/single-navigation-menu.js +3 -3
- 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 +5 -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/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 +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.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/status-label.js +1 -32
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +35 -25
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +8 -7
- 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 +18 -4
- 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 +53 -28
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +76 -60
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +28 -13
- 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-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
- 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 +2 -1
- 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/hooks/commands/use-common-commands.js +116 -32
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +65 -9
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +139 -57
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +9 -2
- package/build-module/store/private-actions.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/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-module/utils/use-debounced-input.js +5 -7
- package/build-module/utils/use-debounced-input.js.map +1 -1
- package/build-style/style-rtl.css +281 -103
- package/build-style/style.css +281 -103
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +25 -12
- 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 +1 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/use-site-editor-settings.js +119 -20
- package/src/components/canvas-spinner/style.scss +14 -0
- package/src/components/code-editor/index.js +51 -33
- package/src/components/create-pattern-modal/index.js +5 -2
- package/src/components/editor/index.js +5 -5
- package/src/components/global-styles/global-styles-provider.js +7 -2
- package/src/components/global-styles/screen-block.js +15 -0
- package/src/components/global-styles/screen-revisions/index.js +64 -58
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +64 -48
- package/src/components/global-styles/style-variations-container.js +2 -0
- package/src/components/header-edit-mode/document-actions/index.js +8 -4
- package/src/components/header-edit-mode/document-actions/style.scss +45 -28
- package/src/components/header-edit-mode/index.js +29 -22
- package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
- package/src/components/layout/index.js +49 -22
- package/src/components/layout/style.scss +4 -3
- package/src/components/page/index.js +8 -8
- package/src/components/page/style.scss +8 -5
- 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 -22
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +189 -133
- package/src/components/page-patterns/grid.js +3 -20
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/page-patterns/index.js +6 -1
- package/src/components/page-patterns/pagination.js +80 -0
- package/src/components/page-patterns/patterns-list.js +172 -71
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +141 -30
- package/src/components/page-patterns/use-patterns.js +115 -169
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -23
- package/src/components/page-templates/index.js +6 -19
- package/src/components/resizable-frame/index.js +104 -51
- package/src/components/resizable-frame/style.scss +9 -9
- package/src/components/save-button/index.js +2 -0
- package/src/components/save-hub/index.js +6 -1
- package/src/components/save-hub/style.scss +1 -1
- package/src/components/save-panel/index.js +10 -4
- 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/template-panel/index.js +15 -11
- package/src/components/sidebar-navigation-item/style.scss +5 -12
- package/src/components/sidebar-navigation-screen/index.js +30 -15
- package/src/components/sidebar-navigation-screen/style.scss +18 -0
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
- 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/index.js +4 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +16 -7
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
- package/src/components/sidebar-navigation-screen-pages/index.js +48 -33
- package/src/components/sidebar-navigation-screen-pattern/index.js +5 -2
- 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 +23 -3
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +74 -43
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
- package/src/components/sidebar-navigation-screen-patterns/index.js +103 -106
- package/src/components/sidebar-navigation-screen-patterns/style.scss +20 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
- package/src/components/site-hub/index.js +48 -29
- package/src/components/site-hub/style.scss +14 -2
- 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-canvas-mode-with-url.js +1 -4
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
- package/src/components/table/style.scss +1 -0
- package/src/components/template-actions/index.js +2 -1
- package/src/components/template-actions/rename-menu-item.js +17 -10
- package/src/components/use-edited-entity-record/index.js +6 -1
- package/src/hooks/commands/use-common-commands.js +105 -32
- package/src/hooks/commands/use-edit-mode-commands.js +94 -23
- package/src/hooks/push-changes-to-global-styles/index.js +141 -50
- package/src/store/private-actions.js +10 -2
- package/src/style.scss +10 -12
- package/src/utils/normalize-record-key.js +11 -0
- package/src/utils/use-activate-theme.js +1 -1
- package/src/utils/use-debounced-input.js +8 -7
- 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-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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["classnames","__","sprintf","dateI18n","getDate","humanTimeDiff","createInterpolateElement","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["classnames","__","sprintf","dateI18n","getDate","humanTimeDiff","createInterpolateElement","StatusLabel","status","date","short","relateToNow","statusLabel","time","formattedDate"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,aAA5B,QAAiD,iBAAjD;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AAEA,eAAe,SAASC,WAAT,CAAsB;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,IAAV;AAAgBC,EAAAA;AAAhB,CAAtB,EAAgD;AAC9D,QAAMC,WAAW,GAAGN,aAAa,CAAEI,IAAF,CAAjC;AACA,MAAIG,WAAW,GAAGJ,MAAlB;;AACA,UAASA,MAAT;AACC,SAAK,SAAL;AACCI,MAAAA,WAAW,GAAGH,IAAI,GACfH,wBAAwB,CACxBJ,OAAO;AACN;AACAD,MAAAA,EAAE,CAAE,2BAAF,CAFI,EAGNU,WAHM,CADiB,EAMxB;AAAEE,QAAAA,IAAI,EAAE;AAAM,UAAA,QAAQ,EAAGJ;AAAjB;AAAR,OANwB,CADT,GASfR,EAAE,CAAE,WAAF,CATL;AAUA;;AACD,SAAK,QAAL;AACC,YAAMa,aAAa,GAAGX,QAAQ,CAC7BO,KAAK,GAAG,KAAH,GAAW,KADa,EAE7BN,OAAO,CAAEK,IAAF,CAFsB,CAA9B;AAIAG,MAAAA,WAAW,GAAGH,IAAI,GACfH,wBAAwB,CACxBJ,OAAO;AACN;AACAD,MAAAA,EAAE,CAAE,4BAAF,CAFI,EAGNa,aAHM,CADiB,EAMxB;AAAED,QAAAA,IAAI,EAAE;AAAM,UAAA,QAAQ,EAAGJ;AAAjB;AAAR,OANwB,CADT,GASfR,EAAE,CAAE,WAAF,CATL;AAUA;;AACD,SAAK,OAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,OAAF,CAAhB;AACA;;AACD,SAAK,SAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,SAAF,CAAhB;AACA;;AACD,SAAK,SAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,SAAF,CAAhB;AACA;;AACD,SAAK,WAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,oBAAF,CAAhB;AACA;AAxCF;;AA2CA,SACC;AACC,IAAA,SAAS,EAAGD,UAAU,CACrB,kDADqB,EAErB;AACC,OAAG,kBAAkBQ,MAAQ,SAA7B,GAAyC,CAAC,CAAEA;AAD7C,KAFqB;AADvB,KAQGI,WARH,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\n\nexport default function StatusLabel( { status, date, short } ) {\n\tconst relateToNow = humanTimeDiff( date );\n\tlet statusLabel = status;\n\tswitch ( status ) {\n\t\tcase 'publish':\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was published. */\n\t\t\t\t\t\t\t__( 'Published <time>%s</time>' ),\n\t\t\t\t\t\t\trelateToNow\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Published' );\n\t\t\tbreak;\n\t\tcase 'future':\n\t\t\tconst formattedDate = dateI18n(\n\t\t\t\tshort ? 'M j' : 'F j',\n\t\t\t\tgetDate( date )\n\t\t\t);\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the formatted date and time on which the post is scheduled to be published. */\n\t\t\t\t\t\t\t__( 'Scheduled: <time>%s</time>' ),\n\t\t\t\t\t\t\tformattedDate\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Scheduled' );\n\t\t\tbreak;\n\t\tcase 'draft':\n\t\t\tstatusLabel = __( 'Draft' );\n\t\t\tbreak;\n\t\tcase 'pending':\n\t\t\tstatusLabel = __( 'Pending' );\n\t\t\tbreak;\n\t\tcase 'private':\n\t\t\tstatusLabel = __( 'Private' );\n\t\t\tbreak;\n\t\tcase 'protected':\n\t\t\tstatusLabel = __( 'Password protected' );\n\t\t\tbreak;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-screen-page__status',\n\t\t\t\t{\n\t\t\t\t\t[ `has-status has-${ status }-status` ]: !! status,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ statusLabel }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -33,6 +33,8 @@ const PageItem = ({
|
|
|
33
33
|
const linkInfo = useLink({
|
|
34
34
|
postType,
|
|
35
35
|
postId
|
|
36
|
+
}, {
|
|
37
|
+
backPath: '/page'
|
|
36
38
|
});
|
|
37
39
|
return createElement(SidebarNavigationItem, { ...linkInfo,
|
|
38
40
|
...props
|
|
@@ -57,6 +59,9 @@ export default function SidebarNavigationScreenPages() {
|
|
|
57
59
|
slug
|
|
58
60
|
}) => ['404', 'search'].includes(slug));
|
|
59
61
|
const homeTemplate = templates?.find(template => template.slug === 'front-page') || templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
|
|
62
|
+
|
|
63
|
+
const getPostsPageTemplate = () => templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
|
|
64
|
+
|
|
60
65
|
const pagesAndTemplates = pages?.concat(dynamicPageTemplates, [homeTemplate]);
|
|
61
66
|
const {
|
|
62
67
|
frontPage,
|
|
@@ -99,6 +104,27 @@ export default function SidebarNavigationScreenPages() {
|
|
|
99
104
|
setShowAddPage(false);
|
|
100
105
|
};
|
|
101
106
|
|
|
107
|
+
const getPageProps = id => {
|
|
108
|
+
let itemIcon = page;
|
|
109
|
+
const postsPageTemplateId = postsPage && postsPage === id ? getPostsPageTemplate()?.id : null;
|
|
110
|
+
|
|
111
|
+
switch (id) {
|
|
112
|
+
case frontPage:
|
|
113
|
+
itemIcon = home;
|
|
114
|
+
break;
|
|
115
|
+
|
|
116
|
+
case postsPage:
|
|
117
|
+
itemIcon = verse;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
icon: itemIcon,
|
|
123
|
+
postType: postsPageTemplateId ? 'wp_template' : 'page',
|
|
124
|
+
postId: postsPageTemplateId || id
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
102
128
|
return createElement(Fragment, null, showAddPage && createElement(AddNewPageModal, {
|
|
103
129
|
onSave: handleNewPage,
|
|
104
130
|
onClose: () => setShowAddPage(false)
|
|
@@ -118,31 +144,15 @@ export default function SidebarNavigationScreenPages() {
|
|
|
118
144
|
withChevron: true
|
|
119
145
|
}, createElement(Truncate, {
|
|
120
146
|
numberOfLines: 1
|
|
121
|
-
}, decodeEntities(homeTemplate.title?.rendered || __('(no title)')))), reorderedPages?.map(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
itemIcon = verse;
|
|
131
|
-
break;
|
|
132
|
-
|
|
133
|
-
default:
|
|
134
|
-
itemIcon = page;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return createElement(PageItem, {
|
|
138
|
-
postId: item.id,
|
|
139
|
-
key: item.id,
|
|
140
|
-
icon: itemIcon,
|
|
141
|
-
withChevron: true
|
|
142
|
-
}, createElement(Truncate, {
|
|
143
|
-
numberOfLines: 1
|
|
144
|
-
}, decodeEntities(item?.title?.rendered || __('(no title)'))));
|
|
145
|
-
}))),
|
|
147
|
+
}, decodeEntities(homeTemplate.title?.rendered || __('(no title)')))), reorderedPages?.map(({
|
|
148
|
+
id,
|
|
149
|
+
title
|
|
150
|
+
}) => createElement(PageItem, { ...getPageProps(id),
|
|
151
|
+
key: id,
|
|
152
|
+
withChevron: true
|
|
153
|
+
}, createElement(Truncate, {
|
|
154
|
+
numberOfLines: 1
|
|
155
|
+
}, decodeEntities(title?.rendered || __('(no title)'))))))),
|
|
146
156
|
footer: createElement(VStack, {
|
|
147
157
|
spacing: 0
|
|
148
158
|
}, dynamicPageTemplates?.map(item => createElement(PageItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalTruncate","Truncate","__experimentalVStack","VStack","useState","__","useEntityRecords","store","coreStore","decodeEntities","privateApis","routerPrivateApis","layout","page","home","verse","plus","useSelect","SidebarNavigationScreen","useLink","SidebarNavigationItem","SidebarButton","AddNewPageModal","unlock","useHistory","PageItem","postType","postId","props","linkInfo","SidebarNavigationScreenPages","records","pages","isResolving","isLoadingPages","status","per_page","templates","isLoadingTemplates","dynamicPageTemplates","filter","slug","includes","homeTemplate","find","template","pagesAndTemplates","concat","frontPage","postsPage","select","getEntityRecord","siteSettings","page_on_front","page_for_posts","isHomePageBlog","reorderedPages","length","homePageIndex","findIndex","item","id","homePage","splice","postsPageIndex","blogPage","showAddPage","setShowAddPage","history","handleNewPage","type","push","canvas","title","rendered","map","itemIcon","document","location"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,sBAAsB,IAAIC,QAH3B,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,QAAT,QAAyB,oBAA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AAA1B,SACGnE,cAAc,CACfmD,IAAI,EAAEa,KAAN,EAAaC,QAAb,IACCrE,EAAE,CAAE,YAAF,CAFY,CADjB,CAND,CADD;AAeA,KA3BC,CApBH,CAPF,CAXF;AAsEC,IAAA,MAAM,EACL,cAAC,MAAD;AAAQ,MAAA,OAAO,EAAG;AAAlB,OACGkC,oBAAoB,EAAEoC,GAAtB,CAA6Bf,IAAF,IAC5B,cAAC,QAAD;AACC,MAAA,QAAQ,EAAC,aADV;AAEC,MAAA,MAAM,EAAGA,IAAI,CAACC,EAFf;AAGC,MAAA,GAAG,EAAGD,IAAI,CAACC,EAHZ;AAIC,MAAA,IAAI,EAAGjD,MAJR;AAKC,MAAA,WAAW;AALZ,OAOC,cAAC,QAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACGH,cAAc,CACfmD,IAAI,CAACa,KAAL,EAAYC,QAAZ,IACCrE,EAAE,CAAE,YAAF,CAFY,CADjB,CAPD,CADC,CADH,EAiBC,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC,oDADX;AAEC,MAAA,IAAI,EAAC,yBAFN;AAGC,MAAA,OAAO,EAAG,MAAM;AACfwE,QAAAA,QAAQ,CAACC,QAAT,GAAoB,yBAApB;AACA;AALF,OAOGzE,EAAE,CAAE,kBAAF,CAPL,CAjBD;AAvEF,IAPD,CADD;AA8GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { layout, page, home, verse, plus } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarButton from '../sidebar-button';\nimport AddNewPageModal from '../add-new-page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPages() {\n\tconst { records: pages, isResolving: isLoadingPages } = useEntityRecords(\n\t\t'postType',\n\t\t'page',\n\t\t{\n\t\t\tstatus: 'any',\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst { records: templates, isResolving: isLoadingTemplates } =\n\t\tuseEntityRecords( 'postType', 'wp_template', {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst dynamicPageTemplates = templates?.filter( ( { slug } ) =>\n\t\t[ '404', 'search' ].includes( slug )\n\t);\n\n\tconst homeTemplate =\n\t\ttemplates?.find( ( template ) => template.slug === 'front-page' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst pagesAndTemplates = pages?.concat( dynamicPageTemplates, [\n\t\thomeTemplate,\n\t] );\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst isHomePageBlog = frontPage === postsPage;\n\n\tconst reorderedPages = pages && [ ...pages ];\n\n\tif ( ! isHomePageBlog && reorderedPages?.length ) {\n\t\tconst homePageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === frontPage\n\t\t);\n\t\tconst homePage = reorderedPages.splice( homePageIndex, 1 );\n\t\treorderedPages?.splice( 0, 0, ...homePage );\n\n\t\tconst postsPageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === postsPage\n\t\t);\n\n\t\tconst blogPage = reorderedPages.splice( postsPageIndex, 1 );\n\n\t\treorderedPages.splice( 1, 0, ...blogPage );\n\t}\n\n\tconst [ showAddPage, setShowAddPage ] = useState( false );\n\n\tconst history = useHistory();\n\n\tconst handleNewPage = ( { type, id } ) => {\n\t\t// Navigate to the created template editor.\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tsetShowAddPage( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ showAddPage && (\n\t\t\t\t<AddNewPageModal\n\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\tonClose={ () => setShowAddPage( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\tdescription={ __( 'Browse and edit pages on your site.' ) }\n\t\t\t\tactions={\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ __( 'Draft a new page' ) }\n\t\t\t\t\t\tonClick={ () => setShowAddPage( true ) }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<Item>{ __( 'Loading pages' ) }</Item>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ ! pagesAndTemplates?.length && (\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No page found' ) }</Item>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isHomePageBlog && homeTemplate && (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\tpostId={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\tkey={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\ticon={ home }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ reorderedPages?.map( ( item ) => {\n\t\t\t\t\t\t\t\t\tlet itemIcon;\n\t\t\t\t\t\t\t\t\tswitch ( item.id ) {\n\t\t\t\t\t\t\t\t\t\tcase frontPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = home;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase postsPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = verse;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = page;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\t\titem?.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t</PageItem>\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) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t{ dynamicPageTemplates?.map( ( item ) => (\n\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-pages__see-all\"\n\t\t\t\t\t\t\thref=\"edit.php?post_type=page\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tdocument.location = 'edit.php?post_type=page';\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage all pages' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t</VStack>\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalTruncate","Truncate","__experimentalVStack","VStack","useState","__","useEntityRecords","store","coreStore","decodeEntities","privateApis","routerPrivateApis","layout","page","home","verse","plus","useSelect","SidebarNavigationScreen","useLink","SidebarNavigationItem","SidebarButton","AddNewPageModal","unlock","useHistory","PageItem","postType","postId","props","linkInfo","backPath","SidebarNavigationScreenPages","records","pages","isResolving","isLoadingPages","status","per_page","templates","isLoadingTemplates","dynamicPageTemplates","filter","slug","includes","homeTemplate","find","template","getPostsPageTemplate","pagesAndTemplates","concat","frontPage","postsPage","select","getEntityRecord","siteSettings","page_on_front","page_for_posts","isHomePageBlog","reorderedPages","length","homePageIndex","findIndex","item","id","homePage","splice","postsPageIndex","blogPage","showAddPage","setShowAddPage","history","handleNewPage","type","push","canvas","getPageProps","itemIcon","postsPageTemplateId","icon","title","rendered","map","document","location"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,sBAAsB,IAAIC,QAH3B,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,gBAAT,EAA2BC,KAAK,IAAIC,SAApC,QAAqD,sBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AACA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,IAAvB,EAA6BC,KAA7B,EAAoCC,IAApC,QAAgD,k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D,CALF,EAoBGqD,cAAc,EAAEuB,GAAhB,CAAqB,CAAE;AAAElB,MAAAA,EAAF;AAAMgB,MAAAA;AAAN,KAAF,KACtB,cAAC,QAAD,OACMJ,YAAY,CAAEZ,EAAF,CADlB;AAEC,MAAA,GAAG,EAAGA,EAFP;AAGC,MAAA,WAAW;AAHZ,OAKC,cAAC,QAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACGtD,cAAc,CACfsE,KAAK,EAAEC,QAAP,IACC3E,EAAE,CAAE,YAAF,CAFY,CADjB,CALD,CADC,CApBH,CAPF,CAXF;AAwDC,IAAA,MAAM,EACL,cAAC,MAAD;AAAQ,MAAA,OAAO,EAAG;AAAlB,OACGmC,oBAAoB,EAAEyC,GAAtB,CAA6BnB,IAAF,IAC5B,cAAC,QAAD;AACC,MAAA,QAAQ,EAAC,aADV;AAEC,MAAA,MAAM,EAAGA,IAAI,CAACC,EAFf;AAGC,MAAA,GAAG,EAAGD,IAAI,CAACC,EAHZ;AAIC,MAAA,IAAI,EAAGnD,MAJR;AAKC,MAAA,WAAW;AALZ,OAOC,cAAC,QAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACGH,cAAc,CACfqD,IAAI,CAACiB,KAAL,EAAYC,QAAZ,IACC3E,EAAE,CAAE,YAAF,CAFY,CADjB,CAPD,CADC,CADH,EAiBC,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC,oDADX;AAEC,MAAA,IAAI,EAAC,yBAFN;AAGC,MAAA,OAAO,EAAG,MAAM;AACf6E,QAAAA,QAAQ,CAACC,QAAT,GAAoB,yBAApB;AACA;AALF,OAOG9E,EAAE,CAAE,kBAAF,CAPL,CAjBD;AAzDF,IAPD,CADD;AAgGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { layout, page, home, verse, plus } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarButton from '../sidebar-button';\nimport AddNewPageModal from '../add-new-page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t},\n\t\t{\n\t\t\tbackPath: '/page',\n\t\t}\n\t);\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPages() {\n\tconst { records: pages, isResolving: isLoadingPages } = useEntityRecords(\n\t\t'postType',\n\t\t'page',\n\t\t{\n\t\t\tstatus: 'any',\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst { records: templates, isResolving: isLoadingTemplates } =\n\t\tuseEntityRecords( 'postType', 'wp_template', {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst dynamicPageTemplates = templates?.filter( ( { slug } ) =>\n\t\t[ '404', 'search' ].includes( slug )\n\t);\n\n\tconst homeTemplate =\n\t\ttemplates?.find( ( template ) => template.slug === 'front-page' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst getPostsPageTemplate = () =>\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst pagesAndTemplates = pages?.concat( dynamicPageTemplates, [\n\t\thomeTemplate,\n\t] );\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst isHomePageBlog = frontPage === postsPage;\n\n\tconst reorderedPages = pages && [ ...pages ];\n\n\tif ( ! isHomePageBlog && reorderedPages?.length ) {\n\t\tconst homePageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === frontPage\n\t\t);\n\t\tconst homePage = reorderedPages.splice( homePageIndex, 1 );\n\t\treorderedPages?.splice( 0, 0, ...homePage );\n\n\t\tconst postsPageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === postsPage\n\t\t);\n\n\t\tconst blogPage = reorderedPages.splice( postsPageIndex, 1 );\n\n\t\treorderedPages.splice( 1, 0, ...blogPage );\n\t}\n\n\tconst [ showAddPage, setShowAddPage ] = useState( false );\n\n\tconst history = useHistory();\n\n\tconst handleNewPage = ( { type, id } ) => {\n\t\t// Navigate to the created template editor.\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tsetShowAddPage( false );\n\t};\n\n\tconst getPageProps = ( id ) => {\n\t\tlet itemIcon = page;\n\t\tconst postsPageTemplateId =\n\t\t\tpostsPage && postsPage === id ? getPostsPageTemplate()?.id : null;\n\n\t\tswitch ( id ) {\n\t\t\tcase frontPage:\n\t\t\t\titemIcon = home;\n\t\t\t\tbreak;\n\t\t\tcase postsPage:\n\t\t\t\titemIcon = verse;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn {\n\t\t\ticon: itemIcon,\n\t\t\tpostType: postsPageTemplateId ? 'wp_template' : 'page',\n\t\t\tpostId: postsPageTemplateId || id,\n\t\t};\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ showAddPage && (\n\t\t\t\t<AddNewPageModal\n\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\tonClose={ () => setShowAddPage( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\tdescription={ __( 'Browse and edit pages on your site.' ) }\n\t\t\t\tactions={\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ __( 'Draft a new page' ) }\n\t\t\t\t\t\tonClick={ () => setShowAddPage( true ) }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<Item>{ __( 'Loading pages' ) }</Item>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ ! pagesAndTemplates?.length && (\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No page found' ) }</Item>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isHomePageBlog && homeTemplate && (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\tpostId={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\tkey={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\ticon={ home }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ reorderedPages?.map( ( { id, title } ) => (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\t{ ...getPageProps( id ) }\n\t\t\t\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\ttitle?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\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) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t{ dynamicPageTemplates?.map( ( item ) => (\n\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-pages__see-all\"\n\t\t\t\t\t\t\thref=\"edit.php?post_type=page\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tdocument.location = 'edit.php?post_type=page';\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage all pages' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t</VStack>\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -18,20 +18,21 @@ import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-e
|
|
|
18
18
|
import usePatternDetails from './use-pattern-details';
|
|
19
19
|
import { store as editSiteStore } from '../../store';
|
|
20
20
|
import { unlock } from '../../lock-unlock';
|
|
21
|
+
import normalizeRecordKey from '../../utils/normalize-record-key';
|
|
21
22
|
export default function SidebarNavigationScreenPattern() {
|
|
22
|
-
const {
|
|
23
|
-
params
|
|
24
|
-
} = useNavigator();
|
|
25
23
|
const {
|
|
26
24
|
categoryType
|
|
27
25
|
} = getQueryArgs(window.location.href);
|
|
28
|
-
const {
|
|
29
|
-
postType,
|
|
30
|
-
postId
|
|
31
|
-
} = params;
|
|
32
26
|
const {
|
|
33
27
|
setCanvasMode
|
|
34
28
|
} = unlock(useDispatch(editSiteStore));
|
|
29
|
+
const {
|
|
30
|
+
params
|
|
31
|
+
} = useNavigator();
|
|
32
|
+
const {
|
|
33
|
+
postType
|
|
34
|
+
} = params;
|
|
35
|
+
const postId = normalizeRecordKey(params?.postId);
|
|
35
36
|
useInitEditedEntityFromURL();
|
|
36
37
|
const patternDetails = usePatternDetails(postType, postId); // The absence of a category type in the query params for template parts
|
|
37
38
|
// indicates the user has arrived at the template part via the "manage all"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["__experimentalUseNavigator","useNavigator","useDispatch","__","pencil","getQueryArgs","SidebarButton","SidebarNavigationScreen","useInitEditedEntityFromURL","usePatternDetails","store","editSiteStore","unlock","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["__experimentalUseNavigator","useNavigator","useDispatch","__","pencil","getQueryArgs","SidebarButton","SidebarNavigationScreen","useInitEditedEntityFromURL","usePatternDetails","store","editSiteStore","unlock","normalizeRecordKey","SidebarNavigationScreenPattern","categoryType","window","location","href","setCanvasMode","params","postType","postId","patternDetails","backPath"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,0BAAP,MAAuC,wDAAvC;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AAEA,eAAe,SAASC,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAmBV,YAAY,CAAEW,MAAM,CAACC,QAAP,CAAgBC,IAAlB,CAArC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoBP,MAAM,CAAEV,WAAW,CAAES,aAAF,CAAb,CAAhC;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAanB,YAAY,EAA/B;AACA,QAAM;AAAEoB,IAAAA;AAAF,MAAeD,MAArB;AACA,QAAME,MAAM,GAAGT,kBAAkB,CAAEO,MAAM,EAAEE,MAAV,CAAjC;AAEAd,EAAAA,0BAA0B;AAE1B,QAAMe,cAAc,GAAGd,iBAAiB,CAAEY,QAAF,EAAYC,MAAZ,CAAxC,CAVwD,CAYxD;AACA;AACA;;AACA,QAAME,QAAQ,GACb,CAAET,YAAF,IAAkBM,QAAQ,KAAK,kBAA/B,GACG,uBADH,GAEG,WAHJ;AAKA,SACC,cAAC,uBAAD;AACC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGhB,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGC;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAGoB,QARZ;AAAA,OASMD;AATN,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport usePatternDetails from './use-pattern-details';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport normalizeRecordKey from '../../utils/normalize-record-key';\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst { categoryType } = getQueryArgs( window.location.href );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst { params } = useNavigator();\n\tconst { postType } = params;\n\tconst postId = normalizeRecordKey( params?.postId );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\n\t// The absence of a category type in the query params for template parts\n\t// indicates the user has arrived at the template part via the \"manage all\"\n\t// page and the back button should return them to that list page.\n\tconst backPath =\n\t\t! categoryType && postType === 'wp_template_part'\n\t\t\t? '/wp_template_part/all'\n\t\t\t: '/patterns';\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tbackPath={ backPath }\n\t\t\t{ ...patternDetails }\n\t\t/>\n\t);\n}\n"]}
|
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 || __('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"
|
|
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"],"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,IAAIP,EAAE,CAAE,YAAF,CANd,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 || __( '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
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { parse } from '@wordpress/blocks';
|
|
3
7
|
/**
|
|
4
8
|
* Internal dependencies
|
|
5
9
|
*/
|
|
10
|
+
|
|
6
11
|
import TemplatePartNavigationMenus from './template-part-navigation-menus';
|
|
7
12
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
8
13
|
/**
|
|
@@ -57,15 +62,24 @@ export default function useNavigationMenuContent(postType, postId) {
|
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
64
|
|
|
60
|
-
const
|
|
61
|
-
const
|
|
65
|
+
const blocks = record?.content && typeof record.content !== 'function' ? parse(record.content) : [];
|
|
66
|
+
const navigationBlocks = getBlocksOfTypeFromBlocks('core/navigation', blocks);
|
|
67
|
+
|
|
68
|
+
if (!navigationBlocks.length) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref); // Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.
|
|
73
|
+
// Also, filter out undefined values, as blocks don't have an id when initially added.
|
|
74
|
+
|
|
75
|
+
const uniqueNavigationMenuIds = [...new Set(navigationMenuIds)].filter(menuId => menuId);
|
|
62
76
|
|
|
63
|
-
if (!
|
|
77
|
+
if (!uniqueNavigationMenuIds?.length) {
|
|
64
78
|
return;
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
return createElement(TemplatePartNavigationMenus, {
|
|
68
|
-
menus:
|
|
82
|
+
menus: uniqueNavigationMenuIds
|
|
69
83
|
});
|
|
70
84
|
}
|
|
71
85
|
//# 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,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js"],"names":["parse","TemplatePartNavigationMenus","useEditedEntityRecord","getBlocksOfTypeFromBlocks","targetBlockType","blocks","length","findInBlocks","_blocks","navigationBlocks","block","name","push","innerBlocks","innerNavigationBlocks","useNavigationMenuContent","postType","postId","record","content","navigationMenuIds","map","attributes","ref","uniqueNavigationMenuIds","Set","filter","menuId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,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,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,2BAAD;AAA6B,IAAA,KAAK,EAAGkB;AAArC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\n\n/**\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 blocks =\n\t\trecord?.content && typeof record.content !== 'function'\n\t\t\t? parse( record.content )\n\t\t\t: [];\n\n\tconst navigationBlocks = getBlocksOfTypeFromBlocks(\n\t\t'core/navigation',\n\t\tblocks\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"]}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { sentenceCase } from 'change-case';
|
|
3
7
|
/**
|
|
4
8
|
* WordPress dependencies
|
|
5
9
|
*/
|
|
6
|
-
|
|
10
|
+
|
|
11
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
7
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
8
14
|
import { useSelect } from '@wordpress/data';
|
|
9
|
-
import { Icon } from '@wordpress/components';
|
|
10
15
|
/**
|
|
11
16
|
* Internal dependencies
|
|
12
17
|
*/
|
|
@@ -16,57 +21,77 @@ import useEditedEntityRecord from '../use-edited-entity-record';
|
|
|
16
21
|
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
17
22
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
18
23
|
import { SidebarNavigationScreenDetailsPanel, SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
|
|
24
|
+
import normalizeRecordKey from '../../utils/normalize-record-key';
|
|
19
25
|
export default function usePatternDetails(postType, postId) {
|
|
26
|
+
postId = normalizeRecordKey(postId);
|
|
20
27
|
const {
|
|
21
28
|
getDescription,
|
|
22
29
|
getTitle,
|
|
23
30
|
record
|
|
24
31
|
} = useEditedEntityRecord(postType, postId);
|
|
32
|
+
const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []);
|
|
25
33
|
const currentTheme = useSelect(select => select(coreStore).getCurrentTheme(), []);
|
|
26
34
|
const addedBy = useAddedBy(postType, postId);
|
|
27
35
|
const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
|
|
28
36
|
const title = getTitle();
|
|
29
|
-
let
|
|
37
|
+
let description = getDescription();
|
|
30
38
|
|
|
31
|
-
if (!
|
|
32
|
-
|
|
33
|
-
__('This is
|
|
39
|
+
if (!description && addedBy.text) {
|
|
40
|
+
description = sprintf( // translators: %s: pattern title e.g: "Header".
|
|
41
|
+
__('This is the %s pattern.'), getTitle());
|
|
34
42
|
}
|
|
35
43
|
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
__('This is
|
|
44
|
+
if (!description && postType === 'wp_block' && record?.title) {
|
|
45
|
+
description = sprintf( // translators: %s: user created pattern title e.g. "Footer".
|
|
46
|
+
__('This is the %s pattern.'), record.title);
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
const description = createElement(Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && createElement("span", {
|
|
42
|
-
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description"
|
|
43
|
-
}, createElement("span", {
|
|
44
|
-
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author"
|
|
45
|
-
}, createElement("span", {
|
|
46
|
-
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon"
|
|
47
|
-
}, addedBy.imageUrl ? createElement("img", {
|
|
48
|
-
src: addedBy.imageUrl,
|
|
49
|
-
alt: "",
|
|
50
|
-
width: "24",
|
|
51
|
-
height: "24"
|
|
52
|
-
}) : createElement(Icon, {
|
|
53
|
-
icon: addedBy.icon
|
|
54
|
-
})), addedBy.text), addedBy.isCustomized && createElement("span", {
|
|
55
|
-
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"
|
|
56
|
-
}, _x('(Customized)', 'pattern'))));
|
|
57
49
|
const footer = !!record?.modified ? createElement(SidebarNavigationScreenDetailsFooter, {
|
|
58
50
|
lastModifiedDateTime: record.modified
|
|
59
51
|
}) : null;
|
|
60
52
|
const details = [];
|
|
61
53
|
|
|
62
|
-
if (postType === 'wp_block') {
|
|
54
|
+
if (postType === 'wp_block' || 'wp_template_part') {
|
|
63
55
|
details.push({
|
|
64
56
|
label: __('Syncing'),
|
|
65
57
|
value: record.wp_pattern_sync_status === 'unsynced' ? __('Not synced') : __('Fully synced')
|
|
66
58
|
});
|
|
67
59
|
}
|
|
68
60
|
|
|
69
|
-
|
|
61
|
+
if (postType === 'wp_template_part') {
|
|
62
|
+
const templatePartArea = templatePartAreas.find(area => area.area === record.area);
|
|
63
|
+
let areaDetailValue = templatePartArea?.label;
|
|
64
|
+
|
|
65
|
+
if (!areaDetailValue) {
|
|
66
|
+
areaDetailValue = record.area ? sprintf( // translators: %s: Sentenced cased template part area e.g: "My custom area".
|
|
67
|
+
__('%s (removed)'), sentenceCase(record.area)) : __('None');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
details.push({
|
|
71
|
+
label: __('Area'),
|
|
72
|
+
value: areaDetailValue
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (postType === 'wp_template_part' && addedBy.text && !isAddedByActiveTheme) {
|
|
77
|
+
details.push({
|
|
78
|
+
label: __('Added by'),
|
|
79
|
+
value: createElement("span", {
|
|
80
|
+
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author"
|
|
81
|
+
}, addedBy.text)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (postType === 'wp_template_part' && addedBy.text && (record.origin === 'plugin' || record.has_theme_file === true)) {
|
|
86
|
+
details.push({
|
|
87
|
+
label: __('Customized'),
|
|
88
|
+
value: createElement("span", {
|
|
89
|
+
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"
|
|
90
|
+
}, addedBy.isCustomized ? __('Yes') : __('No'))
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const content = createElement(Fragment, null, useNavigationMenuContent(postType, postId), !!details.length && createElement(SidebarNavigationScreenDetailsPanel, {
|
|
70
95
|
spacing: 5,
|
|
71
96
|
title: __('Details')
|
|
72
97
|
}, details.map(({
|
|
@@ -74,7 +99,7 @@ export default function usePatternDetails(postType, postId) {
|
|
|
74
99
|
value
|
|
75
100
|
}) => createElement(SidebarNavigationScreenDetailsPanelRow, {
|
|
76
101
|
key: label
|
|
77
|
-
}, createElement(SidebarNavigationScreenDetailsPanelLabel, null, label), createElement(SidebarNavigationScreenDetailsPanelValue, null, value))))
|
|
102
|
+
}, createElement(SidebarNavigationScreenDetailsPanelLabel, null, label), createElement(SidebarNavigationScreenDetailsPanelValue, null, value)))));
|
|
78
103
|
return {
|
|
79
104
|
title,
|
|
80
105
|
description,
|
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":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["sentenceCase","__","sprintf","store","coreStore","editorStore","useSelect","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","normalizeRecordKey","usePatternDetails","postType","postId","getDescription","getTitle","record","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","currentTheme","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","footer","modified","details","push","label","value","wp_pattern_sync_status","templatePartArea","find","area","areaDetailValue","origin","has_theme_file","isCustomized","content","length","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,aAA7B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AACA,OAAOC,oCAAP,MAAiD,6CAAjD;AACA,SACCC,mCADD,EAECC,sCAFD,EAGCC,wCAHD,EAICC,wCAJD,QAKO,4CALP;AAMA,OAAOC,kBAAP,MAA+B,kCAA/B;AAEA,eAAe,SAASC,iBAAT,CAA4BC,QAA5B,EAAsCC,MAAtC,EAA+C;AAC7DA,EAAAA,MAAM,GAAGH,kBAAkB,CAAEG,MAAF,CAA3B;AAEA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCb,qBAAqB,CACjES,QADiE,EAEjEC,MAFiE,CAAlE;AAIA,QAAMI,iBAAiB,GAAGhB,SAAS,CAChCiB,MAAF,IACCA,MAAM,CAAElB,WAAF,CAAN,CAAsBmB,yCAAtB,EAFiC,EAGlC,EAHkC,CAAnC;AAKA,QAAMC,YAAY,GAAGnB,SAAS,CAC3BiB,MAAF,IAAcA,MAAM,CAAEnB,SAAF,CAAN,CAAoBsB,eAApB,EADe,EAE7B,EAF6B,CAA9B;AAIA,QAAMC,OAAO,GAAGpB,UAAU,CAAEU,QAAF,EAAYC,MAAZ,CAA1B;AACA,QAAMU,oBAAoB,GACzBD,OAAO,CAACE,IAAR,KAAiB,OAAj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FX,KAIGoC,OAAO,CAACc,GAAR,CAAa,CAAE;AAAEZ,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF,KACd,cAAC,sCAAD;AAAwC,IAAA,GAAG,EAAGD;AAA9C,KACC,cAAC,wCAAD,QACGA,KADH,CADD,EAIC,cAAC,wCAAD,QACGC,KADH,CAJD,CADC,CAJH,CAHF,CADD;AAuBA,SAAO;AAAER,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBgB,IAAAA,OAAtB;AAA+Bd,IAAAA;AAA/B,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\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 templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\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 description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription = 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 ( ! description && postType === 'wp_block' && record?.title ) {\n\t\tdescription = 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 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' || 'wp_template_part' ) {\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\tif ( postType === 'wp_template_part' ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === 'wp_template_part' &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === 'wp_template_part' &&\n\t\taddedBy.text &&\n\t\t( record.origin === 'plugin' || record.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\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</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"]}
|
|
@@ -17,11 +17,6 @@ export default function CategoryItem({
|
|
|
17
17
|
path: '/patterns',
|
|
18
18
|
categoryType: type,
|
|
19
19
|
categoryId: id
|
|
20
|
-
}, {
|
|
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 Patterns.
|
|
23
|
-
// See the implementation of the back button in patterns-list.
|
|
24
|
-
backPath: '/patterns'
|
|
25
20
|
});
|
|
26
21
|
|
|
27
22
|
if (!count) {
|
|
@@ -1 +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","
|
|
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","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,CAAE;AACzBS,IAAAA,IAAI,EAAE,WADmB;AAEzBC,IAAAA,YAAY,EAAEH,IAFW;AAGzBI,IAAAA,UAAU,EAAEP;AAHa,GAAF,CAAxB;;AAMA,MAAK,CAAEF,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,GAAYO;AAJpC,KAMGN,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\tpath: '/patterns',\n\t\tcategoryType: type,\n\t\tcategoryId: id,\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"]}
|