@wordpress/edit-site 5.22.0 → 5.24.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/actions/index.js +115 -15
- package/build/components/actions/index.js.map +1 -1
- package/build/components/add-new-template/new-template.js +0 -7
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +7 -2
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +54 -63
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/dataviews/add-filter.js +91 -0
- package/build/components/dataviews/add-filter.js.map +1 -0
- package/build/components/dataviews/constants.js +14 -0
- package/build/components/dataviews/constants.js.map +1 -0
- package/build/components/dataviews/dataviews.js +30 -9
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filter-summary.js +62 -0
- package/build/components/dataviews/filter-summary.js.map +1 -0
- package/build/components/dataviews/filters.js +37 -48
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/index.js +9 -2
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews/item-actions.js +139 -17
- package/build/components/dataviews/item-actions.js.map +1 -1
- package/build/components/dataviews/pagination.js +7 -2
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/reset-filters.js +33 -0
- package/build/components/dataviews/reset-filters.js.map +1 -0
- package/build/components/dataviews/search.js +1 -0
- package/build/components/dataviews/search.js.map +1 -1
- package/build/components/dataviews/view-actions.js +49 -32
- package/build/components/dataviews/view-actions.js.map +1 -1
- package/build/components/dataviews/view-grid.js +48 -25
- package/build/components/dataviews/view-grid.js.map +1 -1
- package/build/components/dataviews/view-list.js +130 -14
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/dataviews/view-side-by-side.js +20 -0
- package/build/components/dataviews/view-side-by-side.js.map +1 -0
- package/build/components/editor/index.js +52 -56
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +15 -2
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/header.js +4 -2
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +22 -16
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +66 -24
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +52 -24
- 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 +9 -3
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +3 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/ui.js +31 -39
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -1
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +21 -16
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +160 -0
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -0
- package/build/components/header-edit-mode/index.js +50 -117
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +1 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -1
- package/build/components/layout/index.js +4 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +44 -54
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +11 -15
- package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +1 -0
- package/build/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/build/components/page-content-focus-notifications/edit-template-notification.js.map +1 -0
- package/build/components/page-content-focus-notifications/index.js +22 -0
- package/build/components/page-content-focus-notifications/index.js.map +1 -0
- package/build/components/page-main/index.js +2 -1
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +137 -88
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-pages/side-editor.js +25 -0
- package/build/components/page-pages/side-editor.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +2 -2
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +2 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/dataviews-templates.js +316 -0
- package/build/components/page-templates/dataviews-templates.js.map +1 -0
- package/build/components/page-templates/template-actions.js +168 -0
- package/build/components/page-templates/template-actions.js.map +1 -0
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/save-button/index.js +9 -6
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +14 -0
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/sidebar/index.js +1 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +124 -0
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -0
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +191 -0
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
- package/build/components/sidebar-dataviews/dataview-item.js +71 -0
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -0
- package/build/components/sidebar-dataviews/default-views.js +65 -0
- package/build/components/sidebar-dataviews/default-views.js.map +1 -0
- package/build/components/sidebar-dataviews/index.js +21 -38
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +2 -6
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +6 -5
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +18 -29
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +22 -8
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +8 -5
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +5 -8
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +6 -14
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +4 -12
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +10 -6
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +3 -3
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +23 -4
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +3 -11
- package/build/components/sidebar-navigation-screen-page/page-details.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/site-hub/index.js +18 -6
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +12 -16
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +22 -12
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +150 -55
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +1 -1
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/welcome-guide/page.js +2 -2
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +6 -3
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +24 -14
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +6 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +0 -3
- package/build/index.js.map +1 -1
- package/build/store/actions.js +39 -83
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +2 -27
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -23
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -40
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +33 -67
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +3 -14
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/actions/index.js +113 -14
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +0 -7
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +7 -2
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +54 -62
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/dataviews/add-filter.js +84 -0
- package/build-module/components/dataviews/add-filter.js.map +1 -0
- package/build-module/components/dataviews/constants.js +6 -0
- package/build-module/components/dataviews/constants.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +29 -9
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filter-summary.js +55 -0
- package/build-module/components/dataviews/filter-summary.js.map +1 -0
- package/build-module/components/dataviews/filters.js +37 -48
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/index.js +1 -1
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +142 -20
- package/build-module/components/dataviews/item-actions.js.map +1 -1
- package/build-module/components/dataviews/pagination.js +7 -2
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/reset-filters.js +26 -0
- package/build-module/components/dataviews/reset-filters.js.map +1 -0
- package/build-module/components/dataviews/search.js +1 -0
- package/build-module/components/dataviews/search.js.map +1 -1
- package/build-module/components/dataviews/view-actions.js +50 -33
- package/build-module/components/dataviews/view-actions.js.map +1 -1
- package/build-module/components/dataviews/view-grid.js +49 -26
- package/build-module/components/dataviews/view-grid.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +132 -16
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/dataviews/view-side-by-side.js +12 -0
- package/build-module/components/dataviews/view-side-by-side.js.map +1 -0
- package/build-module/components/editor/index.js +55 -59
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +14 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/header.js +4 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +23 -17
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +67 -25
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +51 -24
- 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 +9 -3
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/ui.js +31 -39
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -1
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +21 -16
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +152 -0
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -0
- package/build-module/components/header-edit-mode/index.js +54 -121
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -1
- package/build-module/components/layout/index.js +5 -20
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +45 -56
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +11 -15
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +1 -0
- package/build-module/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +1 -0
- package/build-module/components/page-content-focus-notifications/index.js +14 -0
- package/build-module/components/page-content-focus-notifications/index.js.map +1 -0
- package/build-module/components/page-main/index.js +2 -1
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +141 -90
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-pages/side-editor.js +17 -0
- package/build-module/components/page-pages/side-editor.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +2 -2
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +4 -4
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +3 -3
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/dataviews-templates.js +308 -0
- package/build-module/components/page-templates/dataviews-templates.js.map +1 -0
- package/build-module/components/page-templates/template-actions.js +157 -0
- package/build-module/components/page-templates/template-actions.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/save-button/index.js +11 -8
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +14 -0
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +116 -0
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -0
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +182 -0
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js +63 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -0
- package/build-module/components/sidebar-dataviews/default-views.js +57 -0
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -0
- package/build-module/components/sidebar-dataviews/index.js +22 -39
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +2 -6
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +6 -5
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +20 -31
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +21 -7
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +9 -6
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +6 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +8 -16
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +5 -13
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +10 -6
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +4 -4
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +23 -4
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +3 -11
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +19 -7
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +13 -16
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +22 -12
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +150 -56
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +2 -2
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +6 -3
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +24 -14
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +6 -2
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +0 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +37 -80
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -25
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -22
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -38
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +27 -62
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +1 -11
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +221 -181
- package/build-style/style.css +221 -181
- package/package.json +41 -41
- package/src/components/actions/index.js +150 -14
- package/src/components/add-new-template/new-template.js +0 -5
- package/src/components/block-editor/site-editor-canvas.js +8 -2
- package/src/components/block-editor/style.scss +0 -87
- package/src/components/block-editor/use-site-editor-settings.js +68 -89
- package/src/components/dataviews/README.md +80 -83
- package/src/components/dataviews/add-filter.js +108 -0
- package/src/components/dataviews/constants.js +5 -0
- package/src/components/dataviews/dataviews.js +28 -10
- package/src/components/dataviews/filter-summary.js +79 -0
- package/src/components/dataviews/filters.js +48 -58
- package/src/components/dataviews/index.js +1 -1
- package/src/components/dataviews/item-actions.js +169 -30
- package/src/components/dataviews/pagination.js +9 -4
- package/src/components/dataviews/reset-filters.js +26 -0
- package/src/components/dataviews/search.js +1 -0
- package/src/components/dataviews/style.scss +89 -9
- package/src/components/dataviews/view-actions.js +77 -49
- package/src/components/dataviews/view-grid.js +63 -38
- package/src/components/dataviews/view-list.js +182 -18
- package/src/components/dataviews/view-side-by-side.js +9 -0
- package/src/components/editor/index.js +135 -123
- package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/src/components/global-styles/font-library-modal/utils/index.js +20 -9
- package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +46 -15
- package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +28 -0
- package/src/components/global-styles/header.js +2 -1
- package/src/components/global-styles/screen-block-list.js +37 -26
- package/src/components/global-styles/screen-revisions/index.js +91 -35
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +65 -45
- package/src/components/global-styles/screen-revisions/style.scss +52 -28
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -6
- package/src/components/global-styles/screen-root.js +2 -1
- package/src/components/global-styles/style.scss +0 -11
- package/src/components/global-styles/ui.js +60 -75
- package/src/components/global-styles-renderer/index.js +1 -1
- package/src/components/header-edit-mode/document-actions/index.js +20 -18
- package/src/components/header-edit-mode/document-tools/index.js +201 -0
- package/src/components/header-edit-mode/index.js +87 -184
- package/src/components/header-edit-mode/more-menu/index.js +1 -1
- package/src/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/src/components/header-edit-mode/style.scss +35 -2
- package/src/components/layout/index.js +4 -11
- package/src/components/layout/style.scss +6 -18
- package/src/components/list/added-by.js +24 -64
- package/src/components/list/style.scss +11 -13
- package/src/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +10 -22
- package/src/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/src/components/page-content-focus-notifications/index.js +14 -0
- package/src/components/page-main/index.js +6 -1
- package/src/components/page-pages/index.js +167 -91
- package/src/components/page-pages/side-editor.js +14 -0
- package/src/components/page-patterns/grid-item.js +3 -3
- package/src/components/page-patterns/patterns-list.js +10 -4
- package/src/components/page-patterns/use-patterns.js +4 -3
- package/src/components/page-templates/dataviews-templates.js +345 -0
- package/src/components/page-templates/style.scss +13 -0
- package/src/components/page-templates/template-actions.js +209 -0
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/save-button/index.js +37 -24
- package/src/components/save-hub/index.js +15 -0
- package/src/components/save-hub/style.scss +7 -0
- package/src/components/sidebar/index.js +1 -2
- package/src/components/sidebar-dataviews/add-new-view.js +141 -0
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +229 -0
- package/src/components/sidebar-dataviews/dataview-item.js +67 -0
- package/src/components/sidebar-dataviews/default-views.js +59 -0
- package/src/components/sidebar-dataviews/index.js +36 -45
- package/src/components/sidebar-dataviews/style.scss +29 -0
- package/src/components/sidebar-edit-mode/default-sidebar.js +6 -6
- package/src/components/sidebar-edit-mode/index.js +13 -9
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +31 -57
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +20 -9
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +6 -6
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +10 -8
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +13 -12
- package/src/components/sidebar-edit-mode/page-panels/style.scss +14 -19
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +10 -9
- package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +6 -6
- package/src/components/sidebar-edit-mode/settings-header/index.js +8 -9
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +11 -7
- package/src/components/sidebar-navigation-screen/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/src/components/sidebar-navigation-screen-page/index.js +24 -3
- package/src/components/sidebar-navigation-screen-page/page-details.js +4 -17
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
- package/src/components/sidebar-navigation-screen-template/style.scss +6 -1
- package/src/components/site-hub/index.js +9 -8
- package/src/components/start-template-options/index.js +14 -12
- package/src/components/style-book/index.js +48 -35
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +182 -63
- package/src/components/template-part-converter/convert-to-regular.js +1 -1
- package/src/components/welcome-guide/page.js +2 -2
- package/src/components/welcome-guide/template.js +4 -2
- package/src/hooks/commands/use-edit-mode-commands.js +22 -16
- package/src/hooks/push-changes-to-global-styles/index.js +13 -6
- package/src/hooks/template-part-edit.js +4 -2
- package/src/index.js +0 -8
- package/src/store/actions.js +42 -96
- package/src/store/private-actions.js +1 -24
- package/src/store/private-selectors.js +0 -22
- package/src/store/reducer.js +0 -39
- package/src/store/selectors.js +43 -95
- package/src/store/test/actions.js +14 -169
- package/src/store/test/reducer.js +0 -62
- package/src/store/test/selectors.js +0 -117
- package/src/style.scss +2 -0
- package/src/utils/constants.js +1 -11
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -77
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/index.js +0 -31
- package/build/components/block-editor/block-editor-provider/index.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -110
- package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -84
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
- package/build/components/block-editor/index.js +0 -30
- package/build/components/block-editor/index.js.map +0 -1
- package/build/components/dataviews/in-filter.js +0 -49
- package/build/components/dataviews/in-filter.js.map +0 -1
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +0 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -50
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +0 -1
- package/build/components/page-content-focus-manager/edit-template-notification.js.map +0 -1
- package/build/components/page-content-focus-manager/index.js +0 -61
- package/build/components/page-content-focus-manager/index.js.map +0 -1
- package/build/components/page-pages/default-views.js +0 -62
- package/build/components/page-pages/default-views.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js +0 -87
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -69
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/index.js +0 -23
- package/build-module/components/block-editor/block-editor-provider/index.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -102
- package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -78
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
- package/build-module/components/block-editor/index.js +0 -22
- package/build-module/components/block-editor/index.js.map +0 -1
- package/build-module/components/dataviews/in-filter.js +0 -41
- package/build-module/components/dataviews/in-filter.js.map +0 -1
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +0 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -43
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +0 -1
- package/build-module/components/page-content-focus-manager/edit-template-notification.js.map +0 -1
- package/build-module/components/page-content-focus-manager/index.js +0 -52
- package/build-module/components/page-content-focus-manager/index.js.map +0 -1
- package/build-module/components/page-pages/default-views.js +0 -55
- package/build-module/components/page-pages/default-views.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js +0 -80
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js.map +0 -1
- package/src/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -75
- package/src/components/block-editor/block-editor-provider/index.js +0 -29
- package/src/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -114
- package/src/components/block-editor/block-editor-provider/test/use-page-content-blocks.js +0 -116
- package/src/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -90
- package/src/components/block-editor/index.js +0 -28
- package/src/components/dataviews/in-filter.js +0 -45
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -52
- package/src/components/page-content-focus-manager/index.js +0 -51
- package/src/components/page-pages/default-views.js +0 -60
- package/src/components/sidebar-edit-mode/page-panels/publish-date.js +0 -94
|
@@ -11,6 +11,7 @@ import { Button } from '@wordpress/components';
|
|
|
11
11
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
13
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
14
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
@@ -23,15 +24,18 @@ const SettingsHeader = ({
|
|
|
23
24
|
sidebarName
|
|
24
25
|
}) => {
|
|
25
26
|
const {
|
|
26
|
-
|
|
27
|
+
isEditingPage,
|
|
27
28
|
entityType
|
|
28
29
|
} = useSelect(select => {
|
|
29
30
|
const {
|
|
30
31
|
getEditedPostType,
|
|
31
|
-
|
|
32
|
+
isPage
|
|
32
33
|
} = select(editSiteStore);
|
|
34
|
+
const {
|
|
35
|
+
getRenderingMode
|
|
36
|
+
} = select(editorStore);
|
|
33
37
|
return {
|
|
34
|
-
|
|
38
|
+
isEditingPage: isPage() && getRenderingMode() !== 'template-only',
|
|
35
39
|
entityType: getEditedPostType()
|
|
36
40
|
};
|
|
37
41
|
});
|
|
@@ -42,7 +46,7 @@ const SettingsHeader = ({
|
|
|
42
46
|
const openTemplateSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE);
|
|
43
47
|
const openBlockSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK);
|
|
44
48
|
let templateAriaLabel;
|
|
45
|
-
if (
|
|
49
|
+
if (isEditingPage) {
|
|
46
50
|
templateAriaLabel = sidebarName === SIDEBAR_TEMPLATE ?
|
|
47
51
|
// translators: ARIA label for the Template sidebar tab, selected.
|
|
48
52
|
__('Page (selected)') :
|
|
@@ -63,8 +67,8 @@ const SettingsHeader = ({
|
|
|
63
67
|
'is-active': sidebarName === SIDEBAR_TEMPLATE
|
|
64
68
|
}),
|
|
65
69
|
"aria-label": templateAriaLabel,
|
|
66
|
-
"data-label":
|
|
67
|
-
},
|
|
70
|
+
"data-label": isEditingPage ? __('Page') : entityLabel
|
|
71
|
+
}, isEditingPage ? __('Page') : entityLabel)), createElement("li", null, createElement(Button, {
|
|
68
72
|
onClick: openBlockSettings,
|
|
69
73
|
className: classnames('edit-site-sidebar-edit-mode__panel-tab', {
|
|
70
74
|
'is-active': sidebarName === SIDEBAR_BLOCK
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","Button","__","sprintf","useSelect","useDispatch","store","interfaceStore","STORE_NAME","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","SettingsHeader","sidebarName","
|
|
1
|
+
{"version":3,"names":["classnames","Button","__","sprintf","useSelect","useDispatch","store","interfaceStore","editorStore","STORE_NAME","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","SettingsHeader","sidebarName","isEditingPage","entityType","select","getEditedPostType","isPage","getRenderingMode","entityLabel","enableComplementaryArea","openTemplateSettings","openBlockSettings","templateAriaLabel","createElement","onClick","className"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/settings-header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../../../store/constants';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';\nimport { store as editSiteStore } from '../../../store';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../../utils/constants';\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { isEditingPage, entityType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, isPage } = select( editSiteStore );\n\t\tconst { getRenderingMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisEditingPage: isPage() && getRenderingMode() !== 'template-only',\n\t\t\tentityType: getEditedPostType(),\n\t\t};\n\t} );\n\n\tconst entityLabel =\n\t\tPOST_TYPE_LABELS[ entityType ] ||\n\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ];\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openTemplateSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\tconst openBlockSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\n\tlet templateAriaLabel;\n\tif ( isEditingPage ) {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t __( 'Page (selected)' )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t __( 'Page' );\n\t} else {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t sprintf( __( '%s (selected)' ), entityLabel )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t entityLabel;\n\t}\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openTemplateSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_TEMPLATE,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\tdata-label={ isEditingPage ? __( 'Page' ) : entityLabel }\n\t\t\t\t>\n\t\t\t\t\t{ isEditingPage ? __( 'Page' ) : entityLabel }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_BLOCK,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tsidebarName === SIDEBAR_BLOCK\n\t\t\t\t\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t\t\t\t\t __( 'Block (selected)' )\n\t\t\t\t\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t\t\t\t\t __( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Block' ) }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,cAAc;AAC9D,SAASL,KAAK,IAAIM,aAAa,QAAQ,gBAAgB;AACvD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,0BAA0B;AAE/E,MAAMC,cAAc,GAAGA,CAAE;EAAEC;AAAY,CAAC,KAAM;EAC7C,MAAM;IAAEC,aAAa;IAAEC;EAAW,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IAC9D,MAAM;MAAEC,iBAAiB;MAAEC;IAAO,CAAC,GAAGF,MAAM,CAAEP,aAAc,CAAC;IAC7D,MAAM;MAAEU;IAAiB,CAAC,GAAGH,MAAM,CAAEX,WAAY,CAAC;IAElD,OAAO;MACNS,aAAa,EAAEI,MAAM,CAAC,CAAC,IAAIC,gBAAgB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B,WAAW,KAAKN;IAC9B,CACD,CAAG;IACH,cACCM,WAAW,KAAKN,aAAa;IAC1B;IACAR,EAAE,CAAE,kBAAmB,CAAC;IACxB;IACAA,EAAE,CAAE,OAAQ,CACf;IACD,cAAaA,EAAE,CAAE,OAAQ;EAAG,GAE1BA,EAAE,CAAE,OAAQ,CACP,CACL,CACD,CAAC;AAEP,CAAC;AAED,eAAea,cAAc"}
|
|
@@ -10,7 +10,7 @@ import { parse } from '@wordpress/blocks';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { store as editSiteStore } from '../../../store';
|
|
13
|
-
import {
|
|
13
|
+
import { EXCLUDED_PATTERN_SOURCES, PATTERN_TYPES } from '../../../utils/constants';
|
|
14
14
|
import { unlock } from '../../../lock-unlock';
|
|
15
15
|
function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) {
|
|
16
16
|
block.innerBlocks = block.innerBlocks.map(innerBlock => {
|
|
@@ -25,12 +25,12 @@ function preparePatterns(patterns, template, currentThemeStylesheet) {
|
|
|
25
25
|
// Filter out duplicates.
|
|
26
26
|
const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name);
|
|
27
27
|
|
|
28
|
-
// Filter out core patterns.
|
|
29
|
-
const
|
|
28
|
+
// Filter out core/directory patterns not included in theme.json.
|
|
29
|
+
const filterOutExcludedPatternSources = pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source);
|
|
30
30
|
|
|
31
31
|
// Filter only the patterns that are compatible with the current template.
|
|
32
32
|
const filterCompatiblePatterns = pattern => pattern.templateTypes?.includes(template.slug);
|
|
33
|
-
return patterns.filter(
|
|
33
|
+
return patterns.filter((pattern, index, items) => filterOutExcludedPatternSources(pattern) && filterOutDuplicatesByName(pattern, index, items) && filterCompatiblePatterns(pattern)).map(pattern => ({
|
|
34
34
|
...pattern,
|
|
35
35
|
keywords: pattern.keywords || [],
|
|
36
36
|
type: PATTERN_TYPES.theme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useMemo","store","coreStore","parse","editSiteStore","
|
|
1
|
+
{"version":3,"names":["useSelect","useMemo","store","coreStore","parse","editSiteStore","EXCLUDED_PATTERN_SOURCES","PATTERN_TYPES","unlock","injectThemeAttributeInBlockTemplateContent","block","currentThemeStylesheet","innerBlocks","map","innerBlock","name","attributes","theme","undefined","preparePatterns","patterns","template","filterOutDuplicatesByName","currentItem","index","items","findIndex","item","filterOutExcludedPatternSources","pattern","includes","source","filterCompatiblePatterns","templateTypes","slug","filter","keywords","type","blocks","content","__unstableSkipMigrationLogs","useAvailablePatterns","blockPatterns","restBlockPatterns","select","_settings$__experimen","getSettings","settings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","getBlockPatterns","getCurrentTheme","stylesheet","mergedPatterns"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport {\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_TYPES,\n} from '../../../utils/constants';\nimport { unlock } from '../../../lock-unlock';\n\nfunction injectThemeAttributeInBlockTemplateContent(\n\tblock,\n\tcurrentThemeStylesheet\n) {\n\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\treturn injectThemeAttributeInBlockTemplateContent(\n\t\t\tinnerBlock,\n\t\t\tcurrentThemeStylesheet\n\t\t);\n\t} );\n\n\tif (\n\t\tblock.name === 'core/template-part' &&\n\t\tblock.attributes.theme === undefined\n\t) {\n\t\tblock.attributes.theme = currentThemeStylesheet;\n\t}\n\treturn block;\n}\n\nfunction preparePatterns( patterns, template, currentThemeStylesheet ) {\n\t// Filter out duplicates.\n\tconst filterOutDuplicatesByName = ( currentItem, index, items ) =>\n\t\tindex === items.findIndex( ( item ) => currentItem.name === item.name );\n\n\t// Filter out core/directory patterns not included in theme.json.\n\tconst filterOutExcludedPatternSources = ( pattern ) =>\n\t\t! EXCLUDED_PATTERN_SOURCES.includes( pattern.source );\n\n\t// Filter only the patterns that are compatible with the current template.\n\tconst filterCompatiblePatterns = ( pattern ) =>\n\t\tpattern.templateTypes?.includes( template.slug );\n\n\treturn patterns\n\t\t.filter(\n\t\t\t( pattern, index, items ) =>\n\t\t\t\tfilterOutExcludedPatternSources( pattern ) &&\n\t\t\t\tfilterOutDuplicatesByName( pattern, index, items ) &&\n\t\t\t\tfilterCompatiblePatterns( pattern )\n\t\t)\n\t\t.map( ( pattern ) => ( {\n\t\t\t...pattern,\n\t\t\tkeywords: pattern.keywords || [],\n\t\t\ttype: PATTERN_TYPES.theme,\n\t\t\tblocks: parse( pattern.content, {\n\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t} ).map( ( block ) =>\n\t\t\t\tinjectThemeAttributeInBlockTemplateContent(\n\t\t\t\t\tblock,\n\t\t\t\t\tcurrentThemeStylesheet\n\t\t\t\t)\n\t\t\t),\n\t\t} ) );\n}\n\nexport function useAvailablePatterns( template ) {\n\tconst { blockPatterns, restBlockPatterns, currentThemeStylesheet } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst settings = getSettings();\n\n\t\t\treturn {\n\t\t\t\tblockPatterns:\n\t\t\t\t\tsettings.__experimentalAdditionalBlockPatterns ??\n\t\t\t\t\tsettings.__experimentalBlockPatterns,\n\t\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\t\tcurrentThemeStylesheet:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme().stylesheet,\n\t\t\t};\n\t\t}, [] );\n\n\treturn useMemo( () => {\n\t\tconst mergedPatterns = [\n\t\t\t...( blockPatterns || [] ),\n\t\t\t...( restBlockPatterns || [] ),\n\t\t];\n\t\treturn preparePatterns(\n\t\t\tmergedPatterns,\n\t\t\ttemplate,\n\t\t\tcurrentThemeStylesheet\n\t\t);\n\t}, [ blockPatterns, restBlockPatterns, template, currentThemeStylesheet ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,KAAK,QAAQ,mBAAmB;;AAEzC;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,gBAAgB;AACvD,SACCC,wBAAwB,EACxBC,aAAa,QACP,0BAA0B;AACjC,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SAASC,0CAA0CA,CAClDC,KAAK,EACLC,sBAAsB,EACrB;EACDD,KAAK,CAACE,WAAW,GAAGF,KAAK,CAACE,WAAW,CAACC,GAAG,CAAIC,UAAU,IAAM;IAC5D,OAAOL,0CAA0C,CAChDK,UAAU,EACVH,sBACD,CAAC;EACF,CAAE,CAAC;EAEH,IACCD,KAAK,CAACK,IAAI,KAAK,oBAAoB,IACnCL,KAAK,CAACM,UAAU,CAACC,KAAK,KAAKC,SAAS,EACnC;IACDR,KAAK,CAACM,UAAU,CAACC,KAAK,GAAGN,sBAAsB;EAChD;EACA,OAAOD,KAAK;AACb;AAEA,SAASS,eAAeA,CAAEC,QAAQ,EAAEC,QAAQ,EAAEV,sBAAsB,EAAG;EACtE;EACA,MAAMW,yBAAyB,GAAGA,CAAEC,WAAW,EAAEC,KAAK,EAAEC,KAAK,KAC5DD,KAAK,KAAKC,KAAK,CAACC,SAAS,CAAIC,IAAI,IAAMJ,WAAW,CAACR,IAAI,KAAKY,IAAI,CAACZ,IAAK,CAAC;;EAExE;EACA,MAAMa,+BAA+B,GAAKC,OAAO,IAChD,CAAEvB,wBAAwB,CAACwB,QAAQ,CAAED,OAAO,CAACE,MAAO,CAAC;;E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CAAC,CAACgD,eAAe,CAAC,CAAC,CAACC;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAER,OAAOnD,OAAO,CAAE,MAAM;IACrB,MAAMoD,cAAc,GAAG,CACtB,IAAKX,aAAa,IAAI,EAAE,CAAE,EAC1B,IAAKC,iBAAiB,IAAI,EAAE,CAAE,CAC9B;IACD,OAAOxB,eAAe,CACrBkC,cAAc,EACdhC,QAAQ,EACRV,sBACD,CAAC;EACF,CAAC,EAAE,CAAE+B,aAAa,EAAEC,iBAAiB,EAAEtB,QAAQ,EAAEV,sBAAsB,CAAG,CAAC;AAC5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","useViewportMatch","BlockEditorProvider","useCallback","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","settings","onChange","onInput","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","record","actions","icon","label","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SA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kB,IAAIuB,gBAAgB;EAEzD,OACCpC,aAAA,CAAAuC,QAAA,QACCvC,aAAA,CAAClB,uBAAuB;IACvB0D,KAAK,EAAGtE,EAAE,CAAE,QAAS,CAAG;IACxBuE,WAAW,EAAGvE,EAAE,CACf,4DACD,CAAG;IACHwE,OAAO,EAAG1C,aAAA,CAACI,0CAA0C,MAAE,CAAG;IAC1DuC,MAAM,EACLL,4BAA4B,IAC3BtC,aAAA,CAACV,oCAAoC;MACpCsD,MAAM,EAAGjC,SAAS,GAAI,CAAC,CAAI;MAC3BR,OAAO,EAAG+B;IAAe,CACzB,CAEF;IACDW,OAAO,EACN7C,aAAA,CAAAuC,QAAA,QACG,CAAExB,gBAAgB,IACnBf,aAAA,CAACd,aAAa;MACb4D,IAAI,EAAG1E,IAAM;MACb2E,KAAK,EAAG7E,EAAE,CAAE,YAAa,CAAG;MAC5BiC,OAAO,EAAGA,CAAA,KACTa,4BAA4B,CAC3B,CAAEE,iBAAiB,GAChB,YAAY,GACZS,SACJ,CACA;MACDqB,SAAS,EAAG9B;IAAmB,CAC/B,CACD,EACDlB,aAAA,CAACd,aAAa;MACb4D,IAAI,EAAG3E,IAAM;MACb4E,KAAK,EAAG7E,EAAE,CAAE,aAAc,CAAG;MAC7BiC,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAM2B,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAZ,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,IACtDjB,aAAA,CAACZ,SAAS;IACT6D,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1B/C,OAAO,EAAG8B,aAAe;IACzBkB,QAAQ,EAAGlB,aAAe;IAC1BmB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","useViewportMatch","BlockEditorProvider","useCallback","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","settings","onChange","onInput","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","record","actions","icon","label","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,6BAA6B,IAAIC,eAAe,QAAQ,uBAAuB;AACxF,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,wBAAwB,MAAM,6CAA6C;AAClF,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAAST,KAAK,IAAIU,aAAa,QAAQ,aAAa;AACpD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,wBAAwB,MAAM,+DAA+D;AACpG,OAAOC,oCAAoC,MAAM,6CAA6C;A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,KAAK,EAAG7E,EAAE,CAAE,YAAa,CAAG;MAC5BiC,OAAO,EAAGA,CAAA,KACTa,4BAA4B,CAC3B,CAAEE,iBAAiB,GAChB,YAAY,GACZS,SACJ,CACA;MACDqB,SAAS,EAAG9B;IAAmB,CAC/B,CACD,EACDlB,aAAA,CAACd,aAAa;MACb4D,IAAI,EAAG3E,IAAM;MACb4E,KAAK,EAAG7E,EAAE,CAAE,aAAc,CAAG;MAC7BiC,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAM2B,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAZ,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,IACtDjB,aAAA,CAACZ,SAAS;IACT6D,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1B/C,OAAO,EAAG8B,aAAe;IACzBkB,QAAQ,EAAGlB,aAAe;IAC1BmB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useSelect","BlockEditorProvider","createBlock","unlock","store","editSiteStore","NavigationMenuContent","noop","NavigationMenuEditor","navigationMenuId","storedSettings","select","getSettings","blocks","ref","length","createElement","settings","value","onChange","onInput","className","rootClientId","clientId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport NavigationMenuContent from '../sidebar-navigation-screen-navigation-menus/navigation-menu-content';\n\nconst noop = () => {};\n\nexport default function NavigationMenuEditor( { navigationMenuId } ) {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(
|
|
1
|
+
{"version":3,"names":["useMemo","useSelect","BlockEditorProvider","createBlock","unlock","store","editSiteStore","NavigationMenuContent","noop","NavigationMenuEditor","navigationMenuId","storedSettings","select","getSettings","blocks","ref","length","createElement","settings","value","onChange","onInput","className","rootClientId","clientId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport NavigationMenuContent from '../sidebar-navigation-screen-navigation-menus/navigation-menu-content';\n\nconst noop = () => {};\n\nexport default function NavigationMenuEditor( { navigationMenuId } ) {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst blocks = useMemo( () => {\n\t\tif ( ! navigationMenuId ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [ createBlock( 'core/navigation', { ref: navigationMenuId } ) ];\n\t}, [ navigationMenuId ] );\n\n\tif ( ! navigationMenuId || ! blocks?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t<NavigationMenuContent rootClientId={ blocks[ 0 ].clientId } />\n\t\t\t</div>\n\t\t</BlockEditorProvider>\n\t);\n}\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,CAAE,CAACU;EAAU,CAAE,CAC1D,CACe,CAAC;AAExB"}
|
|
@@ -11,6 +11,8 @@ import { pencil } from '@wordpress/icons';
|
|
|
11
11
|
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
12
12
|
import { escapeAttribute } from '@wordpress/escape-html';
|
|
13
13
|
import { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';
|
|
14
|
+
import { useEffect } from '@wordpress/element';
|
|
15
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Internal dependencies
|
|
@@ -22,18 +24,23 @@ import SidebarButton from '../sidebar-button';
|
|
|
22
24
|
import PageDetails from './page-details';
|
|
23
25
|
import PageActions from '../page-actions';
|
|
24
26
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
27
|
+
const {
|
|
28
|
+
useHistory
|
|
29
|
+
} = unlock(routerPrivateApis);
|
|
25
30
|
export default function SidebarNavigationScreenPage() {
|
|
26
|
-
const navigator = useNavigator();
|
|
27
31
|
const {
|
|
28
32
|
setCanvasMode
|
|
29
33
|
} = unlock(useDispatch(editSiteStore));
|
|
34
|
+
const history = useHistory();
|
|
30
35
|
const {
|
|
31
36
|
params: {
|
|
32
37
|
postId
|
|
33
|
-
}
|
|
38
|
+
},
|
|
39
|
+
goTo
|
|
34
40
|
} = useNavigator();
|
|
35
41
|
const {
|
|
36
|
-
record
|
|
42
|
+
record,
|
|
43
|
+
hasResolved
|
|
37
44
|
} = useEntityRecord('postType', 'page', postId);
|
|
38
45
|
const {
|
|
39
46
|
featuredMediaAltText,
|
|
@@ -49,6 +56,18 @@ export default function SidebarNavigationScreenPage() {
|
|
|
49
56
|
featuredMediaAltText: escapeAttribute(attachedMedia?.alt_text || attachedMedia?.description?.raw || '')
|
|
50
57
|
};
|
|
51
58
|
}, [record]);
|
|
59
|
+
|
|
60
|
+
// Redirect to the main pages navigation screen if the page is not found or has been deleted.
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (hasResolved && !record) {
|
|
63
|
+
history.push({
|
|
64
|
+
path: '/page',
|
|
65
|
+
postId: undefined,
|
|
66
|
+
postType: undefined,
|
|
67
|
+
canvas: 'view'
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}, [hasResolved, history]);
|
|
52
71
|
const featureImageAltText = featuredMediaAltText ? decodeEntities(featuredMediaAltText) : decodeEntities(record?.title?.rendered || __('Featured image'));
|
|
53
72
|
return record ? createElement(SidebarNavigationScreen, {
|
|
54
73
|
title: decodeEntities(record?.title?.rendered || __('(no title)')),
|
|
@@ -58,7 +77,7 @@ export default function SidebarNavigationScreenPage() {
|
|
|
58
77
|
as: SidebarButton
|
|
59
78
|
},
|
|
60
79
|
onRemove: () => {
|
|
61
|
-
|
|
80
|
+
goTo('/page');
|
|
62
81
|
}
|
|
63
82
|
}), createElement(SidebarButton, {
|
|
64
83
|
onClick: () => setCanvasMode('edit'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useDispatch","useSelect","__experimentalUseNavigator","useNavigator","__experimentalVStack","VStack","ExternalLink","__experimentalTruncate","Truncate","store","coreStore","useEntityRecord","decodeEntities","pencil","__unstableStripHTML","stripHTML","escapeAttribute","safeDecodeURIComponent","filterURLForDisplay","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","PageDetails","PageActions","SidebarNavigationScreenDetailsFooter","
|
|
1
|
+
{"version":3,"names":["__","useDispatch","useSelect","__experimentalUseNavigator","useNavigator","__experimentalVStack","VStack","ExternalLink","__experimentalTruncate","Truncate","store","coreStore","useEntityRecord","decodeEntities","pencil","__unstableStripHTML","stripHTML","escapeAttribute","safeDecodeURIComponent","filterURLForDisplay","useEffect","privateApis","routerPrivateApis","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","PageDetails","PageActions","SidebarNavigationScreenDetailsFooter","useHistory","SidebarNavigationScreenPage","setCanvasMode","history","params","postId","goTo","record","hasResolved","featuredMediaAltText","featuredMediaSourceUrl","select","getEntityRecord","attachedMedia","featured_media","media_details","sizes","medium","source_url","alt_text","description","raw","push","path","undefined","postType","canvas","featureImageAltText","title","rendered","createElement","actions","Fragment","toggleProps","as","onRemove","onClick","label","icon","meta","className","href","link","content","alignment","spacing","alt","src","excerpt","numberOfLines","id","footer","modified"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalVStack as VStack,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';\nimport { useEffect } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport PageDetails from './page-details';\nimport PageActions from '../page-actions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreenPage() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId },\n\t\tgoTo,\n\t} = useNavigator();\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'page',\n\t\tpostId\n\t);\n\n\tconst { featuredMediaAltText, featuredMediaSourceUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// Featured image.\n\t\t\tconst attachedMedia = record?.featured_media\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\trecord?.featured_media\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tfeaturedMediaSourceUrl:\n\t\t\t\t\tattachedMedia?.media_details.sizes?.medium?.source_url ||\n\t\t\t\t\tattachedMedia?.source_url,\n\t\t\t\tfeaturedMediaAltText: escapeAttribute(\n\t\t\t\t\tattachedMedia?.alt_text ||\n\t\t\t\t\t\tattachedMedia?.description?.raw ||\n\t\t\t\t\t\t''\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record ]\n\t);\n\n\t// Redirect to the main pages navigation screen if the page is not found or has been deleted.\n\tuseEffect( () => {\n\t\tif ( hasResolved && ! record ) {\n\t\t\thistory.push( {\n\t\t\t\tpath: '/page',\n\t\t\t\tpostId: undefined,\n\t\t\t\tpostType: undefined,\n\t\t\t\tcanvas: 'view',\n\t\t\t} );\n\t\t}\n\t}, [ hasResolved, history ] );\n\n\tconst featureImageAltText = featuredMediaAltText\n\t\t? decodeEntities( featuredMediaAltText )\n\t\t: decodeEntities( record?.title?.rendered || __( 'Featured image' ) );\n\n\treturn record ? (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ decodeEntities(\n\t\t\t\trecord?.title?.rendered || __( '(no title)' )\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<PageActions\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tgoTo( '/page' );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tmeta={\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\thref={ record.link }\n\t\t\t\t>\n\t\t\t\t\t{ filterURLForDisplay(\n\t\t\t\t\t\tsafeDecodeURIComponent( record.link )\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ !! featuredMediaSourceUrl && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__featured-image-wrapper\"\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-page__featured-image has-image\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ featureImageAltText }\n\t\t\t\t\t\t\t\t\tsrc={ featuredMediaSourceUrl }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! record?.excerpt?.rendered && (\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__excerpt\"\n\t\t\t\t\t\t\tnumberOfLines={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( record.excerpt.rendered ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t) }\n\t\t\t\t\t<PageDetails id={ postId } />\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\trecord?.modified ? (\n\t\t\t\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t\t\t\t) : null\n\t\t\t}\n\t\t/>\n\t) : null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AQ,GACftB,aAAA,CAAC/B,oCAAoC;MAACQ,MAAM,EAAGA;IAAQ,CAAE,CAAC,GACvD;EACJ,CACD,CAAC,GACC,IAAI;AACT"}
|
|
@@ -83,18 +83,10 @@ export default function PageDetails({
|
|
|
83
83
|
isPostsPage
|
|
84
84
|
} = useSelect(select => {
|
|
85
85
|
const {
|
|
86
|
-
|
|
86
|
+
getEditedPostId
|
|
87
87
|
} = unlock(select(editSiteStore));
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
per_page: -1
|
|
91
|
-
});
|
|
92
|
-
// Template title.
|
|
93
|
-
const templateSlug =
|
|
94
|
-
// Checks that the post type matches the current theme's post type, otherwise
|
|
95
|
-
// the templateSlug returns 'home'.
|
|
96
|
-
postContext?.postType === 'page' ? postContext?.templateSlug : null;
|
|
97
|
-
const _templateTitle = templates && templateSlug ? templates.find(template => template.slug === templateSlug)?.title?.rendered : null;
|
|
88
|
+
const template = select(coreStore).getEntityRecord('postType', TEMPLATE_POST_TYPE, getEditedPostId());
|
|
89
|
+
const _templateTitle = template?.title?.rendered;
|
|
98
90
|
|
|
99
91
|
// Parent page title.
|
|
100
92
|
const _parentTitle = record?.parent ? select(coreStore).getEntityRecord('postType', 'page', record.parent, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","sprintf","__experimentalTruncate","Truncate","count","wordCount","useSelect","decodeEntities","store","coreStore","useEntityRecord","safeDecodeURIComponent","StatusLabel","unlock","editSiteStore","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","TEMPLATE_POST_TYPE","AVERAGE_READING_RATE","getPageDetails","page","details","label","value","createElement","status","password","date","short","numberOfLines","slug","generated_slug","templateTitle","push","parentTitle","wordCountType","wordsCounted","content","rendered","readingTime","Math","round","isPostsPage","toLocaleString","PageDetails","id","record","select","getEditedPostContext","postContext","templates","getEntityRecords","per_page","templateSlug","postType","_templateTitle","find","template","title","_parentTitle","parent","getEntityRecord","_fields","siteSettings","page_for_posts","spacing","map","key"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent(\n\t\t\t\t\t\tpage.slug || page.generated_slug\n\t\t\t\t\t) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted && ! page?.isPostsPage ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle, isPostsPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext } = unlock( select( editSiteStore ) );\n\t\t\tconst postContext = getEditedPostContext();\n\t\t\tconst templates = select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{ per_page: -1 }\n\t\t\t);\n\t\t\t// Template title.\n\t\t\tconst templateSlug =\n\t\t\t\t// Checks that the post type matches the current theme's post type, otherwise\n\t\t\t\t// the templateSlug returns 'home'.\n\t\t\t\tpostContext?.postType === 'page'\n\t\t\t\t\t? postContext?.templateSlug\n\t\t\t\t\t: null;\n\t\t\tconst _templateTitle =\n\t\t\t\ttemplates && templateSlug\n\t\t\t\t\t? templates.find(\n\t\t\t\t\t\t\t( template ) => template.slug === templateSlug\n\t\t\t\t\t )?.title?.rendered\n\t\t\t\t\t: null;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t\tisPostsPage: record?.id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent, record?.id ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\tisPostsPage,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,sBAAsB,IAAIC,QAAQ,QAAQ,uBAAuB;AAC1E,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,EAAEC,eAAe,QAAQ,sBAAsB;AAC1E,SAASC,sBAAsB,QAAQ,gBAAgB;;AAEvD;AACA;AACA;AACA,OAAOC,WAAW,MAAM,gBAAgB;AACxC,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,SACCC,mCAAmC,EACnCC,sCAAsC,EACtCC,wCAAwC,EACxCC,wCAAwC,QAClC,4CAA4C;AACnD,SAASC,kBAAkB,QAAQ,uBAAuB;;AAE1D;AACA,MAAMC,oBAAoB,GAAG,GAAG;AAEhC,SAASC,cAAcA,CAAEC,IAAI,EAAG;EAC/B,IAAK,CAAEA,IAAI,EAAG;IACb,OAAO,EAAE;EACV;EAEA,MAAMC,OAAO,GAAG,CACf;IACCC,KAAK,EAAEzB,EAAE,CAAE,QAAS,CAAC;IACrB0B,KAAK,EACJC,aAAA,CAACd,WAAW;MACXe,MAAM,EAAGL,IAAI,EAAEM,QAAQ,GAAG,WAAW,GAAGN,IAAI,CAACK,MAAQ;MACrDE,IAAI,EAAGP,IAAI,EAAEO,IAAM;MACnBC,KAAK;IAAA,CACL;EAEH,CAAC,EACD;IACCN,KAAK,EAAEzB,EAAE,CAAE,MAAO,CAAC;IACnB0B,KAAK,EACJC,aAAA,CAACvB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CAAC;IAC/C,MAAMwD,YAAY,GAAGF,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC;IAEtD,OAAO;MACN3B,WAAW,EAAEyB,YAAY;MACzB3B,aAAa,EAAEuB,cAAc;MAC7Bb,WAAW,EAAEI,MAAM,EAAED,EAAE,KAAKkB,YAAY,EAAEC;IAC3C,CAAC;EACF,CAAC,EACD,CAAElB,MAAM,EAAEc,MAAM,EAAEd,MAAM,EAAED,EAAE,CAC7B,CAAC;EACD,OACCrB,aAAA,CAACX,mCAAmC;IACnCoD,OAAO,EAAG,CAAG;IACbP,KAAK,EAAG7D,EAAE,CAAE,SAAU;EAAG,GAEvBsB,cAAc,CAAE;IACjBe,WAAW;IACXF,aAAa;IACbU,WAAW;IACX,GAAGI;EACJ,CAAE,CAAC,CAACoB,GAAG,CAAE,CAAE;IAAE5C,KAAK;IAAEC;EAAM,CAAC,KAC1BC,aAAA,CAACV,sCAAsC;IAACqD,GAAG,EAAG7C;EAAO,GACpDE,aAAA,CAACT,wCAAwC,QACtCO,KACuC,CAAC,EAC3CE,aAAA,CAACR,wCAAwC,QACtCO,KACuC,CACH,CACvC,CACkC,CAAC;AAExC"}
|
|
1
|
+
{"version":3,"names":["__","_x","sprintf","__experimentalTruncate","Truncate","count","wordCount","useSelect","decodeEntities","store","coreStore","useEntityRecord","safeDecodeURIComponent","StatusLabel","unlock","editSiteStore","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","TEMPLATE_POST_TYPE","AVERAGE_READING_RATE","getPageDetails","page","details","label","value","createElement","status","password","date","short","numberOfLines","slug","generated_slug","templateTitle","push","parentTitle","wordCountType","wordsCounted","content","rendered","readingTime","Math","round","isPostsPage","toLocaleString","PageDetails","id","record","select","getEditedPostId","template","getEntityRecord","_templateTitle","title","_parentTitle","parent","_fields","siteSettings","page_for_posts","spacing","map","key"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent(\n\t\t\t\t\t\tpage.slug || page.generated_slug\n\t\t\t\t\t) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted && ! page?.isPostsPage ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle, isPostsPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostId } = unlock( select( editSiteStore ) );\n\t\t\tconst template = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tgetEditedPostId()\n\t\t\t);\n\t\t\tconst _templateTitle = template?.title?.rendered;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t\tisPostsPage: record?.id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent, record?.id ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\tisPostsPage,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,sBAAsB,IAAIC,QAAQ,QAAQ,uBAAuB;AAC1E,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAA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AAExC"}
|
|
@@ -9,7 +9,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { filterOutDuplicatesByName } from '../page-patterns/utils';
|
|
12
|
-
import {
|
|
12
|
+
import { EXCLUDED_PATTERN_SOURCES } from '../../utils/constants';
|
|
13
13
|
import { unlock } from '../../lock-unlock';
|
|
14
14
|
import { store as editSiteStore } from '../../store';
|
|
15
15
|
export default function useThemePatterns() {
|
|
@@ -21,7 +21,7 @@ export default function useThemePatterns() {
|
|
|
21
21
|
return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns;
|
|
22
22
|
});
|
|
23
23
|
const restBlockPatterns = useSelect(select => select(coreStore).getBlockPatterns());
|
|
24
|
-
const patterns = useMemo(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !
|
|
24
|
+
const patterns = useMemo(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]);
|
|
25
25
|
return patterns;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=use-theme-patterns.js.map
|
package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","coreStore","useSelect","useMemo","filterOutDuplicatesByName","
|
|
1
|
+
{"version":3,"names":["store","coreStore","useSelect","useMemo","filterOutDuplicatesByName","EXCLUDED_PATTERN_SOURCES","unlock","editSiteStore","useThemePatterns","blockPatterns","select","_getSettings$__experi","getSettings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","patterns","filter","pattern","includes","source","inserter"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { filterOutDuplicatesByName } from '../page-patterns/utils';\nimport { EXCLUDED_PATTERN_SOURCES } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useThemePatterns() {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn (\n\t\t\tgetSettings().__experimentalAdditionalBlockPatterns ??\n\t\t\tgetSettings().__experimentalBlockPatterns\n\t\t);\n\t} );\n\n\tconst restBlockPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatterns()\n\t);\n\n\tconst patterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]\n\t\t\t\t.filter(\n\t\t\t\t\t( pattern ) =>\n\t\t\t\t\t\t! EXCLUDED_PATTERN_SOURCES.includes( pattern.source )\n\t\t\t\t)\n\t\t\t\t.filter( filterOutDuplicatesByName )\n\t\t\t\t.filter( ( pattern ) => pattern.inserter !== false ),\n\t\t[ blockPatterns, restBlockPatterns ]\n\t);\n\n\treturn patterns;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SAASC,yBAAyB,QAAQ,wBAAwB;AAClE,SAASC,wBAAwB,QAAQ,uBAAuB;AAChE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASN,KAAK,IAAIO,aAAa,QAAQ,aAAa;AAEpD,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAMC,aAAa,GAAGP,SAAS,CAAIQ,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAC9C,MAAM;MAAEC;IAAY,CAAC,GAAGN,MAAM,CAAEI,MAAM,CAAEH,aAAc,CAAE,CAAC;IAEzD,QAAAI,qBAAA,GACCC,WAAW,CAAC,CAAC,CAACC,qCAAqC,cAAAF,qBAAA,cAAAA,qBAAA,GACnDC,WAAW,CAAC,CAAC,CAACE,2BAA2B;EAE3C,CAAE,CAAC;EAEH,MAAMC,iBAAiB,GAAGb,SAAS,CAAIQ,MAAM,IAC5CA,MAAM,CAAET,SAAU,CAAC,CAACe,gBAAgB,CAAC,CACtC,CAAC;EAED,MAAMC,QAAQ,GAAGd,OAAO,CACvB,MACC,CAAE,IAAKM,aAAa,IAAI,EAAE,CAAE,EAAE,IAAKM,iBAAiB,IAAI,EAAE,CAAE,CAAE,CAC5DG,MAAM,CACJC,OAAO,IACR,CAAEd,wBAAwB,CAACe,QAAQ,CAAED,OAAO,CAACE,MAAO,CACtD,CAAC,CACAH,MAAM,CAAEd,yBAA0B,CAAC,CACnCc,MAAM,CAAIC,OAAO,IAAMA,OAAO,CAACG,QAAQ,KAAK,KAAM,CAAC,EACtD,CAAEb,aAAa,EAAEM,iBAAiB,CACnC,CAAC;EAED,OAAOE,QAAQ;AAChB"}
|
|
@@ -14,7 +14,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
14
14
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
15
15
|
import { store as coreStore } from '@wordpress/core-data';
|
|
16
16
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
17
|
-
import {
|
|
17
|
+
import { memo } from '@wordpress/element';
|
|
18
18
|
import { search, external } from '@wordpress/icons';
|
|
19
19
|
import { store as commandsStore } from '@wordpress/commands';
|
|
20
20
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
@@ -26,10 +26,10 @@ import { store as editSiteStore } from '../../store';
|
|
|
26
26
|
import SiteIcon from '../site-icon';
|
|
27
27
|
import { unlock } from '../../lock-unlock';
|
|
28
28
|
const HUB_ANIMATION_DURATION = 0.3;
|
|
29
|
-
const SiteHub =
|
|
29
|
+
const SiteHub = memo(({
|
|
30
30
|
isTransparent,
|
|
31
|
-
|
|
32
|
-
}
|
|
31
|
+
className
|
|
32
|
+
}) => {
|
|
33
33
|
const {
|
|
34
34
|
canvasMode,
|
|
35
35
|
dashboardLink,
|
|
@@ -81,9 +81,21 @@ const SiteHub = forwardRef(({
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
return createElement(motion.div, {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
className: classnames('edit-site-site-hub', className),
|
|
85
|
+
variants: {
|
|
86
|
+
isDistractionFree: {
|
|
87
|
+
x: '-100%'
|
|
88
|
+
},
|
|
89
|
+
isDistractionFreeHovering: {
|
|
90
|
+
x: 0
|
|
91
|
+
},
|
|
92
|
+
view: {
|
|
93
|
+
x: 0
|
|
94
|
+
},
|
|
95
|
+
edit: {
|
|
96
|
+
x: 0
|
|
97
|
+
}
|
|
98
|
+
},
|
|
87
99
|
initial: false,
|
|
88
100
|
transition: {
|
|
89
101
|
type: 'tween',
|