@wordpress/edit-site 6.13.0 → 6.13.1-next.a9f418477.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/build/components/add-new-pattern/index.js +3 -16
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-post/index.js +1 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/index.js +1 -5
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/app/index.js +31 -29
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +8 -8
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build/components/block-editor/use-navigate-to-entity-record.js +1 -5
- package/build/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +4 -4
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/dataviews-actions/index.js +1 -5
- package/build/components/dataviews-actions/index.js.map +1 -1
- package/build/components/editor/index.js +38 -22
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +5 -0
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +19 -4
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +0 -1
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +36 -26
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +0 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +0 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/preview-colors.js +2 -2
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/preview-styles.js +2 -2
- package/build/components/global-styles/preview-styles.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +2 -2
- package/build/components/global-styles/preview-typography.js.map +1 -1
- package/build/components/global-styles/{preview-iframe.js → preview-wrapper.js} +10 -29
- package/build/components/global-styles/preview-wrapper.js.map +1 -0
- package/build/components/global-styles/typography-example.js +8 -1
- package/build/components/global-styles/typography-example.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +5 -5
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +44 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +1 -4
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/fields.js +6 -57
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-patterns/index.js +31 -30
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-templates/fields.js +6 -34
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/page-templates/index.js +34 -46
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/post-edit/header.js +83 -0
- package/build/components/post-edit/header.js.map +1 -0
- package/build/components/post-edit/index.js +42 -7
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +26 -40
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js +10 -16
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app-routes/index.js +3 -7
- package/build/components/posts-app-routes/index.js.map +1 -1
- package/build/components/posts-app-routes/{posts-edit.js → post-item.js} +9 -13
- package/build/components/posts-app-routes/post-item.js.map +1 -0
- package/build/components/posts-app-routes/posts.js +89 -0
- package/build/components/posts-app-routes/posts.js.map +1 -0
- package/build/components/resizable-frame/index.js +6 -5
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-panel/index.js +9 -6
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +7 -8
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +5 -8
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +7 -24
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +18 -18
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +8 -5
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +2 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/content.js +12 -38
- package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +8 -19
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +6 -14
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +4 -5
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-editor-routes/{home-view.js → home.js} +7 -8
- package/build/components/site-editor-routes/home.js.map +1 -0
- package/build/components/site-editor-routes/index.js +12 -18
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/site-editor-routes/navigation-item.js +49 -0
- package/build/components/site-editor-routes/navigation-item.js.map +1 -0
- package/build/components/{posts-app-routes/home.js → site-editor-routes/navigation.js} +16 -18
- package/build/components/site-editor-routes/navigation.js.map +1 -0
- package/build/components/site-editor-routes/{pages-edit.js → page-item.js} +10 -17
- package/build/components/site-editor-routes/page-item.js.map +1 -0
- package/build/components/site-editor-routes/pages.js +87 -0
- package/build/components/site-editor-routes/pages.js.map +1 -0
- package/build/components/site-editor-routes/{home-edit.js → pattern-item.js} +11 -11
- package/build/components/site-editor-routes/pattern-item.js.map +1 -0
- package/build/components/site-editor-routes/{patterns-view.js → patterns.js} +6 -9
- package/build/components/site-editor-routes/patterns.js.map +1 -0
- package/build/components/site-editor-routes/{styles-view.js → styles.js} +28 -9
- package/build/components/site-editor-routes/styles.js.map +1 -0
- package/build/components/site-editor-routes/{templates-edit.js → template-item.js} +6 -11
- package/build/components/site-editor-routes/template-item.js.map +1 -0
- package/build/components/site-editor-routes/{patterns-edit.js → template-part-item.js} +6 -11
- package/build/components/site-editor-routes/template-part-item.js.map +1 -0
- package/build/components/site-editor-routes/{templates-list-view.js → templates.js} +20 -13
- package/build/components/site-editor-routes/templates.js.map +1 -0
- package/build/components/site-hub/index.js +3 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/constants.js +8 -19
- package/build/components/style-book/constants.js.map +1 -1
- package/build/components/style-book/examples.js +42 -27
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/index.js +21 -5
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/style-book/types.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +12 -48
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +2 -2
- package/build/hooks/commands/use-set-command-context.js.map +1 -1
- package/build/store/private-actions.js +7 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +2 -0
- package/build/store/reducer.js.map +1 -1
- package/build/utils/is-previewing-theme.js +1 -1
- package/build/utils/is-previewing-theme.js.map +1 -1
- package/build/utils/use-activate-theme.js +9 -8
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +3 -16
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-post/index.js +1 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/index.js +1 -5
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/app/index.js +33 -31
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +8 -8
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build-module/components/block-editor/use-navigate-to-entity-record.js +1 -5
- package/build-module/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +4 -4
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/dataviews-actions/index.js +1 -5
- package/build-module/components/dataviews-actions/index.js.map +1 -1
- package/build-module/components/editor/index.js +38 -22
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +5 -0
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +19 -4
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +0 -1
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +37 -27
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +0 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +0 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/preview-colors.js +2 -2
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/preview-styles.js +2 -2
- package/build-module/components/global-styles/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +2 -2
- package/build-module/components/global-styles/preview-typography.js.map +1 -1
- package/build-module/components/global-styles/{preview-iframe.js → preview-wrapper.js} +12 -31
- package/build-module/components/global-styles/preview-wrapper.js.map +1 -0
- package/build-module/components/global-styles/typography-example.js +8 -1
- package/build-module/components/global-styles/typography-example.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +5 -5
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +45 -20
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +1 -4
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +7 -58
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-patterns/index.js +29 -28
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-templates/fields.js +5 -31
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/page-templates/index.js +33 -45
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/post-edit/header.js +76 -0
- package/build-module/components/post-edit/header.js.map +1 -0
- package/build-module/components/post-edit/index.js +42 -7
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +26 -40
- package/build-module/components/post-list/index.js.map +1 -1
- 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-routes/index.js +3 -7
- package/build-module/components/posts-app-routes/index.js.map +1 -1
- package/build-module/components/posts-app-routes/{posts-edit.js → post-item.js} +8 -12
- package/build-module/components/posts-app-routes/post-item.js.map +1 -0
- package/build-module/components/posts-app-routes/posts.js +81 -0
- package/build-module/components/posts-app-routes/posts.js.map +1 -0
- package/build-module/components/resizable-frame/index.js +6 -5
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +9 -6
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +7 -8
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +5 -8
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +7 -24
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +4 -3
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +18 -18
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +8 -5
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js +12 -38
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +9 -20
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +6 -14
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -5
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-editor-routes/{home-edit.js → home.js} +5 -7
- package/build-module/components/site-editor-routes/home.js.map +1 -0
- package/build-module/components/site-editor-routes/index.js +12 -18
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/site-editor-routes/navigation-item.js +41 -0
- package/build-module/components/site-editor-routes/navigation-item.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation.js +38 -0
- package/build-module/components/site-editor-routes/navigation.js.map +1 -0
- package/build-module/components/site-editor-routes/{pages-edit.js → page-item.js} +9 -16
- package/build-module/components/site-editor-routes/page-item.js.map +1 -0
- package/build-module/components/site-editor-routes/pages.js +79 -0
- package/build-module/components/site-editor-routes/pages.js.map +1 -0
- package/build-module/components/site-editor-routes/pattern-item.js +18 -0
- package/build-module/components/site-editor-routes/pattern-item.js.map +1 -0
- package/build-module/components/site-editor-routes/{patterns-view.js → patterns.js} +5 -8
- package/build-module/components/site-editor-routes/patterns.js.map +1 -0
- package/build-module/components/site-editor-routes/styles.js +44 -0
- package/build-module/components/site-editor-routes/styles.js.map +1 -0
- package/build-module/components/site-editor-routes/{templates-edit.js → template-item.js} +5 -10
- package/build-module/components/site-editor-routes/template-item.js.map +1 -0
- package/build-module/components/site-editor-routes/template-part-item.js +18 -0
- package/build-module/components/site-editor-routes/template-part-item.js.map +1 -0
- package/build-module/components/site-editor-routes/templates.js +33 -0
- package/build-module/components/site-editor-routes/templates.js.map +1 -0
- package/build-module/components/site-hub/index.js +3 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/constants.js +8 -19
- package/build-module/components/style-book/constants.js.map +1 -1
- package/build-module/components/style-book/examples.js +42 -27
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/index.js +21 -5
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/style-book/types.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +12 -48
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +2 -2
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
- package/build-module/store/private-actions.js +6 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +1 -1
- package/build-module/utils/is-previewing-theme.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +9 -8
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/posts-rtl.css +73 -107
- package/build-style/posts.css +73 -107
- package/build-style/style-rtl.css +201 -142
- package/build-style/style.css +201 -142
- package/package.json +40 -40
- package/src/components/add-new-pattern/index.js +9 -17
- package/src/components/add-new-post/index.js +1 -1
- package/src/components/add-new-template/index.js +3 -5
- package/src/components/app/index.js +34 -35
- package/src/components/block-editor/use-editor-iframe-props.js +5 -4
- package/src/components/block-editor/use-navigate-to-entity-record.js +3 -1
- package/src/components/block-editor/use-site-editor-settings.js +6 -6
- package/src/components/dataviews-actions/index.js +1 -5
- package/src/components/editor/index.js +64 -29
- package/src/components/editor/use-editor-title.js +4 -0
- package/src/components/editor/use-resolve-edited-entity.js +17 -2
- package/src/components/global-styles/font-library-modal/font-collection.js +40 -27
- package/src/components/global-styles/font-library-modal/style.scss +12 -5
- package/src/components/global-styles/preview-colors.js +3 -3
- package/src/components/global-styles/preview-styles.js +3 -3
- package/src/components/global-styles/preview-typography.js +3 -3
- package/src/components/global-styles/{preview-iframe.js → preview-wrapper.js} +9 -35
- package/src/components/global-styles/style.scss +5 -1
- package/src/components/global-styles/typography-example.js +12 -1
- package/src/components/global-styles-sidebar/index.js +4 -4
- package/src/components/layout/index.js +43 -11
- package/src/components/page-patterns/delete-category-menu-item.js +3 -4
- package/src/components/page-patterns/fields.js +9 -65
- package/src/components/page-patterns/index.js +39 -25
- package/src/components/page-patterns/style.scss +0 -28
- package/src/components/page-templates/fields.js +3 -31
- package/src/components/page-templates/index.js +34 -51
- package/src/components/post-edit/header.js +88 -0
- package/src/components/post-edit/index.js +39 -7
- package/src/components/post-edit/style.scss +10 -0
- package/src/components/post-list/index.js +44 -40
- package/src/components/post-list/style.scss +0 -36
- package/src/components/posts-app/index.js +9 -18
- package/src/components/posts-app-routes/index.js +3 -14
- package/src/components/posts-app-routes/{posts-edit.js → post-item.js} +5 -9
- package/src/components/posts-app-routes/posts.js +66 -0
- package/src/components/resizable-frame/index.js +6 -7
- package/src/components/save-panel/index.js +11 -5
- package/src/components/sidebar-dataviews/add-new-view.js +9 -9
- package/src/components/sidebar-dataviews/dataview-item.js +5 -8
- package/src/components/sidebar-dataviews/default-views.js +7 -24
- package/src/components/sidebar-dataviews/index.js +2 -2
- package/src/components/sidebar-dataviews/style.scss +2 -2
- package/src/components/sidebar-global-styles-wrapper/index.js +24 -30
- package/src/components/sidebar-navigation-item/index.js +7 -5
- package/src/components/sidebar-navigation-item/style.scss +1 -2
- package/src/components/sidebar-navigation-screen/index.js +2 -2
- package/src/components/sidebar-navigation-screen/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-global-styles/content.js +7 -35
- package/src/components/sidebar-navigation-screen-global-styles/index.js +13 -34
- package/src/components/sidebar-navigation-screen-main/index.js +6 -10
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +3 -5
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +6 -6
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +9 -21
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -20
- package/src/components/sidebar-navigation-screen-patterns/index.js +3 -4
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +24 -18
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
- package/src/components/site-editor-routes/{home-view.js → home.js} +4 -5
- package/src/components/site-editor-routes/index.js +22 -34
- package/src/components/site-editor-routes/navigation-item.js +39 -0
- package/src/components/site-editor-routes/navigation.js +34 -0
- package/src/components/site-editor-routes/{pages-edit.js → page-item.js} +6 -14
- package/src/components/site-editor-routes/pages.js +66 -0
- package/src/components/site-editor-routes/pattern-item.js +15 -0
- package/src/components/site-editor-routes/patterns.js +15 -0
- package/src/components/site-editor-routes/styles.js +39 -0
- package/src/components/site-editor-routes/template-item.js +15 -0
- package/src/components/site-editor-routes/template-part-item.js +15 -0
- package/src/components/site-editor-routes/templates.js +26 -0
- package/src/components/site-hub/index.js +3 -6
- package/src/components/style-book/constants.ts +8 -19
- package/src/components/style-book/examples.tsx +47 -28
- package/src/components/style-book/index.js +28 -5
- package/src/components/style-book/types.ts +1 -1
- package/src/hooks/commands/use-common-commands.js +14 -72
- package/src/hooks/commands/use-set-command-context.js +2 -2
- package/src/store/private-actions.js +7 -0
- package/src/store/reducer.js +2 -0
- package/src/style.scss +1 -0
- package/src/utils/is-previewing-theme.js +1 -3
- package/src/utils/use-activate-theme.js +4 -3
- package/build/components/error-boundary/index.js +0 -47
- package/build/components/error-boundary/index.js.map +0 -1
- package/build/components/error-boundary/warning.js +0 -42
- package/build/components/error-boundary/warning.js.map +0 -1
- package/build/components/global-styles/preview-iframe.js.map +0 -1
- package/build/components/layout/router.js +0 -92
- package/build/components/layout/router.js.map +0 -1
- package/build/components/posts-app-routes/home.js.map +0 -1
- package/build/components/posts-app-routes/posts-edit.js.map +0 -1
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js +0 -63
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
- package/build/components/posts-app-routes/posts-list-view.js +0 -48
- package/build/components/posts-app-routes/posts-list-view.js.map +0 -1
- package/build/components/posts-app-routes/posts-view-quick-edit.js +0 -60
- package/build/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
- package/build/components/posts-app-routes/posts-view.js +0 -41
- package/build/components/posts-app-routes/posts-view.js.map +0 -1
- package/build/components/routes/link.js +0 -69
- package/build/components/routes/link.js.map +0 -1
- package/build/components/site-editor-routes/home-edit.js.map +0 -1
- package/build/components/site-editor-routes/home-view.js.map +0 -1
- package/build/components/site-editor-routes/navigation-edit.js +0 -29
- package/build/components/site-editor-routes/navigation-edit.js.map +0 -1
- package/build/components/site-editor-routes/navigation-item-edit.js +0 -31
- package/build/components/site-editor-routes/navigation-item-edit.js.map +0 -1
- package/build/components/site-editor-routes/navigation-item-view.js +0 -30
- package/build/components/site-editor-routes/navigation-item-view.js.map +0 -1
- package/build/components/site-editor-routes/navigation-view.js +0 -28
- package/build/components/site-editor-routes/navigation-view.js.map +0 -1
- package/build/components/site-editor-routes/pages-edit.js.map +0 -1
- package/build/components/site-editor-routes/pages-list-view-quick-edit.js +0 -64
- package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
- package/build/components/site-editor-routes/pages-list-view.js +0 -47
- package/build/components/site-editor-routes/pages-list-view.js.map +0 -1
- package/build/components/site-editor-routes/pages-view-quick-edit.js +0 -61
- package/build/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
- package/build/components/site-editor-routes/pages-view.js +0 -42
- package/build/components/site-editor-routes/pages-view.js.map +0 -1
- package/build/components/site-editor-routes/patterns-edit.js.map +0 -1
- package/build/components/site-editor-routes/patterns-view.js.map +0 -1
- package/build/components/site-editor-routes/styles-view.js.map +0 -1
- package/build/components/site-editor-routes/templates-edit.js.map +0 -1
- package/build/components/site-editor-routes/templates-list-view.js.map +0 -1
- package/build/components/site-editor-routes/templates-view.js +0 -29
- package/build/components/site-editor-routes/templates-view.js.map +0 -1
- package/build-module/components/error-boundary/index.js +0 -38
- package/build-module/components/error-boundary/index.js.map +0 -1
- package/build-module/components/error-boundary/warning.js +0 -35
- package/build-module/components/error-boundary/warning.js.map +0 -1
- package/build-module/components/global-styles/preview-iframe.js.map +0 -1
- package/build-module/components/layout/router.js +0 -84
- package/build-module/components/layout/router.js.map +0 -1
- package/build-module/components/posts-app-routes/home.js +0 -40
- package/build-module/components/posts-app-routes/home.js.map +0 -1
- package/build-module/components/posts-app-routes/posts-edit.js.map +0 -1
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +0 -55
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
- package/build-module/components/posts-app-routes/posts-list-view.js +0 -40
- package/build-module/components/posts-app-routes/posts-list-view.js.map +0 -1
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js +0 -52
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
- package/build-module/components/posts-app-routes/posts-view.js +0 -33
- package/build-module/components/posts-app-routes/posts-view.js.map +0 -1
- package/build-module/components/routes/link.js +0 -61
- package/build-module/components/routes/link.js.map +0 -1
- package/build-module/components/site-editor-routes/home-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/home-view.js +0 -17
- package/build-module/components/site-editor-routes/home-view.js.map +0 -1
- package/build-module/components/site-editor-routes/navigation-edit.js +0 -21
- package/build-module/components/site-editor-routes/navigation-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/navigation-item-edit.js +0 -23
- package/build-module/components/site-editor-routes/navigation-item-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/navigation-item-view.js +0 -22
- package/build-module/components/site-editor-routes/navigation-item-view.js.map +0 -1
- package/build-module/components/site-editor-routes/navigation-view.js +0 -20
- package/build-module/components/site-editor-routes/navigation-view.js.map +0 -1
- package/build-module/components/site-editor-routes/pages-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
- package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/pages-list-view.js +0 -39
- package/build-module/components/site-editor-routes/pages-list-view.js.map +0 -1
- package/build-module/components/site-editor-routes/pages-view-quick-edit.js +0 -53
- package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/pages-view.js +0 -34
- package/build-module/components/site-editor-routes/pages-view.js.map +0 -1
- package/build-module/components/site-editor-routes/patterns-edit.js +0 -23
- package/build-module/components/site-editor-routes/patterns-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/patterns-view.js.map +0 -1
- package/build-module/components/site-editor-routes/styles-view.js +0 -25
- package/build-module/components/site-editor-routes/styles-view.js.map +0 -1
- package/build-module/components/site-editor-routes/templates-edit.js.map +0 -1
- package/build-module/components/site-editor-routes/templates-list-view.js +0 -26
- package/build-module/components/site-editor-routes/templates-list-view.js.map +0 -1
- package/build-module/components/site-editor-routes/templates-view.js +0 -21
- package/build-module/components/site-editor-routes/templates-view.js.map +0 -1
- package/src/components/error-boundary/index.js +0 -44
- package/src/components/error-boundary/test/error-boundary.js +0 -40
- package/src/components/error-boundary/warning.js +0 -30
- package/src/components/layout/router.js +0 -86
- package/src/components/posts-app-routes/home.js +0 -36
- package/src/components/posts-app-routes/posts-list-view-quick-edit.js +0 -52
- package/src/components/posts-app-routes/posts-list-view.js +0 -40
- package/src/components/posts-app-routes/posts-view-quick-edit.js +0 -49
- package/src/components/posts-app-routes/posts-view.js +0 -35
- package/src/components/routes/link.js +0 -68
- package/src/components/site-editor-routes/home-edit.js +0 -17
- package/src/components/site-editor-routes/navigation-edit.js +0 -22
- package/src/components/site-editor-routes/navigation-item-edit.js +0 -26
- package/src/components/site-editor-routes/navigation-item-view.js +0 -25
- package/src/components/site-editor-routes/navigation-view.js +0 -21
- package/src/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
- package/src/components/site-editor-routes/pages-list-view.js +0 -44
- package/src/components/site-editor-routes/pages-view-quick-edit.js +0 -53
- package/src/components/site-editor-routes/pages-view.js +0 -39
- package/src/components/site-editor-routes/patterns-edit.js +0 -24
- package/src/components/site-editor-routes/patterns-view.js +0 -22
- package/src/components/site-editor-routes/styles-view.js +0 -26
- package/src/components/site-editor-routes/templates-edit.js +0 -22
- package/src/components/site-editor-routes/templates-list-view.js +0 -28
- package/src/components/site-editor-routes/templates-view.js +0 -22
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* wp:polyfill */
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -10,6 +9,7 @@ import { usePrevious } from '@wordpress/compose';
|
|
|
10
9
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
11
10
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
12
11
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
|
+
import { patternTitleField } from '@wordpress/fields';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -21,7 +21,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
21
21
|
import usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';
|
|
22
22
|
import PatternsHeader from './header';
|
|
23
23
|
import { useEditPostAction } from '../dataviews-actions';
|
|
24
|
-
import { patternStatusField, previewField,
|
|
24
|
+
import { patternStatusField, previewField, templatePartAuthorField } from './fields';
|
|
25
25
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
26
|
const {
|
|
27
27
|
ExperimentalBlockEditorProvider
|
|
@@ -30,17 +30,14 @@ const {
|
|
|
30
30
|
usePostActions
|
|
31
31
|
} = unlock(editorPrivateApis);
|
|
32
32
|
const {
|
|
33
|
-
useLocation
|
|
33
|
+
useLocation,
|
|
34
|
+
useHistory
|
|
34
35
|
} = unlock(routerPrivateApis);
|
|
35
36
|
const EMPTY_ARRAY = [];
|
|
36
37
|
const defaultLayouts = {
|
|
37
38
|
[LAYOUT_TABLE]: {
|
|
38
39
|
layout: {
|
|
39
|
-
primaryField: 'title',
|
|
40
40
|
styles: {
|
|
41
|
-
preview: {
|
|
42
|
-
width: '1%'
|
|
43
|
-
},
|
|
44
41
|
author: {
|
|
45
42
|
width: '1%'
|
|
46
43
|
}
|
|
@@ -49,8 +46,6 @@ const defaultLayouts = {
|
|
|
49
46
|
},
|
|
50
47
|
[LAYOUT_GRID]: {
|
|
51
48
|
layout: {
|
|
52
|
-
mediaField: 'preview',
|
|
53
|
-
primaryField: 'title',
|
|
54
49
|
badgeFields: ['sync-status']
|
|
55
50
|
}
|
|
56
51
|
}
|
|
@@ -60,29 +55,31 @@ const DEFAULT_VIEW = {
|
|
|
60
55
|
search: '',
|
|
61
56
|
page: 1,
|
|
62
57
|
perPage: 20,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
titleField: 'title',
|
|
59
|
+
mediaField: 'preview',
|
|
60
|
+
fields: ['sync-status'],
|
|
61
|
+
filters: [],
|
|
62
|
+
...defaultLayouts[LAYOUT_GRID]
|
|
66
63
|
};
|
|
67
64
|
export default function DataviewsPatterns() {
|
|
68
65
|
const {
|
|
69
|
-
|
|
70
|
-
postType,
|
|
66
|
+
query: {
|
|
67
|
+
postType = 'wp_block',
|
|
71
68
|
categoryId: categoryIdFromURL
|
|
72
69
|
}
|
|
73
70
|
} = useLocation();
|
|
74
|
-
const
|
|
71
|
+
const history = useHistory();
|
|
75
72
|
const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
|
|
76
73
|
const [view, setView] = useState(DEFAULT_VIEW);
|
|
77
74
|
const previousCategoryId = usePrevious(categoryId);
|
|
78
|
-
const previousPostType = usePrevious(
|
|
75
|
+
const previousPostType = usePrevious(postType);
|
|
79
76
|
const viewSyncStatus = view.filters?.find(({
|
|
80
77
|
field
|
|
81
78
|
}) => field === 'sync-status')?.value;
|
|
82
79
|
const {
|
|
83
80
|
patterns,
|
|
84
81
|
isResolving
|
|
85
|
-
} = usePatterns(
|
|
82
|
+
} = usePatterns(postType, categoryId, {
|
|
86
83
|
search: view.search,
|
|
87
84
|
syncStatus: viewSyncStatus
|
|
88
85
|
});
|
|
@@ -105,27 +102,27 @@ export default function DataviewsPatterns() {
|
|
|
105
102
|
}));
|
|
106
103
|
}, [records]);
|
|
107
104
|
const fields = useMemo(() => {
|
|
108
|
-
const _fields = [previewField,
|
|
109
|
-
if (
|
|
105
|
+
const _fields = [previewField, patternTitleField];
|
|
106
|
+
if (postType === PATTERN_TYPES.user) {
|
|
110
107
|
_fields.push(patternStatusField);
|
|
111
|
-
} else if (
|
|
108
|
+
} else if (postType === TEMPLATE_PART_POST_TYPE) {
|
|
112
109
|
_fields.push({
|
|
113
110
|
...templatePartAuthorField,
|
|
114
111
|
elements: authors
|
|
115
112
|
});
|
|
116
113
|
}
|
|
117
114
|
return _fields;
|
|
118
|
-
}, [
|
|
115
|
+
}, [postType, authors]);
|
|
119
116
|
|
|
120
117
|
// Reset the page number when the category changes.
|
|
121
118
|
useEffect(() => {
|
|
122
|
-
if (previousCategoryId !== categoryId || previousPostType !==
|
|
119
|
+
if (previousCategoryId !== categoryId || previousPostType !== postType) {
|
|
123
120
|
setView(prevView => ({
|
|
124
121
|
...prevView,
|
|
125
122
|
page: 1
|
|
126
123
|
}));
|
|
127
124
|
}
|
|
128
|
-
}, [categoryId, previousCategoryId, previousPostType,
|
|
125
|
+
}, [categoryId, previousCategoryId, previousPostType, postType]);
|
|
129
126
|
const {
|
|
130
127
|
data,
|
|
131
128
|
paginationInfo
|
|
@@ -136,11 +133,11 @@ export default function DataviewsPatterns() {
|
|
|
136
133
|
...view
|
|
137
134
|
};
|
|
138
135
|
delete viewWithoutFilters.search;
|
|
139
|
-
if (
|
|
136
|
+
if (postType !== TEMPLATE_PART_POST_TYPE) {
|
|
140
137
|
viewWithoutFilters.filters = [];
|
|
141
138
|
}
|
|
142
139
|
return filterSortAndPaginate(patterns, viewWithoutFilters, fields);
|
|
143
|
-
}, [patterns, view, fields,
|
|
140
|
+
}, [patterns, view, fields, postType]);
|
|
144
141
|
const dataWithPermissions = useAugmentPatternsWithPermissions(data);
|
|
145
142
|
const templatePartActions = usePostActions({
|
|
146
143
|
postType: TEMPLATE_PART_POST_TYPE,
|
|
@@ -152,11 +149,11 @@ export default function DataviewsPatterns() {
|
|
|
152
149
|
});
|
|
153
150
|
const editAction = useEditPostAction();
|
|
154
151
|
const actions = useMemo(() => {
|
|
155
|
-
if (
|
|
152
|
+
if (postType === TEMPLATE_PART_POST_TYPE) {
|
|
156
153
|
return [editAction, ...templatePartActions].filter(Boolean);
|
|
157
154
|
}
|
|
158
155
|
return [editAction, ...patternActions].filter(Boolean);
|
|
159
|
-
}, [editAction,
|
|
156
|
+
}, [editAction, postType, templatePartActions, patternActions]);
|
|
160
157
|
const id = useId();
|
|
161
158
|
const settings = usePatternSettings();
|
|
162
159
|
// Wrap everything in a block editor provider.
|
|
@@ -170,7 +167,7 @@ export default function DataviewsPatterns() {
|
|
|
170
167
|
hideTitleFromUI: true,
|
|
171
168
|
children: [/*#__PURE__*/_jsx(PatternsHeader, {
|
|
172
169
|
categoryId: categoryId,
|
|
173
|
-
type:
|
|
170
|
+
type: postType,
|
|
174
171
|
titleId: `${id}-title`,
|
|
175
172
|
descriptionId: `${id}-description`
|
|
176
173
|
}), /*#__PURE__*/_jsx(DataViews, {
|
|
@@ -183,6 +180,10 @@ export default function DataviewsPatterns() {
|
|
|
183
180
|
return (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id;
|
|
184
181
|
},
|
|
185
182
|
isLoading: isResolving,
|
|
183
|
+
isItemClickable: item => item.type !== PATTERN_TYPES.theme,
|
|
184
|
+
onClickItem: item => {
|
|
185
|
+
history.navigate(`/${item.type}/${[PATTERN_TYPES.user, TEMPLATE_PART_POST_TYPE].includes(item.type) ? item.id : item.name}?canvas=edit`);
|
|
186
|
+
},
|
|
186
187
|
view: view,
|
|
187
188
|
onChangeView: setView,
|
|
188
189
|
defaultLayouts: defaultLayouts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useState","useMemo","useId","useEffect","privateApis","blockEditorPrivateApis","DataViews","filterSortAndPaginate","usePrevious","useEntityRecords","editorPrivateApis","routerPrivateApis","Page","LAYOUT_GRID","LAYOUT_TABLE","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_DEFAULT_CATEGORY","usePatternSettings","unlock","usePatterns","useAugmentPatternsWithPermissions","PatternsHeader","useEditPostAction","patternStatusField","previewField","titleField","templatePartAuthorField","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","usePostActions","useLocation","EMPTY_ARRAY","defaultLayouts","layout","primaryField","styles","preview","width","author","mediaField","badgeFields","DEFAULT_VIEW","type","search","page","perPage","fields","filters","DataviewsPatterns","params","postType","categoryId","categoryIdFromURL","user","view","setView","previousCategoryId","previousPostType","viewSyncStatus","find","field","value","patterns","isResolving","syncStatus","records","per_page","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","label","_fields","push","elements","prevView","data","paginationInfo","viewWithoutFilters","dataWithPermissions","templatePartActions","context","patternActions","editAction","actions","filter","Boolean","id","settings","children","title","className","hideTitleFromUI","titleId","descriptionId","getItemId","item","_item$name","name","isLoading","onChangeView"],"sources":["@wordpress/edit-site/src/components/page-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useId, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { usePrevious } from '@wordpress/compose';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport usePatternSettings from './use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\nimport usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';\nimport PatternsHeader from './header';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {\n\tpatternStatusField,\n\tpreviewField,\n\ttitleField,\n\ttemplatePartAuthorField,\n} from './fields';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tstyles: {\n\t\t\t\tpreview: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\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: 'preview',\n\t\t\tprimaryField: 'title',\n\t\t\tbadgeFields: [ 'sync-status' ],\n\t\t},\n\t},\n};\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\tlayout: defaultLayouts[ LAYOUT_GRID ].layout,\n\tfields: [ 'title', 'sync-status' ],\n\tfilters: [],\n};\n\nexport default function DataviewsPatterns() {\n\tconst {\n\t\tparams: { postType, categoryId: categoryIdFromURL },\n\t} = useLocation();\n\tconst type = postType || PATTERN_TYPES.user;\n\tconst categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;\n\tconst [ view, setView ] = useState( DEFAULT_VIEW );\n\tconst previousCategoryId = usePrevious( categoryId );\n\tconst previousPostType = usePrevious( type );\n\tconst viewSyncStatus = view.filters?.find(\n\t\t( { field } ) => field === 'sync-status'\n\t)?.value;\n\tconst { patterns, isResolving } = usePatterns( type, categoryId, {\n\t\tsearch: view.search,\n\t\tsyncStatus: viewSyncStatus,\n\t} );\n\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_PART_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [ previewField, titleField ];\n\n\t\tif ( type === PATTERN_TYPES.user ) {\n\t\t\t_fields.push( patternStatusField );\n\t\t} else if ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\t\t_fields.push( {\n\t\t\t\t...templatePartAuthorField,\n\t\t\t\telements: authors,\n\t\t\t} );\n\t\t}\n\n\t\treturn _fields;\n\t}, [ type, authors ] );\n\n\t// Reset the page number when the category changes.\n\tuseEffect( () => {\n\t\tif ( previousCategoryId !== categoryId || previousPostType !== type ) {\n\t\t\tsetView( ( prevView ) => ( { ...prevView, page: 1 } ) );\n\t\t}\n\t}, [ categoryId, previousCategoryId, previousPostType, type ] );\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\t// Search is managed server-side as well as filters for patterns.\n\t\t// However, the author filter in template parts is done client-side.\n\t\tconst viewWithoutFilters = { ...view };\n\t\tdelete viewWithoutFilters.search;\n\t\tif ( type !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\tviewWithoutFilters.filters = [];\n\t\t}\n\t\treturn filterSortAndPaginate( patterns, viewWithoutFilters, fields );\n\t}, [ patterns, view, fields, type ] );\n\n\tconst dataWithPermissions = useAugmentPatternsWithPermissions( data );\n\n\tconst templatePartActions = usePostActions( {\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst patternActions = usePostActions( {\n\t\tpostType: PATTERN_TYPES.user,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\n\tconst actions = useMemo( () => {\n\t\tif ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\t\treturn [ editAction, ...templatePartActions ].filter( Boolean );\n\t\t}\n\t\treturn [ editAction, ...patternActions ].filter( Boolean );\n\t}, [ editAction, type, templatePartActions, patternActions ] );\n\tconst id = useId();\n\tconst settings = usePatternSettings();\n\t// Wrap everything in a block editor provider.\n\t// This ensures 'styles' that are needed for the previews are synced\n\t// from the site editor store to the block editor store.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<Page\n\t\t\t\ttitle={ __( 'Patterns content' ) }\n\t\t\t\tclassName=\"edit-site-page-patterns-dataviews\"\n\t\t\t\thideTitleFromUI\n\t\t\t>\n\t\t\t\t<PatternsHeader\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\ttitleId={ `${ id }-title` }\n\t\t\t\t\tdescriptionId={ `${ id }-description` }\n\t\t\t\t/>\n\t\t\t\t<DataViews\n\t\t\t\t\tkey={ categoryId + postType }\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tdata={ dataWithPermissions || EMPTY_ARRAY }\n\t\t\t\t\tgetItemId={ ( item ) => item.name ?? item.id }\n\t\t\t\t\tisLoading={ isResolving }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ setView }\n\t\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,SAAS,QAAQ,oBAAoB;AACxE,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,SAAS,EAAEC,qBAAqB,QAAQ,sBAAsB;AACvE,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASL,WAAW,IAAIM,iBAAiB,QAAQ,mBAAmB;AACpE,SAASN,WAAW,IAAIO,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,SACCC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,uBAAuB,EACvBC,wBAAwB,QAClB,uBAAuB;AAC9B,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,IAAIC,iCAAiC,QAAQ,gBAAgB;AAC/E,OAAOC,cAAc,MAAM,UAAU;AACrC,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SACCC,kBAAkB,EAClBC,YAAY,EACZC,UAAU,EACVC,uBAAuB,QACjB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAElB,MAAM;EAAEC;AAAgC,CAAC,GAAGb,MAAM,CAAEd,sBAAuB,CAAC;AAC5E,MAAM;EAAE4B;AAAe,CAAC,GAAGd,MAAM,CAAET,iBAAkB,CAAC;AACtD,MAAM;EAAEwB;AAAY,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C;AAEpC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","useState","useMemo","useId","useEffect","privateApis","blockEditorPrivateApis","DataViews","filterSortAndPaginate","usePrevious","useEntityRecords","editorPrivateApis","routerPrivateApis","patternTitleField","Page","LAYOUT_GRID","LAYOUT_TABLE","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_DEFAULT_CATEGORY","usePatternSettings","unlock","usePatterns","useAugmentPatternsWithPermissions","PatternsHeader","useEditPostAction","patternStatusField","previewField","templatePartAuthorField","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","usePostActions","useLocation","useHistory","EMPTY_ARRAY","defaultLayouts","layout","styles","author","width","badgeFields","DEFAULT_VIEW","type","search","page","perPage","titleField","mediaField","fields","filters","DataviewsPatterns","query","postType","categoryId","categoryIdFromURL","history","view","setView","previousCategoryId","previousPostType","viewSyncStatus","find","field","value","patterns","isResolving","syncStatus","records","per_page","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","label","_fields","user","push","elements","prevView","data","paginationInfo","viewWithoutFilters","dataWithPermissions","templatePartActions","context","patternActions","editAction","actions","filter","Boolean","id","settings","children","title","className","hideTitleFromUI","titleId","descriptionId","getItemId","item","_item$name","name","isLoading","isItemClickable","theme","onClickItem","navigate","includes","onChangeView"],"sources":["@wordpress/edit-site/src/components/page-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useId, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { usePrevious } from '@wordpress/compose';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { patternTitleField } from '@wordpress/fields';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport usePatternSettings from './use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\nimport usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';\nimport PatternsHeader from './header';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {\n\tpatternStatusField,\n\tpreviewField,\n\ttemplatePartAuthorField,\n} from './fields';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tbadgeFields: [ 'sync-status' ],\n\t\t},\n\t},\n};\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\ttitleField: 'title',\n\tmediaField: 'preview',\n\tfields: [ 'sync-status' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nexport default function DataviewsPatterns() {\n\tconst {\n\t\tquery: { postType = 'wp_block', categoryId: categoryIdFromURL },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;\n\tconst [ view, setView ] = useState( DEFAULT_VIEW );\n\tconst previousCategoryId = usePrevious( categoryId );\n\tconst previousPostType = usePrevious( postType );\n\tconst viewSyncStatus = view.filters?.find(\n\t\t( { field } ) => field === 'sync-status'\n\t)?.value;\n\tconst { patterns, isResolving } = usePatterns( postType, categoryId, {\n\t\tsearch: view.search,\n\t\tsyncStatus: viewSyncStatus,\n\t} );\n\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_PART_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [ previewField, patternTitleField ];\n\n\t\tif ( postType === PATTERN_TYPES.user ) {\n\t\t\t_fields.push( patternStatusField );\n\t\t} else if ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\t\t_fields.push( {\n\t\t\t\t...templatePartAuthorField,\n\t\t\t\telements: authors,\n\t\t\t} );\n\t\t}\n\n\t\treturn _fields;\n\t}, [ postType, authors ] );\n\n\t// Reset the page number when the category changes.\n\tuseEffect( () => {\n\t\tif (\n\t\t\tpreviousCategoryId !== categoryId ||\n\t\t\tpreviousPostType !== postType\n\t\t) {\n\t\t\tsetView( ( prevView ) => ( { ...prevView, page: 1 } ) );\n\t\t}\n\t}, [ categoryId, previousCategoryId, previousPostType, postType ] );\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\t// Search is managed server-side as well as filters for patterns.\n\t\t// However, the author filter in template parts is done client-side.\n\t\tconst viewWithoutFilters = { ...view };\n\t\tdelete viewWithoutFilters.search;\n\t\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\tviewWithoutFilters.filters = [];\n\t\t}\n\t\treturn filterSortAndPaginate( patterns, viewWithoutFilters, fields );\n\t}, [ patterns, view, fields, postType ] );\n\n\tconst dataWithPermissions = useAugmentPatternsWithPermissions( data );\n\n\tconst templatePartActions = usePostActions( {\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst patternActions = usePostActions( {\n\t\tpostType: PATTERN_TYPES.user,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\n\tconst actions = useMemo( () => {\n\t\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\t\treturn [ editAction, ...templatePartActions ].filter( Boolean );\n\t\t}\n\t\treturn [ editAction, ...patternActions ].filter( Boolean );\n\t}, [ editAction, postType, templatePartActions, patternActions ] );\n\tconst id = useId();\n\tconst settings = usePatternSettings();\n\t// Wrap everything in a block editor provider.\n\t// This ensures 'styles' that are needed for the previews are synced\n\t// from the site editor store to the block editor store.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<Page\n\t\t\t\ttitle={ __( 'Patterns content' ) }\n\t\t\t\tclassName=\"edit-site-page-patterns-dataviews\"\n\t\t\t\thideTitleFromUI\n\t\t\t>\n\t\t\t\t<PatternsHeader\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\ttype={ postType }\n\t\t\t\t\ttitleId={ `${ id }-title` }\n\t\t\t\t\tdescriptionId={ `${ id }-description` }\n\t\t\t\t/>\n\t\t\t\t<DataViews\n\t\t\t\t\tkey={ categoryId + postType }\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tdata={ dataWithPermissions || EMPTY_ARRAY }\n\t\t\t\t\tgetItemId={ ( item ) => item.name ?? item.id }\n\t\t\t\t\tisLoading={ isResolving }\n\t\t\t\t\tisItemClickable={ ( item ) =>\n\t\t\t\t\t\titem.type !== PATTERN_TYPES.theme\n\t\t\t\t\t}\n\t\t\t\t\tonClickItem={ ( item ) => {\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t`/${ item.type }/${\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tPATTERN_TYPES.user,\n\t\t\t\t\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\t\t\t\t].includes( item.type )\n\t\t\t\t\t\t\t\t\t? item.id\n\t\t\t\t\t\t\t\t\t: item.name\n\t\t\t\t\t\t\t}?canvas=edit`\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ setView }\n\t\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,SAAS,QAAQ,oBAAoB;AACxE,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,SAAS,EAAEC,qBAAqB,QAAQ,sBAAsB;AACvE,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASL,WAAW,IAAIM,iBAAiB,QAAQ,mBAAmB;AACpE,SAASN,WAAW,IAAIO,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,iBAAiB,QAAQ,mBAAmB;;AAErD;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,SACCC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,uBAAuB,EACvBC,wBAAwB,QAClB,uBAAuB;AAC9B,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,IAAIC,iCAAiC,QAAQ,gBAAgB;AAC/E,OAAOC,cAAc,MAAM,UAAU;AACrC,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SACCC,kBAAkB,EAClBC,YAAY,EACZC,uBAAuB,QACjB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAElB,MAAM;EAAEC;A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QACDC,WAAW,EAAKN,IAAI,IAAM;UACzBlD,OAAO,CAACyD,QAAQ,CACf,IAAKP,IAAI,CAAC/D,IAAI,IACb,CACC5B,aAAa,CAACmE,IAAI,EAClBlE,uBAAuB,CACvB,CAACkG,QAAQ,CAAER,IAAI,CAAC/D,IAAK,CAAC,GACpB+D,IAAI,CAACT,EAAE,GACPS,IAAI,CAACE,IAAI,cAEd,CAAC;QACF,CAAG;QACHnD,IAAI,EAAGA,IAAM;QACb0D,YAAY,EAAGzD,OAAS;QACxBtB,cAAc,EAAGA;MAAgB,GAxB3BkB,UAAU,GAAGD,QAyBnB,CAAC;IAAA,CACG;EAAC,CACyB,CAAC;AAEpC","ignoreList":[]}
|
|
@@ -13,15 +13,18 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
13
13
|
import { parse } from '@wordpress/blocks';
|
|
14
14
|
import { BlockPreview, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
15
15
|
import { EditorProvider } from '@wordpress/editor';
|
|
16
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
19
20
|
*/
|
|
20
|
-
import { default as Link, useLink } from '../routes/link';
|
|
21
21
|
import { useAddedBy } from './hooks';
|
|
22
22
|
import usePatternSettings from '../page-patterns/use-pattern-settings';
|
|
23
23
|
import { unlock } from '../../lock-unlock';
|
|
24
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
const {
|
|
26
|
+
useLink
|
|
27
|
+
} = unlock(routerPrivateApis);
|
|
25
28
|
const {
|
|
26
29
|
useGlobalStyle
|
|
27
30
|
} = unlock(blockEditorPrivateApis);
|
|
@@ -35,11 +38,7 @@ function PreviewField({
|
|
|
35
38
|
}, [item.content.raw]);
|
|
36
39
|
const {
|
|
37
40
|
onClick
|
|
38
|
-
} = useLink({
|
|
39
|
-
postId: item.id,
|
|
40
|
-
postType: item.type,
|
|
41
|
-
canvas: 'edit'
|
|
42
|
-
});
|
|
41
|
+
} = useLink(`/${item.type}/${item.id}?canvas=edit`);
|
|
43
42
|
const isEmpty = !blocks?.length;
|
|
44
43
|
// Wrap everything in a block editor provider to ensure 'styles' that are needed
|
|
45
44
|
// for the previews are synced between the site editor store and the block editor store.
|
|
@@ -76,31 +75,6 @@ export const previewField = {
|
|
|
76
75
|
render: PreviewField,
|
|
77
76
|
enableSorting: false
|
|
78
77
|
};
|
|
79
|
-
function TitleField({
|
|
80
|
-
item
|
|
81
|
-
}) {
|
|
82
|
-
const linkProps = {
|
|
83
|
-
params: {
|
|
84
|
-
postId: item.id,
|
|
85
|
-
postType: item.type,
|
|
86
|
-
canvas: 'edit'
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
return /*#__PURE__*/_jsx(Link, {
|
|
90
|
-
...linkProps,
|
|
91
|
-
children: decodeEntities(item.title?.rendered) || __('(no title)')
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
export const titleField = {
|
|
95
|
-
label: __('Template'),
|
|
96
|
-
id: 'title',
|
|
97
|
-
getValue: ({
|
|
98
|
-
item
|
|
99
|
-
}) => item.title?.rendered,
|
|
100
|
-
render: TitleField,
|
|
101
|
-
enableHiding: false,
|
|
102
|
-
enableGlobalSearch: true
|
|
103
|
-
};
|
|
104
78
|
export const descriptionField = {
|
|
105
79
|
label: __('Description'),
|
|
106
80
|
id: 'description',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__","useState","useMemo","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","EditorProvider","
|
|
1
|
+
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__","useState","useMemo","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","EditorProvider","routerPrivateApis","useAddedBy","usePatternSettings","unlock","jsx","_jsx","jsxs","_jsxs","useLink","useGlobalStyle","PreviewField","item","settings","backgroundColor","blocks","content","raw","onClick","type","id","isEmpty","length","post","children","className","style","title","rendered","Async","previewField","label","render","enableSorting","descriptionField","description","enableGlobalSearch","AuthorField","isImageLoaded","setIsImageLoaded","text","icon","imageUrl","alignment","spacing","onLoad","alt","src","authorField","getValue","author_text"],"sources":["@wordpress/edit-site/src/components/page-templates/fields.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Icon, __experimentalHStack as HStack } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { EditorProvider } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from './hooks';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLink } = unlock( routerPrivateApis );\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction PreviewField( { item } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( item.content.raw );\n\t}, [ item.content.raw ] );\n\tconst { onClick } = useLink( `/${ item.type }/${ item.id }?canvas=edit` );\n\n\tconst isEmpty = ! blocks?.length;\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider post={ item } settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName=\"page-templates-preview-field\"\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t<button\n\t\t\t\t\tclassName=\"page-templates-preview-field__button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\taria-label={ item.title?.rendered || item.title }\n\t\t\t\t>\n\t\t\t\t\t{ isEmpty && __( 'Empty template' ) }\n\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t\t) }\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</EditorProvider>\n\t);\n}\n\nexport const previewField = {\n\tlabel: __( 'Preview' ),\n\tid: 'preview',\n\trender: PreviewField,\n\tenableSorting: false,\n};\n\nexport const descriptionField = {\n\tlabel: __( 'Description' ),\n\tid: 'description',\n\trender: ( { item } ) => {\n\t\treturn (\n\t\t\titem.description && (\n\t\t\t\t<span className=\"page-templates-description\">\n\t\t\t\t\t{ decodeEntities( item.description ) }\n\t\t\t\t</span>\n\t\t\t)\n\t\t);\n\t},\n\tenableSorting: false,\n\tenableGlobalSearch: true,\n};\n\nfunction AuthorField( { item } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport const authorField = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\tgetValue: ( { item } ) => item.author_text,\n\trender: AuthorField,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,IAAI,EAAEC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SACCC,YAAY,EACZC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASF,WAAW,IAAIG,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,UAAU,QAAQ,SAAS;AACpC,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC;AAAQ,CAAC,GAAGL,MAAM,CAAEH,iBAAkB,CAAC;AAC/C,MAAM;EAAES;AAAe,CAAC,GAAGN,MAAM,CAAEL,sBAAuB,CAAC;AAE3D,SAASY,YAAYA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACjC,MAAMC,QAAQ,GAAGV,kBAAkB,CAAC,CAAC;EACrC,MAAM,CAAEW,eAAe,GAAG,OAAO,CAAE,GAAGJ,cAAc,CAAE,kBAAmB,CAAC;EAC1E,MAAMK,MAAM,GAAGrB,OAAO,CAAE,MAAM;IAC7B,OAAOE,K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,EAAE,EAAE,QAAQ;EACZ6B,QAAQ,EAAEA,CAAE;IAAErC;EAAK,CAAC,KAAMA,IAAI,CAACsC,WAAW;EAC1ClB,MAAM,EAAEK;AACT,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* wp:polyfill */
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -8,6 +7,8 @@ import { privateApis as corePrivateApis } from '@wordpress/core-data';
|
|
|
8
7
|
import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
|
|
9
8
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
10
9
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
|
+
import { templateTitleField } from '@wordpress/fields';
|
|
11
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -17,7 +18,7 @@ import AddNewTemplate from '../add-new-template';
|
|
|
17
18
|
import { TEMPLATE_POST_TYPE, OPERATOR_IS_ANY, LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST } from '../../utils/constants';
|
|
18
19
|
import { unlock } from '../../lock-unlock';
|
|
19
20
|
import { useEditPostAction } from '../dataviews-actions';
|
|
20
|
-
import { authorField, descriptionField, previewField
|
|
21
|
+
import { authorField, descriptionField, previewField } from './fields';
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
const {
|
|
23
24
|
usePostActions
|
|
@@ -32,23 +33,9 @@ const {
|
|
|
32
33
|
const EMPTY_ARRAY = [];
|
|
33
34
|
const defaultLayouts = {
|
|
34
35
|
[LAYOUT_TABLE]: {
|
|
35
|
-
|
|
36
|
+
showMedia: false,
|
|
36
37
|
layout: {
|
|
37
|
-
primaryField: 'title',
|
|
38
|
-
combinedFields: [{
|
|
39
|
-
id: 'template',
|
|
40
|
-
label: __('Template'),
|
|
41
|
-
children: ['title', 'description'],
|
|
42
|
-
direction: 'vertical'
|
|
43
|
-
}],
|
|
44
38
|
styles: {
|
|
45
|
-
template: {
|
|
46
|
-
maxWidth: 400,
|
|
47
|
-
minWidth: 320
|
|
48
|
-
},
|
|
49
|
-
preview: {
|
|
50
|
-
width: '1%'
|
|
51
|
-
},
|
|
52
39
|
author: {
|
|
53
40
|
width: '1%'
|
|
54
41
|
}
|
|
@@ -56,18 +43,10 @@ const defaultLayouts = {
|
|
|
56
43
|
}
|
|
57
44
|
},
|
|
58
45
|
[LAYOUT_GRID]: {
|
|
59
|
-
|
|
60
|
-
layout: {
|
|
61
|
-
mediaField: 'preview',
|
|
62
|
-
primaryField: 'title',
|
|
63
|
-
columnFields: ['description']
|
|
64
|
-
}
|
|
46
|
+
showMedia: true
|
|
65
47
|
},
|
|
66
48
|
[LAYOUT_LIST]: {
|
|
67
|
-
|
|
68
|
-
layout: {
|
|
69
|
-
primaryField: 'title'
|
|
70
|
-
}
|
|
49
|
+
showMedia: false
|
|
71
50
|
}
|
|
72
51
|
};
|
|
73
52
|
const DEFAULT_VIEW = {
|
|
@@ -79,45 +58,50 @@ const DEFAULT_VIEW = {
|
|
|
79
58
|
field: 'title',
|
|
80
59
|
direction: 'asc'
|
|
81
60
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
61
|
+
titleField: 'title',
|
|
62
|
+
descriptionField: 'description',
|
|
63
|
+
mediaField: 'preview',
|
|
64
|
+
fields: ['author'],
|
|
65
|
+
filters: [],
|
|
66
|
+
...defaultLayouts[LAYOUT_GRID]
|
|
85
67
|
};
|
|
86
68
|
export default function PageTemplates() {
|
|
87
69
|
const {
|
|
88
|
-
|
|
70
|
+
path,
|
|
71
|
+
query
|
|
89
72
|
} = useLocation();
|
|
90
73
|
const {
|
|
91
74
|
activeView = 'all',
|
|
92
75
|
layout,
|
|
93
76
|
postId
|
|
94
|
-
} =
|
|
77
|
+
} = query;
|
|
95
78
|
const [selection, setSelection] = useState([postId]);
|
|
96
79
|
const defaultView = useMemo(() => {
|
|
97
80
|
const usedType = layout !== null && layout !== void 0 ? layout : DEFAULT_VIEW.type;
|
|
98
81
|
return {
|
|
99
82
|
...DEFAULT_VIEW,
|
|
100
83
|
type: usedType,
|
|
101
|
-
layout: defaultLayouts[usedType].layout,
|
|
102
|
-
fields: defaultLayouts[usedType].fields,
|
|
103
84
|
filters: activeView !== 'all' ? [{
|
|
104
85
|
field: 'author',
|
|
105
86
|
operator: 'isAny',
|
|
106
87
|
value: [activeView]
|
|
107
|
-
}] : []
|
|
88
|
+
}] : [],
|
|
89
|
+
...defaultLayouts[usedType]
|
|
108
90
|
};
|
|
109
91
|
}, [layout, activeView]);
|
|
110
92
|
const [view, setView] = useState(defaultView);
|
|
111
93
|
useEffect(() => {
|
|
94
|
+
const usedType = layout !== null && layout !== void 0 ? layout : DEFAULT_VIEW.type;
|
|
112
95
|
setView(currentView => ({
|
|
113
96
|
...currentView,
|
|
97
|
+
type: usedType,
|
|
114
98
|
filters: activeView !== 'all' ? [{
|
|
115
99
|
field: 'author',
|
|
116
100
|
operator: OPERATOR_IS_ANY,
|
|
117
101
|
value: [activeView]
|
|
118
102
|
}] : []
|
|
119
103
|
}));
|
|
120
|
-
}, [activeView]);
|
|
104
|
+
}, [activeView, layout]);
|
|
121
105
|
const {
|
|
122
106
|
records,
|
|
123
107
|
isResolving: isLoadingData
|
|
@@ -128,12 +112,11 @@ export default function PageTemplates() {
|
|
|
128
112
|
const onChangeSelection = useCallback(items => {
|
|
129
113
|
setSelection(items);
|
|
130
114
|
if (view?.type === LAYOUT_LIST) {
|
|
131
|
-
history.
|
|
132
|
-
...params,
|
|
115
|
+
history.navigate(addQueryArgs(path, {
|
|
133
116
|
postId: items.length === 1 ? items[0] : undefined
|
|
134
|
-
});
|
|
117
|
+
}));
|
|
135
118
|
}
|
|
136
|
-
}, [history,
|
|
119
|
+
}, [history, path, view?.type]);
|
|
137
120
|
const authors = useMemo(() => {
|
|
138
121
|
if (!records) {
|
|
139
122
|
return EMPTY_ARRAY;
|
|
@@ -147,7 +130,7 @@ export default function PageTemplates() {
|
|
|
147
130
|
label: author
|
|
148
131
|
}));
|
|
149
132
|
}, [records]);
|
|
150
|
-
const fields = useMemo(() => [previewField,
|
|
133
|
+
const fields = useMemo(() => [previewField, templateTitleField, descriptionField, {
|
|
151
134
|
...authorField,
|
|
152
135
|
elements: authors
|
|
153
136
|
}], [authors]);
|
|
@@ -165,13 +148,12 @@ export default function PageTemplates() {
|
|
|
165
148
|
const actions = useMemo(() => [editAction, ...postTypeActions], [postTypeActions, editAction]);
|
|
166
149
|
const onChangeView = useCallback(newView => {
|
|
167
150
|
if (newView.type !== view.type) {
|
|
168
|
-
history.
|
|
169
|
-
...params,
|
|
151
|
+
history.navigate(addQueryArgs(path, {
|
|
170
152
|
layout: newView.type
|
|
171
|
-
});
|
|
153
|
+
}));
|
|
172
154
|
}
|
|
173
155
|
setView(newView);
|
|
174
|
-
}, [view.type, setView, history,
|
|
156
|
+
}, [view.type, setView, history, path]);
|
|
175
157
|
return /*#__PURE__*/_jsx(Page, {
|
|
176
158
|
className: "edit-site-page-templates",
|
|
177
159
|
title: __('Templates'),
|
|
@@ -185,6 +167,12 @@ export default function PageTemplates() {
|
|
|
185
167
|
view: view,
|
|
186
168
|
onChangeView: onChangeView,
|
|
187
169
|
onChangeSelection: onChangeSelection,
|
|
170
|
+
isItemClickable: () => true,
|
|
171
|
+
onClickItem: ({
|
|
172
|
+
id
|
|
173
|
+
}) => {
|
|
174
|
+
history.navigate(`/wp_template/${id}?canvas=edit`);
|
|
175
|
+
},
|
|
188
176
|
selection: selection,
|
|
189
177
|
defaultLayouts: defaultLayouts
|
|
190
178
|
}, activeView)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useState","useMemo","useCallback","useEffect","privateApis","corePrivateApis","DataViews","filterSortAndPaginate","routerPrivateApis","editorPrivateApis","Page","AddNewTemplate","TEMPLATE_POST_TYPE","OPERATOR_IS_ANY","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","unlock","useEditPostAction","authorField","descriptionField","previewField","titleField","jsx","_jsx","usePostActions","useHistory","useLocation","useEntityRecordsWithPermissions","EMPTY_ARRAY","defaultLayouts","fields","layout","primaryField","combinedFields","id","label","children","direction","styles","template","maxWidth","minWidth","preview","width","author","mediaField","columnFields","DEFAULT_VIEW","type","search","page","perPage","sort","field","filters","PageTemplates","params","activeView","postId","selection","setSelection","defaultView","usedType","operator","value","view","setView","currentView","records","isResolving","isLoadingData","per_page","history","onChangeSelection","items","push","length","undefined","authors","authorsSet","Set","forEach","add","author_text","Array","from","map","elements","data","paginationInfo","postTypeActions","postType","context","editAction","actions","onChangeView","newView","className","title","isLoading"],"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport AddNewTemplate from '../add-new-template';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tOPERATOR_IS_ANY,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {\n\tauthorField,\n\tdescriptionField,\n\tpreviewField,\n\ttitleField,\n} from './fields';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tfields: [ 'template', 'author' ],\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tcombinedFields: [\n\t\t\t\t{\n\t\t\t\t\tid: 'template',\n\t\t\t\t\tlabel: __( 'Template' ),\n\t\t\t\t\tchildren: [ 'title', 'description' ],\n\t\t\t\t\tdirection: 'vertical',\n\t\t\t\t},\n\t\t\t],\n\t\t\tstyles: {\n\t\t\t\ttemplate: {\n\t\t\t\t\tmaxWidth: 400,\n\t\t\t\t\tminWidth: 320,\n\t\t\t\t},\n\t\t\t\tpreview: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tfields: [ 'title', 'description', 'author' ],\n\t\tlayout: {\n\t\t\tmediaField: 'preview',\n\t\t\tprimaryField: 'title',\n\t\t\tcolumnFields: [ 'description' ],\n\t\t},\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tfields: [ 'title', 'description', 'author' ],\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t},\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\tfields: defaultLayouts[ LAYOUT_GRID ].fields,\n\tlayout: defaultLayouts[ LAYOUT_GRID ].layout,\n\tfilters: [],\n};\n\nexport default function PageTemplates() {\n\tconst { params } = useLocation();\n\tconst { activeView = 'all', layout, postId } = params;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\n\tconst defaultView = useMemo( () => {\n\t\tconst usedType = layout ?? DEFAULT_VIEW.type;\n\t\treturn {\n\t\t\t...DEFAULT_VIEW,\n\t\t\ttype: usedType,\n\t\t\tlayout: defaultLayouts[ usedType ].layout,\n\t\t\tfields: defaultLayouts[ usedType ].fields,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t};\n\t}, [ layout, activeView ] );\n\tconst [ view, setView ] = useState( defaultView );\n\tuseEffect( () => {\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t} ) );\n\t}, [ activeView ] );\n\n\tconst { records, isResolving: isLoadingData } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === LAYOUT_LIST ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history, params, view?.type ]\n\t);\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\tpreviewField,\n\t\t\ttitleField,\n\t\t\tdescriptionField,\n\t\t\t{\n\t\t\t\t...authorField,\n\t\t\t\telements: authors,\n\t\t\t},\n\t\t],\n\t\t[ authors ]\n\t);\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst onChangeView = useCallback(\n\t\t( newView ) => {\n\t\t\tif ( newView.type !== view.type ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tsetView( newView );\n\t\t},\n\t\t[ view.type, setView, history, params ]\n\t);\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={ <AddNewTemplate /> }\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,QAAQ,oBAAoB;AAC9E,SAASC,WAAW,IAAIC,eAAe,QAAQ,sBAAsB;AACrE,SA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,YAAY,GAAG9F,WAAW,CAC7B+F,OAAO,IAAM;IACd,IAAKA,OAAO,CAAChD,IAAI,KAAKiB,IAAI,CAACjB,IAAI,EAAG;MACjCwB,OAAO,CAACG,IAAI,CAAE;QACb,GAAGnB,MAAM;QACTzB,MAAM,EAAEiE,OAAO,CAAChD;MACjB,CAAE,CAAC;IACJ;IAEAkB,OAAO,CAAE8B,OAAQ,CAAC;EACnB,CAAC,EACD,CAAE/B,IAAI,CAACjB,IAAI,EAAEkB,OAAO,EAAEM,OAAO,EAAEhB,MAAM,CACtC,CAAC;EAED,oBACCjC,IAAA,CAACd,IAAI;IACJwF,SAAS,EAAC,0BAA0B;IACpCC,KAAK,EAAGpG,EAAE,CAAE,WAAY,CAAG;IAC3BgG,OAAO,eAAGvE,IAAA,CAACb,cAAc,IAAE,CAAG;IAAA0B,QAAA,eAE9Bb,IAAA,CAAClB,SAAS;MAEToF,cAAc,EAAGA,cAAgB;MACjC3D,MAAM,EAAGA,MAAQ;MACjBgE,OAAO,EAAGA,OAAS;MACnBN,IAAI,EAAGA,IAAM;MACbW,SAAS,EAAG7B,aAAe;MAC3BL,IAAI,EAAGA,IAAM;MACb8B,YAAY,EAAGA,YAAc;MAC7BtB,iBAAiB,EAAGA,iBAAmB;MACvCd,SAAS,EAAGA,SAAW;MACvB9B,cAAc,EAAGA;IAAgB,GAV3B4B,UAWN;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","useState","useMemo","useCallback","useEffect","privateApis","corePrivateApis","DataViews","filterSortAndPaginate","routerPrivateApis","editorPrivateApis","templateTitleField","addQueryArgs","Page","AddNewTemplate","TEMPLATE_POST_TYPE","OPERATOR_IS_ANY","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","unlock","useEditPostAction","authorField","descriptionField","previewField","jsx","_jsx","usePostActions","useHistory","useLocation","useEntityRecordsWithPermissions","EMPTY_ARRAY","defaultLayouts","showMedia","layout","styles","author","width","DEFAULT_VIEW","type","search","page","perPage","sort","field","direction","titleField","mediaField","fields","filters","PageTemplates","path","query","activeView","postId","selection","setSelection","defaultView","usedType","operator","value","view","setView","currentView","records","isResolving","isLoadingData","per_page","history","onChangeSelection","items","navigate","length","undefined","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","label","elements","data","paginationInfo","postTypeActions","postType","context","editAction","actions","onChangeView","newView","className","title","children","isLoading","isItemClickable","onClickItem","id"],"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { templateTitleField } from '@wordpress/fields';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport AddNewTemplate from '../add-new-template';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tOPERATOR_IS_ANY,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { authorField, descriptionField, previewField } from './fields';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tshowMedia: false,\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tshowMedia: true,\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tshowMedia: false,\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\ttitleField: 'title',\n\tdescriptionField: 'description',\n\tmediaField: 'preview',\n\tfields: [ 'author' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'all', layout, postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\n\tconst defaultView = useMemo( () => {\n\t\tconst usedType = layout ?? DEFAULT_VIEW.type;\n\t\treturn {\n\t\t\t...DEFAULT_VIEW,\n\t\t\ttype: usedType,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t\t...defaultLayouts[ usedType ],\n\t\t};\n\t}, [ layout, activeView ] );\n\tconst [ view, setView ] = useState( defaultView );\n\tuseEffect( () => {\n\t\tconst usedType = layout ?? DEFAULT_VIEW.type;\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\ttype: usedType,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t} ) );\n\t}, [ activeView, layout ] );\n\n\tconst { records, isResolving: isLoadingData } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === LAYOUT_LIST ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, path, view?.type ]\n\t);\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\tpreviewField,\n\t\t\ttemplateTitleField,\n\t\t\tdescriptionField,\n\t\t\t{\n\t\t\t\t...authorField,\n\t\t\t\telements: authors,\n\t\t\t},\n\t\t],\n\t\t[ authors ]\n\t);\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst onChangeView = useCallback(\n\t\t( newView ) => {\n\t\t\tif ( newView.type !== view.type ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tlayout: newView.type,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tsetView( newView );\n\t\t},\n\t\t[ view.type, setView, history, path ]\n\t);\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={ <AddNewTemplate /> }\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ () => true }\n\t\t\t\tonClickItem={ ( { id } ) => {\n\t\t\t\t\thistory.navigate( `/wp_template/${ id }?canvas=edit` );\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,QAAQ,oBAAoB;AAC9E,SAASC,WAAW,IAAIC,eAAe,QAAQ,sBAAsB;AACrE,SAASC,SAAS,EAAEC,qBAAqB,QAAQ,sBAAsB;AACvE,SAASH,WAAW,IAAII,iBAAiB,QAAQ,mBAAmB;AACpE,SAASJ,WAAW,IAAIK,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,cAAc,MAAM,qBAAqB;AAChD,SACCC,kBAAkB,EAClBC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,WAAW,QACL,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,iB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