@wordpress/edit-site 6.2.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-pattern/index.js +8 -2
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/{add-new-page → add-new-post}/index.js +21 -17
- package/build/components/add-new-post/index.js.map +1 -0
- package/build/components/add-new-template/index.js +3 -1
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +6 -85
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +21 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +0 -5
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +14 -5
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +42 -23
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +4 -4
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +60 -12
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +39 -0
- package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
- package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +39 -0
- package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-size-preview.js +44 -0
- package/build/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-size.js +213 -0
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-sizes-count.js +50 -0
- package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-sizes.js +163 -0
- package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -0
- package/build/components/global-styles/font-sizes/rename-font-size-dialog.js +67 -0
- package/build/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
- package/build/components/global-styles/hooks.js +0 -40
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +47 -0
- package/build/components/global-styles/preview-typography.js.map +1 -0
- package/build/components/global-styles/screen-block.js +17 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +5 -1
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -2
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +3 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -2
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/size-control/index.js +85 -0
- package/build/components/global-styles/size-control/index.js.map +1 -0
- package/build/components/global-styles/style-variations-container.js +8 -5
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +0 -2
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/ui.js +8 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +4 -4
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +4 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +15 -29
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -2
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +22 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +30 -43
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/header.js +1 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +65 -49
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +29 -4
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +22 -55
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +56 -50
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +4 -4
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/post-edit/index.js +105 -0
- package/build/components/post-edit/index.js.map +1 -0
- package/build/components/post-fields/index.js +314 -0
- package/build/components/post-fields/index.js.map +1 -0
- package/build/components/post-list/index.js +281 -0
- package/build/components/post-list/index.js.map +1 -0
- package/build/components/posts-app/index.js +11 -17
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app/router.js +85 -0
- package/build/components/posts-app/router.js.map +1 -0
- package/build/components/revisions/index.js +10 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +1 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +119 -93
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +44 -2
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/content.js +64 -0
- package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js +2 -47
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/site-hub/index.js +81 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +10 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +57 -2
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +7 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +34 -6
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-filtered-template-parts.js +64 -0
- package/build/utils/get-filtered-template-parts.js.map +1 -0
- package/build-module/components/add-new-pattern/index.js +8 -2
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/{add-new-page → add-new-post}/index.js +21 -17
- package/build-module/components/add-new-post/index.js.map +1 -0
- package/build-module/components/add-new-template/index.js +3 -1
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +6 -85
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +21 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +0 -5
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +14 -5
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +44 -25
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +4 -4
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +63 -15
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +32 -0
- package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +32 -0
- package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-size-preview.js +37 -0
- package/build-module/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-size.js +207 -0
- package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js +43 -0
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-sizes.js +157 -0
- package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js +61 -0
- package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +0 -38
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +39 -0
- package/build-module/components/global-styles/preview-typography.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +18 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +5 -1
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -2
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/size-control/index.js +79 -0
- package/build-module/components/global-styles/size-control/index.js.map +1 -0
- package/build-module/components/global-styles/style-variations-container.js +9 -6
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +0 -2
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/ui.js +8 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +5 -5
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +5 -4
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +16 -30
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +20 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +30 -43
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/header.js +1 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +66 -50
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +28 -4
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -56
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +58 -53
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +4 -4
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +98 -0
- package/build-module/components/post-edit/index.js.map +1 -0
- package/build-module/components/post-fields/index.js +306 -0
- package/build-module/components/post-fields/index.js.map +1 -0
- package/build-module/components/post-list/index.js +275 -0
- package/build-module/components/post-list/index.js.map +1 -0
- package/build-module/components/posts-app/index.js +11 -17
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app/router.js +77 -0
- package/build-module/components/posts-app/router.js.map +1 -0
- package/build-module/components/revisions/index.js +10 -7
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +1 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +117 -92
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +47 -5
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js +57 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +2 -47
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/site-hub/index.js +81 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +11 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +57 -2
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +7 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +35 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-filtered-template-parts.js +57 -0
- package/build-module/utils/get-filtered-template-parts.js.map +1 -0
- package/build-style/posts-rtl.css +668 -510
- package/build-style/posts.css +668 -510
- package/build-style/style-rtl.css +772 -702
- package/build-style/style.css +772 -702
- package/package.json +41 -41
- package/src/components/add-new-pattern/index.js +8 -2
- package/src/components/{add-new-page → add-new-post}/index.js +28 -22
- package/src/components/add-new-template/index.js +4 -1
- package/src/components/add-new-template/style.scss +4 -6
- package/src/components/block-editor/use-site-editor-settings.js +10 -101
- package/src/components/editor/index.js +21 -5
- package/src/components/global-styles/background-panel.js +0 -8
- package/src/components/global-styles/block-preview-panel.js +22 -9
- package/src/components/global-styles/font-families.js +66 -31
- package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
- package/src/components/global-styles/font-library-modal/index.js +4 -2
- package/src/components/global-styles/font-library-modal/installed-fonts.js +94 -13
- package/src/components/global-styles/font-library-modal/style.scss +26 -10
- package/src/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +43 -0
- package/src/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +37 -0
- package/src/components/global-styles/font-sizes/font-size-preview.js +43 -0
- package/src/components/global-styles/font-sizes/font-size.js +250 -0
- package/src/components/global-styles/font-sizes/font-sizes-count.js +40 -0
- package/src/components/global-styles/font-sizes/font-sizes.js +263 -0
- package/src/components/global-styles/font-sizes/rename-font-size-dialog.js +70 -0
- package/src/components/global-styles/hooks.js +0 -41
- package/src/components/global-styles/preview-typography.js +39 -0
- package/src/components/global-styles/screen-block.js +20 -0
- package/src/components/global-styles/screen-layout.js +5 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +2 -2
- package/src/components/global-styles/screen-typography.js +3 -2
- package/src/components/global-styles/shadows-edit-panel.js +1 -2
- package/src/components/global-styles/size-control/index.js +86 -0
- package/src/components/global-styles/style-variations-container.js +14 -7
- package/src/components/global-styles/style.scss +13 -3
- package/src/components/global-styles/typography-elements.js +0 -4
- package/src/components/global-styles/ui.js +10 -0
- package/src/components/global-styles/variations/variation.js +5 -5
- package/src/components/global-styles/variations/variations-color.js +6 -4
- package/src/components/global-styles/variations/variations-typography.js +15 -33
- package/src/components/global-styles-sidebar/index.js +2 -2
- package/src/components/layout/index.js +24 -4
- package/src/components/layout/router.js +29 -37
- package/src/components/layout/style.scss +38 -8
- package/src/components/page-patterns/header.js +1 -1
- package/src/components/page-patterns/index.js +62 -64
- package/src/components/page-patterns/search-items.js +37 -3
- package/src/components/page-patterns/style.scss +1 -8
- package/src/components/page-patterns/use-patterns.js +43 -82
- package/src/components/page-templates/index.js +67 -64
- package/src/components/page-templates/style.scss +6 -9
- package/src/components/pagination/index.js +4 -4
- package/src/components/post-edit/index.js +96 -0
- package/src/components/post-edit/style.scss +9 -0
- package/src/components/post-fields/index.js +345 -0
- package/src/components/post-list/index.js +326 -0
- package/src/components/{page-pages → post-list}/style.scss +25 -8
- package/src/components/posts-app/index.js +9 -11
- package/src/components/posts-app/router.js +69 -0
- package/src/components/revisions/index.js +9 -1
- package/src/components/save-panel/index.js +1 -1
- package/src/components/sidebar/style.scss +6 -0
- package/src/components/sidebar-dataviews/add-new-view.js +2 -1
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/src/components/sidebar-dataviews/default-views.js +131 -106
- package/src/components/sidebar-dataviews/index.js +39 -4
- package/src/components/sidebar-navigation-screen-global-styles/content.js +55 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -54
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
- package/src/components/site-hub/index.js +84 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
- package/src/hooks/push-changes-to-global-styles/index.js +2 -2
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
- package/src/index.js +14 -1
- package/src/posts.js +63 -2
- package/src/posts.scss +9 -0
- package/src/store/private-actions.js +7 -3
- package/src/store/selectors.js +53 -14
- package/src/store/test/selectors.js +1 -26
- package/src/style.scss +2 -2
- package/src/utils/get-filtered-template-parts.js +61 -0
- package/src/utils/test/get-filtered-template-parts.js +127 -0
- package/build/components/add-new-page/index.js.map +0 -1
- package/build/components/global-styles/screen-background.js +0 -36
- package/build/components/global-styles/screen-background.js.map +0 -1
- package/build/components/page-pages/index.js +0 -473
- package/build/components/page-pages/index.js.map +0 -1
- package/build/components/table/index.js +0 -35
- package/build/components/table/index.js.map +0 -1
- package/build-module/components/add-new-page/index.js.map +0 -1
- package/build-module/components/global-styles/screen-background.js +0 -30
- package/build-module/components/global-styles/screen-background.js.map +0 -1
- package/build-module/components/page-pages/index.js +0 -465
- package/build-module/components/page-pages/index.js.map +0 -1
- package/build-module/components/table/index.js +0 -30
- package/build-module/components/table/index.js.map +0 -1
- package/src/components/global-styles/screen-background.js +0 -29
- package/src/components/page-pages/index.js +0 -564
- package/src/components/table/index.js +0 -33
- package/src/components/table/style.scss +0 -38
|
@@ -3,25 +3,42 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { trash, pages, drafts, published, scheduled, pending, notAllowed } from '@wordpress/icons';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { useMemo } from '@wordpress/element';
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* Internal dependencies
|
|
9
12
|
*/
|
|
10
13
|
import { LAYOUT_LIST, LAYOUT_TABLE, LAYOUT_GRID, OPERATOR_IS_ANY } from '../../utils/constants';
|
|
11
|
-
export const
|
|
14
|
+
export const defaultLayouts = {
|
|
12
15
|
[LAYOUT_TABLE]: {
|
|
13
|
-
|
|
16
|
+
layout: {
|
|
17
|
+
primaryField: 'title',
|
|
18
|
+
styles: {
|
|
19
|
+
'featured-image': {
|
|
20
|
+
width: '1%'
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
maxWidth: 300
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
14
27
|
},
|
|
15
28
|
[LAYOUT_GRID]: {
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
layout: {
|
|
30
|
+
mediaField: 'featured-image',
|
|
31
|
+
primaryField: 'title'
|
|
32
|
+
}
|
|
18
33
|
},
|
|
19
34
|
[LAYOUT_LIST]: {
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
layout: {
|
|
36
|
+
primaryField: 'title',
|
|
37
|
+
mediaField: 'featured-image'
|
|
38
|
+
}
|
|
22
39
|
}
|
|
23
40
|
};
|
|
24
|
-
const
|
|
41
|
+
const DEFAULT_POST_BASE = {
|
|
25
42
|
type: LAYOUT_LIST,
|
|
26
43
|
search: '',
|
|
27
44
|
filters: [],
|
|
@@ -31,91 +48,99 @@ const DEFAULT_PAGE_BASE = {
|
|
|
31
48
|
field: 'date',
|
|
32
49
|
direction: 'desc'
|
|
33
50
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
hiddenFields: ['date', 'featured-image'],
|
|
37
|
-
layout: {
|
|
38
|
-
...DEFAULT_CONFIG_PER_VIEW_TYPE[LAYOUT_LIST]
|
|
39
|
-
}
|
|
51
|
+
fields: ['title', 'author', 'status'],
|
|
52
|
+
layout: defaultLayouts[LAYOUT_LIST].layout
|
|
40
53
|
};
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
54
|
+
export function useDefaultViews({
|
|
55
|
+
postType
|
|
56
|
+
}) {
|
|
57
|
+
const labels = useSelect(select => {
|
|
58
|
+
const {
|
|
59
|
+
getPostType
|
|
60
|
+
} = select(coreStore);
|
|
61
|
+
return getPostType(postType)?.labels;
|
|
62
|
+
}, [postType]);
|
|
63
|
+
return useMemo(() => {
|
|
64
|
+
return {
|
|
65
|
+
[postType]: [{
|
|
66
|
+
title: labels?.all_items || __('All items'),
|
|
67
|
+
slug: 'all',
|
|
68
|
+
icon: pages,
|
|
69
|
+
view: DEFAULT_POST_BASE
|
|
70
|
+
}, {
|
|
71
|
+
title: __('Published'),
|
|
72
|
+
slug: 'published',
|
|
73
|
+
icon: published,
|
|
74
|
+
view: {
|
|
75
|
+
...DEFAULT_POST_BASE,
|
|
76
|
+
filters: [{
|
|
77
|
+
field: 'status',
|
|
78
|
+
operator: OPERATOR_IS_ANY,
|
|
79
|
+
value: 'publish'
|
|
80
|
+
}]
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
title: __('Scheduled'),
|
|
84
|
+
slug: 'future',
|
|
85
|
+
icon: scheduled,
|
|
86
|
+
view: {
|
|
87
|
+
...DEFAULT_POST_BASE,
|
|
88
|
+
filters: [{
|
|
89
|
+
field: 'status',
|
|
90
|
+
operator: OPERATOR_IS_ANY,
|
|
91
|
+
value: 'future'
|
|
92
|
+
}]
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
title: __('Drafts'),
|
|
96
|
+
slug: 'drafts',
|
|
97
|
+
icon: drafts,
|
|
98
|
+
view: {
|
|
99
|
+
...DEFAULT_POST_BASE,
|
|
100
|
+
filters: [{
|
|
101
|
+
field: 'status',
|
|
102
|
+
operator: OPERATOR_IS_ANY,
|
|
103
|
+
value: 'draft'
|
|
104
|
+
}]
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
title: __('Pending'),
|
|
108
|
+
slug: 'pending',
|
|
109
|
+
icon: pending,
|
|
110
|
+
view: {
|
|
111
|
+
...DEFAULT_POST_BASE,
|
|
112
|
+
filters: [{
|
|
113
|
+
field: 'status',
|
|
114
|
+
operator: OPERATOR_IS_ANY,
|
|
115
|
+
value: 'pending'
|
|
116
|
+
}]
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
title: __('Private'),
|
|
120
|
+
slug: 'private',
|
|
121
|
+
icon: notAllowed,
|
|
122
|
+
view: {
|
|
123
|
+
...DEFAULT_POST_BASE,
|
|
124
|
+
filters: [{
|
|
125
|
+
field: 'status',
|
|
126
|
+
operator: OPERATOR_IS_ANY,
|
|
127
|
+
value: 'private'
|
|
128
|
+
}]
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
title: __('Trash'),
|
|
132
|
+
slug: 'trash',
|
|
133
|
+
icon: trash,
|
|
134
|
+
view: {
|
|
135
|
+
...DEFAULT_POST_BASE,
|
|
136
|
+
filters: [{
|
|
137
|
+
field: 'status',
|
|
138
|
+
operator: OPERATOR_IS_ANY,
|
|
139
|
+
value: 'trash'
|
|
140
|
+
}]
|
|
141
|
+
}
|
|
81
142
|
}]
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
slug: 'pending',
|
|
86
|
-
icon: pending,
|
|
87
|
-
view: {
|
|
88
|
-
...DEFAULT_PAGE_BASE,
|
|
89
|
-
filters: [{
|
|
90
|
-
field: 'status',
|
|
91
|
-
operator: OPERATOR_IS_ANY,
|
|
92
|
-
value: 'pending'
|
|
93
|
-
}]
|
|
94
|
-
}
|
|
95
|
-
}, {
|
|
96
|
-
title: __('Private'),
|
|
97
|
-
slug: 'private',
|
|
98
|
-
icon: notAllowed,
|
|
99
|
-
view: {
|
|
100
|
-
...DEFAULT_PAGE_BASE,
|
|
101
|
-
filters: [{
|
|
102
|
-
field: 'status',
|
|
103
|
-
operator: OPERATOR_IS_ANY,
|
|
104
|
-
value: 'private'
|
|
105
|
-
}]
|
|
106
|
-
}
|
|
107
|
-
}, {
|
|
108
|
-
title: __('Trash'),
|
|
109
|
-
slug: 'trash',
|
|
110
|
-
icon: trash,
|
|
111
|
-
view: {
|
|
112
|
-
...DEFAULT_PAGE_BASE,
|
|
113
|
-
filters: [{
|
|
114
|
-
field: 'status',
|
|
115
|
-
operator: OPERATOR_IS_ANY,
|
|
116
|
-
value: 'trash'
|
|
117
|
-
}]
|
|
118
|
-
}
|
|
119
|
-
}]
|
|
120
|
-
};
|
|
143
|
+
};
|
|
144
|
+
}, [labels, postType]);
|
|
145
|
+
}
|
|
121
146
|
//# sourceMappingURL=default-views.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","trash","pages","drafts","published","scheduled","pending","notAllowed","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","
|
|
1
|
+
{"version":3,"names":["__","trash","pages","drafts","published","scheduled","pending","notAllowed","useSelect","store","coreStore","useMemo","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","defaultLayouts","layout","primaryField","styles","width","title","maxWidth","mediaField","DEFAULT_POST_BASE","type","search","filters","page","perPage","sort","field","direction","fields","useDefaultViews","postType","labels","select","getPostType","all_items","slug","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tstyles: {\n\t\t\t\t'featured-image': {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t\ttitle: {\n\t\t\t\t\tmaxWidth: 300,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tmediaField: 'featured-image',\n\t\t\tprimaryField: 'title',\n\t\t},\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tmediaField: 'featured-image',\n\t\t},\n\t},\n};\n\nconst DEFAULT_POST_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\tfields: [ 'title', 'author', 'status' ],\n\tlayout: defaultLayouts[ LAYOUT_LIST ].layout,\n};\n\nexport function useDefaultViews( { postType } ) {\n\tconst labels = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn getPostType( postType )?.labels;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn {\n\t\t\t[ postType ]: [\n\t\t\t\t{\n\t\t\t\t\ttitle: labels?.all_items || __( 'All items' ),\n\t\t\t\t\tslug: 'all',\n\t\t\t\t\ticon: pages,\n\t\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Published' ),\n\t\t\t\t\tslug: 'published',\n\t\t\t\t\ticon: published,\n\t\t\t\t\tview: {\n\t\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: 'publish',\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{\n\t\t\t\t\ttitle: __( 'Scheduled' ),\n\t\t\t\t\tslug: 'future',\n\t\t\t\t\ticon: scheduled,\n\t\t\t\t\tview: {\n\t\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: 'future',\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{\n\t\t\t\t\ttitle: __( 'Drafts' ),\n\t\t\t\t\tslug: 'drafts',\n\t\t\t\t\ticon: drafts,\n\t\t\t\t\tview: {\n\t\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: 'draft',\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{\n\t\t\t\t\ttitle: __( 'Pending' ),\n\t\t\t\t\tslug: 'pending',\n\t\t\t\t\ticon: pending,\n\t\t\t\t\tview: {\n\t\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: 'pending',\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{\n\t\t\t\t\ttitle: __( 'Private' ),\n\t\t\t\t\tslug: 'private',\n\t\t\t\t\ticon: notAllowed,\n\t\t\t\t\tview: {\n\t\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: 'private',\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{\n\t\t\t\t\ttitle: __( 'Trash' ),\n\t\t\t\t\tslug: 'trash',\n\t\t\t\t\ticon: trash,\n\t\t\t\t\tview: {\n\t\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t\t\t},\n\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EAAE,QAAQ;YACfY,QAAQ,EAAE5B,eAAe;YACzB6B,KAAK,EAAE;UACR,CAAC;QAEH;MACD,CAAC,EACD;QACCvB,KAAK,EAAErB,EAAE,CAAE,SAAU,CAAC;QACtBwC,IAAI,EAAE,SAAS;QACfC,IAAI,EAAEnC,OAAO;QACboC,IAAI,EAAE;UACL,GAAGlB,iBAAiB;UACpBG,OAAO,EAAE,CACR;YACCI,KAAK,EAAE,QAAQ;YACfY,QAAQ,EAAE5B,eAAe;YACzB6B,KAAK,EAAE;UACR,CAAC;QAEH;MACD,CAAC,EACD;QACCvB,KAAK,EAAErB,EAAE,CAAE,SAAU,CAAC;QACtBwC,IAAI,EAAE,SAAS;QACfC,IAAI,EAAElC,UAAU;QAChBmC,IAAI,EAAE;UACL,GAAGlB,iBAAiB;UACpBG,OAAO,EAAE,CACR;YACCI,KAAK,EAAE,QAAQ;YACfY,QAAQ,EAAE5B,eAAe;YACzB6B,KAAK,EAAE;UACR,CAAC;QAEH;MACD,CAAC,EACD;QACCvB,KAAK,EAAErB,EAAE,CAAE,OAAQ,CAAC;QACpBwC,IAAI,EAAE,OAAO;QACbC,IAAI,EAAExC,KAAK;QACXyC,IAAI,EAAE;UACL,GAAGlB,iBAAiB;UACpBG,OAAO,EAAE,CACR;YACCI,KAAK,EAAE,QAAQ;YACfY,QAAQ,EAAE5B,eAAe;YACzB6B,KAAK,EAAE;UACR,CAAC;QAEH;MACD,CAAC;IAEH,CAAC;EACF,CAAC,EAAE,CAAER,MAAM,EAAED,QAAQ,CAAG,CAAC;AAC1B","ignoreList":[]}
|
|
@@ -3,20 +3,58 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
5
5
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
import { useRef, useEffect } from '@wordpress/element';
|
|
7
|
+
import { usePrevious } from '@wordpress/compose';
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* Internal dependencies
|
|
8
11
|
*/
|
|
9
|
-
|
|
10
|
-
import { DEFAULT_VIEWS } from './default-views';
|
|
12
|
+
import { useDefaultViews } from './default-views';
|
|
11
13
|
import { unlock } from '../../lock-unlock';
|
|
12
|
-
const {
|
|
13
|
-
useLocation
|
|
14
|
-
} = unlock(routerPrivateApis);
|
|
15
14
|
import DataViewItem from './dataview-item';
|
|
16
15
|
import CustomDataViewsList from './custom-dataviews-list';
|
|
17
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
const {
|
|
20
|
+
useLocation,
|
|
21
|
+
useHistory
|
|
22
|
+
} = unlock(routerPrivateApis);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Hook to switch to table layout when switching to the trash view.
|
|
26
|
+
* When going out of the trash view, it switches back to the previous layout if
|
|
27
|
+
* there was an automatic switch to table layout.
|
|
28
|
+
*/
|
|
29
|
+
function useSwitchToTableOnTrash() {
|
|
30
|
+
const {
|
|
31
|
+
params: {
|
|
32
|
+
activeView,
|
|
33
|
+
layout,
|
|
34
|
+
...restParams
|
|
35
|
+
}
|
|
36
|
+
} = useLocation();
|
|
37
|
+
const history = useHistory();
|
|
38
|
+
const viewToSwitchOutOfTrash = useRef(undefined);
|
|
39
|
+
const previousActiveView = usePrevious(activeView);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (activeView === 'trash' && previousActiveView !== 'trash') {
|
|
42
|
+
viewToSwitchOutOfTrash.current = layout || 'list';
|
|
43
|
+
history.push({
|
|
44
|
+
...restParams,
|
|
45
|
+
layout: 'table',
|
|
46
|
+
activeView
|
|
47
|
+
});
|
|
48
|
+
} else if (previousActiveView === 'trash' && activeView !== 'trash' && viewToSwitchOutOfTrash.current) {
|
|
49
|
+
history.push({
|
|
50
|
+
...restParams,
|
|
51
|
+
layout: viewToSwitchOutOfTrash.current,
|
|
52
|
+
activeView
|
|
53
|
+
});
|
|
54
|
+
viewToSwitchOutOfTrash.current = undefined;
|
|
55
|
+
}
|
|
56
|
+
}, [previousActiveView, activeView, layout, history, restParams]);
|
|
57
|
+
}
|
|
20
58
|
export default function DataViewsSidebarContent() {
|
|
21
59
|
const {
|
|
22
60
|
params: {
|
|
@@ -25,6 +63,10 @@ export default function DataViewsSidebarContent() {
|
|
|
25
63
|
isCustom = 'false'
|
|
26
64
|
}
|
|
27
65
|
} = useLocation();
|
|
66
|
+
useSwitchToTableOnTrash();
|
|
67
|
+
const DEFAULT_VIEWS = useDefaultViews({
|
|
68
|
+
postType
|
|
69
|
+
});
|
|
28
70
|
if (!postType) {
|
|
29
71
|
return null;
|
|
30
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalItemGroup","ItemGroup","privateApis","routerPrivateApis","
|
|
1
|
+
{"version":3,"names":["__experimentalItemGroup","ItemGroup","privateApis","routerPrivateApis","useRef","useEffect","usePrevious","useDefaultViews","unlock","DataViewItem","CustomDataViewsList","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLocation","useHistory","useSwitchToTableOnTrash","params","activeView","layout","restParams","history","viewToSwitchOutOfTrash","undefined","previousActiveView","current","push","DataViewsSidebarContent","postType","isCustom","DEFAULT_VIEWS","isCustomBoolean","children","map","dataview","slug","title","icon","type","view","isActive","window","__experimentalCustomViews"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useDefaultViews } from './default-views';\nimport { unlock } from '../../lock-unlock';\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\n/**\n * Hook to switch to table layout when switching to the trash view.\n * When going out of the trash view, it switches back to the previous layout if\n * there was an automatic switch to table layout.\n */\nfunction useSwitchToTableOnTrash() {\n\tconst {\n\t\tparams: { activeView, layout, ...restParams },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst viewToSwitchOutOfTrash = useRef( undefined );\n\tconst previousActiveView = usePrevious( activeView );\n\tuseEffect( () => {\n\t\tif ( activeView === 'trash' && previousActiveView !== 'trash' ) {\n\t\t\tviewToSwitchOutOfTrash.current = layout || 'list';\n\t\t\thistory.push( { ...restParams, layout: 'table', activeView } );\n\t\t} else if (\n\t\t\tpreviousActiveView === 'trash' &&\n\t\t\tactiveView !== 'trash' &&\n\t\t\tviewToSwitchOutOfTrash.current\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...restParams,\n\t\t\t\tlayout: viewToSwitchOutOfTrash.current,\n\t\t\t\tactiveView,\n\t\t\t} );\n\t\t\tviewToSwitchOutOfTrash.current = undefined;\n\t\t}\n\t}, [ previousActiveView, activeView, layout, history, restParams ] );\n}\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { postType, activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tuseSwitchToTableOnTrash();\n\tconst DEFAULT_VIEWS = useDefaultViews( { postType } );\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\tconst isCustomBoolean = isCustom === 'true';\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ DEFAULT_VIEWS[ postType ].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\t! isCustomBoolean &&\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{ window?.__experimentalCustomViews && (\n\t\t\t\t<CustomDataViewsList\n\t\t\t\t\tactiveView={ activeView }\n\t\t\t\t\ttype={ postType }\n\t\t\t\t\tisCustom\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,mBAAmB,MAAM,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE1D,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGV,MAAM,CAAEL,iBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA,SAASgB,uBAAuBA,CAAA,EAAG;EAClC,MAAM;IACLC,MAAM,EAAE;MAAEC,UAAU;MAAEC,MAAM;MAAE,GAAGC;IAAW;EAC7C,CAAC,GAAGN,WAAW,CAAC,CAAC;EACjB,MAAMO,OAAO,GAAGN,UAAU,CAAC,CAAC;EAC5B,MAAMO,sBAAsB,GAAGrB,MAAM,CAAEsB,SAAU,CAAC;EAClD,MAAMC,kBAAkB,GAAGrB,WAAW,CAAEe,UAAW,CAAC;EACpDhB,SAAS,CAAE,MAAM;IA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IAAI,EAAGH,QAAQ,CAACG,IAAM;UACtBC,IAAI,EAAGJ,QAAQ,CAACK,IAAI,CAACD,IAAM;UAC3BE,QAAQ,EACP,CAAET,eAAe,IACjBG,QAAQ,CAACC,IAAI,KAAKjB,UAClB;UACDW,QAAQ,EAAG;QAAO,GATZK,QAAQ,CAACC,IAUf,CAAC;MAEJ,CAAE;IAAC,CACO,CAAC,EACVM,MAAM,EAAEC,yBAAyB,iBAClCjC,IAAA,CAACF,mBAAmB;MACnBW,UAAU,EAAGA,UAAY;MACzBoB,IAAI,EAAGV,QAAU;MACjBC,QAAQ;IAAA,CACR,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
|
+
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import StyleVariationsContainer from '../global-styles/style-variations-container';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
import ColorVariations from '../global-styles/variations/variations-color';
|
|
16
|
+
import TypographyVariations from '../global-styles/variations/variations-typography';
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
const noop = () => {};
|
|
20
|
+
export default function SidebarNavigationScreenGlobalStylesContent() {
|
|
21
|
+
const {
|
|
22
|
+
storedSettings
|
|
23
|
+
} = useSelect(select => {
|
|
24
|
+
const {
|
|
25
|
+
getSettings
|
|
26
|
+
} = unlock(select(editSiteStore));
|
|
27
|
+
return {
|
|
28
|
+
storedSettings: getSettings()
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
const gap = 3;
|
|
32
|
+
|
|
33
|
+
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
|
|
34
|
+
// loaded. This is necessary because the Iframe component waits until
|
|
35
|
+
// the block editor store's `__internalIsInitialized` is true before
|
|
36
|
+
// rendering the iframe. Without this, the iframe previews will not render
|
|
37
|
+
// in mobile viewport sizes, where the editor canvas is hidden.
|
|
38
|
+
return /*#__PURE__*/_jsx(BlockEditorProvider, {
|
|
39
|
+
settings: storedSettings,
|
|
40
|
+
onChange: noop,
|
|
41
|
+
onInput: noop,
|
|
42
|
+
children: /*#__PURE__*/_jsxs(VStack, {
|
|
43
|
+
spacing: 10,
|
|
44
|
+
className: "edit-site-global-styles-variation-container",
|
|
45
|
+
children: [/*#__PURE__*/_jsx(StyleVariationsContainer, {
|
|
46
|
+
gap: gap
|
|
47
|
+
}), /*#__PURE__*/_jsx(ColorVariations, {
|
|
48
|
+
title: __('Palettes'),
|
|
49
|
+
gap: gap
|
|
50
|
+
}), /*#__PURE__*/_jsx(TypographyVariations, {
|
|
51
|
+
title: __('Typography'),
|
|
52
|
+
gap: gap
|
|
53
|
+
})]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","useSelect","__experimentalVStack","VStack","BlockEditorProvider","StyleVariationsContainer","unlock","store","editSiteStore","ColorVariations","TypographyVariations","jsx","_jsx","jsxs","_jsxs","noop","SidebarNavigationScreenGlobalStylesContent","storedSettings","select","getSettings","gap","settings","onChange","onInput","children","spacing","className","title"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport ColorVariations from '../global-styles/variations/variations-color';\nimport TypographyVariations from '../global-styles/variations/variations-typography';\n\nconst noop = () => {};\n\nexport default function 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\tconst gap = 3;\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<VStack\n\t\t\t\tspacing={ 10 }\n\t\t\t\tclassName=\"edit-site-global-styles-variation-container\"\n\t\t\t>\n\t\t\t\t<StyleVariationsContainer gap={ gap } />\n\t\t\t\t<ColorVariations title={ __( 'Palettes' ) } gap={ gap } />\n\t\t\t\t<TypographyVariations\n\t\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</BlockEditorProvider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,mBAAmB,QAAQ,yBAAyB;;AAE7D;AACA;AACA;AACA,OAAOC,wBAAwB,MAAM,6CAA6C;AAClF,SAASC,MAAM,QAAQ,mBAAmB;AAC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Dispatch } from '@wordpress/data';
|
|
7
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
9
8
|
import { useViewportMatch } from '@wordpress/compose';
|
|
10
|
-
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
11
9
|
import { useCallback } from '@wordpress/element';
|
|
12
10
|
import { store as editorStore } from '@wordpress/editor';
|
|
13
11
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
@@ -16,7 +14,6 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
16
14
|
* Internal dependencies
|
|
17
15
|
*/
|
|
18
16
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
19
|
-
import StyleVariationsContainer from '../global-styles/style-variations-container';
|
|
20
17
|
import { unlock } from '../../lock-unlock';
|
|
21
18
|
import { store as editSiteStore } from '../../store';
|
|
22
19
|
import SidebarButton from '../sidebar-button';
|
|
@@ -24,13 +21,10 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
24
21
|
import StyleBook from '../style-book';
|
|
25
22
|
import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
|
|
26
23
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
27
|
-
import
|
|
28
|
-
import TypographyVariations from '../global-styles/variations/variations-typography';
|
|
29
|
-
import { useColorVariations, useTypographyVariations } from '../global-styles/hooks';
|
|
24
|
+
import SidebarNavigationScreenGlobalStylesContent from './content';
|
|
30
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
26
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
|
-
|
|
27
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
34
28
|
export function SidebarNavigationItemGlobalStyles(props) {
|
|
35
29
|
const {
|
|
36
30
|
openGeneralSidebar
|
|
@@ -58,45 +52,6 @@ export function SidebarNavigationItemGlobalStyles(props) {
|
|
|
58
52
|
}
|
|
59
53
|
});
|
|
60
54
|
}
|
|
61
|
-
function SidebarNavigationScreenGlobalStylesContent() {
|
|
62
|
-
const {
|
|
63
|
-
storedSettings
|
|
64
|
-
} = useSelect(select => {
|
|
65
|
-
const {
|
|
66
|
-
getSettings
|
|
67
|
-
} = unlock(select(editSiteStore));
|
|
68
|
-
return {
|
|
69
|
-
storedSettings: getSettings()
|
|
70
|
-
};
|
|
71
|
-
}, []);
|
|
72
|
-
const colorVariations = useColorVariations();
|
|
73
|
-
const typographyVariations = useTypographyVariations();
|
|
74
|
-
const gap = 3;
|
|
75
|
-
|
|
76
|
-
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
|
|
77
|
-
// loaded. This is necessary because the Iframe component waits until
|
|
78
|
-
// the block editor store's `__internalIsInitialized` is true before
|
|
79
|
-
// rendering the iframe. Without this, the iframe previews will not render
|
|
80
|
-
// in mobile viewport sizes, where the editor canvas is hidden.
|
|
81
|
-
return /*#__PURE__*/_jsx(BlockEditorProvider, {
|
|
82
|
-
settings: storedSettings,
|
|
83
|
-
onChange: noop,
|
|
84
|
-
onInput: noop,
|
|
85
|
-
children: /*#__PURE__*/_jsxs(VStack, {
|
|
86
|
-
spacing: 10,
|
|
87
|
-
className: "edit-site-global-styles-variation-container",
|
|
88
|
-
children: [/*#__PURE__*/_jsx(StyleVariationsContainer, {
|
|
89
|
-
gap: gap
|
|
90
|
-
}), colorVariations?.length && /*#__PURE__*/_jsx(ColorVariations, {
|
|
91
|
-
title: __('Palettes'),
|
|
92
|
-
gap: gap
|
|
93
|
-
}), typographyVariations?.length && /*#__PURE__*/_jsx(TypographyVariations, {
|
|
94
|
-
title: __('Typography'),
|
|
95
|
-
gap: gap
|
|
96
|
-
})]
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
55
|
export default function SidebarNavigationScreenGlobalStyles({
|
|
101
56
|
backPath
|
|
102
57
|
}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalVStack","VStack","useViewportMatch","BlockEditorProvider","useCallback","editorStore","preferencesStore","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","ColorVariations","TypographyVariations","useColorVariations","useTypographyVariations","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","params","path","uid","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","colorVariations","typographyVariations","gap","settings","onChange","onInput","children","spacing","className","title","SidebarNavigationScreenGlobalStyles","backPath","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","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 { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\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';\nimport ColorVariations from '../global-styles/variations/variations-color';\nimport TypographyVariations from '../global-styles/variations/variations-typography';\nimport {\n\tuseColorVariations,\n\tuseTypographyVariations,\n} from '../global-styles/hooks';\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<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\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\tconst colorVariations = useColorVariations();\n\tconst typographyVariations = useTypographyVariations();\n\tconst gap = 3;\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<VStack\n\t\t\t\tspacing={ 10 }\n\t\t\t\tclassName=\"edit-site-global-styles-variation-container\"\n\t\t\t>\n\t\t\t\t<StyleVariationsContainer gap={ gap } />\n\t\t\t\t{ colorVariations?.length && (\n\t\t\t\t\t<ColorVariations title={ __( 'Palettes' ) } gap={ gap } />\n\t\t\t\t) }\n\t\t\t\t{ typographyVariations?.length && (\n\t\t\t\t\t<TypographyVariations\n\t\t\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\t\t\tgap={ gap }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles( { backPath } ) {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\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\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\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\tbackPath={ backPath }\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,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASN,KAAK,IAAIO,WAAW,QAAQ,mBAAmB;AACxD,SAASP,KAAK,IAAIQ,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,wBAAwB,MAAM,6CAA6C;AAClF,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASX,KAAK,IAAIY,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;AAC9F,OAAOC,eAAe,MAAM,8CAA8C;AAC1E,OAAOC,oBAAoB,MAAM,mDAAmD;AACpF,SACCC,kBAAkB,EAClBC,uBAAuB,QACjB,wBAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,I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,MAAMqC,gBAAgB,CAAC;QAAG,CAChD,CAAC;MAAA,CACD;IACF,CACD,CAAC,EACAd,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,iBACtDvC,IAAA,CAACR,SAAS;MACT+E,cAAc,EAAG,KAAO;MACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;MAC1BvD,OAAO,EAAGwC,aAAe;MACzBgB,QAAQ,EAAGhB,aAAe;MAC1BiB,eAAe,EAAG,KAAO;MACzBC,QAAQ,EAAG;IAAO,CAClB,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","useViewportMatch","useCallback","editorStore","preferencesStore","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenGlobalStylesContent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","params","path","uid","onClick","SidebarNavigationScreenGlobalStyles","backPath","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","children","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 { useViewportMatch } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\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 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';\nimport SidebarNavigationScreenGlobalStylesContent from './content';\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<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\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\nexport default function SidebarNavigationScreenGlobalStyles( { backPath } ) {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\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\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\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\tbackPath={ backPath }\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,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASH,KAAK,IAAII,WAAW,QAAQ,mBAAmB;AACxD,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASP,KAAK,IAAIQ,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,oC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EAAGA,CAAA,KACTQ,4BAA4B,CAC3B,CAAEE,iBAAiB,GAChB,YAAY,GACZS,SACJ,CACA;UACDuB,SAAS,EAAGhC;QAAmB,CAC/B,CACD,eACD1B,IAAA,CAACP,aAAa;UACb+D,IAAI,EAAG5E,IAAM;UACb6E,KAAK,EAAG9E,EAAE,CAAE,aAAc,CAAG;UAC7BqC,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAMwB,gBAAgB,CAAC;QAAG,CAChD,CAAC;MAAA,CACD;IACF,CACD,CAAC,EACAd,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,iBACtDzB,IAAA,CAACL,SAAS;MACTgE,cAAc,EAAG,KAAO;MACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;MAC1B5C,OAAO,EAAG2B,aAAe;MACzBkB,QAAQ,EAAGlB,aAAe;MAC1BmB,eAAe,EAAG,KAAO;MACzBC,QAAQ,EAAG;IAAO,CAClB,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -29,7 +29,8 @@ export default function RenameModal({
|
|
|
29
29
|
__next40pxDefaultSize: true,
|
|
30
30
|
value: editedMenuTitle,
|
|
31
31
|
placeholder: __('Navigation title'),
|
|
32
|
-
onChange: setEditedMenuTitle
|
|
32
|
+
onChange: setEditedMenuTitle,
|
|
33
|
+
label: __('Name')
|
|
33
34
|
}), /*#__PURE__*/_jsxs(HStack, {
|
|
34
35
|
justify: "right",
|
|
35
36
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
@@ -39,7 +40,7 @@ export default function RenameModal({
|
|
|
39
40
|
children: __('Cancel')
|
|
40
41
|
}), /*#__PURE__*/_jsx(Button, {
|
|
41
42
|
__next40pxDefaultSize: true,
|
|
42
|
-
|
|
43
|
+
accessibleWhenDisabled: true,
|
|
43
44
|
disabled: !isEditedMenuTitleValid,
|
|
44
45
|
variant: "primary",
|
|
45
46
|
type: "submit",
|