@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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalHeading as Heading, DropdownMenu, MenuGroup, MenuItem, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack, Button, Modal } from '@wordpress/components';
|
|
8
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
9
|
+
import { moreVertical } from '@wordpress/icons';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import DataViewItem from './dataview-item';
|
|
17
|
+
import AddNewItem from './add-new-view';
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
|
+
const {
|
|
20
|
+
useHistory,
|
|
21
|
+
useLocation
|
|
22
|
+
} = unlock(routerPrivateApis);
|
|
23
|
+
const EMPTY_ARRAY = [];
|
|
24
|
+
function RenameItemModalContent({
|
|
25
|
+
dataviewId,
|
|
26
|
+
currentTitle,
|
|
27
|
+
setIsRenaming
|
|
28
|
+
}) {
|
|
29
|
+
const {
|
|
30
|
+
editEntityRecord
|
|
31
|
+
} = useDispatch(coreStore);
|
|
32
|
+
const [title, setTitle] = useState(currentTitle);
|
|
33
|
+
return createElement("form", {
|
|
34
|
+
onSubmit: async event => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
await editEntityRecord('postType', 'wp_dataviews', dataviewId, {
|
|
37
|
+
title
|
|
38
|
+
});
|
|
39
|
+
setIsRenaming(false);
|
|
40
|
+
}
|
|
41
|
+
}, createElement(VStack, {
|
|
42
|
+
spacing: "5"
|
|
43
|
+
}, createElement(TextControl, {
|
|
44
|
+
__nextHasNoMarginBottom: true,
|
|
45
|
+
label: __('Name'),
|
|
46
|
+
value: title,
|
|
47
|
+
onChange: setTitle,
|
|
48
|
+
placeholder: __('My view'),
|
|
49
|
+
className: "patterns-create-modal__name-input"
|
|
50
|
+
}), createElement(HStack, {
|
|
51
|
+
justify: "right"
|
|
52
|
+
}, createElement(Button, {
|
|
53
|
+
variant: "tertiary",
|
|
54
|
+
onClick: () => {
|
|
55
|
+
setIsRenaming(false);
|
|
56
|
+
}
|
|
57
|
+
}, __('Cancel')), createElement(Button, {
|
|
58
|
+
variant: "primary",
|
|
59
|
+
type: "submit",
|
|
60
|
+
"aria-disabled": !title
|
|
61
|
+
}, __('Rename')))));
|
|
62
|
+
}
|
|
63
|
+
function CustomDataViewItem({
|
|
64
|
+
dataviewId,
|
|
65
|
+
isActive
|
|
66
|
+
}) {
|
|
67
|
+
const {
|
|
68
|
+
params: {
|
|
69
|
+
path
|
|
70
|
+
}
|
|
71
|
+
} = useLocation();
|
|
72
|
+
const history = useHistory();
|
|
73
|
+
const {
|
|
74
|
+
dataview
|
|
75
|
+
} = useSelect(select => {
|
|
76
|
+
const {
|
|
77
|
+
getEditedEntityRecord
|
|
78
|
+
} = select(coreStore);
|
|
79
|
+
return {
|
|
80
|
+
dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId)
|
|
81
|
+
};
|
|
82
|
+
}, [dataviewId]);
|
|
83
|
+
const {
|
|
84
|
+
deleteEntityRecord
|
|
85
|
+
} = useDispatch(coreStore);
|
|
86
|
+
const type = useMemo(() => {
|
|
87
|
+
const viewContent = JSON.parse(dataview.content);
|
|
88
|
+
return viewContent.type;
|
|
89
|
+
}, [dataview.content]);
|
|
90
|
+
const [isRenaming, setIsRenaming] = useState(false);
|
|
91
|
+
return createElement(Fragment, null, createElement(DataViewItem, {
|
|
92
|
+
title: dataview.title,
|
|
93
|
+
type: type,
|
|
94
|
+
isActive: isActive,
|
|
95
|
+
isCustom: "true",
|
|
96
|
+
customViewId: dataviewId,
|
|
97
|
+
suffix: createElement(DropdownMenu, {
|
|
98
|
+
icon: moreVertical,
|
|
99
|
+
label: __('Actions'),
|
|
100
|
+
className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu",
|
|
101
|
+
toggleProps: {
|
|
102
|
+
style: {
|
|
103
|
+
color: 'inherit'
|
|
104
|
+
},
|
|
105
|
+
size: 'small'
|
|
106
|
+
}
|
|
107
|
+
}, ({
|
|
108
|
+
onClose
|
|
109
|
+
}) => createElement(MenuGroup, null, createElement(MenuItem, {
|
|
110
|
+
onClick: () => {
|
|
111
|
+
setIsRenaming(true);
|
|
112
|
+
onClose();
|
|
113
|
+
}
|
|
114
|
+
}, __('Rename')), createElement(MenuItem, {
|
|
115
|
+
onClick: async () => {
|
|
116
|
+
await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, {
|
|
117
|
+
force: true
|
|
118
|
+
});
|
|
119
|
+
if (isActive) {
|
|
120
|
+
history.replace({
|
|
121
|
+
path
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
onClose();
|
|
125
|
+
},
|
|
126
|
+
isDestructive: true
|
|
127
|
+
}, __('Delete'))))
|
|
128
|
+
}), isRenaming && createElement(Modal, {
|
|
129
|
+
title: __('Rename view'),
|
|
130
|
+
onRequestClose: () => {
|
|
131
|
+
setIsRenaming(false);
|
|
132
|
+
}
|
|
133
|
+
}, createElement(RenameItemModalContent, {
|
|
134
|
+
dataviewId: dataviewId,
|
|
135
|
+
setIsRenaming: setIsRenaming,
|
|
136
|
+
currentTitle: dataview.title
|
|
137
|
+
})));
|
|
138
|
+
}
|
|
139
|
+
export function useCustomDataViews(type) {
|
|
140
|
+
const customDataViews = useSelect(select => {
|
|
141
|
+
const {
|
|
142
|
+
getEntityRecords
|
|
143
|
+
} = select(coreStore);
|
|
144
|
+
const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', {
|
|
145
|
+
slug: type
|
|
146
|
+
});
|
|
147
|
+
if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) {
|
|
148
|
+
return EMPTY_ARRAY;
|
|
149
|
+
}
|
|
150
|
+
const dataViews = getEntityRecords('postType', 'wp_dataviews', {
|
|
151
|
+
wp_dataviews_type: dataViewTypeRecords[0].id,
|
|
152
|
+
orderby: 'date',
|
|
153
|
+
order: 'asc'
|
|
154
|
+
});
|
|
155
|
+
if (!dataViews) {
|
|
156
|
+
return EMPTY_ARRAY;
|
|
157
|
+
}
|
|
158
|
+
return dataViews;
|
|
159
|
+
});
|
|
160
|
+
return customDataViews;
|
|
161
|
+
}
|
|
162
|
+
export default function CustomDataViewsList({
|
|
163
|
+
type,
|
|
164
|
+
activeView,
|
|
165
|
+
isCustom
|
|
166
|
+
}) {
|
|
167
|
+
const customDataViews = useCustomDataViews(type);
|
|
168
|
+
return createElement(Fragment, null, createElement("div", {
|
|
169
|
+
className: "edit-site-sidebar-navigation-screen-dataviews__group-header"
|
|
170
|
+
}, createElement(Heading, {
|
|
171
|
+
level: 2
|
|
172
|
+
}, __('Custom Views'))), createElement(ItemGroup, null, customDataViews.map(customViewRecord => {
|
|
173
|
+
return createElement(CustomDataViewItem, {
|
|
174
|
+
key: customViewRecord.id,
|
|
175
|
+
dataviewId: customViewRecord.id,
|
|
176
|
+
isActive: isCustom === 'true' && Number(activeView) === customViewRecord.id
|
|
177
|
+
});
|
|
178
|
+
}), createElement(AddNewItem, {
|
|
179
|
+
type: type
|
|
180
|
+
})));
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=custom-dataviews-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","store","coreStore","__experimentalItemGroup","ItemGroup","__experimentalHeading","Heading","DropdownMenu","MenuGroup","MenuItem","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","Modal","useMemo","useState","moreVertical","__","privateApis","routerPrivateApis","DataViewItem","AddNewItem","unlock","useHistory","useLocation","EMPTY_ARRAY","RenameItemModalContent","dataviewId","currentTitle","setIsRenaming","editEntityRecord","title","setTitle","createElement","onSubmit","event","preventDefault","spacing","__nextHasNoMarginBottom","label","value","onChange","placeholder","className","justify","variant","onClick","type","CustomDataViewItem","isActive","params","path","history","dataview","select","getEditedEntityRecord","deleteEntityRecord","viewContent","JSON","parse","content","isRenaming","Fragment","isCustom","customViewId","suffix","icon","toggleProps","style","color","size","onClose","id","force","replace","isDestructive","onRequestClose","useCustomDataViews","customDataViews","getEntityRecords","dataViewTypeRecords","slug","length","dataViews","wp_dataviews_type","orderby","order","CustomDataViewsList","activeView","level","map","customViewRecord","key","Number"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/custom-dataviews-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHeading as Heading,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from './dataview-item';\nimport AddNewItem from './add-new-view';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nfunction RenameItemModalContent( { dataviewId, currentTitle, setIsRenaming } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst [ title, setTitle ] = useState( currentTitle );\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\tdataviewId,\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tsetIsRenaming( false );\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\tplaceholder={ __( 'My view' ) }\n\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsRenaming( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nfunction CustomDataViewItem( { dataviewId, isActive } ) {\n\tconst {\n\t\tparams: { path },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst { dataview } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tdataview: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\tdataviewId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ dataviewId ]\n\t);\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst type = useMemo( () => {\n\t\tconst viewContent = JSON.parse( dataview.content );\n\t\treturn viewContent.type;\n\t}, [ dataview.content ] );\n\tconst [ isRenaming, setIsRenaming ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<DataViewItem\n\t\t\t\ttitle={ dataview.title }\n\t\t\t\ttype={ type }\n\t\t\t\tisActive={ isActive }\n\t\t\t\tisCustom=\"true\"\n\t\t\t\tcustomViewId={ dataviewId }\n\t\t\t\tsuffix={\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-dataviews-dataview-item__dropdown-menu\"\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tcolor: 'inherit',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsRenaming( true );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\t\t\t\t\t\t\tdataview.id,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tforce: true,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tif ( isActive ) {\n\t\t\t\t\t\t\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isRenaming && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename view' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsRenaming( false );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<RenameItemModalContent\n\t\t\t\t\t\tdataviewId={ dataviewId }\n\t\t\t\t\t\tsetIsRenaming={ setIsRenaming }\n\t\t\t\t\t\tcurrentTitle={ dataview.title }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport function useCustomDataViews( type ) {\n\tconst customDataViews = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\tconst dataViewTypeRecords = getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'wp_dataviews_type',\n\t\t\t{ slug: type }\n\t\t);\n\t\tif ( ! dataViewTypeRecords || dataViewTypeRecords.length === 0 ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst dataViews = getEntityRecords( 'postType', 'wp_dataviews', {\n\t\t\twp_dataviews_type: dataViewTypeRecords[ 0 ].id,\n\t\t\torderby: 'date',\n\t\t\torder: 'asc',\n\t\t} );\n\t\tif ( ! dataViews ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn dataViews;\n\t} );\n\treturn customDataViews;\n}\n\nexport default function CustomDataViewsList( { type, activeView, isCustom } ) {\n\tconst customDataViews = useCustomDataViews( type );\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-dataviews__group-header\">\n\t\t\t\t<Heading level={ 2 }>{ __( 'Custom Views' ) }</Heading>\n\t\t\t</div>\n\t\t\t<ItemGroup>\n\t\t\t\t{ customDataViews.map( ( customViewRecord ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<CustomDataViewItem\n\t\t\t\t\t\t\tkey={ customViewRecord.id }\n\t\t\t\t\t\t\tdataviewId={ customViewRecord.id }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tisCustom === 'true' &&\n\t\t\t\t\t\t\t\tNumber( activeView ) === customViewRecord.id\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t<AddNewItem type={ type } />\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,qBAAqB,IAAIC,OAAO,EAChCC,YAAY,EACZC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,UAAU,MAAM,gBAAgB;AACvC,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,UAAU;EAAEC;AAAY,CAAC,GAAGF,MAAM,CAAEH,iBAAkB,CAAC;AAE/D,MAAMM,WAAW,GAAG,EAAE;AAEtB,SAASC,sBAAsBA,CAAE;EAAEC,UAAU;EAAEC,YAAY;EAAEC;AAAc,CAAC,EAAG;EAC9E,MAAM;IAAEC;EAAiB,CAAC,GAAGjC,WAAW,CAAEE,SAAU,CAAC;EACrD,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ACfC,KAAK,EAAE;IACR,CAAE,CAAC;IACH,IAAK,CAAEH,SAAS,EAAG;MAClB,OAAO1D,WAAW;IACnB;IACA,OAAO0D,SAAS;EACjB,CAAE,CAAC;EACH,OAAOL,eAAe;AACvB;AAEA,eAAe,SAASS,mBAAmBA,CAAE;EAAExC,IAAI;EAAEyC,UAAU;EAAEzB;AAAS,CAAC,EAAG;EAC7E,MAAMe,eAAe,GAAGD,kBAAkB,CAAE9B,IAAK,CAAC;EAClD,OACCd,aAAA,CAAA6B,QAAA,QACC7B,aAAA;IAAKU,SAAS,EAAC;EAA6D,GAC3EV,aAAA,CAAC9B,OAAO;IAACsF,KAAK,EAAG;EAAG,GAAGxE,EAAE,CAAE,cAAe,CAAY,CAClD,CAAC,EACNgB,aAAA,CAAChC,SAAS,QACP6E,eAAe,CAACY,GAAG,CAAIC,gBAAgB,IAAM;IAC9C,OACC1D,aAAA,CAACe,kBAAkB;MAClB4C,GAAG,EAAGD,gBAAgB,CAACnB,EAAI;MAC3B7C,UAAU,EAAGgE,gBAAgB,CAACnB,EAAI;MAClCvB,QAAQ,EACPc,QAAQ,KAAK,MAAM,IACnB8B,MAAM,CAAEL,UAAW,CAAC,KAAKG,gBAAgB,CAACnB;IAC1C,CACD,CAAC;EAEJ,CAAE,CAAC,EACHvC,aAAA,CAACZ,UAAU;IAAC0B,IAAI,EAAGA;EAAM,CAAE,CACjB,CACV,CAAC;AAEL"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { page, columns, pullRight } from '@wordpress/icons';
|
|
11
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
|
+
import { __experimentalHStack as HStack } from '@wordpress/components';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { useLink } from '../routes/link';
|
|
18
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
20
|
+
const {
|
|
21
|
+
useLocation
|
|
22
|
+
} = unlock(routerPrivateApis);
|
|
23
|
+
function getDataViewIcon(type) {
|
|
24
|
+
const icons = {
|
|
25
|
+
list: page,
|
|
26
|
+
grid: columns,
|
|
27
|
+
'side-by-side': pullRight
|
|
28
|
+
};
|
|
29
|
+
return icons[type];
|
|
30
|
+
}
|
|
31
|
+
export default function DataViewItem({
|
|
32
|
+
title,
|
|
33
|
+
slug,
|
|
34
|
+
customViewId,
|
|
35
|
+
type,
|
|
36
|
+
icon,
|
|
37
|
+
isActive,
|
|
38
|
+
isCustom,
|
|
39
|
+
suffix
|
|
40
|
+
}) {
|
|
41
|
+
const {
|
|
42
|
+
params: {
|
|
43
|
+
path
|
|
44
|
+
}
|
|
45
|
+
} = useLocation();
|
|
46
|
+
const iconToUse = icon || getDataViewIcon(type);
|
|
47
|
+
const linkInfo = useLink({
|
|
48
|
+
path,
|
|
49
|
+
activeView: isCustom === 'true' ? customViewId : slug,
|
|
50
|
+
isCustom
|
|
51
|
+
});
|
|
52
|
+
return createElement(HStack, {
|
|
53
|
+
justify: "flex-start",
|
|
54
|
+
className: classnames('edit-site-sidebar-dataviews-dataview-item', {
|
|
55
|
+
'is-selected': isActive
|
|
56
|
+
})
|
|
57
|
+
}, createElement(SidebarNavigationItem, {
|
|
58
|
+
icon: iconToUse,
|
|
59
|
+
...linkInfo,
|
|
60
|
+
"aria-current": isActive ? 'true' : undefined
|
|
61
|
+
}, title), suffix);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=dataview-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["classnames","page","columns","pullRight","privateApis","routerPrivateApis","__experimentalHStack","HStack","useLink","SidebarNavigationItem","unlock","useLocation","getDataViewIcon","type","icons","list","grid","DataViewItem","title","slug","customViewId","icon","isActive","isCustom","suffix","params","path","iconToUse","linkInfo","activeView","createElement","justify","className","undefined"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/dataview-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { page, columns, pullRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction getDataViewIcon( type ) {\n\tconst icons = { list: page, grid: columns, 'side-by-side': pullRight };\n\treturn icons[ type ];\n}\n\nexport default function DataViewItem( {\n\ttitle,\n\tslug,\n\tcustomViewId,\n\ttype,\n\ticon,\n\tisActive,\n\tisCustom,\n\tsuffix,\n} ) {\n\tconst {\n\t\tparams: { path },\n\t} = useLocation();\n\n\tconst iconToUse = icon || getDataViewIcon( type );\n\n\tconst linkInfo = useLink( {\n\t\tpath,\n\t\tactiveView: isCustom === 'true' ? customViewId : slug,\n\t\tisCustom,\n\t} );\n\treturn (\n\t\t<HStack\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-dataviews-dataview-item',\n\t\t\t\t{\n\t\t\t\t\t'is-selected': isActive,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ iconToUse }\n\t\t\t\t{ ...linkInfo }\n\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ suffix }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU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AeN,QAAQ,GAAG,MAAM,GAAGW;EAAW,GAE5Cf,KACoB,CAAC,EACtBM,MACK,CAAC;AAEX"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { trash } from '@wordpress/icons';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { OPERATOR_IN } from '../dataviews/constants';
|
|
11
|
+
const DEFAULT_PAGE_BASE = {
|
|
12
|
+
type: 'list',
|
|
13
|
+
search: '',
|
|
14
|
+
filters: [],
|
|
15
|
+
page: 1,
|
|
16
|
+
perPage: 20,
|
|
17
|
+
sort: {
|
|
18
|
+
field: 'date',
|
|
19
|
+
direction: 'desc'
|
|
20
|
+
},
|
|
21
|
+
// All fields are visible by default, so it's
|
|
22
|
+
// better to keep track of the hidden ones.
|
|
23
|
+
hiddenFields: ['date', 'featured-image'],
|
|
24
|
+
layout: {}
|
|
25
|
+
};
|
|
26
|
+
const DEFAULT_VIEWS = {
|
|
27
|
+
page: [{
|
|
28
|
+
title: __('All'),
|
|
29
|
+
slug: 'all',
|
|
30
|
+
view: DEFAULT_PAGE_BASE
|
|
31
|
+
}, {
|
|
32
|
+
title: __('Drafts'),
|
|
33
|
+
slug: 'drafts',
|
|
34
|
+
view: {
|
|
35
|
+
...DEFAULT_PAGE_BASE,
|
|
36
|
+
filters: [{
|
|
37
|
+
field: 'status',
|
|
38
|
+
operator: OPERATOR_IN,
|
|
39
|
+
value: 'draft'
|
|
40
|
+
}]
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
title: __('Trash'),
|
|
44
|
+
slug: 'trash',
|
|
45
|
+
icon: trash,
|
|
46
|
+
view: {
|
|
47
|
+
...DEFAULT_PAGE_BASE,
|
|
48
|
+
filters: [{
|
|
49
|
+
field: 'status',
|
|
50
|
+
operator: OPERATOR_IN,
|
|
51
|
+
value: 'trash'
|
|
52
|
+
}]
|
|
53
|
+
}
|
|
54
|
+
}]
|
|
55
|
+
};
|
|
56
|
+
export default DEFAULT_VIEWS;
|
|
57
|
+
//# sourceMappingURL=default-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","trash","OPERATOR_IN","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","slug","view","operator","value","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IN } from '../dataviews/constants';\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: 'list',\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {},\n};\n\nconst DEFAULT_VIEWS = {\n\tpage: [\n\t\t{\n\t\t\ttitle: __( 'All' ),\n\t\t\tslug: 'all',\n\t\t\tview: DEFAULT_PAGE_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{ field: 'status', operator: OPERATOR_IN, value: 'draft' },\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{ field: 'status', operator: OPERATOR_IN, value: 'trash' },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
|
|
@@ -1,66 +1,49 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
6
|
-
import { page, columns } from '@wordpress/icons';
|
|
7
6
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
* Internal dependencies
|
|
11
9
|
*/
|
|
12
|
-
|
|
13
|
-
import { default as DEFAULT_VIEWS } from '
|
|
10
|
+
|
|
11
|
+
import { default as DEFAULT_VIEWS } from './default-views';
|
|
14
12
|
import { unlock } from '../../lock-unlock';
|
|
15
13
|
const {
|
|
16
14
|
useLocation
|
|
17
15
|
} = unlock(routerPrivateApis);
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
return icons[dataview.view.type];
|
|
25
|
-
}
|
|
26
|
-
function DataViewItem({
|
|
27
|
-
dataview,
|
|
28
|
-
isActive,
|
|
29
|
-
icon
|
|
30
|
-
}) {
|
|
31
|
-
const {
|
|
32
|
-
params: {
|
|
33
|
-
path
|
|
34
|
-
}
|
|
35
|
-
} = useLocation();
|
|
36
|
-
const _icon = icon || getDataViewIcon(dataview);
|
|
37
|
-
const linkInfo = useLink({
|
|
38
|
-
path,
|
|
39
|
-
activeView: dataview.slug
|
|
40
|
-
});
|
|
41
|
-
return createElement(SidebarNavigationItem, {
|
|
42
|
-
icon: _icon,
|
|
43
|
-
...linkInfo,
|
|
44
|
-
"aria-current": isActive ? 'true' : undefined
|
|
45
|
-
}, dataview.title);
|
|
46
|
-
}
|
|
16
|
+
import DataViewItem from './dataview-item';
|
|
17
|
+
import CustomDataViewsList from './custom-dataviews-list';
|
|
18
|
+
const PATH_TO_TYPE = {
|
|
19
|
+
'/pages': 'page'
|
|
20
|
+
};
|
|
47
21
|
export default function DataViewsSidebarContent() {
|
|
48
22
|
const {
|
|
49
23
|
params: {
|
|
50
24
|
path,
|
|
51
|
-
activeView = 'all'
|
|
25
|
+
activeView = 'all',
|
|
26
|
+
isCustom = 'false'
|
|
52
27
|
}
|
|
53
28
|
} = useLocation();
|
|
54
|
-
if (!path || path
|
|
29
|
+
if (!path || !PATH_TO_TYPE[path]) {
|
|
55
30
|
return null;
|
|
56
31
|
}
|
|
57
|
-
|
|
32
|
+
const type = PATH_TO_TYPE[path];
|
|
33
|
+
return createElement(Fragment, null, createElement(ItemGroup, null, DEFAULT_VIEWS[type].map(dataview => {
|
|
58
34
|
return createElement(DataViewItem, {
|
|
59
35
|
key: dataview.slug,
|
|
36
|
+
slug: dataview.slug,
|
|
37
|
+
title: dataview.title,
|
|
60
38
|
icon: dataview.icon,
|
|
61
|
-
|
|
62
|
-
isActive: dataview.slug === activeView
|
|
39
|
+
type: dataview.view.type,
|
|
40
|
+
isActive: isCustom === 'false' && dataview.slug === activeView,
|
|
41
|
+
isCustom: "false"
|
|
63
42
|
});
|
|
43
|
+
})), createElement(CustomDataViewsList, {
|
|
44
|
+
activeView: activeView,
|
|
45
|
+
type: type,
|
|
46
|
+
isCustom: "true"
|
|
64
47
|
}));
|
|
65
48
|
}
|
|
66
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalItemGroup","ItemGroup","
|
|
1
|
+
{"version":3,"names":["__experimentalItemGroup","ItemGroup","privateApis","routerPrivateApis","default","DEFAULT_VIEWS","unlock","useLocation","DataViewItem","CustomDataViewsList","PATH_TO_TYPE","DataViewsSidebarContent","params","path","activeView","isCustom","type","createElement","Fragment","map","dataview","key","slug","title","icon","view","isActive"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n/**\n * Internal dependencies\n */\n\nimport { default as DEFAULT_VIEWS } from './default-views';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst PATH_TO_TYPE = {\n\t'/pages': 'page',\n};\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { path, activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tif ( ! path || ! PATH_TO_TYPE[ path ] ) {\n\t\treturn null;\n\t}\n\tconst type = PATH_TO_TYPE[ path ];\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ DEFAULT_VIEWS[ type ].map( ( dataview ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DataViewItem\n\t\t\t\t\t\t\tkey={ dataview.slug }\n\t\t\t\t\t\t\tslug={ dataview.slug }\n\t\t\t\t\t\t\ttitle={ dataview.title }\n\t\t\t\t\t\t\ticon={ dataview.icon }\n\t\t\t\t\t\t\ttype={ dataview.view.type }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tisCustom === 'false' &&\n\t\t\t\t\t\t\t\tdataview.slug === activeView\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisCustom=\"false\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t\t<CustomDataViewsList\n\t\t\t\tactiveView={ activeView }\n\t\t\t\ttype={ type }\n\t\t\t\tisCustom=\"true\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAE5E,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE;AACA;AACA;;AAEA,SAASC,OAAO,IAAIC,aAAa,QAAQ,iBAAiB;AAC1D,SAASC,MAAM,QAAQ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ComplementaryArea, ComplementaryAreaMoreMenuItem } from '@wordpress/interface';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editSiteStore } from '../../store';
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
12
8
|
export default function DefaultSidebar({
|
|
13
9
|
className,
|
|
14
10
|
identifier,
|
|
@@ -20,7 +16,7 @@ export default function DefaultSidebar({
|
|
|
20
16
|
headerClassName,
|
|
21
17
|
panelClassName
|
|
22
18
|
}) {
|
|
23
|
-
const showIconLabels = useSelect(select => select(
|
|
19
|
+
const showIconLabels = useSelect(select => !!select(preferencesStore).get('core/edit-site', 'showIconLabels'), []);
|
|
24
20
|
return createElement(Fragment, null, createElement(ComplementaryArea, {
|
|
25
21
|
className: className,
|
|
26
22
|
scope: "core/edit-site",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComplementaryArea","ComplementaryAreaMoreMenuItem","useSelect","store","
|
|
1
|
+
{"version":3,"names":["ComplementaryArea","ComplementaryAreaMoreMenuItem","useSelect","store","preferencesStore","DefaultSidebar","className","identifier","title","icon","children","closeLabel","header","headerClassName","panelClassName","showIconLabels","select","get","createElement","Fragment","scope","smallScreenTitle"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/default-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tComplementaryArea,\n\tComplementaryAreaMoreMenuItem,\n} from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function DefaultSidebar( {\n\tclassName,\n\tidentifier,\n\ttitle,\n\ticon,\n\tchildren,\n\tcloseLabel,\n\theader,\n\theaderClassName,\n\tpanelClassName,\n} ) {\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ComplementaryArea\n\t\t\t\tclassName={ className }\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ttitle={ title }\n\t\t\t\tsmallScreenTitle={ title }\n\t\t\t\ticon={ icon }\n\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\theader={ header }\n\t\t\t\theaderClassName={ headerClassName }\n\t\t\t\tpanelClassName={ panelClassName }\n\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</ComplementaryArea>\n\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ticon={ icon }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,iBAAiB,EACjBC,6BAA6B,QACvB,sBAAsB;AAC7B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAElE,eAAe,SAASC,cAAcA,CAAE;EACvCC,SAAS;EACTC,UAAU;EACVC,KAAK;EACLC,IAAI;EACJC,QAAQ;EACRC,UAAU;EACVC,MAAM;EACNC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGb,SAAS,CAC7Bc,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEZ,gBAAiB,CAAC,CAACa,GAAG,CAChC,gBAAgB,EAChB,gBACD,CAAC,EACF,EACD,CAAC;EAED,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAClB,iBAAiB;IACjBM,SAAS,EAAGA,SAAW;IACvBc,KAAK,EAAC,gBAAgB;IACtBb,UAAU,EAAGA,UAAY;IACzBC,KAAK,EAAGA,KAAO;IACfa,gBAAgB,EAAGb,KAAO;IAC1BC,IAAI,EAAGA,IAAM;IACbE,UAAU,EAAGA,UAAY;IACzBC,MAAM,EAAGA,MAAQ;IACjBC,eAAe,EAAGA,eAAiB;IACnCC,cAAc,EAAGA,cAAgB;IACjCC,cAAc,EAAGA;EAAgB,GAE/BL,QACgB,CAAC,EACpBQ,aAAA,CAACjB,6BAA6B;IAC7BmB,KAAK,EAAC,gBAAgB;IACtBb,UAAU,EAAGA,UAAY;IACzBE,IAAI,EAAGA;EAAM,GAEXD,KAC4B,CAC9B,CAAC;AAEL"}
|
|
@@ -9,6 +9,7 @@ import { useEffect } from '@wordpress/element';
|
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
10
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
11
11
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -33,7 +34,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
33
34
|
isEditorSidebarOpened,
|
|
34
35
|
hasBlockSelection,
|
|
35
36
|
supportsGlobalStyles,
|
|
36
|
-
|
|
37
|
+
isEditingPage
|
|
37
38
|
} = useSelect(select => {
|
|
38
39
|
const _sidebar = select(interfaceStore).getActiveComplementaryArea(STORE_NAME);
|
|
39
40
|
const _isEditorSidebarOpened = [SIDEBAR_BLOCK, SIDEBAR_TEMPLATE].includes(_sidebar);
|
|
@@ -43,7 +44,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
43
44
|
isEditorSidebarOpened: _isEditorSidebarOpened,
|
|
44
45
|
hasBlockSelection: !!select(blockEditorStore).getBlockSelectionStart(),
|
|
45
46
|
supportsGlobalStyles: !settings?.supportsTemplatePartsMode,
|
|
46
|
-
|
|
47
|
+
isEditingPage: select(editSiteStore).isPage() && select(editorStore).getRenderingMode() !== 'template-only'
|
|
47
48
|
};
|
|
48
49
|
}, []);
|
|
49
50
|
const {
|
|
@@ -56,13 +57,13 @@ export function SidebarComplementaryAreaFills() {
|
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
59
|
if (hasBlockSelection) {
|
|
59
|
-
if (!
|
|
60
|
+
if (!isEditingPage) {
|
|
60
61
|
enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK);
|
|
61
62
|
}
|
|
62
63
|
} else {
|
|
63
64
|
enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE);
|
|
64
65
|
}
|
|
65
|
-
}, [hasBlockSelection, isEditorSidebarOpened,
|
|
66
|
+
}, [hasBlockSelection, isEditorSidebarOpened, isEditingPage, enableComplementaryArea]);
|
|
66
67
|
let sidebarName = sidebar;
|
|
67
68
|
if (!isEditorSidebarOpened) {
|
|
68
69
|
sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;
|
|
@@ -76,7 +77,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
76
77
|
sidebarName: sidebarName
|
|
77
78
|
}),
|
|
78
79
|
headerClassName: "edit-site-sidebar-edit-mode__panel-tabs"
|
|
79
|
-
}, sidebarName === SIDEBAR_TEMPLATE && createElement(Fragment, null,
|
|
80
|
+
}, sidebarName === SIDEBAR_TEMPLATE && createElement(Fragment, null, isEditingPage ? createElement(PagePanels, null) : createElement(TemplatePanel, null), createElement(PluginTemplateSettingPanel.Slot, null)), sidebarName === SIDEBAR_BLOCK && createElement(InspectorSlot, {
|
|
80
81
|
bubblesVirtually: true
|
|
81
82
|
})), supportsGlobalStyles && createElement(GlobalStylesSidebar, null));
|
|
82
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createSlotFill","isRTL","__","drawerLeft","drawerRight","useEffect","useSelect","useDispatch","store","interfaceStore","blockEditorStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","PagePanels","TemplatePanel","PluginTemplateSettingPanel","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","
|
|
1
|
+
{"version":3,"names":["createSlotFill","isRTL","__","drawerLeft","drawerRight","useEffect","useSelect","useDispatch","store","interfaceStore","blockEditorStore","editorStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","PagePanels","TemplatePanel","PluginTemplateSettingPanel","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","isEditingPage","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","settings","getSettings","getBlockSelectionStart","supportsTemplatePartsMode","isPage","getRenderingMode","enableComplementaryArea","sidebarName","createElement","Fragment","identifier","title","icon","closeLabel","header","headerClassName","bubblesVirtually"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t\tisEditingPage,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles: ! settings?.supportsTemplatePartsMode,\n\t\t\tisEditingPage:\n\t\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\t\tselect( editorStore ).getRenderingMode() !== 'template-only',\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Don't automatically switch tab when the sidebar is closed or when we\n\t\t// are focused on page content.\n\t\tif ( ! isEditorSidebarOpened ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\tif ( ! isEditingPage ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t}\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisEditorSidebarOpened,\n\t\tisEditingPage,\n\t\tenableComplementaryArea,\n\t] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,uBAAuB;AACtD,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC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