@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,3 +1,4 @@
|
|
|
1
|
+
// packages/edit-site/src/store/actions.js
|
|
1
2
|
import { parse } from "@wordpress/blocks";
|
|
2
3
|
import deprecated from "@wordpress/deprecated";
|
|
3
4
|
import { store as coreStore } from "@wordpress/core-data";
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
NAVIGATION_POST_TYPE
|
|
14
15
|
} from "../utils/constants";
|
|
15
16
|
import { unlock } from "../lock-unlock";
|
|
16
|
-
|
|
17
|
+
var { interfaceStore } = unlock(editorPrivateApis);
|
|
17
18
|
function toggleFeature(featureName) {
|
|
18
19
|
return function({ registry }) {
|
|
19
20
|
deprecated(
|
|
@@ -26,7 +27,7 @@ function toggleFeature(featureName) {
|
|
|
26
27
|
registry.dispatch(preferencesStore).toggle("core/edit-site", featureName);
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
var __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => {
|
|
30
31
|
deprecated(
|
|
31
32
|
"dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",
|
|
32
33
|
{
|
|
@@ -47,7 +48,7 @@ function setTemplate() {
|
|
|
47
48
|
type: "NOTHING"
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
var addTemplate = (template) => async ({ dispatch, registry }) => {
|
|
51
52
|
deprecated("dispatch( 'core/edit-site' ).addTemplate", {
|
|
52
53
|
since: "6.5",
|
|
53
54
|
version: "6.8",
|
|
@@ -69,7 +70,7 @@ const addTemplate = (template) => async ({ dispatch, registry }) => {
|
|
|
69
70
|
id: newTemplate.id
|
|
70
71
|
});
|
|
71
72
|
};
|
|
72
|
-
|
|
73
|
+
var removeTemplate = (template) => ({ registry }) => {
|
|
73
74
|
return unlock(registry.dispatch(editorStore)).removeTemplates([
|
|
74
75
|
template
|
|
75
76
|
]);
|
|
@@ -149,14 +150,14 @@ function setIsNavigationPanelOpened() {
|
|
|
149
150
|
});
|
|
150
151
|
return { type: "NOTHING" };
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
+
var setIsInserterOpened = (value) => ({ registry }) => {
|
|
153
154
|
deprecated("dispatch( 'core/edit-site' ).setIsInserterOpened", {
|
|
154
155
|
since: "6.5",
|
|
155
156
|
alternative: "dispatch( 'core/editor').setIsInserterOpened"
|
|
156
157
|
});
|
|
157
158
|
registry.dispatch(editorStore).setIsInserterOpened(value);
|
|
158
159
|
};
|
|
159
|
-
|
|
160
|
+
var setIsListViewOpened = (isOpen) => ({ registry }) => {
|
|
160
161
|
deprecated("dispatch( 'core/edit-site' ).setIsListViewOpened", {
|
|
161
162
|
since: "6.5",
|
|
162
163
|
alternative: "dispatch( 'core/editor').setIsListViewOpened"
|
|
@@ -175,26 +176,26 @@ function setIsSaveViewOpened(isOpen) {
|
|
|
175
176
|
isOpen
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
|
-
|
|
179
|
+
var revertTemplate = (template, options) => ({ registry }) => {
|
|
179
180
|
return unlock(registry.dispatch(editorStore)).revertTemplate(
|
|
180
181
|
template,
|
|
181
182
|
options
|
|
182
183
|
);
|
|
183
184
|
};
|
|
184
|
-
|
|
185
|
+
var openGeneralSidebar = (name) => ({ registry }) => {
|
|
185
186
|
registry.dispatch(interfaceStore).enableComplementaryArea("core", name);
|
|
186
187
|
};
|
|
187
|
-
|
|
188
|
+
var closeGeneralSidebar = () => ({ registry }) => {
|
|
188
189
|
registry.dispatch(interfaceStore).disableComplementaryArea("core");
|
|
189
190
|
};
|
|
190
|
-
|
|
191
|
+
var switchEditorMode = (mode) => ({ registry }) => {
|
|
191
192
|
deprecated("dispatch( 'core/edit-site' ).switchEditorMode", {
|
|
192
193
|
since: "6.6",
|
|
193
194
|
alternative: "dispatch( 'core/editor').switchEditorMode"
|
|
194
195
|
});
|
|
195
196
|
registry.dispatch(editorStore).switchEditorMode(mode);
|
|
196
197
|
};
|
|
197
|
-
|
|
198
|
+
var setHasPageContentFocus = (hasPageContentFocus) => ({ dispatch, registry }) => {
|
|
198
199
|
deprecated(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, {
|
|
199
200
|
since: "6.5"
|
|
200
201
|
});
|
|
@@ -206,7 +207,7 @@ const setHasPageContentFocus = (hasPageContentFocus) => ({ dispatch, registry })
|
|
|
206
207
|
hasPageContentFocus
|
|
207
208
|
});
|
|
208
209
|
};
|
|
209
|
-
|
|
210
|
+
var toggleDistractionFree = () => ({ registry }) => {
|
|
210
211
|
deprecated("dispatch( 'core/edit-site' ).toggleDistractionFree", {
|
|
211
212
|
since: "6.6",
|
|
212
213
|
alternative: "dispatch( 'core/editor').toggleDistractionFree"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/actions.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @deprecated\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\t( { registry } ) => {\n\t\treturn unlock( registry.dispatch( editorStore ) ).removeTemplates( [\n\t\t\ttemplate,\n\t\t] );\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @deprecated\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplatePart\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @deprecated\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationMenu\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @deprecated\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @deprecated\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setEditedPostContext\", {\n\t\tsince: '6.8',\n\t} );\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, options ) =>\n\t( { registry } ) => {\n\t\treturn unlock( registry.dispatch( editorStore ) ).revertTemplate(\n\t\t\ttemplate,\n\t\t\toptions\n\t\t);\n\t};\n\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( 'core', name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry.dispatch( interfaceStore ).disableComplementaryArea( 'core' );\n\t};\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @deprecated\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).switchEditorMode\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').switchEditorMode\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).switchEditorMode( mode );\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tdeprecated( `dispatch( 'core/edit-site' ).setHasPageContentFocus`, {\n\t\t\tsince: '6.5',\n\t\t} );\n\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n *\n * @deprecated\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).toggleDistractionFree\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').toggleDistractionFree\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleDistractionFree();\n\t};\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,aAAa;AACtB,OAAO,gBAAgB;AACvB,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,wBAAwB;AAC1C;AAAA,EACC,SAAS;AAAA,EACT,eAAe;AAAA,OACT;AACP,SAAS,SAAS,wBAAwB;AAK1C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,cAAc;AAEvB,
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/constants.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/edit-site';\n"],
|
|
5
|
-
"mappings": "AAKO,
|
|
5
|
+
"mappings": ";AAKO,IAAM,aAAa;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/edit-site/src/store/index.js
|
|
1
2
|
import { createReduxStore, register } from "@wordpress/data";
|
|
2
3
|
import reducer from "./reducer";
|
|
3
4
|
import * as actions from "./actions";
|
|
@@ -6,12 +7,12 @@ import * as selectors from "./selectors";
|
|
|
6
7
|
import * as privateSelectors from "./private-selectors";
|
|
7
8
|
import { STORE_NAME } from "./constants";
|
|
8
9
|
import { unlock } from "../lock-unlock";
|
|
9
|
-
|
|
10
|
+
var storeConfig = {
|
|
10
11
|
reducer,
|
|
11
12
|
actions,
|
|
12
13
|
selectors
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
var store = createReduxStore(STORE_NAME, storeConfig);
|
|
15
16
|
register(store);
|
|
16
17
|
unlock(store).registerPrivateSelectors(privateSelectors);
|
|
17
18
|
unlock(store).registerPrivateActions(privateActions);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as privateActions from './private-actions';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\n\nexport const storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n};\n\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nunlock( store ).registerPrivateActions( privateActions );\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,aAAa;AACzB,YAAY,oBAAoB;AAChC,YAAY,eAAe;AAC3B,YAAY,sBAAsB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAEhB,
|
|
5
|
+
"mappings": ";AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,aAAa;AACzB,YAAY,oBAAoB;AAChC,YAAY,eAAe;AAC3B,YAAY,sBAAsB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAEhB,IAAM,cAAc;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,QAAQ,iBAAkB,YAAY,WAAY;AAC/D,SAAU,KAAM;AAChB,OAAQ,KAAM,EAAE,yBAA0B,gBAAiB;AAC3D,OAAQ,KAAM,EAAE,uBAAwB,cAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/private-actions.js"],
|
|
4
4
|
"sourcesContent": ["export function registerRoute( route ) {\n\treturn {\n\t\ttype: 'REGISTER_ROUTE',\n\t\troute,\n\t};\n}\n\nexport function unregisterRoute( name ) {\n\treturn {\n\t\ttype: 'UNREGISTER_ROUTE',\n\t\tname,\n\t};\n}\n"],
|
|
5
|
-
"mappings": "AAAO,SAAS,cAAe,OAAQ;AACtC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAEO,SAAS,gBAAiB,MAAO;AACvC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
|
|
5
|
+
"mappings": ";AAAO,SAAS,cAAe,OAAQ;AACtC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAEO,SAAS,gBAAiB,MAAO;AACvC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/private-selectors.js"],
|
|
4
4
|
"sourcesContent": ["export function getRoutes( state ) {\n\treturn state.routes;\n}\n"],
|
|
5
|
-
"mappings": "AAAO,SAAS,UAAW,OAAQ;AAClC,SAAO,MAAM;AACd;",
|
|
5
|
+
"mappings": ";AAAO,SAAS,UAAW,OAAQ;AAClC,SAAO,MAAM;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/reducer.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nfunction routes( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_ROUTE':\n\t\t\treturn [ ...state, action.route ];\n\t\tcase 'UNREGISTER_ROUTE':\n\t\t\treturn state.filter( ( route ) => route.name !== action.name );\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tsettings,\n\teditedPost,\n\tsaveViewPanel,\n\troutes,\n} );\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,uBAAuB;AAUzB,SAAS,SAAU,QAAQ,CAAC,GAAG,QAAS;AAC9C,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,GAAG,OAAO;AAAA,MACX;AAAA,EACF;AAEA,SAAO;AACR;AAWO,SAAS,WAAY,QAAQ,CAAC,GAAG,QAAS;AAChD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,UAAU,OAAO;AAAA,QACjB,IAAI,OAAO;AAAA,QACX,SAAS,OAAO;AAAA,MACjB;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,SAAS,OAAO;AAAA,MACjB;AAAA,EACF;AAEA,SAAO;AACR;AAQO,SAAS,cAAe,QAAQ,OAAO,QAAS;AACtD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACR;AAEA,SAAS,OAAQ,QAAQ,CAAC,GAAG,QAAS;AACrC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,CAAE,GAAG,OAAO,OAAO,KAAM;AAAA,IACjC,KAAK;AACJ,aAAO,MAAM,OAAQ,CAAE,UAAW,MAAM,SAAS,OAAO,IAAK;AAAA,EAC/D;AAEA,SAAO;AACR;AAEA,IAAO,kBAAQ,gBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAE;",
|
|
5
|
+
"mappings": ";AAGA,SAAS,uBAAuB;AAUzB,SAAS,SAAU,QAAQ,CAAC,GAAG,QAAS;AAC9C,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,GAAG,OAAO;AAAA,MACX;AAAA,EACF;AAEA,SAAO;AACR;AAWO,SAAS,WAAY,QAAQ,CAAC,GAAG,QAAS;AAChD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,UAAU,OAAO;AAAA,QACjB,IAAI,OAAO;AAAA,QACX,SAAS,OAAO;AAAA,MACjB;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,SAAS,OAAO;AAAA,MACjB;AAAA,EACF;AAEA,SAAO;AACR;AAQO,SAAS,cAAe,QAAQ,OAAO,QAAS;AACtD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACR;AAEA,SAAS,OAAQ,QAAQ,CAAC,GAAG,QAAS;AACrC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,CAAE,GAAG,OAAO,OAAO,KAAM;AAAA,IACjC,KAAK;AACJ,aAAO,MAAM,OAAQ,CAAE,UAAW,MAAM,SAAS,OAAO,IAAK;AAAA,EAC/D;AAEA,SAAO;AACR;AAEA,IAAO,kBAAQ,gBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/edit-site/src/store/selectors.js
|
|
1
2
|
import { store as coreDataStore } from "@wordpress/core-data";
|
|
2
3
|
import { createRegistrySelector, createSelector } from "@wordpress/data";
|
|
3
4
|
import deprecated from "@wordpress/deprecated";
|
|
@@ -8,7 +9,7 @@ import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
|
8
9
|
import { unlock } from "../lock-unlock";
|
|
9
10
|
import { TEMPLATE_PART_POST_TYPE } from "../utils/constants";
|
|
10
11
|
import getFilteredTemplatePartBlocks from "../utils/get-filtered-template-parts";
|
|
11
|
-
|
|
12
|
+
var isFeatureActive = createRegistrySelector(
|
|
12
13
|
(select) => (_, featureName) => {
|
|
13
14
|
deprecated(`select( 'core/edit-site' ).isFeatureActive`, {
|
|
14
15
|
since: "6.0",
|
|
@@ -20,7 +21,7 @@ const isFeatureActive = createRegistrySelector(
|
|
|
20
21
|
);
|
|
21
22
|
}
|
|
22
23
|
);
|
|
23
|
-
|
|
24
|
+
var __experimentalGetPreviewDeviceType = createRegistrySelector(
|
|
24
25
|
(select) => () => {
|
|
25
26
|
deprecated(
|
|
26
27
|
`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,
|
|
@@ -33,7 +34,7 @@ const __experimentalGetPreviewDeviceType = createRegistrySelector(
|
|
|
33
34
|
return select(editorStore).getDeviceType();
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
|
-
|
|
37
|
+
var getCanUserCreateMedia = createRegistrySelector(
|
|
37
38
|
(select) => () => {
|
|
38
39
|
deprecated(
|
|
39
40
|
`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,
|
|
@@ -45,7 +46,7 @@ const getCanUserCreateMedia = createRegistrySelector(
|
|
|
45
46
|
return select(coreDataStore).canUser("create", "media");
|
|
46
47
|
}
|
|
47
48
|
);
|
|
48
|
-
|
|
49
|
+
var getReusableBlocks = createRegistrySelector((select) => () => {
|
|
49
50
|
deprecated(`select( 'core/edit-site' ).getReusableBlocks()`, {
|
|
50
51
|
since: "6.5",
|
|
51
52
|
version: "6.8",
|
|
@@ -91,14 +92,14 @@ function getPage(state) {
|
|
|
91
92
|
});
|
|
92
93
|
return { context: state.editedPost.context };
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
+
var isInserterOpened = createRegistrySelector((select) => () => {
|
|
95
96
|
deprecated(`select( 'core/edit-site' ).isInserterOpened`, {
|
|
96
97
|
since: "6.5",
|
|
97
98
|
alternative: `select( 'core/editor' ).isInserterOpened`
|
|
98
99
|
});
|
|
99
100
|
return select(editorStore).isInserterOpened();
|
|
100
101
|
});
|
|
101
|
-
|
|
102
|
+
var __experimentalGetInsertionPoint = createRegistrySelector(
|
|
102
103
|
(select) => () => {
|
|
103
104
|
deprecated(
|
|
104
105
|
`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,
|
|
@@ -110,7 +111,7 @@ const __experimentalGetInsertionPoint = createRegistrySelector(
|
|
|
110
111
|
return unlock(select(editorStore)).getInserter();
|
|
111
112
|
}
|
|
112
113
|
);
|
|
113
|
-
|
|
114
|
+
var isListViewOpened = createRegistrySelector((select) => () => {
|
|
114
115
|
deprecated(`select( 'core/edit-site' ).isListViewOpened`, {
|
|
115
116
|
since: "6.5",
|
|
116
117
|
alternative: `select( 'core/editor' ).isListViewOpened`
|
|
@@ -131,7 +132,7 @@ function getBlocksAndTemplateParts(select) {
|
|
|
131
132
|
const blocks = getBlocksByClientId(clientIds);
|
|
132
133
|
return [blocks, templateParts];
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
+
var getCurrentTemplateTemplateParts = createRegistrySelector(
|
|
135
136
|
(select) => createSelector(
|
|
136
137
|
() => {
|
|
137
138
|
deprecated(
|
|
@@ -149,7 +150,7 @@ const getCurrentTemplateTemplateParts = createRegistrySelector(
|
|
|
149
150
|
() => getBlocksAndTemplateParts(select)
|
|
150
151
|
)
|
|
151
152
|
);
|
|
152
|
-
|
|
153
|
+
var getEditorMode = createRegistrySelector((select) => () => {
|
|
153
154
|
return select(preferencesStore).get("core", "editorMode");
|
|
154
155
|
});
|
|
155
156
|
function getCurrentTemplateNavigationPanelSubMenu() {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/selectors.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector, createSelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport getFilteredTemplatePartBlocks from '../utils/get-filtered-template-parts';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\talternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )`,\n\t\t\t}\n\t\t);\n\n\t\treturn select( coreDataStore ).canUser( 'create', 'media' );\n\t}\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).getReusableBlocks()`, {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\talternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`,\n\t} );\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?TemplateType} Template type.\n */\nexport function getEditedPostType( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostType\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?string} Post ID.\n */\nexport function getEditedPostId( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostId\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostId\",\n\t} );\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostContext\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getPage\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInserter();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\nfunction getBlocksAndTemplateParts( select ) {\n\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\tconst { getBlocksByName, getBlocksByClientId } = select( blockEditorStore );\n\n\tconst clientIds = getBlocksByName( 'core/template-part' );\n\tconst blocks = getBlocksByClientId( clientIds );\n\treturn [ blocks, templateParts ];\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) =>\n\t\tcreateSelector(\n\t\t\t() => {\n\t\t\t\tdeprecated(\n\t\t\t\t\t`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,\n\t\t\t\t\t{\n\t\t\t\t\t\tsince: '6.7',\n\t\t\t\t\t\tversion: '6.9',\n\t\t\t\t\t\talternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\treturn getFilteredTemplatePartBlocks(\n\t\t\t\t\t...getBlocksAndTemplateParts( select )\n\t\t\t\t);\n\t\t\t},\n\t\t\t() => getBlocksAndTemplateParts( select )\n\t\t)\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).isPage\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,SAAS,qBAAqB;AACvC,SAAS,wBAAwB,sBAAsB;AACvD,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AACzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,SAAS,mBAAmB;AACrC,SAAS,SAAS,wBAAwB;AAK1C,SAAS,cAAc;AACvB,SAAS,+BAA+B;AACxC,OAAO,mCAAmC;AAenC,
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
+
// packages/edit-site/src/utils/constants.js
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { privateApis as patternPrivateApis } from "@wordpress/patterns";
|
|
3
4
|
import { unlock } from "../lock-unlock";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
var NAVIGATION_POST_TYPE = "wp_navigation";
|
|
6
|
+
var TEMPLATE_POST_TYPE = "wp_template";
|
|
7
|
+
var TEMPLATE_PART_POST_TYPE = "wp_template_part";
|
|
8
|
+
var TEMPLATE_ORIGINS = {
|
|
8
9
|
custom: "custom",
|
|
9
10
|
theme: "theme",
|
|
10
11
|
plugin: "plugin"
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized";
|
|
14
|
+
var TEMPLATE_PART_ALL_AREAS_CATEGORY = "all-parts";
|
|
15
|
+
var {
|
|
15
16
|
PATTERN_TYPES,
|
|
16
17
|
PATTERN_DEFAULT_CATEGORY,
|
|
17
18
|
PATTERN_USER_CATEGORY,
|
|
18
19
|
EXCLUDED_PATTERN_SOURCES,
|
|
19
20
|
PATTERN_SYNC_TYPES
|
|
20
21
|
} = unlock(patternPrivateApis);
|
|
21
|
-
|
|
22
|
+
var FOCUSABLE_ENTITIES = [
|
|
22
23
|
TEMPLATE_PART_POST_TYPE,
|
|
23
24
|
NAVIGATION_POST_TYPE,
|
|
24
25
|
PATTERN_TYPES.user
|
|
25
26
|
];
|
|
26
|
-
|
|
27
|
+
var POST_TYPE_LABELS = {
|
|
27
28
|
[TEMPLATE_POST_TYPE]: __("Template"),
|
|
28
29
|
[TEMPLATE_PART_POST_TYPE]: __("Template part"),
|
|
29
30
|
[PATTERN_TYPES.user]: __("Pattern"),
|
|
30
31
|
[NAVIGATION_POST_TYPE]: __("Navigation")
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
var LAYOUT_GRID = "grid";
|
|
34
|
+
var LAYOUT_TABLE = "table";
|
|
35
|
+
var LAYOUT_LIST = "list";
|
|
36
|
+
var OPERATOR_IS = "is";
|
|
37
|
+
var OPERATOR_IS_NOT = "isNot";
|
|
38
|
+
var OPERATOR_IS_ANY = "isAny";
|
|
39
|
+
var OPERATOR_IS_NONE = "isNone";
|
|
39
40
|
export {
|
|
40
41
|
EXCLUDED_PATTERN_SOURCES,
|
|
41
42
|
FOCUSABLE_ENTITIES,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/constants.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\nexport const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\n\nexport const OPERATOR_IS = 'is';\nexport const OPERATOR_IS_NOT = 'isNot';\nexport const OPERATOR_IS_ANY = 'isAny';\nexport const OPERATOR_IS_NONE = 'isNone';\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,UAAU;AACnB,SAAS,eAAe,0BAA0B;AAKlD,SAAS,cAAc;AAGhB,
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,eAAe,0BAA0B;AAKlD,SAAS,cAAc;AAGhB,IAAM,uBAAuB;AAG7B,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAChC,IAAM,mBAAmB;AAAA,EAC/B,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AACT;AACO,IAAM,sCAAsC;AAC5C,IAAM,mCAAmC;AAGzC,IAAM;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,IAAI,OAAQ,kBAAmB;AAGxB,IAAM,qBAAqB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,cAAc;AACf;AAEO,IAAM,mBAAmB;AAAA,EAC/B,CAAE,kBAAmB,GAAG,GAAI,UAAW;AAAA,EACvC,CAAE,uBAAwB,GAAG,GAAI,eAAgB;AAAA,EACjD,CAAE,cAAc,IAAK,GAAG,GAAI,SAAU;AAAA,EACtC,CAAE,oBAAqB,GAAG,GAAI,YAAa;AAC5C;AAGO,IAAM,cAAc;AACpB,IAAM,eAAe;AACrB,IAAM,cAAc;AAEpB,IAAM,cAAc;AACpB,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AACxB,IAAM,mBAAmB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// packages/edit-site/src/utils/get-filtered-template-parts.js
|
|
1
2
|
import { isTemplatePart } from "@wordpress/blocks";
|
|
2
|
-
|
|
3
|
+
var EMPTY_ARRAY = [];
|
|
3
4
|
function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) {
|
|
4
5
|
const templatePartsById = templateParts ? (
|
|
5
6
|
// Key template parts by their ID.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/get-filtered-template-parts.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { isTemplatePart } from '@wordpress/blocks';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Get a flattened and filtered list of template parts and the matching block for that template part.\n *\n * Takes a list of blocks defined within a template, and a list of template parts, and returns a\n * flattened list of template parts and the matching block for that template part.\n *\n * @param {Array} blocks Blocks to flatten.\n * @param {?Array} templateParts Available template parts.\n * @return {Array} An array of template parts and their blocks.\n */\nexport default function getFilteredTemplatePartBlocks(\n\tblocks = EMPTY_ARRAY,\n\ttemplateParts\n) {\n\tconst templatePartsById = templateParts\n\t\t? // Key template parts by their ID.\n\t\t templateParts.reduce(\n\t\t\t\t( newTemplateParts, part ) => ( {\n\t\t\t\t\t...newTemplateParts,\n\t\t\t\t\t[ part.id ]: part,\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t )\n\t\t: {};\n\n\tconst result = [];\n\n\t// Iterate over all blocks, recursing into inner blocks.\n\t// Output will be based on a depth-first traversal.\n\tconst stack = [ ...blocks ];\n\twhile ( stack.length ) {\n\t\tconst { innerBlocks, ...block } = stack.shift();\n\t\t// Place inner blocks at the beginning of the stack to preserve order.\n\t\tstack.unshift( ...innerBlocks );\n\n\t\tif ( isTemplatePart( block ) ) {\n\t\t\tconst {\n\t\t\t\tattributes: { theme, slug },\n\t\t\t} = block;\n\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t// Only add to output if the found template part block is in the list of available template parts.\n\t\t\tif ( templatePart ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,sBAAsB;AAE/B,
|
|
5
|
+
"mappings": ";AAGA,SAAS,sBAAsB;AAE/B,IAAM,cAAc,CAAC;AAYN,SAAR,8BACN,SAAS,aACT,eACC;AACD,QAAM,oBAAoB;AAAA;AAAA,IAEvB,cAAc;AAAA,MACd,CAAE,kBAAkB,UAAY;AAAA,QAC/B,GAAG;AAAA,QACH,CAAE,KAAK,EAAG,GAAG;AAAA,MACd;AAAA,MACA,CAAC;AAAA,IACD;AAAA,MACA,CAAC;AAEJ,QAAM,SAAS,CAAC;AAIhB,QAAM,QAAQ,CAAE,GAAG,MAAO;AAC1B,SAAQ,MAAM,QAAS;AACtB,UAAM,EAAE,aAAa,GAAG,MAAM,IAAI,MAAM,MAAM;AAE9C,UAAM,QAAS,GAAG,WAAY;AAE9B,QAAK,eAAgB,KAAM,GAAI;AAC9B,YAAM;AAAA,QACL,YAAY,EAAE,OAAO,KAAK;AAAA,MAC3B,IAAI;AACJ,YAAM,iBAAiB,GAAI,KAAM,KAAM,IAAK;AAC5C,YAAM,eAAe,kBAAmB,cAAe;AAGvD,UAAK,cAAe;AACnB,eAAO,KAAM;AAAA,UACZ;AAAA,UACA;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/is-previewing-theme.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getQueryArg } from '@wordpress/url';\n\nexport function isPreviewingTheme() {\n\treturn !! getQueryArg( window.location.href, 'wp_theme_preview' );\n}\n\nexport function currentlyPreviewingTheme() {\n\tif ( isPreviewingTheme() ) {\n\t\treturn getQueryArg( window.location.href, 'wp_theme_preview' );\n\t}\n\treturn null;\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,mBAAmB;AAErB,SAAS,oBAAoB;AACnC,SAAO,CAAC,CAAE,YAAa,OAAO,SAAS,MAAM,kBAAmB;AACjE;AAEO,SAAS,2BAA2B;AAC1C,MAAK,kBAAkB,GAAI;AAC1B,WAAO,YAAa,OAAO,SAAS,MAAM,kBAAmB;AAAA,EAC9D;AACA,SAAO;AACR;",
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAErB,SAAS,oBAAoB;AACnC,SAAO,CAAC,CAAE,YAAa,OAAO,SAAS,MAAM,kBAAmB;AACjE;AAEO,SAAS,2BAA2B;AAC1C,MAAK,kBAAkB,GAAI;AAC1B,WAAO,YAAa,OAAO,SAAS,MAAM,kBAAmB;AAAA,EAC9D;AACA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/is-template-removable.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from './constants';\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is removable.\n */\nexport default function isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplate.source === TEMPLATE_ORIGINS.custom &&\n\t\t! Boolean( template.plugin ) &&\n\t\t! template.has_theme_file\n\t);\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,wBAAwB;AAQlB,SAAR,oBAAsC,UAAW;AACvD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SACC,SAAS,WAAW,iBAAiB,UACrC,CAAE,QAAS,SAAS,MAAO,KAC3B,CAAE,SAAS;AAEb;",
|
|
5
|
+
"mappings": ";AAGA,SAAS,wBAAwB;AAQlB,SAAR,oBAAsC,UAAW;AACvD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SACC,SAAS,WAAW,iBAAiB,UACrC,CAAE,QAAS,SAAS,MAAO,KAC3B,CAAE,SAAS;AAEb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/is-template-revertable.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from './constants';\n\n/**\n * Check if a template is revertable to its original theme-provided template file.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRevertable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\
|
|
5
|
-
"mappings": "AAGA,SAAS,wBAAwB;AAQlB,SAAR,qBAAuC,UAAW;AACxD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SACC,UAAU,WAAW,iBAAiB,WACpC,QAAS,UAAU,MAAO,KAAK,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from './constants';\n\n/**\n * Check if a template is revertable to its original theme-provided template file.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRevertable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom &&\n\t\t( Boolean( template?.plugin ) || template?.has_theme_file )\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,wBAAwB;AAQlB,SAAR,qBAAuC,UAAW;AACxD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SACC,UAAU,WAAW,iBAAiB,WACpC,QAAS,UAAU,MAAO,KAAK,UAAU;AAE7C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/edit-site/src/utils/use-activate-theme.js
|
|
1
2
|
import { store as coreStore } from "@wordpress/core-data";
|
|
2
3
|
import { useDispatch } from "@wordpress/data";
|
|
3
4
|
import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
isPreviewingTheme,
|
|
8
9
|
currentlyPreviewingTheme
|
|
9
10
|
} from "./is-previewing-theme";
|
|
10
|
-
|
|
11
|
+
var { useHistory, useLocation } = unlock(routerPrivateApis);
|
|
11
12
|
function useActivateTheme() {
|
|
12
13
|
const history = useHistory();
|
|
13
14
|
const { path } = useLocation();
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/use-activate-theme.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from './is-previewing-theme';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * This should be refactored to use the REST API, once the REST API can activate themes.\n *\n * @return {Function} A function that activates the theme.\n */\nexport function useActivateTheme() {\n\tconst history = useHistory();\n\tconst { path } = useLocation();\n\tconst { startResolution, finishResolution } = useDispatch( coreStore );\n\n\treturn async () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tconst activationURL =\n\t\t\t\t'themes.php?action=activate&stylesheet=' +\n\t\t\t\tcurrentlyPreviewingTheme() +\n\t\t\t\t'&_wpnonce=' +\n\t\t\t\twindow.WP_BLOCK_THEME_ACTIVATE_NONCE;\n\t\t\tstartResolution( 'activateTheme' );\n\t\t\tawait window.fetch( activationURL );\n\t\t\tfinishResolution( 'activateTheme' );\n\t\t\t// Remove the wp_theme_preview query param: we've finished activating\n\t\t\t// the queue and are switching to normal Site Editor.\n\t\t\thistory.navigate( addQueryArgs( path, { wp_theme_preview: '' } ) );\n\t\t}\n\t};\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,SAAS,iBAAiB;AACnC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAK7B,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAEP,
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,iBAAiB;AACnC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAK7B,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAEP,IAAM,EAAE,YAAY,YAAY,IAAI,OAAQ,iBAAkB;AAOvD,SAAS,mBAAmB;AAClC,QAAM,UAAU,WAAW;AAC3B,QAAM,EAAE,KAAK,IAAI,YAAY;AAC7B,QAAM,EAAE,iBAAiB,iBAAiB,IAAI,YAAa,SAAU;AAErE,SAAO,YAAY;AAClB,QAAK,kBAAkB,GAAI;AAC1B,YAAM,gBACL,2CACA,yBAAyB,IACzB,eACA,OAAO;AACR,sBAAiB,eAAgB;AACjC,YAAM,OAAO,MAAO,aAAc;AAClC,uBAAkB,eAAgB;AAGlC,cAAQ,SAAU,aAAc,MAAM,EAAE,kBAAkB,GAAG,CAAE,CAAE;AAAA,IAClE;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/edit-site/src/utils/use-actual-current-theme.js
|
|
1
2
|
import apiFetch from "@wordpress/api-fetch";
|
|
2
3
|
import { useState, useEffect } from "@wordpress/element";
|
|
3
4
|
import { addQueryArgs } from "@wordpress/url";
|
|
4
|
-
|
|
5
|
+
var ACTIVE_THEMES_URL = "/wp/v2/themes?status=active";
|
|
5
6
|
function useActualCurrentTheme() {
|
|
6
7
|
const [currentTheme, setCurrentTheme] = useState();
|
|
7
8
|
useEffect(() => {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/use-actual-current-theme.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { useState, useEffect } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\n\nconst ACTIVE_THEMES_URL = '/wp/v2/themes?status=active';\n\nexport function useActualCurrentTheme() {\n\tconst [ currentTheme, setCurrentTheme ] = useState();\n\n\tuseEffect( () => {\n\t\t// Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware.\n\t\tconst path = addQueryArgs( ACTIVE_THEMES_URL, {\n\t\t\tcontext: 'edit',\n\t\t\twp_theme_preview: '',\n\t\t} );\n\n\t\tapiFetch( { path } )\n\t\t\t.then( ( activeThemes ) => setCurrentTheme( activeThemes[ 0 ] ) )\n\t\t\t// Do nothing\n\t\t\t.catch( () => {} );\n\t}, [] );\n\n\treturn currentTheme;\n}\n"],
|
|
5
|
-
"mappings": "AAGA,OAAO,cAAc;AACrB,SAAS,UAAU,iBAAiB;AACpC,SAAS,oBAAoB;AAE7B,
|
|
5
|
+
"mappings": ";AAGA,OAAO,cAAc;AACrB,SAAS,UAAU,iBAAiB;AACpC,SAAS,oBAAoB;AAE7B,IAAM,oBAAoB;AAEnB,SAAS,wBAAwB;AACvC,QAAM,CAAE,cAAc,eAAgB,IAAI,SAAS;AAEnD,YAAW,MAAM;AAEhB,UAAM,OAAO,aAAc,mBAAmB;AAAA,MAC7C,SAAS;AAAA,MACT,kBAAkB;AAAA,IACnB,CAAE;AAEF,aAAU,EAAE,KAAK,CAAE,EACjB,KAAM,CAAE,iBAAkB,gBAAiB,aAAc,CAAE,CAAE,CAAE,EAE/D,MAAO,MAAM;AAAA,IAAC,CAAE;AAAA,EACnB,GAAG,CAAC,CAAE;AAEN,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|