@wordpress/edit-site 6.34.0 → 6.34.1-next.2f1c7c01b.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 +6 -4
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-post/index.js +3 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +4 -2
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +7 -5
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +14 -12
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +3 -1
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build/components/block-editor/use-navigate-to-entity-record.js +3 -1
- package/build/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +3 -1
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/canvas-loader/index.js +5 -3
- package/build/components/canvas-loader/index.js.map +1 -1
- package/build/components/dataviews-actions/index.js +5 -3
- package/build/components/dataviews-actions/index.js.map +1 -1
- package/build/components/editor/index.js +8 -6
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/site-preview.js +3 -1
- package/build/components/editor/site-preview.js.map +1 -1
- package/build/components/editor/use-adapt-editor-to-canvas.js +2 -0
- package/build/components/editor/use-adapt-editor-to-canvas.js.map +1 -1
- package/build/components/editor/use-editor-title.js +3 -1
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +5 -3
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -1
- package/build/components/layout/animation.js +3 -1
- package/build/components/layout/animation.js.map +1 -1
- package/build/components/layout/hooks.js +3 -1
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +6 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/media/index.js +3 -1
- package/build/components/media/index.js.map +1 -1
- package/build/components/more-menu/index.js +4 -2
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/site-export.js +3 -1
- package/build/components/more-menu/site-export.js.map +1 -1
- package/build/components/more-menu/welcome-guide-menu-item.js +3 -1
- package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -1
- package/build/components/page-patterns/actions.js +3 -1
- package/build/components/page-patterns/actions.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +4 -2
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/fields.js +8 -6
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-patterns/index.js +9 -7
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +4 -2
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/search-items.js +10 -8
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-pattern-settings.js +2 -0
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +8 -6
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-patterns/utils.js +3 -1
- package/build/components/page-patterns/utils.js.map +1 -1
- package/build/components/page-templates/fields.js +14 -12
- package/build/components/page-templates/fields.js.map +2 -2
- package/build/components/page-templates/hooks.js +2 -0
- package/build/components/page-templates/hooks.js.map +1 -1
- package/build/components/page-templates/index.js +16 -11
- package/build/components/page-templates/index.js.map +2 -2
- package/build/components/page-templates/view-utils.js +8 -2
- package/build/components/page-templates/view-utils.js.map +2 -2
- package/build/components/pagination/index.js +3 -1
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +5 -3
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/post-edit/index.js +5 -3
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +8 -6
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/post-list/view-utils.js +5 -3
- package/build/components/post-list/view-utils.js.map +1 -1
- package/build/components/posts-app/index.js +4 -2
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app-routes/index.js +3 -1
- package/build/components/posts-app-routes/index.js.map +1 -1
- package/build/components/posts-app-routes/post-item.js +4 -2
- package/build/components/posts-app-routes/post-item.js.map +1 -1
- package/build/components/posts-app-routes/posts.js +5 -3
- package/build/components/posts-app-routes/posts.js.map +1 -1
- package/build/components/resizable-frame/index.js +10 -8
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/routes/use-title.js +3 -1
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +3 -1
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-keyboard-shortcut/index.js +3 -1
- package/build/components/save-keyboard-shortcut/index.js.map +1 -1
- package/build/components/save-panel/index.js +7 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +4 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +3 -1
- package/build/components/sidebar-button/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +4 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -2
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-global-styles/index.js +7 -5
- package/build/components/sidebar-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +4 -2
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +4 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +3 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/content.js +4 -2
- package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +3 -1
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +3 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +5 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +5 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +4 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +4 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +3 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +4 -2
- 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 +5 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +6 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +4 -2
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +2 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +2 -0
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -0
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +5 -3
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +3 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-unsupported/index.js +3 -1
- package/build/components/sidebar-navigation-screen-unsupported/index.js.map +1 -1
- package/build/components/site-editor-routes/home.js +4 -2
- package/build/components/site-editor-routes/home.js.map +1 -1
- package/build/components/site-editor-routes/index.js +3 -1
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/site-editor-routes/navigation-item.js +5 -3
- package/build/components/site-editor-routes/navigation-item.js.map +1 -1
- package/build/components/site-editor-routes/navigation.js +5 -3
- package/build/components/site-editor-routes/navigation.js.map +1 -1
- package/build/components/site-editor-routes/notfound.js +4 -2
- package/build/components/site-editor-routes/notfound.js.map +1 -1
- package/build/components/site-editor-routes/page-item.js +4 -2
- package/build/components/site-editor-routes/page-item.js.map +1 -1
- package/build/components/site-editor-routes/pages.js +5 -3
- package/build/components/site-editor-routes/pages.js.map +1 -1
- package/build/components/site-editor-routes/pattern-item.js +4 -2
- package/build/components/site-editor-routes/pattern-item.js.map +1 -1
- package/build/components/site-editor-routes/patterns.js +4 -2
- package/build/components/site-editor-routes/patterns.js.map +1 -1
- package/build/components/site-editor-routes/stylebook.js +5 -3
- package/build/components/site-editor-routes/stylebook.js.map +1 -1
- package/build/components/site-editor-routes/styles.js +6 -4
- package/build/components/site-editor-routes/styles.js.map +1 -1
- package/build/components/site-editor-routes/template-item.js +5 -3
- package/build/components/site-editor-routes/template-item.js.map +1 -1
- package/build/components/site-editor-routes/template-part-item.js +4 -2
- package/build/components/site-editor-routes/template-part-item.js.map +1 -1
- package/build/components/site-editor-routes/templates.js +4 -2
- package/build/components/site-editor-routes/templates.js.map +1 -1
- package/build/components/site-editor-routes/utils.js +2 -0
- package/build/components/site-editor-routes/utils.js.map +1 -1
- package/build/components/site-hub/index.js +6 -4
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +3 -1
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +3 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/image.js +2 -0
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +3 -1
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +3 -1
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +5 -3
- package/build/deprecated.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +7 -5
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +4 -2
- package/build/hooks/commands/use-set-command-context.js.map +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +3 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/posts.js +3 -1
- package/build/posts.js.map +1 -1
- package/build/store/actions.js +14 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +3 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +4 -2
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +2 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +2 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +2 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -9
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +18 -16
- package/build/utils/constants.js.map +1 -1
- package/build/utils/get-filtered-template-parts.js +3 -1
- package/build/utils/get-filtered-template-parts.js.map +1 -1
- package/build/utils/is-previewing-theme.js +2 -0
- package/build/utils/is-previewing-theme.js.map +1 -1
- package/build/utils/is-template-removable.js +2 -0
- package/build/utils/is-template-removable.js.map +1 -1
- package/build/utils/is-template-revertable.js +2 -0
- package/build/utils/is-template-revertable.js.map +2 -2
- package/build/utils/use-activate-theme.js +3 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build/utils/use-actual-current-theme.js +3 -1
- package/build/utils/use-actual-current-theme.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +5 -4
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-post/index.js +2 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +2 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -2
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/index.js +6 -5
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +13 -12
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +3 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +2 -1
- 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 +2 -1
- 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 +2 -1
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/canvas-loader/index.js +4 -3
- package/build-module/components/canvas-loader/index.js.map +1 -1
- package/build-module/components/dataviews-actions/index.js +4 -3
- package/build-module/components/dataviews-actions/index.js.map +1 -1
- package/build-module/components/editor/index.js +7 -6
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/site-preview.js +2 -1
- package/build-module/components/editor/site-preview.js.map +1 -1
- package/build-module/components/editor/use-adapt-editor-to-canvas.js +1 -0
- package/build-module/components/editor/use-adapt-editor-to-canvas.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +2 -1
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +4 -3
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -1
- package/build-module/components/layout/animation.js +2 -1
- package/build-module/components/layout/animation.js.map +1 -1
- package/build-module/components/layout/hooks.js +2 -1
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +5 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/media/index.js +2 -1
- package/build-module/components/media/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +3 -2
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/site-export.js +2 -1
- package/build-module/components/more-menu/site-export.js.map +1 -1
- package/build-module/components/more-menu/welcome-guide-menu-item.js +2 -1
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/actions.js +2 -1
- package/build-module/components/page-patterns/actions.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +3 -2
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +7 -6
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-patterns/index.js +8 -7
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +3 -2
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +11 -10
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-pattern-settings.js +1 -0
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +7 -6
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-patterns/utils.js +2 -1
- package/build-module/components/page-patterns/utils.js.map +1 -1
- package/build-module/components/page-templates/fields.js +13 -12
- package/build-module/components/page-templates/fields.js.map +2 -2
- package/build-module/components/page-templates/hooks.js +1 -0
- package/build-module/components/page-templates/hooks.js.map +1 -1
- package/build-module/components/page-templates/index.js +15 -11
- package/build-module/components/page-templates/index.js.map +2 -2
- package/build-module/components/page-templates/view-utils.js +7 -2
- package/build-module/components/page-templates/view-utils.js.map +2 -2
- package/build-module/components/pagination/index.js +2 -1
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +4 -3
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +4 -3
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +7 -6
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/post-list/view-utils.js +4 -3
- package/build-module/components/post-list/view-utils.js.map +1 -1
- package/build-module/components/posts-app/index.js +3 -2
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app-routes/index.js +2 -1
- package/build-module/components/posts-app-routes/index.js.map +1 -1
- package/build-module/components/posts-app-routes/post-item.js +3 -2
- package/build-module/components/posts-app-routes/post-item.js.map +1 -1
- package/build-module/components/posts-app-routes/posts.js +4 -3
- package/build-module/components/posts-app-routes/posts.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +9 -8
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/routes/use-title.js +2 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +3 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +2 -1
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-keyboard-shortcut/index.js +2 -1
- package/build-module/components/save-keyboard-shortcut/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +6 -5
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +2 -1
- package/build-module/components/sidebar-button/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +3 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +3 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-global-styles/index.js +6 -5
- package/build-module/components/sidebar-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +3 -2
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +3 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js +3 -2
- 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 +3 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +2 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +4 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +3 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +2 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -1
- 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/build-navigation-label.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +3 -2
- 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 +5 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +5 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +4 -3
- 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 +2 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-unsupported/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-unsupported/index.js.map +1 -1
- package/build-module/components/site-editor-routes/home.js +3 -2
- package/build-module/components/site-editor-routes/home.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +2 -1
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/site-editor-routes/navigation-item.js +4 -3
- package/build-module/components/site-editor-routes/navigation-item.js.map +1 -1
- package/build-module/components/site-editor-routes/navigation.js +4 -3
- package/build-module/components/site-editor-routes/navigation.js.map +1 -1
- package/build-module/components/site-editor-routes/notfound.js +3 -2
- package/build-module/components/site-editor-routes/notfound.js.map +1 -1
- package/build-module/components/site-editor-routes/page-item.js +3 -2
- package/build-module/components/site-editor-routes/page-item.js.map +1 -1
- package/build-module/components/site-editor-routes/pages.js +4 -3
- package/build-module/components/site-editor-routes/pages.js.map +1 -1
- package/build-module/components/site-editor-routes/pattern-item.js +3 -2
- package/build-module/components/site-editor-routes/pattern-item.js.map +1 -1
- package/build-module/components/site-editor-routes/patterns.js +3 -2
- package/build-module/components/site-editor-routes/patterns.js.map +1 -1
- package/build-module/components/site-editor-routes/stylebook.js +4 -3
- package/build-module/components/site-editor-routes/stylebook.js.map +1 -1
- package/build-module/components/site-editor-routes/styles.js +5 -4
- package/build-module/components/site-editor-routes/styles.js.map +1 -1
- package/build-module/components/site-editor-routes/template-item.js +4 -3
- package/build-module/components/site-editor-routes/template-item.js.map +1 -1
- package/build-module/components/site-editor-routes/template-part-item.js +3 -2
- package/build-module/components/site-editor-routes/template-part-item.js.map +1 -1
- package/build-module/components/site-editor-routes/templates.js +3 -2
- package/build-module/components/site-editor-routes/templates.js.map +1 -1
- package/build-module/components/site-editor-routes/utils.js +1 -0
- package/build-module/components/site-editor-routes/utils.js.map +1 -1
- package/build-module/components/site-hub/index.js +5 -4
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +2 -1
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +2 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +1 -0
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +2 -1
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +2 -1
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +4 -3
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +6 -5
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +3 -2
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
- package/build-module/index.js +7 -6
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/posts.js +2 -1
- package/build-module/posts.js.map +1 -1
- package/build-module/store/actions.js +13 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +2 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +3 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +1 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +10 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +17 -16
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/get-filtered-template-parts.js +2 -1
- package/build-module/utils/get-filtered-template-parts.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +1 -0
- package/build-module/utils/is-previewing-theme.js.map +1 -1
- package/build-module/utils/is-template-removable.js +1 -0
- package/build-module/utils/is-template-removable.js.map +1 -1
- package/build-module/utils/is-template-revertable.js +1 -0
- package/build-module/utils/is-template-revertable.js.map +2 -2
- package/build-module/utils/use-activate-theme.js +2 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-module/utils/use-actual-current-theme.js +2 -1
- package/build-module/utils/use-actual-current-theme.js.map +1 -1
- package/package.json +46 -46
- package/src/components/page-templates/fields.js +3 -3
- package/src/components/page-templates/index.js +11 -7
- package/src/components/page-templates/view-utils.js +7 -0
- package/src/utils/is-template-revertable.js +1 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-templates/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport {\n\tprivateApis as corePrivateApis,\n\tstore as coreStore,\n} 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 { addQueryArgs } from '@wordpress/url';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEvent } from '@wordpress/compose';\nimport { useView } from '@wordpress/views';\nimport { Button, Modal } from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tuseEditPostAction,\n\tuseSetActiveTemplateAction,\n} from '../dataviews-actions';\nimport {\n\tauthorField,\n\tdescriptionField,\n\tpreviewField,\n\tactiveField,\n\tslugField,\n\tuseThemeField,\n} from './fields';\nimport { defaultLayouts, getDefaultView } from './view-utils';\n\nconst { usePostActions, templateTitleField } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'active', postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\tconst [ selectedRegisteredTemplate, setSelectedRegisteredTemplate ] =\n\t\tuseState( false );\n\tconst defaultView = useMemo( () => {\n\t\treturn getDefaultView( activeView );\n\t}, [ activeView ] );\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t\tslug: activeView,\n\t\tdefaultView,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( newQueryParams ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: newQueryParams.page,\n\t\t\t\t\tsearch: newQueryParams.search || undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\n\tconst { activeTemplatesOption, activeTheme, defaultTemplateTypes } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEntityRecord, getCurrentTheme } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tactiveTemplatesOption: getEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.active_templates,\n\t\t\t\tactiveTheme: getCurrentTheme(),\n\t\t\t\tdefaultTemplateTypes:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t\t\t?.default_template_types,\n\t\t\t};\n\t\t} );\n\t// Todo: this will have to be better so that we're not fetching all the\n\t// records all the time. Active templates query will need to move server\n\t// side.\n\tconst { records: userRecords, isResolving: isLoadingUserRecords } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t\tcombinedTemplates: false,\n\t\t} );\n\tconst { records: staticRecords, isResolving: isLoadingStaticData } =\n\t\tuseEntityRecordsWithPermissions( 'root', 'registeredTemplate', {\n\t\t\t// This should not be needed, the endpoint returns all registered\n\t\t\t// templates, but it's not possible right now to turn off pagination\n\t\t\t// for entity configs.\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst activeTemplates = useMemo( () => {\n\t\tconst _active = [ ...staticRecords ];\n\t\tif ( activeTemplatesOption ) {\n\t\t\tfor ( const activeSlug in activeTemplatesOption ) {\n\t\t\t\tconst activeId = activeTemplatesOption[ activeSlug ];\n\t\t\t\t// Replace the template in the array.\n\t\t\t\tconst template = userRecords.find(\n\t\t\t\t\t( userRecord ) =>\n\t\t\t\t\t\tuserRecord.id === activeId &&\n\t\t\t\t\t\tuserRecord.theme === activeTheme.stylesheet\n\t\t\t\t);\n\t\t\t\tif ( template ) {\n\t\t\t\t\tconst index = _active.findIndex(\n\t\t\t\t\t\t( { slug } ) => slug === template.slug\n\t\t\t\t\t);\n\t\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\t\t_active[ index ] = template;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_active.push( template );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn _active;\n\t}, [ userRecords, staticRecords, activeTemplatesOption, activeTheme ] );\n\n\tlet isLoadingData;\n\tif ( activeView === 'active' ) {\n\t\tisLoadingData = isLoadingUserRecords || isLoadingStaticData;\n\t} else if ( activeView === 'user' ) {\n\t\tisLoadingData = isLoadingUserRecords;\n\t} else {\n\t\tisLoadingData = isLoadingStaticData;\n\t}\n\n\tconst records = useMemo( () => {\n\t\tfunction isCustom( record ) {\n\t\t\t// For registered templates, the is_custom field is defined.\n\t\t\treturn (\n\t\t\t\trecord.is_custom ??\n\t\t\t\t// For user templates it's custom if the is_wp_suggestion meta\n\t\t\t\t// field is not set and the slug is not found in the default\n\t\t\t\t// template types.\n\t\t\t\t( ! record.meta?.is_wp_suggestion &&\n\t\t\t\t\t! defaultTemplateTypes.some(\n\t\t\t\t\t\t( type ) => type.slug === record.slug\n\t\t\t\t\t) )\n\t\t\t);\n\t\t}\n\n\t\tlet _records;\n\t\tif ( activeView === 'active' ) {\n\t\t\t// Don't show active custom templates in the active view.\n\t\t\t_records = activeTemplates.filter(\n\t\t\t\t( record ) => ! isCustom( record )\n\t\t\t);\n\t\t} else if ( activeView === 'user' ) {\n\t\t\t_records = userRecords;\n\t\t} else {\n\t\t\t_records = staticRecords;\n\t\t}\n\t\treturn _records.map( ( record ) => ( {\n\t\t\t...record,\n\t\t\t_isActive: activeTemplates.some(\n\t\t\t\t( template ) => template.id === record.id\n\t\t\t),\n\t\t\t_isCustom: isCustom( record ),\n\t\t} ) );\n\t}, [\n\t\tactiveTemplates,\n\t\tdefaultTemplateTypes,\n\t\tuserRecords,\n\t\tstaticRecords,\n\t\tactiveView,\n\t] );\n\n\tconst users = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\treturn records.reduce( ( acc, record ) => {\n\t\t\t\tif ( record.author_text ) {\n\t\t\t\t\tif ( ! acc[ record.author_text ] ) {\n\t\t\t\t\t\tacc[ record.author_text ] = record.author_text;\n\t\t\t\t\t}\n\t\t\t\t} else if ( record.author ) {\n\t\t\t\t\tif ( ! acc[ record.author ] ) {\n\t\t\t\t\t\tacc[ record.author ] = getUser( record.author );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t}, {} );\n\t\t},\n\t\t[ records ]\n\t);\n\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === '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 themeField = useThemeField();\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [\n\t\t\tpreviewField,\n\t\t\ttemplateTitleField,\n\t\t\tdescriptionField,\n\t\t\tactiveField,\n\t\t\tslugField,\n\t\t];\n\t\tif ( activeView === 'user' ) {\n\t\t\t_fields.push( themeField );\n\t\t}\n\t\tconst elements = [];\n\t\tfor ( const author in users ) {\n\t\t\telements.push( {\n\t\t\t\tvalue: users[ author ]?.id ?? author,\n\t\t\t\tlabel: users[ author ]?.name ?? author,\n\t\t\t} );\n\t\t}\n\t\t_fields.push( {\n\t\t\t...authorField,\n\t\t\telements,\n\t\t} );\n\t\treturn _fields;\n\t}, [ users, activeView, themeField ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t\tonActionPerformed,\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst setActiveTemplateAction = useSetActiveTemplateAction();\n\tconst actions = useMemo(\n\t\t() =>\n\t\t\tactiveView === 'user'\n\t\t\t\t? [ setActiveTemplateAction, editAction, ...postTypeActions ]\n\t\t\t\t: [ setActiveTemplateAction, ...postTypeActions ],\n\t\t[ postTypeActions, setActiveTemplateAction, editAction, activeView ]\n\t);\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tif ( newView.type !== view.type ) {\n\t\t\t// Retrigger the routing areas resolution.\n\t\t\thistory.invalidate();\n\t\t}\n\t\tupdateView( newView );\n\t} );\n\n\tconst duplicateAction = actions.find(\n\t\t( action ) => action.id === 'duplicate-post'\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={\n\t\t\t\t<>\n\t\t\t\t\t{ isModified && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tresetToDefault();\n\t\t\t\t\t\t\t\thistory.invalidate();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset view' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<AddNewTemplate />\n\t\t\t\t</>\n\t\t\t}\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={ ( item ) => {\n\t\t\t\t\tif ( typeof item.id === 'string' ) {\n\t\t\t\t\t\tsetSelectedRegisteredTemplate( item );\n\t\t\t\t\t} else {\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t`/${ item.type }/${ item.id }?canvas=edit`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t\t{ selectedRegisteredTemplate && duplicateAction && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Duplicate' ) }\n\t\t\t\t\tonRequestClose={ () => setSelectedRegisteredTemplate() }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<duplicateAction.RenderModal\n\t\t\t\t\t\titems={ [ selectedRegisteredTemplate ] }\n\t\t\t\t\t\tcloseModal={ () => setSelectedRegisteredTemplate() }\n\t\t\t\t\t\tonActionPerformed={ ( [ item ] ) => {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t`/${ item.type }/${ item.id }?canvas=edit`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport {\n\tprivateApis as corePrivateApis,\n\tstore as coreStore,\n} 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 { addQueryArgs } from '@wordpress/url';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEvent } from '@wordpress/compose';\nimport { useView } from '@wordpress/views';\nimport { Button, Modal } from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tuseEditPostAction,\n\tuseSetActiveTemplateAction,\n} from '../dataviews-actions';\nimport {\n\tauthorField,\n\tdescriptionField,\n\tpreviewField,\n\tactiveField,\n\tslugField,\n\tuseThemeField,\n} from './fields';\nimport { defaultLayouts, getDefaultView } from './view-utils';\n\nconst { usePostActions, usePostFields, templateTitleField } =\n\tunlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'active', postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\tconst [ selectedRegisteredTemplate, setSelectedRegisteredTemplate ] =\n\t\tuseState( false );\n\tconst defaultView = useMemo( () => {\n\t\treturn getDefaultView( activeView );\n\t}, [ activeView ] );\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t\tslug: activeView,\n\t\tdefaultView,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( newQueryParams ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: newQueryParams.page,\n\t\t\t\t\tsearch: newQueryParams.search || undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\n\tconst { activeTemplatesOption, activeTheme, defaultTemplateTypes } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEntityRecord, getCurrentTheme } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tactiveTemplatesOption: getEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.active_templates,\n\t\t\t\tactiveTheme: getCurrentTheme(),\n\t\t\t\tdefaultTemplateTypes:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t\t\t?.default_template_types,\n\t\t\t};\n\t\t} );\n\t// Todo: this will have to be better so that we're not fetching all the\n\t// records all the time. Active templates query will need to move server\n\t// side.\n\tconst { records: userRecords, isResolving: isLoadingUserRecords } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t\tcombinedTemplates: false,\n\t\t} );\n\tconst { records: staticRecords, isResolving: isLoadingStaticData } =\n\t\tuseEntityRecordsWithPermissions( 'root', 'registeredTemplate', {\n\t\t\t// This should not be needed, the endpoint returns all registered\n\t\t\t// templates, but it's not possible right now to turn off pagination\n\t\t\t// for entity configs.\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst activeTemplates = useMemo( () => {\n\t\tconst _active = [ ...staticRecords ];\n\t\tif ( activeTemplatesOption ) {\n\t\t\tfor ( const activeSlug in activeTemplatesOption ) {\n\t\t\t\tconst activeId = activeTemplatesOption[ activeSlug ];\n\t\t\t\t// Replace the template in the array.\n\t\t\t\tconst template = userRecords.find(\n\t\t\t\t\t( userRecord ) =>\n\t\t\t\t\t\tuserRecord.id === activeId &&\n\t\t\t\t\t\tuserRecord.theme === activeTheme.stylesheet\n\t\t\t\t);\n\t\t\t\tif ( template ) {\n\t\t\t\t\tconst index = _active.findIndex(\n\t\t\t\t\t\t( { slug } ) => slug === template.slug\n\t\t\t\t\t);\n\t\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\t\t_active[ index ] = template;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_active.push( template );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn _active;\n\t}, [ userRecords, staticRecords, activeTemplatesOption, activeTheme ] );\n\n\tlet isLoadingData;\n\tif ( activeView === 'active' ) {\n\t\tisLoadingData = isLoadingUserRecords || isLoadingStaticData;\n\t} else if ( activeView === 'user' ) {\n\t\tisLoadingData = isLoadingUserRecords;\n\t} else {\n\t\tisLoadingData = isLoadingStaticData;\n\t}\n\n\tconst records = useMemo( () => {\n\t\tfunction isCustom( record ) {\n\t\t\t// For registered templates, the is_custom field is defined.\n\t\t\treturn (\n\t\t\t\trecord.is_custom ??\n\t\t\t\t// For user templates it's custom if the is_wp_suggestion meta\n\t\t\t\t// field is not set and the slug is not found in the default\n\t\t\t\t// template types.\n\t\t\t\t( ! record.meta?.is_wp_suggestion &&\n\t\t\t\t\t! defaultTemplateTypes.some(\n\t\t\t\t\t\t( type ) => type.slug === record.slug\n\t\t\t\t\t) )\n\t\t\t);\n\t\t}\n\n\t\tlet _records;\n\t\tif ( activeView === 'active' ) {\n\t\t\t// Don't show active custom templates in the active view.\n\t\t\t_records = activeTemplates.filter(\n\t\t\t\t( record ) => ! isCustom( record )\n\t\t\t);\n\t\t} else if ( activeView === 'user' ) {\n\t\t\t_records = userRecords;\n\t\t} else {\n\t\t\t_records = staticRecords;\n\t\t}\n\t\treturn _records.map( ( record ) => ( {\n\t\t\t...record,\n\t\t\t_isActive: activeTemplates.some(\n\t\t\t\t( template ) => template.id === record.id\n\t\t\t),\n\t\t\t_isCustom: isCustom( record ),\n\t\t} ) );\n\t}, [\n\t\tactiveTemplates,\n\t\tdefaultTemplateTypes,\n\t\tuserRecords,\n\t\tstaticRecords,\n\t\tactiveView,\n\t] );\n\n\tconst users = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\treturn records.reduce( ( acc, record ) => {\n\t\t\t\tif ( record.author_text ) {\n\t\t\t\t\tif ( ! acc[ record.author_text ] ) {\n\t\t\t\t\t\tacc[ record.author_text ] = record.author_text;\n\t\t\t\t\t}\n\t\t\t\t} else if ( record.author ) {\n\t\t\t\t\tif ( ! acc[ record.author ] ) {\n\t\t\t\t\t\tacc[ record.author ] = getUser( record.author );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t}, {} );\n\t\t},\n\t\t[ records ]\n\t);\n\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === '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 postTypeFields = usePostFields( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t} );\n\tconst dateField = postTypeFields.find( ( field ) => field.id === 'date' );\n\tconst themeField = useThemeField();\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [\n\t\t\tpreviewField,\n\t\t\ttemplateTitleField,\n\t\t\tdescriptionField,\n\t\t\tactiveField,\n\t\t\tslugField,\n\t\t];\n\t\tif ( activeView === 'user' ) {\n\t\t\t_fields.push( themeField );\n\t\t\tif ( dateField ) {\n\t\t\t\t_fields.push( dateField );\n\t\t\t}\n\t\t}\n\t\tconst elements = [];\n\t\tfor ( const author in users ) {\n\t\t\telements.push( {\n\t\t\t\tvalue: users[ author ]?.id ?? author,\n\t\t\t\tlabel: users[ author ]?.name ?? author,\n\t\t\t} );\n\t\t}\n\t\t_fields.push( {\n\t\t\t...authorField,\n\t\t\telements,\n\t\t} );\n\t\treturn _fields;\n\t}, [ users, activeView, themeField, dateField ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\thistory.navigate( `/template?activeView=user` );\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t\tonActionPerformed,\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst setActiveTemplateAction = useSetActiveTemplateAction();\n\tconst actions = useMemo(\n\t\t() =>\n\t\t\tactiveView === 'user'\n\t\t\t\t? [ setActiveTemplateAction, editAction, ...postTypeActions ]\n\t\t\t\t: [ setActiveTemplateAction, ...postTypeActions ],\n\t\t[ postTypeActions, setActiveTemplateAction, editAction, activeView ]\n\t);\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tif ( newView.type !== view.type ) {\n\t\t\t// Retrigger the routing areas resolution.\n\t\t\thistory.invalidate();\n\t\t}\n\t\tupdateView( newView );\n\t} );\n\n\tconst duplicateAction = actions.find(\n\t\t( action ) => action.id === 'duplicate-post'\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={\n\t\t\t\t<>\n\t\t\t\t\t{ isModified && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tresetToDefault();\n\t\t\t\t\t\t\t\thistory.invalidate();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset view' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<AddNewTemplate />\n\t\t\t\t</>\n\t\t\t}\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={ ( item ) => {\n\t\t\t\t\tif ( typeof item.id === 'string' ) {\n\t\t\t\t\t\tsetSelectedRegisteredTemplate( item );\n\t\t\t\t\t} else {\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t`/${ item.type }/${ item.id }?canvas=edit`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t\t{ selectedRegisteredTemplate && duplicateAction && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Duplicate' ) }\n\t\t\t\t\tonRequestClose={ () => setSelectedRegisteredTemplate() }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<duplicateAction.RenderModal\n\t\t\t\t\t\titems={ [ selectedRegisteredTemplate ] }\n\t\t\t\t\t\tcloseModal={ () => setSelectedRegisteredTemplate() }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,IAAI,eAAe;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,UAAU,SAAS,mBAAmB;AAC/C;AAAA,EACC,eAAe;AAAA,EACf,SAAS;AAAA,OACH;AACP,SAAS,WAAW,6BAA6B;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,WAAW,mBAAmB;AACvC,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,QAAQ,aAAa;AAC9B,SAAS,SAAS,oBAAoB;AAKtC,OAAO,oBAAoB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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A;AAAA,YACA;AAAA,YACA,iBAAkB,MAAM;AAAA,YACxB,aAAc,CAAE,SAAU;AACzB,kBAAK,OAAO,KAAK,OAAO,UAAW;AAClC,8CAA+B,IAAK;AAAA,cACrC,OAAO;AACN,wBAAQ;AAAA,kBACP,IAAK,KAAK,IAAK,IAAK,KAAK,EAAG;AAAA,gBAC7B;AAAA,cACD;AAAA,YACD;AAAA,YACA;AAAA,YACA;AAAA;AAAA,UApBM;AAAA,QAqBP;AAAA,QACE,8BAA8B,mBAC/B;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,WAAY;AAAA,YACxB,gBAAiB,MAAM,8BAA8B;AAAA,YACrD,MAAK;AAAA,YAEL;AAAA,cAAC,gBAAgB;AAAA,cAAhB;AAAA,gBACA,OAAQ,CAAE,0BAA2B;AAAA,gBACrC,YAAa,MAAM,8BAA8B;AAAA;AAAA,YAClD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/page-templates/view-utils.js
|
|
2
|
+
var defaultLayouts = {
|
|
2
3
|
table: {
|
|
3
4
|
showMedia: false
|
|
4
5
|
},
|
|
@@ -9,7 +10,7 @@ const defaultLayouts = {
|
|
|
9
10
|
showMedia: false
|
|
10
11
|
}
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
var DEFAULT_VIEW = {
|
|
13
14
|
type: "grid",
|
|
14
15
|
perPage: 20,
|
|
15
16
|
sort: {
|
|
@@ -26,6 +27,10 @@ const DEFAULT_VIEW = {
|
|
|
26
27
|
function getDefaultView(activeView) {
|
|
27
28
|
return {
|
|
28
29
|
...DEFAULT_VIEW,
|
|
30
|
+
sort: activeView === "user" ? {
|
|
31
|
+
field: "date",
|
|
32
|
+
direction: "desc"
|
|
33
|
+
} : DEFAULT_VIEW.sort,
|
|
29
34
|
filters: !["active", "user"].includes(activeView) ? [
|
|
30
35
|
{
|
|
31
36
|
field: "author",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-templates/view-utils.js"],
|
|
4
|
-
"sourcesContent": ["export const defaultLayouts = {\n\ttable: {\n\t\tshowMedia: false,\n\t},\n\tgrid: {\n\t\tshowMedia: true,\n\t},\n\tlist: {\n\t\tshowMedia: false,\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: 'grid',\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', 'active', 'slug', 'theme' ],\n\tfilters: [],\n\t...defaultLayouts.grid,\n};\n\nexport function getDefaultView( activeView ) {\n\treturn {\n\t\t...DEFAULT_VIEW,\n\t\tfilters: ! [ 'active', 'user' ].includes( activeView )\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: [],\n\t};\n}\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
4
|
+
"sourcesContent": ["export const defaultLayouts = {\n\ttable: {\n\t\tshowMedia: false,\n\t},\n\tgrid: {\n\t\tshowMedia: true,\n\t},\n\tlist: {\n\t\tshowMedia: false,\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: 'grid',\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', 'active', 'slug', 'theme' ],\n\tfilters: [],\n\t...defaultLayouts.grid,\n};\n\nexport function getDefaultView( activeView ) {\n\treturn {\n\t\t...DEFAULT_VIEW,\n\t\tsort:\n\t\t\tactiveView === 'user'\n\t\t\t\t? {\n\t\t\t\t\t\tfield: 'date',\n\t\t\t\t\t\tdirection: 'desc',\n\t\t\t\t }\n\t\t\t\t: DEFAULT_VIEW.sort,\n\t\tfilters: ! [ 'active', 'user' ].includes( activeView )\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: [],\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,iBAAiB;AAAA,EAC7B,OAAO;AAAA,IACN,WAAW;AAAA,EACZ;AAAA,EACA,MAAM;AAAA,IACL,WAAW;AAAA,EACZ;AAAA,EACA,MAAM;AAAA,IACL,WAAW;AAAA,EACZ;AACD;AAEA,IAAM,eAAe;AAAA,EACpB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,QAAQ,CAAE,UAAU,UAAU,QAAQ,OAAQ;AAAA,EAC9C,SAAS,CAAC;AAAA,EACV,GAAG,eAAe;AACnB;AAEO,SAAS,eAAgB,YAAa;AAC5C,SAAO;AAAA,IACN,GAAG;AAAA,IACH,MACC,eAAe,SACZ;AAAA,MACA,OAAO;AAAA,MACP,WAAW;AAAA,IACX,IACA,aAAa;AAAA,IACjB,SAAS,CAAE,CAAE,UAAU,MAAO,EAAE,SAAU,UAAW,IAClD;AAAA,MACA;AAAA,QACC,OAAO;AAAA,QACP,UAAU;AAAA,QACV,OAAO,CAAE,UAAW;AAAA,MACrB;AAAA,IACA,IACA,CAAC;AAAA,EACL;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/pagination/index.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import {
|
|
4
4
|
__experimentalHStack as HStack,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "@wordpress/components";
|
|
8
8
|
import { __, _x, _n, sprintf, isRTL } from "@wordpress/i18n";
|
|
9
9
|
import { previous, chevronLeft, chevronRight, next } from "@wordpress/icons";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
function Pagination({
|
|
11
12
|
currentPage,
|
|
12
13
|
numPages,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/pagination/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf, isRTL } from '@wordpress/i18n';\nimport { previous, chevronLeft, chevronRight, next } from '@wordpress/icons';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n\tclassName,\n\tdisabled = false,\n\tbuttonVariant = 'tertiary',\n\tlabel = __( 'Pagination' ),\n} ) {\n\treturn (\n\t\t<HStack\n\t\t\texpanded={ false }\n\t\t\tas=\"nav\"\n\t\t\taria-label={ label }\n\t\t\tspacing={ 3 }\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ clsx( 'edit-site-pagination', className ) }\n\t\t>\n\t\t\t<Text variant=\"muted\" className=\"edit-site-pagination__total\">\n\t\t\t\t{\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\t\ttotalItems\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</Text>\n\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === 1 }\n\t\t\t\t\tlabel={ __( 'First page' ) }\n\t\t\t\t\ticon={ isRTL() ? next : previous }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === 1 }\n\t\t\t\t\tlabel={ __( 'Previous page' ) }\n\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: 1: Current page number. 2: Total number of pages.\n\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\tcurrentPage,\n\t\t\t\t\tnumPages\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === numPages }\n\t\t\t\t\tlabel={ __( 'Next page' ) }\n\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === numPages }\n\t\t\t\t\tlabel={ __( 'Last page' ) }\n\t\t\t\t\ticon={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Q,GAAI,eAAgB;AAAA,cAC5B,MAAO,MAAM,IAAI,eAAe;AAAA,cAChC,MAAK;AAAA;AAAA,UACN;AAAA,WACD;AAAA,QACA,oBAAC,QAAK,SAAQ,SACX;AAAA;AAAA,UAED,GAAI,gBAAgB,QAAS;AAAA,UAC7B;AAAA,UACA;AAAA,QACD,GACD;AAAA,QACA,qBAAC,UAAO,UAAW,OAAQ,SAAU,GACpC;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,SAAU;AAAA,cACV,SAAU,MAAM,WAAY,cAAc,CAAE;AAAA,cAC5C,wBAAsB;AAAA,cACtB,UAAW,YAAY,gBAAgB;AAAA,cACvC,OAAQ,GAAI,WAAY;AAAA,cACxB,MAAO,MAAM,IAAI,cAAc;AAAA,cAC/B,MAAK;AAAA;AAAA,UACN;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,SAAU;AAAA,cACV,SAAU,MAAM,WAAY,QAAS;AAAA,cACrC,wBAAsB;AAAA,cACtB,UAAW,YAAY,gBAAgB;AAAA,cACvC,OAAQ,GAAI,WAAY;AAAA,cACxB,MAAO,MAAM,IAAI,WAAW;AAAA,cAC5B,MAAK;AAAA;AAAA,UACN;AAAA,WACD;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/plugin-template-setting-panel/index.js
|
|
2
2
|
import { store as editorStore } from "@wordpress/editor";
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import { createSlotFill } from "@wordpress/components";
|
|
5
5
|
import deprecated from "@wordpress/deprecated";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var { Fill, Slot } = createSlotFill("PluginTemplateSettingPanel");
|
|
8
|
+
var PluginTemplateSettingPanel = ({ children }) => {
|
|
8
9
|
deprecated("wp.editSite.PluginTemplateSettingPanel", {
|
|
9
10
|
since: "6.6",
|
|
10
11
|
version: "6.8",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/plugin-template-setting-panel/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * Defines an extensibility slot for the Template sidebar.\n */\n\n/**\n * WordPress dependencies\n */\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { createSlotFill } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\nconst { Fill, Slot } = createSlotFill( 'PluginTemplateSettingPanel' );\n\nconst PluginTemplateSettingPanel = ( { children } ) => {\n\tdeprecated( 'wp.editSite.PluginTemplateSettingPanel', {\n\t\tsince: '6.6',\n\t\tversion: '6.8',\n\t\talternative: 'wp.editor.PluginDocumentSettingPanel',\n\t} );\n\tconst isCurrentEntityTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\tif ( ! isCurrentEntityTemplate ) {\n\t\treturn null;\n\t}\n\treturn <Fill>{ children }</Fill>;\n};\n\nPluginTemplateSettingPanel.Slot = Slot;\n\n/**\n * Renders items in the Template Sidebar below the main information\n * like the Template Card.\n *\n * @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead.\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { PluginTemplateSettingPanel } from '@wordpress/edit-site';\n *\n * const MyTemplateSettingTest = () => (\n * \t\t<PluginTemplateSettingPanel>\n *\t\t\t<p>Hello, World!</p>\n *\t\t</PluginTemplateSettingPanel>\n *\t);\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nexport default PluginTemplateSettingPanel;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAOA,SAAS,SAAS,mBAAmB;AACrC,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,OAAO,gBAAgB;AAkBf;AAhBR,IAAM,EAAE,MAAM,KAAK,IAAI,eAAgB,4BAA6B;AAEpE,IAAM,6BAA6B,CAAE,EAAE,SAAS,MAAO;AACtD,aAAY,0CAA0C;AAAA,IACrD,OAAO;AAAA,IACP,SAAS;AAAA,IACT,aAAa;AAAA,EACd,CAAE;AACF,QAAM,0BAA0B;AAAA,IAC/B,CAAE,WACD,OAAQ,WAAY,EAAE,mBAAmB,MAAM;AAAA,IAChD,CAAC;AAAA,EACF;AACA,MAAK,CAAE,yBAA0B;AAChC,WAAO;AAAA,EACR;AACA,SAAO,oBAAC,QAAO,UAAU;AAC1B;AAEA,2BAA2B,OAAO;AAsBlC,IAAO,wCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/post-edit/index.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { Page } from "@wordpress/admin-ui";
|
|
4
4
|
import { __ } from "@wordpress/i18n";
|
|
@@ -11,8 +11,9 @@ import { privateApis as editorPrivateApis } from "@wordpress/editor";
|
|
|
11
11
|
import { unlock } from "../../lock-unlock";
|
|
12
12
|
import usePatternSettings from "../page-patterns/use-pattern-settings";
|
|
13
13
|
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var { usePostFields, PostCardPanel } = unlock(editorPrivateApis);
|
|
16
|
+
var fieldsWithBulkEditSupport = [
|
|
16
17
|
"title",
|
|
17
18
|
"status",
|
|
18
19
|
"date",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-edit/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\nconst { usePostFields, PostCardPanel } = unlock( editorPrivateApis );\n\nconst fieldsWithBulkEditSupport = [\n\t'title',\n\t'status',\n\t'date',\n\t'author',\n\t'discussion',\n];\n\nfunction PostEditForm( { postType, postId } ) {\n\tconst ids = useMemo( () => postId.split( ',' ), [ postId ] );\n\tconst { record, hasFinishedResolution } = useSelect(\n\t\t( select ) => {\n\t\t\tconst args = [ 'postType', postType, ids[ 0 ] ];\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution: hasFinished,\n\t\t\t} = select( coreDataStore );\n\n\t\t\treturn {\n\t\t\t\trecord:\n\t\t\t\t\tids.length === 1 ? getEditedEntityRecord( ...args ) : null,\n\t\t\t\thasFinishedResolution: hasFinished(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\targs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType, ids ]\n\t);\n\tconst [ multiEdits, setMultiEdits ] = useState( {} );\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields?.map( ( field ) => {\n\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn field;\n\t\t\t} ),\n\t\t[ _fields ]\n\t);\n\n\tconst form = useMemo(\n\t\t() => ( {\n\t\t\tlayout: {\n\t\t\t\ttype: 'panel',\n\t\t\t},\n\t\t\tfields: [\n\t\t\t\t{\n\t\t\t\t\tid: 'featured_media',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'status',\n\t\t\t\t\tlabel: __( 'Status & Visibility' ),\n\t\t\t\t\tchildren: [ 'status', 'password' ],\n\t\t\t\t},\n\t\t\t\t'author',\n\t\t\t\t'date',\n\t\t\t\t'slug',\n\t\t\t\t'parent',\n\t\t\t\t{\n\t\t\t\t\tid: 'discussion',\n\t\t\t\t\tlabel: __( 'Discussion' ),\n\t\t\t\t\tchildren: [ 'comment_status', 'ping_status' ],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Template' ),\n\t\t\t\t\tid: 'template',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t\tlabelPosition: 'side',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t].filter(\n\t\t\t\t( field ) =>\n\t\t\t\t\tids.length === 1 ||\n\t\t\t\t\tfieldsWithBulkEditSupport.includes(\n\t\t\t\t\t\ttypeof field === 'string' ? field : field.id\n\t\t\t\t\t)\n\t\t\t),\n\t\t} ),\n\t\t[ ids ]\n\t);\n\tconst onChange = ( edits ) => {\n\t\tfor ( const id of ids ) {\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status !== 'future' &&\n\t\t\t\trecord?.status === 'future' &&\n\t\t\t\tnew Date( record.date ) > new Date()\n\t\t\t) {\n\t\t\t\tedits.date = null;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status === 'private' &&\n\t\t\t\trecord.password\n\t\t\t) {\n\t\t\t\tedits.password = '';\n\t\t\t}\n\t\t\teditEntityRecord( 'postType', postType, id, edits );\n\t\t\tif ( ids.length > 1 ) {\n\t\t\t\tsetMultiEdits( ( prev ) => ( {\n\t\t\t\t\t...prev,\n\t\t\t\t\t...edits,\n\t\t\t\t} ) );\n\t\t\t}\n\t\t}\n\t};\n\tuseEffect( () => {\n\t\tsetMultiEdits( {} );\n\t}, [ ids ] );\n\n\tconst { ExperimentalBlockEditorProvider } = unlock(\n\t\tblockEditorPrivateApis\n\t);\n\tconst settings = usePatternSettings();\n\n\t/**\n\t * The template field depends on the block editor settings.\n\t * This is a workaround to ensure that the block editor settings are available.\n\t * For more information, see: https://github.com/WordPress/gutenberg/issues/67521\n\t */\n\tconst fieldsWithDependency = useMemo( () => {\n\t\treturn fields.map( ( field ) => {\n\t\t\tif ( field.id === 'template' ) {\n\t\t\t\treturn {\n\t\t\t\t\t...field,\n\t\t\t\t\tEdit: ( data ) => (\n\t\t\t\t\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t\t\t\t\t<field.Edit { ...data } />\n\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn field;\n\t\t} );\n\t}, [ fields, settings ] );\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t<PostCardPanel postType={ postType } postId={ ids } />\n\t\t\t{ hasFinishedResolution && (\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ ids.length === 1 ? record : multiEdits }\n\t\t\t\t\tfields={ fieldsWithDependency }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function PostEdit( { postType, postId } ) {\n\treturn (\n\t\t<Page\n\t\t\tclassName={ clsx( 'edit-site-post-edit', {\n\t\t\t\t'is-empty': ! postId,\n\t\t\t} ) }\n\t\t\tlabel={ __( 'Post Edit' ) }\n\t\t>\n\t\t\t{ postId && (\n\t\t\t\t<PostEditForm postType={ postType } postId={ postId } />\n\t\t\t) }\n\t\t\t{ ! postId && <p>{ __( 'Select a page to edit' ) }</p> }\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,qBAAqB;AACvC,SAAS,wBAAwB,cAAc;AAC/C,SAAS,UAAU,SAAS,iBAAiB;AAC7C,SAAS,eAAe,yBAAyB;AAKjD,SAAS,cAAc;AACvB,OAAO,wBAAwB;AAC/B,SAAS,eAAe,8BAA8B;AAgJ/C,cAUL,YAVK;AA9IP,IAAM,EAAE,eAAe,cAAc,IAAI,OAAQ,iBAAkB;AAEnE,IAAM,4BAA4B;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,SAAS,aAAc,EAAE,UAAU,OAAO,GAAI;AAC7C,QAAM,MAAM,QAAS,MAAM,OAAO,MAAO,GAAI,GAAG,CAAE,MAAO,CAAE;AAC3D,QAAM,EAAE,QAAQ,sBAAsB,IAAI;AAAA,IACzC,CAAE,WAAY;AACb,YAAM,OAAO,CAAE,YAAY,UAAU,IAAK,CAAE,CAAE;AAE9C,YAAM;AAAA,QACL;AAAA,QACA,uBAAuB;AAAA,MACxB,IAAI,OAAQ,aAAc;AAE1B,aAAO;AAAA,QACN,QACC,IAAI,WAAW,IAAI,sBAAuB,GAAG,IAAK,IAAI;AAAA,QACvD,uBAAuB;AAAA,UACtB;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,UAAU,GAAI;AAAA,EACjB;AACA,QAAM,CAAE,YAAY,aAAc,IAAI,SAAU,CAAC,CAAE;AACnD,QAAM,EAAE,iBAAiB,IAAI,YAAa,aAAc;AACxD,QAAM,UAAU,cAAe,EAAE,SAAS,CAAE;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BAAwB,GAAG;AAAA;AAAA;AAAA,EACnD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/post-list/index.js
|
|
2
2
|
import { Page } from "@wordpress/admin-ui";
|
|
3
3
|
import { Button } from "@wordpress/components";
|
|
4
4
|
import {
|
|
@@ -24,11 +24,12 @@ import AddNewPostModal from "../add-new-post";
|
|
|
24
24
|
import { unlock } from "../../lock-unlock";
|
|
25
25
|
import { useEditPostAction } from "../dataviews-actions";
|
|
26
26
|
import { defaultLayouts, getDefaultView } from "./view-utils";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
var { usePostActions, usePostFields } = unlock(editorPrivateApis);
|
|
29
|
+
var { useLocation, useHistory } = unlock(routerPrivateApis);
|
|
30
|
+
var { useEntityRecordsWithPermissions } = unlock(coreDataPrivateApis);
|
|
31
|
+
var EMPTY_ARRAY = [];
|
|
32
|
+
var DEFAULT_STATUSES = "draft,future,pending,private,publish";
|
|
32
33
|
function getItemId(item) {
|
|
33
34
|
return item.id.toString();
|
|
34
35
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-list/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { Button } from '@wordpress/components';\nimport {\n\tstore as coreStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { drawerRight } from '@wordpress/icons';\nimport { useEvent, usePrevious } from '@wordpress/compose';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useView } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport {\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\n\nimport AddNewPostModal from '../add-new-post';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { defaultLayouts, getDefaultView } from './view-utils';\n\nconst { usePostActions, usePostFields } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( coreDataPrivateApis );\nconst EMPTY_ARRAY = [];\n\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nfunction getItemId( item ) {\n\treturn item.id.toString();\n}\n\nfunction getItemLevel( item ) {\n\treturn item.level;\n}\n\nexport default function PostList( { postType } ) {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'all', postId, quickEdit = false } = query;\n\tconst history = useHistory();\n\tconst postTypeObject = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn getPostType( postType );\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tslug: activeView,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( newQueryParams ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: newQueryParams.page,\n\t\t\t\t\tsearch: newQueryParams.search || undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\tdefaultView: getDefaultView( postTypeObject, activeView ),\n\t} );\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tif ( newView.type !== view.type ) {\n\t\t\t// Retrigger the routing areas resolution.\n\t\t\thistory.invalidate();\n\t\t}\n\t\tupdateView( newView );\n\t} );\n\n\tconst [ selection, setSelection ] = useState( postId?.split( ',' ) ?? [] );\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\tpostId: items.join( ',' ),\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t[ path, history ]\n\t);\n\n\tconst fields = usePostFields( {\n\t\tpostType,\n\t} );\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters?.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author,wp:featuredmedia',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\torderby_hierarchy: !! view.showLevels,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view ] );\n\tconst {\n\t\trecords,\n\t\tisResolving: isLoadingData,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecordsWithPermissions( 'postType', postType, queryArgs );\n\n\t// The REST API sort the authors by ID, but we want to sort them by name.\n\tconst data = useMemo( () => {\n\t\tif ( view?.sort?.field === 'author' ) {\n\t\t\treturn filterSortAndPaginate(\n\t\t\t\trecords,\n\t\t\t\t{ sort: { ...view.sort } },\n\t\t\t\tfields\n\t\t\t).data;\n\t\t}\n\n\t\treturn records;\n\t}, [ records, fields, view?.sort ] );\n\n\tconst ids = data?.map( ( record ) => getItemId( record ) ) ?? [];\n\tconst prevIds = usePrevious( ids ) ?? [];\n\tconst deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );\n\tconst postIdWasDeleted = deletedIds.includes( postId );\n\n\tuseEffect( () => {\n\t\tif ( postIdWasDeleted ) {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\tpostId: undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t}\n\t}, [ history, postIdWasDeleted, path ] );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst { labels, canCreateRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t\tcanCreateRecord: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType,\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 [ showAddPostModal, setShowAddPostModal ] = useState( false );\n\n\tconst openModal = () => setShowAddPostModal( true );\n\tconst closeModal = () => setShowAddPostModal( false );\n\tconst handleNewPage = ( { type, id } ) => {\n\t\thistory.navigate( `/${ type }/${ id }?canvas=edit` );\n\t\tcloseModal();\n\t};\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ labels?.name }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t{ isModified && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tresetToDefault();\n\t\t\t\t\t\t\t\thistory.invalidate();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset view' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t{ labels?.add_new_item && canCreateRecord && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ openModal }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ labels.add_new_item }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t{ showAddPostModal && (\n\t\t\t\t\t\t\t\t<AddNewPostModal\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\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 || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tselection={ selection }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ ( item ) => item.status !== 'trash' }\n\t\t\t\tonClickItem={ ( { id } ) => {\n\t\t\t\t\thistory.navigate( `/${ postType }/${ id }?canvas=edit` );\n\t\t\t\t} }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t\tgetItemLevel={ getItemLevel }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\theader={\n\t\t\t\t\twindow.__experimentalQuickEditDataViews &&\n\t\t\t\t\tview.type !== LAYOUT_LIST &&\n\t\t\t\t\tpostType === 'page' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tisPressed={ quickEdit }\n\t\t\t\t\t\t\ticon={ drawerRight }\n\t\t\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\t\t\t\t\tquickEdit: quickEdit ? undefined : true,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB;AAAA,EACC,SAAS;AAAA,EACT,eAAe;AAAA,OACT;AACP,SAAS,UAAU,SAAS,aAAa,iBAAiB;AAC1D,SAAS,eAAe,yBAAyB;AACjD,SAAS,iBAAiB;AAC1B,SAAS,WAAW,6BAA6B;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,UAAU,mBAAmB;AACtC,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AAKxB;AAAA,EACC;AAAA,EACA;AAAA,E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,UACZ;AAAA,YAAC;AAAA;AAAA,cACA,MAAK;AAAA,cACL,WAAY;AAAA,cACZ,MAAO;AAAA,cACP,OAAQ,GAAI,SAAU;AAAA,cACtB,SAAU,MAAM;AACf,wBAAQ;AAAA,kBACP,aAAc,MAAM;AAAA,oBACnB,WAAW,YAAY,SAAY;AAAA,kBACpC,CAAE;AAAA,gBACH;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA,QAjCI;AAAA,MAoCP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/edit-site/src/components/post-list/view-utils.js
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import {
|
|
3
4
|
trash,
|
|
@@ -9,12 +10,12 @@ import {
|
|
|
9
10
|
notAllowed
|
|
10
11
|
} from "@wordpress/icons";
|
|
11
12
|
import { OPERATOR_IS_ANY } from "../../utils/constants";
|
|
12
|
-
|
|
13
|
+
var defaultLayouts = {
|
|
13
14
|
table: {},
|
|
14
15
|
grid: {},
|
|
15
16
|
list: {}
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
+
var DEFAULT_POST_BASE = {
|
|
18
19
|
type: "list",
|
|
19
20
|
filters: [],
|
|
20
21
|
perPage: 20,
|
|
@@ -136,7 +137,7 @@ function getDefaultViews(postType) {
|
|
|
136
137
|
}
|
|
137
138
|
];
|
|
138
139
|
}
|
|
139
|
-
|
|
140
|
+
var getDefaultView = (postType, activeView) => {
|
|
140
141
|
return getDefaultViews(postType).find(
|
|
141
142
|
({ slug }) => slug === activeView
|
|
142
143
|
)?.view;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-list/view-utils.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IS_ANY } from '../../utils/constants';\n\nexport const defaultLayouts = {\n\ttable: {},\n\tgrid: {},\n\tlist: {},\n};\n\nconst DEFAULT_POST_BASE = {\n\ttype: 'list',\n\tfilters: [],\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\tshowLevels: true,\n\ttitleField: 'title',\n\tmediaField: 'featured_media',\n\tfields: [ 'author', 'status' ],\n\t...defaultLayouts.list,\n};\n\nexport function getDefaultViews( postType ) {\n\treturn [\n\t\t{\n\t\t\ttitle: postType?.labels?.all_items || __( 'All items' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_POST_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Published' ),\n\t\t\tslug: 'published',\n\t\t\ticon: published,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'publish',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Scheduled' ),\n\t\t\tslug: 'future',\n\t\t\ticon: scheduled,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'future',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Pending' ),\n\t\t\tslug: 'pending',\n\t\t\ticon: pending,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'pending',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Private' ),\n\t\t\tslug: 'private',\n\t\t\ticon: notAllowed,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'private',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\ttype: 'table',\n\t\t\t\tlayout: defaultLayouts.table.layout,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const getDefaultView = ( postType, activeView ) => {\n\treturn getDefaultViews( postType ).find(\n\t\t( { slug } ) => slug === activeView\n\t)?.view;\n};\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,UAAU;AAEnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP,SAAS,uBAAuB;AAEzB,
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AAEnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP,SAAS,uBAAuB;AAEzB,IAAM,iBAAiB;AAAA,EAC7B,OAAO,CAAC;AAAA,EACR,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AACR;AAEA,IAAM,oBAAoB;AAAA,EACzB,MAAM;AAAA,EACN,SAAS,CAAC;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,QAAQ,CAAE,UAAU,QAAS;AAAA,EAC7B,GAAG,eAAe;AACnB;AAEO,SAAS,gBAAiB,UAAW;AAC3C,SAAO;AAAA,IACN;AAAA,MACC,OAAO,UAAU,QAAQ,aAAa,GAAI,WAAY;AAAA,MACtD,MAAM;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,OAAO,GAAI,WAAY;AAAA,MACvB,MAAM;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,QACL,GAAG;AAAA,QACH,SAAS;AAAA,UACR;AAAA,YACC,OAAO;AAAA,YACP,UAAU;AAAA,YACV,OAAO;AAAA,YACP,UAAU;AAAA,UACX;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,GAAI,WAAY;AAAA,MACvB,MAAM;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EACD;AACD;AAEO,IAAM,iBAAiB,CAAE,UAAU,eAAgB;AACzD,SAAO,gBAAiB,QAAS,EAAE;AAAA,IAClC,CAAE,EAAE,KAAK,MAAO,SAAS;AAAA,EAC1B,GAAG;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/posts-app/index.js
|
|
2
2
|
import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import Layout from "../layout";
|
|
5
5
|
import { useRegisterPostsAppRoutes } from "../posts-app-routes";
|
|
6
6
|
import { unlock } from "../../lock-unlock";
|
|
7
7
|
import { store as editSiteStore } from "../../store";
|
|
8
|
-
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var { RouterProvider } = unlock(routerPrivateApis);
|
|
9
10
|
function PostsApp() {
|
|
10
11
|
useRegisterPostsAppRoutes();
|
|
11
12
|
const routes = useSelect((select) => {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/posts-app/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { useRegisterPostsAppRoutes } from '../posts-app-routes';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\n\nexport default function PostsApp() {\n\tuseRegisterPostsAppRoutes();\n\tconst routes = useSelect( ( select ) => {\n\t\treturn unlock( select( editSiteStore ) ).getRoutes();\n\t}, [] );\n\treturn (\n\t\t<RouterProvider routes={ routes } pathArg=\"p\">\n\t\t\t<Layout />\n\t\t</RouterProvider>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe,yBAAyB;AACjD,SAAS,iBAAiB;AAK1B,OAAO,YAAY;AACnB,SAAS,iCAAiC;AAC1C,SAAS,cAAc;AACvB,SAAS,SAAS,qBAAqB;AAWpC;AATH,IAAM,EAAE,eAAe,IAAI,OAAQ,iBAAkB;AAEtC,SAAR,WAA4B;AAClC,4BAA0B;AAC1B,QAAM,SAAS,UAAW,CAAE,WAAY;AACvC,WAAO,OAAQ,OAAQ,aAAc,CAAE,EAAE,UAAU;AAAA,EACpD,GAAG,CAAC,CAAE;AACN,SACC,oBAAC,kBAAe,QAAkB,SAAQ,KACzC,8BAAC,UAAO,GACT;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// packages/edit-site/src/components/posts-app-routes/index.js
|
|
1
2
|
import { useRegistry, useDispatch } from "@wordpress/data";
|
|
2
3
|
import { useEffect } from "@wordpress/element";
|
|
3
4
|
import { unlock } from "../../lock-unlock";
|
|
4
5
|
import { store as siteEditorStore } from "../../store";
|
|
5
6
|
import { postsRoute } from "./posts";
|
|
6
7
|
import { postItemRoute } from "./post-item";
|
|
7
|
-
|
|
8
|
+
var routes = [postItemRoute, postsRoute];
|
|
8
9
|
function useRegisterPostsAppRoutes() {
|
|
9
10
|
const registry = useRegistry();
|
|
10
11
|
const { registerRoute } = unlock(useDispatch(siteEditorStore));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/posts-app-routes/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { postsRoute } from './posts';\nimport { postItemRoute } from './post-item';\n\nconst routes = [ postItemRoute, postsRoute ];\n\nexport function useRegisterPostsAppRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,aAAa,mBAAmB;AACzC,SAAS,iBAAiB;AAK1B,SAAS,cAAc;AACvB,SAAS,SAAS,uBAAuB;AACzC,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAE9B,
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,mBAAmB;AACzC,SAAS,iBAAiB;AAK1B,SAAS,cAAc;AACvB,SAAS,SAAS,uBAAuB;AACzC,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAE9B,IAAM,SAAS,CAAE,eAAe,UAAW;AAEpC,SAAS,4BAA4B;AAC3C,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,cAAc,IAAI,OAAQ,YAAa,eAAgB,CAAE;AACjE,YAAW,MAAM;AAChB,aAAS,MAAO,MAAM;AACrB,aAAO,QAAS,aAAc;AAAA,IAC/B,CAAE;AAAA,EACH,GAAG,CAAE,UAAU,aAAc,CAAE;AAChC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/posts-app-routes/post-item.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import Editor from "../editor";
|
|
4
4
|
import DataViewsSidebarContent from "../sidebar-dataviews";
|
|
5
5
|
import SidebarNavigationScreen from "../sidebar-navigation-screen";
|
|
6
|
-
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var postItemRoute = {
|
|
7
8
|
name: "post-item",
|
|
8
9
|
path: "/post/:postId",
|
|
9
10
|
areas: {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/posts-app-routes/post-item.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nexport const postItemRoute = {\n\tname: 'post-item',\n\tpath: '/post/:postId',\n\tareas: {\n\t\tsidebar: (\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Posts' ) }\n\t\t\t\tisRoot\n\t\t\t\tcontent={ <DataViewsSidebarContent postType=\"post\" /> }\n\t\t\t/>\n\t\t),\n\t\tmobile: <Editor isPostsList />,\n\t\tpreview: <Editor isPostsList />,\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AAKnB,OAAO,YAAY;AACnB,OAAO,6BAA6B;AACpC,OAAO,6BAA6B;AAUtB;AARP,IAAM,gBAAgB;AAAA,EAC5B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,IACN,SACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,OAAQ;AAAA,QACpB,QAAM;AAAA,QACN,SAAU,oBAAC,2BAAwB,UAAS,QAAO;AAAA;AAAA,IACpD;AAAA,IAED,QAAQ,oBAAC,UAAO,aAAW,MAAC;AAAA,IAC5B,SAAS,oBAAC,UAAO,aAAW,MAAC;AAAA,EAC9B;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/posts-app-routes/posts.js
|
|
2
2
|
import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
3
3
|
import { __ } from "@wordpress/i18n";
|
|
4
4
|
import { loadView } from "@wordpress/views";
|
|
@@ -11,7 +11,8 @@ import PostList from "../post-list";
|
|
|
11
11
|
import { unlock } from "../../lock-unlock";
|
|
12
12
|
import { PostEdit } from "../post-edit";
|
|
13
13
|
import { getDefaultView } from "../post-list/view-utils";
|
|
14
|
-
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var { useLocation } = unlock(routerPrivateApis);
|
|
15
16
|
async function isListView(query) {
|
|
16
17
|
const { activeView = "all" } = query;
|
|
17
18
|
const postTypeObject = await resolveSelect(coreStore).getPostType("post");
|
|
@@ -28,7 +29,7 @@ function MobilePostsView() {
|
|
|
28
29
|
const { canvas = "view" } = query;
|
|
29
30
|
return canvas === "edit" ? /* @__PURE__ */ jsx(Editor, {}) : /* @__PURE__ */ jsx(PostList, { postType: "post" });
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
var postsRoute = {
|
|
32
33
|
name: "posts",
|
|
33
34
|
path: "/",
|
|
34
35
|
areas: {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/posts-app-routes/posts.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __ } from '@wordpress/i18n';\nimport { loadView } from '@wordpress/views';\nimport { resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport PostList from '../post-list';\nimport { unlock } from '../../lock-unlock';\nimport { PostEdit } from '../post-edit';\nimport { getDefaultView } from '../post-list/view-utils';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nasync function isListView( query ) {\n\tconst { activeView = 'all' } = query;\n\tconst postTypeObject =\n\t\tawait resolveSelect( coreStore ).getPostType( 'post' );\n\tconst view = await loadView( {\n\t\tkind: 'postType',\n\t\tname: 'post',\n\t\tslug: activeView,\n\t\tdefaultView: getDefaultView( postTypeObject, activeView ),\n\t} );\n\treturn view.type === 'list';\n}\n\nfunction MobilePostsView() {\n\tconst { query = {} } = useLocation();\n\tconst { canvas = 'view' } = query;\n\n\treturn canvas === 'edit' ? <Editor /> : <PostList postType=\"post\" />;\n}\n\nexport const postsRoute = {\n\tname: 'posts',\n\tpath: '/',\n\tareas: {\n\t\tsidebar: (\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Posts' ) }\n\t\t\t\tisRoot\n\t\t\t\tcontent={ <DataViewsSidebarContent postType=\"post\" /> }\n\t\t\t/>\n\t\t),\n\t\tcontent: <PostList postType=\"post\" />,\n\t\tasync preview( { query } ) {\n\t\t\tconst isList = await isListView( query );\n\t\t\treturn isList ? <Editor isPostsList /> : undefined;\n\t\t},\n\t\tmobile: <MobilePostsView />,\n\t\tasync edit( { query } ) {\n\t\t\tconst isList = await isListView( query );\n\t\t\tconst hasQuickEdit = ! isList && !! query.quickEdit;\n\t\t\treturn hasQuickEdit ? (\n\t\t\t\t<PostEdit postType=\"post\" postId={ query.postId } />\n\t\t\t) : undefined;\n\t\t},\n\t},\n\twidths: {\n\t\tasync content( { query } ) {\n\t\t\tconst isList = await isListView( query );\n\t\t\treturn isList ? 380 : undefined;\n\t\t},\n\t\tasync edit( { query } ) {\n\t\t\tconst isList = await isListView( query );\n\t\t\tconst hasQuickEdit = ! isList && !! query.quickEdit;\n\t\t\treturn hasQuickEdit ? 380 : undefined;\n\t\t},\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe,yBAAyB;AACjD,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,SAAS,iBAAiB;AAKnC,OAAO,YAAY;AACnB,OAAO,6BAA6B;AACpC,OAAO,6BAA6B;AACpC,OAAO,cAAc;AACrB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAqBH;AAnB5B,IAAM,EAAE,YAAY,IAAI,OAAQ,i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,SAAS,MAAM;AAAA,IACvB;AAAA,IACA,MAAM,KAAM,EAAE,MAAM,GAAI;AACvB,YAAM,SAAS,MAAM,WAAY,KAAM;AACvC,YAAM,eAAe,CAAE,UAAU,CAAC,CAAE,MAAM;AAC1C,aAAO,eAAe,MAAM;AAAA,IAC7B;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/edit-site/src/components/resizable-frame/index.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { useState, useRef } from "@wordpress/element";
|
|
4
4
|
import {
|
|
@@ -13,8 +13,9 @@ import { useSelect } from "@wordpress/data";
|
|
|
13
13
|
import { store as coreStore } from "@wordpress/core-data";
|
|
14
14
|
import { unlock } from "../../lock-unlock";
|
|
15
15
|
import { addQueryArgs } from "@wordpress/url";
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var { useLocation, useHistory } = unlock(routerPrivateApis);
|
|
18
|
+
var HANDLE_STYLES_OVERRIDE = {
|
|
18
19
|
position: void 0,
|
|
19
20
|
userSelect: void 0,
|
|
20
21
|
cursor: void 0,
|
|
@@ -25,11 +26,11 @@ const HANDLE_STYLES_OVERRIDE = {
|
|
|
25
26
|
bottom: void 0,
|
|
26
27
|
left: void 0
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
var FRAME_MIN_WIDTH = 320;
|
|
30
|
+
var FRAME_REFERENCE_WIDTH = 1300;
|
|
31
|
+
var FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;
|
|
32
|
+
var SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
|
|
33
|
+
var INITIAL_FRAME_SIZE = { width: "100%", height: "100%" };
|
|
33
34
|
function calculateNewHeight(width, initialAspectRatio) {
|
|
34
35
|
const lerp = (a, b, amount) => {
|
|
35
36
|
return a + (b - a) * amount;
|