@wordpress/edit-site 5.33.0 → 5.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -3
- package/build/components/add-new-page/index.js +3 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +8 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- 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 +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +2 -2
- package/build/components/add-new-template/index.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/editor-canvas.js +4 -18
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +20 -5
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +2 -2
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +3 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/dataviews-actions/index.js +46 -0
- package/build/components/dataviews-actions/index.js.map +1 -0
- package/build/components/editor/index.js +95 -16
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +13 -1
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +2 -2
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +5 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +9 -3
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +1 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +2 -2
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/preset-colors.js +29 -0
- package/build/components/global-styles/preset-colors.js.map +1 -0
- package/build/components/global-styles/preview-colors.js +3 -7
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +5 -5
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +1 -4
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +8 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-example.js +5 -2
- package/build/components/global-styles/typography-example.js.map +1 -1
- package/build/components/global-styles/ui.js +4 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +12 -6
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +5 -5
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
- package/build/components/global-styles-sidebar/index.js.map +1 -0
- package/build/components/header-edit-mode/index.js +21 -137
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +3 -97
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -49
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +9 -9
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +70 -44
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page/index.js +2 -2
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-pages/index.js +4 -14
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +15 -87
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +3 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +28 -68
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/hooks.js.map +1 -0
- package/build/components/{page-templates-template-parts → page-templates}/index.js +73 -94
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/pagination/index.js +2 -2
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/pattern-modal/duplicate.js +7 -5
- package/build/components/pattern-modal/duplicate.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +9 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +20 -9
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +5 -2
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +4 -4
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +61 -31
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +2 -2
- package/build/components/sidebar-button/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +5 -3
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +6 -32
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -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 +16 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +39 -8
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +2 -2
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +3 -15
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +25 -29
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +5 -2
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -33
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +2 -2
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/style-book/index.js +10 -7
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/index.js +1 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-part-converter/index.js +18 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/deprecated.js +55 -0
- package/build/deprecated.js.map +1 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +40 -6
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +18 -18
- package/build/index.js.map +1 -1
- package/build/utils/constants.js +1 -2
- package/build/utils/constants.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/use-activate-theme.js +9 -6
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-page/index.js +3 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- 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 -1
- 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 +2 -2
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/app/index.js +4 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +4 -18
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +21 -6
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +2 -2
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/dataviews-actions/index.js +38 -0
- package/build-module/components/dataviews-actions/index.js.map +1 -0
- package/build-module/components/editor/index.js +96 -17
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +12 -1
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +2 -2
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +4 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +9 -3
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +1 -2
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +4 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +2 -2
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/preset-colors.js +22 -0
- package/build-module/components/global-styles/preset-colors.js.map +1 -0
- package/build-module/components/global-styles/preview-colors.js +3 -7
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +5 -5
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +1 -4
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +8 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-example.js +4 -1
- package/build-module/components/global-styles/typography-example.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +11 -5
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +6 -6
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
- package/build-module/components/global-styles-sidebar/index.js.map +1 -0
- package/build-module/components/header-edit-mode/index.js +22 -138
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -49
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +9 -9
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +70 -45
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page/index.js +2 -2
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +5 -15
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +15 -87
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +3 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +31 -71
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/hooks.js.map +1 -0
- package/build-module/components/{page-templates-template-parts → page-templates}/index.js +73 -94
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/pagination/index.js +2 -2
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/pattern-modal/duplicate.js +7 -5
- package/build-module/components/pattern-modal/duplicate.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +8 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +21 -10
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +4 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +4 -4
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +62 -32
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +2 -2
- package/build-module/components/sidebar-button/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +5 -3
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +6 -32
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +10 -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 +16 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -2
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +3 -15
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +26 -30
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -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 +6 -33
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +2 -2
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/style-book/index.js +9 -6
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +1 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +18 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/deprecated.js +45 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +38 -5
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +2 -4
- package/build-module/index.js.map +1 -1
- package/build-module/utils/constants.js +0 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +9 -6
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +208 -484
- package/build-style/style.css +208 -484
- package/package.json +43 -45
- package/src/components/add-new-page/index.js +7 -1
- package/src/components/add-new-pattern/index.js +15 -12
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/src/components/add-new-template/index.js +2 -2
- package/src/components/app/index.js +5 -2
- package/src/components/block-editor/editor-canvas.js +6 -26
- package/src/components/block-editor/resize-handle.js +30 -11
- package/src/components/block-editor/site-editor-canvas.js +2 -2
- package/src/components/block-editor/style.scss +12 -17
- package/src/components/create-template-part-modal/index.js +3 -0
- package/src/components/dataviews-actions/index.js +38 -0
- package/src/components/editor/index.js +117 -18
- package/src/components/editor/style.scss +6 -5
- package/src/components/global-styles/background-panel.js +17 -2
- package/src/components/global-styles/color-indicator-wrapper.js +2 -2
- package/src/components/global-styles/color-palette-panel.js +3 -4
- package/src/components/global-styles/font-library-modal/context.js +9 -3
- package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
- package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
- package/src/components/global-styles/font-library-modal/style.scss +17 -0
- package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/src/components/global-styles/gradients-palette-panel.js +1 -4
- package/src/components/global-styles/hooks.js +2 -1
- package/src/components/global-styles/icon-with-current-color.js +2 -2
- package/src/components/global-styles/preset-colors.js +18 -0
- package/src/components/global-styles/preview-colors.js +4 -7
- package/src/components/global-styles/screen-color-palette.js +4 -4
- package/src/components/global-styles/screen-colors.js +0 -2
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/src/components/global-styles/stories/index.story.js +2 -1
- package/src/components/global-styles/style-variations-container.js +11 -2
- package/src/components/global-styles/typography-example.js +2 -1
- package/src/components/global-styles/ui.js +5 -1
- package/src/components/global-styles/variations/style.scss +15 -31
- package/src/components/global-styles/variations/variation.js +13 -10
- package/src/components/global-styles/variations/variations-color.js +5 -8
- package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
- package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
- package/src/components/header-edit-mode/index.js +25 -184
- package/src/components/header-edit-mode/more-menu/index.js +8 -145
- package/src/components/header-edit-mode/style.scss +1 -271
- package/src/components/keyboard-shortcuts/register.js +0 -58
- package/src/components/layout/index.js +14 -10
- package/src/components/layout/router.js +66 -56
- package/src/components/layout/style.scss +2 -1
- package/src/components/page/index.js +2 -2
- package/src/components/page-pages/index.js +8 -28
- package/src/components/page-patterns/dataviews-pattern-actions.js +11 -101
- package/src/components/page-patterns/header.js +3 -1
- package/src/components/page-patterns/index.js +32 -110
- package/src/components/page-patterns/style.scss +14 -1
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/{page-templates-template-parts → page-templates}/index.js +33 -75
- package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
- package/src/components/pagination/index.js +2 -2
- package/src/components/pattern-modal/duplicate.js +4 -3
- package/src/components/plugin-template-setting-panel/index.js +8 -0
- package/src/components/resizable-frame/index.js +20 -7
- package/src/components/revisions/index.js +2 -1
- package/src/components/save-panel/index.js +4 -4
- package/src/components/sidebar/index.js +61 -37
- package/src/components/sidebar-button/index.js +2 -5
- package/src/components/sidebar-dataviews/dataview-item.js +4 -7
- package/src/components/sidebar-navigation-item/index.js +3 -3
- package/src/components/sidebar-navigation-screen/index.js +7 -31
- package/src/components/sidebar-navigation-screen/style.scss +11 -9
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +2 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +0 -10
- package/src/components/sidebar-navigation-screen-page/index.js +48 -9
- package/src/components/sidebar-navigation-screen-page/status-label.js +2 -2
- package/src/components/sidebar-navigation-screen-pattern/index.js +1 -12
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +20 -39
- package/src/components/sidebar-navigation-screen-template/index.js +3 -2
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +8 -39
- package/src/components/site-hub/index.js +3 -3
- package/src/components/site-icon/index.js +2 -2
- package/src/components/style-book/index.js +7 -6
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
- package/src/components/template-actions/index.js +1 -1
- package/src/components/template-part-converter/index.js +16 -3
- package/src/deprecated.js +42 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +71 -17
- package/src/index.js +2 -9
- package/src/style.scss +2 -16
- package/src/utils/constants.js +1 -1
- package/src/utils/get-is-list-page.js +1 -3
- package/src/utils/use-activate-theme.js +4 -4
- package/build/components/global-styles/global-styles-provider.js +0 -129
- package/build/components/global-styles/global-styles-provider.js.map +0 -1
- package/build/components/header-edit-mode/document-tools/index.js +0 -68
- package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
- package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build/components/page-templates-template-parts/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/index.js +0 -146
- package/build/components/sidebar-edit-mode/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +0 -98
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +0 -130
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build/components/start-template-options/index.js +0 -191
- package/build/components/start-template-options/index.js.map +0 -1
- package/build/utils/math.js +0 -98
- package/build/utils/math.js.map +0 -1
- package/build-module/components/global-styles/global-styles-provider.js +0 -120
- package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
- package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build-module/components/page-templates-template-parts/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/index.js +0 -137
- package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -90
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -31
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -122
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build-module/components/start-template-options/index.js +0 -184
- package/build-module/components/start-template-options/index.js.map +0 -1
- package/build-module/utils/math.js +0 -92
- package/build-module/utils/math.js.map +0 -1
- package/src/components/global-styles/global-styles-provider.js +0 -162
- package/src/components/header-edit-mode/document-tools/index.js +0 -68
- package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
- package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
- package/src/components/sidebar-edit-mode/index.js +0 -162
- package/src/components/sidebar-edit-mode/page-panels/index.js +0 -105
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -49
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
- package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
- package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
- package/src/components/sidebar-edit-mode/template-panel/index.js +0 -144
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
- package/src/components/start-template-options/index.js +0 -231
- package/src/components/start-template-options/style.scss +0 -55
- package/src/utils/math.js +0 -93
- /package/build/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
- /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/build-module/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
- /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
- /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
PluginMoreMenuItem as EditorPluginMoreMenuItem,
|
|
6
|
+
PluginSidebar as EditorPluginSidebar,
|
|
7
|
+
PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
|
|
8
|
+
} from '@wordpress/editor';
|
|
9
|
+
import deprecated from '@wordpress/deprecated';
|
|
10
|
+
|
|
11
|
+
const deprecateSlot = ( name ) => {
|
|
12
|
+
deprecated( `wp.editPost.${ name }`, {
|
|
13
|
+
since: '6.6',
|
|
14
|
+
alternative: `wp.editor.${ name }`,
|
|
15
|
+
} );
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/* eslint-disable jsdoc/require-param */
|
|
19
|
+
/**
|
|
20
|
+
* @see PluginMoreMenuItem in @wordpress/editor package.
|
|
21
|
+
*/
|
|
22
|
+
export function PluginMoreMenuItem( props ) {
|
|
23
|
+
deprecateSlot( 'PluginMoreMenuItem' );
|
|
24
|
+
return <EditorPluginMoreMenuItem { ...props } />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @see PluginSidebar in @wordpress/editor package.
|
|
29
|
+
*/
|
|
30
|
+
export function PluginSidebar( props ) {
|
|
31
|
+
deprecateSlot( 'PluginSidebar' );
|
|
32
|
+
return <EditorPluginSidebar { ...props } />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @see PluginSidebarMoreMenuItem in @wordpress/editor package.
|
|
37
|
+
*/
|
|
38
|
+
export function PluginSidebarMoreMenuItem( props ) {
|
|
39
|
+
deprecateSlot( 'PluginSidebarMoreMenuItem' );
|
|
40
|
+
return <EditorPluginSidebarMoreMenuItem { ...props } />;
|
|
41
|
+
}
|
|
42
|
+
/* eslint-enable jsdoc/require-param */
|
|
@@ -5,16 +5,17 @@ import { useSelect } from '@wordpress/data';
|
|
|
5
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
6
6
|
import { useContext, useMemo } from '@wordpress/element';
|
|
7
7
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
|
+
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
8
9
|
import { __ } from '@wordpress/i18n';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
12
13
|
*/
|
|
13
|
-
import { mergeBaseAndUserConfigs } from '../../components/global-styles/global-styles-provider';
|
|
14
14
|
import cloneDeep from '../../utils/clone-deep';
|
|
15
15
|
import { unlock } from '../../lock-unlock';
|
|
16
16
|
|
|
17
17
|
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
18
|
+
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Removes all instances of a property from an object.
|
|
@@ -153,22 +154,53 @@ export default function useThemeStyleVariationsByProperty( {
|
|
|
153
154
|
? cloneDeep( baseVariation )
|
|
154
155
|
: null;
|
|
155
156
|
|
|
156
|
-
let processedStyleVariations = variations.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
157
|
+
let processedStyleVariations = variations.reduce(
|
|
158
|
+
( accumulator, variation ) => {
|
|
159
|
+
const variationFilteredByProperty = filterObjectByProperty(
|
|
160
|
+
cloneDeep( variation ),
|
|
161
|
+
property
|
|
162
|
+
);
|
|
163
|
+
// Remove variations that are empty once the property is filtered out.
|
|
164
|
+
if ( Object.keys( variationFilteredByProperty ).length === 0 ) {
|
|
165
|
+
return accumulator;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
let result = {
|
|
169
|
+
...variationFilteredByProperty,
|
|
170
|
+
title: variation?.title,
|
|
171
|
+
description: variation?.description,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
if ( clonedBaseVariation ) {
|
|
175
|
+
/*
|
|
176
|
+
* Overwrites all baseVariation object `styleProperty` properties
|
|
177
|
+
* with the theme variation `styleProperty` properties.
|
|
178
|
+
*/
|
|
179
|
+
result = mergeBaseAndUserConfigs(
|
|
180
|
+
clonedBaseVariation,
|
|
181
|
+
result
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Detect if this is a duplicate variation.
|
|
186
|
+
const isDuplicate = accumulator.some( ( item ) => {
|
|
187
|
+
return (
|
|
188
|
+
JSON.stringify( item.styles ) ===
|
|
189
|
+
JSON.stringify( result?.styles ) &&
|
|
190
|
+
JSON.stringify( item.settings ) ===
|
|
191
|
+
JSON.stringify( result?.settings )
|
|
192
|
+
);
|
|
193
|
+
} );
|
|
194
|
+
if ( isDuplicate ) {
|
|
195
|
+
return accumulator;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// If the variation is not a duplicate, add it to the accumulator.
|
|
199
|
+
accumulator.push( result );
|
|
200
|
+
return accumulator;
|
|
201
|
+
},
|
|
202
|
+
[] // Initial accumulator value.
|
|
203
|
+
);
|
|
172
204
|
|
|
173
205
|
if ( 'function' === typeof filter ) {
|
|
174
206
|
processedStyleVariations =
|
|
@@ -178,3 +210,25 @@ export default function useThemeStyleVariationsByProperty( {
|
|
|
178
210
|
return processedStyleVariations;
|
|
179
211
|
}, [ variations, property, baseVariation, filter ] );
|
|
180
212
|
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Compares a style variation to the same variation filtered by a single property.
|
|
216
|
+
* Returns true if the variation contains only the property specified.
|
|
217
|
+
*
|
|
218
|
+
* @param {Object} variation The variation to compare.
|
|
219
|
+
* @param {string} property The property to compare.
|
|
220
|
+
* @return {boolean} Whether the variation contains only a single property.
|
|
221
|
+
*/
|
|
222
|
+
export function isVariationWithSingleProperty( variation, property ) {
|
|
223
|
+
const variationWithProperty = filterObjectByProperty(
|
|
224
|
+
cloneDeep( variation ),
|
|
225
|
+
property
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
JSON.stringify( variationWithProperty?.styles ) ===
|
|
230
|
+
JSON.stringify( variation?.styles ) &&
|
|
231
|
+
JSON.stringify( variationWithProperty?.settings ) ===
|
|
232
|
+
JSON.stringify( variation?.settings )
|
|
233
|
+
);
|
|
234
|
+
}
|
package/src/index.js
CHANGED
|
@@ -10,12 +10,7 @@ import {
|
|
|
10
10
|
import { dispatch } from '@wordpress/data';
|
|
11
11
|
import deprecated from '@wordpress/deprecated';
|
|
12
12
|
import { createRoot } from '@wordpress/element';
|
|
13
|
-
import {
|
|
14
|
-
PluginMoreMenuItem,
|
|
15
|
-
PluginSidebar,
|
|
16
|
-
PluginSidebarMoreMenuItem,
|
|
17
|
-
store as editorStore,
|
|
18
|
-
} from '@wordpress/editor';
|
|
13
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
19
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
20
15
|
import {
|
|
21
16
|
registerLegacyWidgetBlock,
|
|
@@ -102,8 +97,6 @@ export function reinitializeEditor() {
|
|
|
102
97
|
} );
|
|
103
98
|
}
|
|
104
99
|
|
|
105
|
-
export { PluginMoreMenuItem };
|
|
106
|
-
export { PluginSidebar };
|
|
107
|
-
export { PluginSidebarMoreMenuItem };
|
|
108
100
|
export { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';
|
|
109
101
|
export { store } from './store';
|
|
102
|
+
export * from './deprecated';
|
package/src/style.scss
CHANGED
|
@@ -6,20 +6,16 @@
|
|
|
6
6
|
@import "./components/code-editor/style.scss";
|
|
7
7
|
@import "./components/global-styles/style.scss";
|
|
8
8
|
@import "./components/global-styles/screen-revisions/style.scss";
|
|
9
|
+
@import "./components/global-styles-sidebar/style.scss";
|
|
9
10
|
@import "./components/header-edit-mode/style.scss";
|
|
10
11
|
@import "./components/page/style.scss";
|
|
11
12
|
@import "./components/page-pages/style.scss";
|
|
12
13
|
@import "./components/page-patterns/style.scss";
|
|
13
|
-
@import "./components/page-templates
|
|
14
|
+
@import "./components/page-templates/style.scss";
|
|
14
15
|
@import "./components/table/style.scss";
|
|
15
|
-
@import "./components/sidebar-edit-mode/style.scss";
|
|
16
|
-
@import "./components/sidebar-edit-mode/page-panels/style.scss";
|
|
17
|
-
@import "./components/sidebar-edit-mode/settings-header/style.scss";
|
|
18
|
-
@import "./components/sidebar-edit-mode/template-panel/style.scss";
|
|
19
16
|
@import "./components/editor/style.scss";
|
|
20
17
|
@import "./components/create-template-part-modal/style.scss";
|
|
21
18
|
@import "./components/welcome-guide/style.scss";
|
|
22
|
-
@import "./components/start-template-options/style.scss";
|
|
23
19
|
@import "./components/layout/style.scss";
|
|
24
20
|
@import "./components/save-hub/style.scss";
|
|
25
21
|
@import "./components/save-panel/style.scss";
|
|
@@ -86,16 +82,6 @@ body.js.site-editor-php {
|
|
|
86
82
|
.interface-interface-skeleton {
|
|
87
83
|
top: 0;
|
|
88
84
|
}
|
|
89
|
-
|
|
90
|
-
// Todo: Remove this rule when edit site gets support
|
|
91
|
-
// for opening unpinned sidebar items.
|
|
92
|
-
.interface-complementary-area__pin-unpin-item.components-button {
|
|
93
|
-
display: none;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.interface-interface-skeleton__content {
|
|
97
|
-
background-color: $gray-300;
|
|
98
|
-
}
|
|
99
85
|
}
|
|
100
86
|
|
|
101
87
|
/**
|
package/src/utils/constants.js
CHANGED
|
@@ -50,7 +50,7 @@ export const POST_TYPE_LABELS = {
|
|
|
50
50
|
export const LAYOUT_GRID = 'grid';
|
|
51
51
|
export const LAYOUT_TABLE = 'table';
|
|
52
52
|
export const LAYOUT_LIST = 'list';
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
export const OPERATOR_IS = 'is';
|
|
55
55
|
export const OPERATOR_IS_NOT = 'isNot';
|
|
56
56
|
export const OPERATOR_IS_ANY = 'isAny';
|
|
@@ -14,9 +14,7 @@ export default function getIsListPage(
|
|
|
14
14
|
isMobileViewport
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
|
-
[ '/wp_template', '/
|
|
18
|
-
path
|
|
19
|
-
) ||
|
|
17
|
+
[ '/wp_template', '/pages' ].includes( path ) ||
|
|
20
18
|
( path === '/patterns' &&
|
|
21
19
|
// Don't treat "/patterns" without categoryType and categoryId as a
|
|
22
20
|
// list page in mobile because the sidebar covers the whole page.
|
|
@@ -23,7 +23,7 @@ const { useHistory, useLocation } = unlock( routerPrivateApis );
|
|
|
23
23
|
*/
|
|
24
24
|
export function useActivateTheme() {
|
|
25
25
|
const history = useHistory();
|
|
26
|
-
const
|
|
26
|
+
const { params } = useLocation();
|
|
27
27
|
const { startResolution, finishResolution } = useDispatch( coreStore );
|
|
28
28
|
|
|
29
29
|
return async () => {
|
|
@@ -36,9 +36,9 @@ export function useActivateTheme() {
|
|
|
36
36
|
startResolution( 'activateTheme' );
|
|
37
37
|
await window.fetch( activationURL );
|
|
38
38
|
finishResolution( 'activateTheme' );
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
history.replace( params );
|
|
39
|
+
// Remove the wp_theme_preview query param: we've finished activating
|
|
40
|
+
// the queue and are switching to normal Site Editor.
|
|
41
|
+
history.replace( { ...params, wp_theme_preview: undefined } );
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.GlobalStylesProvider = GlobalStylesProvider;
|
|
8
|
-
exports.mergeBaseAndUserConfigs = mergeBaseAndUserConfigs;
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
|
11
|
-
var _isPlainObject = require("is-plain-object");
|
|
12
|
-
var _element = require("@wordpress/element");
|
|
13
|
-
var _data = require("@wordpress/data");
|
|
14
|
-
var _coreData = require("@wordpress/core-data");
|
|
15
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
16
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
17
|
-
/**
|
|
18
|
-
* External dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* WordPress dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
GlobalStylesContext,
|
|
31
|
-
cleanEmptyObject
|
|
32
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
33
|
-
function mergeBaseAndUserConfigs(base, user) {
|
|
34
|
-
return (0, _deepmerge.default)(base, user, {
|
|
35
|
-
// We only pass as arrays the presets,
|
|
36
|
-
// in which case we want the new array of values
|
|
37
|
-
// to override the old array (no merging).
|
|
38
|
-
isMergeableObject: _isPlainObject.isPlainObject
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function useGlobalStylesUserConfig() {
|
|
42
|
-
const {
|
|
43
|
-
globalStylesId,
|
|
44
|
-
isReady,
|
|
45
|
-
settings,
|
|
46
|
-
styles
|
|
47
|
-
} = (0, _data.useSelect)(select => {
|
|
48
|
-
const {
|
|
49
|
-
getEditedEntityRecord,
|
|
50
|
-
hasFinishedResolution
|
|
51
|
-
} = select(_coreData.store);
|
|
52
|
-
const _globalStylesId = select(_coreData.store).__experimentalGetCurrentGlobalStylesId();
|
|
53
|
-
const record = _globalStylesId ? getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined;
|
|
54
|
-
let hasResolved = false;
|
|
55
|
-
if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) {
|
|
56
|
-
hasResolved = _globalStylesId ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : true;
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
globalStylesId: _globalStylesId,
|
|
60
|
-
isReady: hasResolved,
|
|
61
|
-
settings: record?.settings,
|
|
62
|
-
styles: record?.styles
|
|
63
|
-
};
|
|
64
|
-
}, []);
|
|
65
|
-
const {
|
|
66
|
-
getEditedEntityRecord
|
|
67
|
-
} = (0, _data.useSelect)(_coreData.store);
|
|
68
|
-
const {
|
|
69
|
-
editEntityRecord
|
|
70
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
71
|
-
const config = (0, _element.useMemo)(() => {
|
|
72
|
-
return {
|
|
73
|
-
settings: settings !== null && settings !== void 0 ? settings : {},
|
|
74
|
-
styles: styles !== null && styles !== void 0 ? styles : {}
|
|
75
|
-
};
|
|
76
|
-
}, [settings, styles]);
|
|
77
|
-
const setConfig = (0, _element.useCallback)((callback, options = {}) => {
|
|
78
|
-
var _record$styles, _record$settings;
|
|
79
|
-
const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
|
|
80
|
-
const currentConfig = {
|
|
81
|
-
styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {},
|
|
82
|
-
settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {}
|
|
83
|
-
};
|
|
84
|
-
const updatedConfig = callback(currentConfig);
|
|
85
|
-
editEntityRecord('root', 'globalStyles', globalStylesId, {
|
|
86
|
-
styles: cleanEmptyObject(updatedConfig.styles) || {},
|
|
87
|
-
settings: cleanEmptyObject(updatedConfig.settings) || {}
|
|
88
|
-
}, options);
|
|
89
|
-
}, [globalStylesId]);
|
|
90
|
-
return [isReady, config, setConfig];
|
|
91
|
-
}
|
|
92
|
-
function useGlobalStylesBaseConfig() {
|
|
93
|
-
const baseConfig = (0, _data.useSelect)(select => {
|
|
94
|
-
return select(_coreData.store).__experimentalGetCurrentThemeBaseGlobalStyles();
|
|
95
|
-
}, []);
|
|
96
|
-
return [!!baseConfig, baseConfig];
|
|
97
|
-
}
|
|
98
|
-
function useGlobalStylesContext() {
|
|
99
|
-
const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
|
|
100
|
-
const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
|
|
101
|
-
const mergedConfig = (0, _element.useMemo)(() => {
|
|
102
|
-
if (!baseConfig || !userConfig) {
|
|
103
|
-
return {};
|
|
104
|
-
}
|
|
105
|
-
return mergeBaseAndUserConfigs(baseConfig, userConfig);
|
|
106
|
-
}, [userConfig, baseConfig]);
|
|
107
|
-
const context = (0, _element.useMemo)(() => {
|
|
108
|
-
return {
|
|
109
|
-
isReady: isUserConfigReady && isBaseConfigReady,
|
|
110
|
-
user: userConfig,
|
|
111
|
-
base: baseConfig,
|
|
112
|
-
merged: mergedConfig,
|
|
113
|
-
setUserConfig
|
|
114
|
-
};
|
|
115
|
-
}, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]);
|
|
116
|
-
return context;
|
|
117
|
-
}
|
|
118
|
-
function GlobalStylesProvider({
|
|
119
|
-
children
|
|
120
|
-
}) {
|
|
121
|
-
const context = useGlobalStylesContext();
|
|
122
|
-
if (!context.isReady) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
return (0, _react.createElement)(GlobalStylesContext.Provider, {
|
|
126
|
-
value: context
|
|
127
|
-
}, children);
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=global-styles-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_element","_data","_coreData","_blockEditor","_lockUnlock","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","useSelect","select","getEditedEntityRecord","hasFinishedResolution","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","undefined","hasResolved","editEntityRecord","useDispatch","config","useMemo","setConfig","useCallback","callback","options","_record$styles","_record$settings","currentConfig","updatedConfig","useGlobalStylesBaseConfig","baseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","userConfig","setUserConfig","isBaseConfigReady","mergedConfig","context","merged","GlobalStylesProvider","children","_react","createElement","Provider","value"],"sources":["@wordpress/edit-site/src/components/global-styles/global-styles-provider.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t// We only pass as arrays the presets,\n\t\t// in which case we want the new array of values\n\t\t// to override the old array (no merging).\n\t\tisMergeableObject: isPlainObject,\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\t\t\tconst record = _globalStylesId\n\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId\n\t\t\t\t )\n\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t};\n\t}, [ settings, styles ] );\n\n\tconst setConfig = useCallback(\n\t\t( callback, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t};\n\t\t\tconst updatedConfig = callback( currentConfig );\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore\n\t\t).__experimentalGetCurrentThemeBaseGlobalStyles();\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nfunction useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = DocumentTools;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _compose = require("@wordpress/compose");
|
|
9
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
var _i18n = require("@wordpress/i18n");
|
|
12
|
-
var _icons = require("@wordpress/icons");
|
|
13
|
-
var _components = require("@wordpress/components");
|
|
14
|
-
var _editor = require("@wordpress/editor");
|
|
15
|
-
var _lockUnlock = require("../../../lock-unlock");
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const {
|
|
25
|
-
DocumentTools: EditorDocumentTools
|
|
26
|
-
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
27
|
-
function DocumentTools({
|
|
28
|
-
blockEditorMode,
|
|
29
|
-
hasFixedToolbar,
|
|
30
|
-
isDistractionFree
|
|
31
|
-
}) {
|
|
32
|
-
const {
|
|
33
|
-
isVisualMode
|
|
34
|
-
} = (0, _data.useSelect)(select => {
|
|
35
|
-
const {
|
|
36
|
-
getEditorMode
|
|
37
|
-
} = select(_editor.store);
|
|
38
|
-
return {
|
|
39
|
-
isVisualMode: getEditorMode() === 'visual'
|
|
40
|
-
};
|
|
41
|
-
}, []);
|
|
42
|
-
const {
|
|
43
|
-
__unstableSetEditorMode
|
|
44
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
45
|
-
const {
|
|
46
|
-
setDeviceType
|
|
47
|
-
} = (0, _data.useDispatch)(_editor.store);
|
|
48
|
-
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
49
|
-
const isZoomedOutViewExperimentEnabled = window?.__experimentalEnableZoomedOutView && isVisualMode;
|
|
50
|
-
const isZoomedOutView = blockEditorMode === 'zoom-out';
|
|
51
|
-
return (0, _react.createElement)(EditorDocumentTools, {
|
|
52
|
-
disableBlockTools: !isVisualMode,
|
|
53
|
-
listViewLabel: (0, _i18n.__)('List View')
|
|
54
|
-
}, isZoomedOutViewExperimentEnabled && isLargeViewport && !isDistractionFree && !hasFixedToolbar && (0, _react.createElement)(_components.ToolbarItem, {
|
|
55
|
-
as: _components.Button,
|
|
56
|
-
className: "edit-site-header-edit-mode__zoom-out-view-toggle",
|
|
57
|
-
icon: _icons.chevronUpDown,
|
|
58
|
-
isPressed: isZoomedOutView
|
|
59
|
-
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
60
|
-
label: (0, _i18n.__)('Zoom-out View'),
|
|
61
|
-
onClick: () => {
|
|
62
|
-
setDeviceType('Desktop');
|
|
63
|
-
__unstableSetEditorMode(isZoomedOutView ? 'edit' : 'zoom-out');
|
|
64
|
-
},
|
|
65
|
-
size: "compact"
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_blockEditor","_data","_i18n","_icons","_components","_editor","_lockUnlock","DocumentTools","EditorDocumentTools","unlock","editorPrivateApis","blockEditorMode","hasFixedToolbar","isDistractionFree","isVisualMode","useSelect","select","getEditorMode","editorStore","__unstableSetEditorMode","useDispatch","blockEditorStore","setDeviceType","isLargeViewport","useViewportMatch","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","_react","createElement","disableBlockTools","listViewLabel","__","ToolbarItem","as","Button","className","icon","chevronUpDown","isPressed","label","onClick","size"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { chevronUpDown } from '@wordpress/icons';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { DocumentTools: EditorDocumentTools } = unlock( editorPrivateApis );\n\nexport default function DocumentTools( {\n\tblockEditorMode,\n\thasFixedToolbar,\n\tisDistractionFree,\n} ) {\n\tconst { isVisualMode } = useSelect( ( select ) => {\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t};\n\t}, [] );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\treturn (\n\t\t<EditorDocumentTools\n\t\t\tdisableBlockTools={ ! isVisualMode }\n\t\t\tlistViewLabel={ __( 'List View' ) }\n\t\t>\n\t\t\t{ isZoomedOutViewExperimentEnabled &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\t! hasFixedToolbar && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetDeviceType( 'Desktop' );\n\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\tisZoomedOutView ? 'edit' : 'zoom-out'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</EditorDocumentTools>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAQA,IAAAO,WAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGA,MAAM;EAAEQ,aAAa,EAAEC;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE3D,SAASH,aAAaA,CAAE;EACtCI,eAAe;EACfC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjD,MAAM;MAAEC;IAAc,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;IAE/C,OAAO;MACNJ,YAAY,EAAEG,aAAa,CAAC,CAAC,KAAK;IACnC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEE;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EACnE,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAF,iBAAW,EAAEF,aAAY,CAAC;EACpD,MAAMK,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACpD,MAAMC,gCAAgC,GACrCC,MAAM,EAAEC,iCAAiC,IAAIb,YAAY;EAC1D,MAAMc,eAAe,GAAGjB,eAAe,KAAK,UAAU;EAEtD,OACC,IAAAkB,MAAA,CAAAC,aAAA,EAACtB,mBAAmB;IACnBuB,iBAAiB,EAAG,CAAEjB,YAAc;IACpCkB,aAAa,EAAG,IAAAC,QAAE,EAAE,WAAY;EAAG,GAEjCR,gCAAgC,IACjCF,eAAe,IACf,CAAEV,iBAAiB,IACnB,CAAED,eAAe,IAChB,IAAAiB,MAAA,CAAAC,aAAA,EAAC1B,WAAA,CAAA8B,WAAW;IACXC,EAAE,EAAGC,kBAAQ;IACbC,SAAS,EAAC,kDAAkD;IAC5DC,IAAI,EAAGC,oBAAe;IACtBC,SAAS,EAAGZ;IACZ;IACAa,KAAK,EAAG,IAAAR,QAAE,EAAE,eAAgB,CAAG;IAC/BS,OAAO,EAAGA,CAAA,KAAM;MACfpB,aAAa,CAAE,SAAU,CAAC;MAC1BH,uBAAuB,CACtBS,eAAe,GAAG,MAAM,GAAG,UAC5B,CAAC;IACF,CAAG;IACHe,IAAI,EAAC;EAAS,CACd,CAEiB,CAAC;AAExB","ignoreList":[]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = CopyContentMenuItem;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _components = require("@wordpress/components");
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _compose = require("@wordpress/compose");
|
|
12
|
-
var _notices = require("@wordpress/notices");
|
|
13
|
-
var _coreData = require("@wordpress/core-data");
|
|
14
|
-
var _blocks = require("@wordpress/blocks");
|
|
15
|
-
var _store = require("../../../store");
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function CopyContentMenuItem() {
|
|
25
|
-
const {
|
|
26
|
-
createNotice
|
|
27
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
28
|
-
const {
|
|
29
|
-
getEditedPostId,
|
|
30
|
-
getEditedPostType
|
|
31
|
-
} = (0, _data.useSelect)(_store.store);
|
|
32
|
-
const {
|
|
33
|
-
getEditedEntityRecord
|
|
34
|
-
} = (0, _data.useSelect)(_coreData.store);
|
|
35
|
-
function getText() {
|
|
36
|
-
const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId());
|
|
37
|
-
if (!record) {
|
|
38
|
-
return '';
|
|
39
|
-
}
|
|
40
|
-
if (typeof record.content === 'function') {
|
|
41
|
-
return record.content(record);
|
|
42
|
-
} else if (record.blocks) {
|
|
43
|
-
return (0, _blocks.__unstableSerializeAndClean)(record.blocks);
|
|
44
|
-
} else if (record.content) {
|
|
45
|
-
return record.content;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function onSuccess() {
|
|
49
|
-
createNotice('info', (0, _i18n.__)('All content copied.'), {
|
|
50
|
-
isDismissible: true,
|
|
51
|
-
type: 'snackbar'
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
const ref = (0, _compose.useCopyToClipboard)(getText, onSuccess);
|
|
55
|
-
return (0, _react.createElement)(_components.MenuItem, {
|
|
56
|
-
ref: ref
|
|
57
|
-
}, (0, _i18n.__)('Copy all blocks'));
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=copy-content-menu-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_compose","_notices","_coreData","_blocks","_store","CopyContentMenuItem","createNotice","useDispatch","noticesStore","getEditedPostId","getEditedPostType","useSelect","editSiteStore","getEditedEntityRecord","coreStore","getText","record","content","blocks","__unstableSerializeAndClean","onSuccess","__","isDismissible","type","ref","useCopyToClipboard","_react","createElement","MenuItem"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/more-menu/copy-content-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nexport default function CopyContentMenuItem() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { getEditedPostId, getEditedPostType } = useSelect( editSiteStore );\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\n\tfunction getText() {\n\t\tconst record = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tgetEditedPostType(),\n\t\t\tgetEditedPostId()\n\t\t);\n\t\tif ( ! record ) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif ( typeof record.content === 'function' ) {\n\t\t\treturn record.content( record );\n\t\t} else if ( record.blocks ) {\n\t\t\treturn __unstableSerializeAndClean( record.blocks );\n\t\t} else if ( record.content ) {\n\t\t\treturn record.content;\n\t\t}\n\t}\n\n\tfunction onSuccess() {\n\t\tcreateNotice( 'info', __( 'All content copied.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n\n\tconst ref = useCopyToClipboard( getText, onSuccess );\n\n\treturn <MenuItem ref={ ref }>{ __( 'Copy all blocks' ) }</MenuItem>;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGe,SAASQ,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EACpD,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAc,CAAC;EACzE,MAAM;IAAEC;EAAsB,CAAC,GAAG,IAAAF,eAAS,EAAEG,eAAU,CAAC;EAExD,SAASC,OAAOA,CAAA,EAAG;IAClB,MAAMC,MAAM,GAAGH,qBAAqB,CACnC,UAAU,EACVH,iBAAiB,CAAC,CAAC,EACnBD,eAAe,CAAC,CACjB,CAAC;IACD,IAAK,CAAEO,MAAM,EAAG;MACf,OAAO,EAAE;IACV;IAEA,IAAK,OAAOA,MAAM,CAACC,OAAO,KAAK,UAAU,EAAG;MAC3C,OAAOD,MAAM,CAACC,OAAO,CAAED,MAAO,CAAC;IAChC,CAAC,MAAM,IAAKA,MAAM,CAACE,MAAM,EAAG;MAC3B,OAAO,IAAAC,mCAA2B,EAAEH,MAAM,CAACE,MAAO,CAAC;IACpD,CAAC,MAAM,IAAKF,MAAM,CAACC,OAAO,EAAG;MAC5B,OAAOD,MAAM,CAACC,OAAO;IACtB;EACD;EAEA,SAASG,SAASA,CAAA,EAAG;IACpBd,YAAY,CAAE,MAAM,EAAE,IAAAe,QAAE,EAAE,qBAAsB,CAAC,EAAE;MAClDC,aAAa,EAAE,IAAI;MACnBC,IAAI,EAAE;IACP,CAAE,CAAC;EACJ;EAEA,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEV,OAAO,EAAEK,SAAU,CAAC;EAEpD,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAAC/B,WAAA,CAAAgC,QAAQ;IAACJ,GAAG,EAAGA;EAAK,GAAG,IAAAH,QAAE,EAAE,iBAAkB,CAAa,CAAC;AACpE","ignoreList":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _components = require("@wordpress/components");
|
|
9
|
-
/**
|
|
10
|
-
* WordPress dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
Fill: ToolsMoreMenuGroup,
|
|
15
|
-
Slot
|
|
16
|
-
} = (0, _components.createSlotFill)('EditSiteToolsMoreMenuGroup');
|
|
17
|
-
ToolsMoreMenuGroup.Slot = ({
|
|
18
|
-
fillProps
|
|
19
|
-
}) => (0, _react.createElement)(Slot, {
|
|
20
|
-
fillProps: fillProps
|
|
21
|
-
}, fills => fills && fills.length > 0);
|
|
22
|
-
var _default = exports.default = ToolsMoreMenuGroup;
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","Fill","ToolsMoreMenuGroup","Slot","createSlotFill","fillProps","_react","createElement","fills","length","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/tools-more-menu-group/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(\n\t'EditSiteToolsMoreMenuGroup'\n);\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) => fills && fills.length > 0 }\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAM;EAAEC,IAAI,EAAEC,kBAAkB;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EACxD,4BACD,CAAC;AAEDF,kBAAkB,CAACC,IAAI,GAAG,CAAE;EAAEE;AAAU,CAAC,KACxC,IAAAC,MAAA,CAAAC,aAAA,EAACJ,IAAI;EAACE,SAAS,EAAGA;AAAW,GACxBG,KAAK,IAAMA,KAAK,IAAIA,KAAK,CAACC,MAAM,GAAG,CAClC,CACN;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaV,kBAAkB","ignoreList":[]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
-
var _blocks = require("@wordpress/blocks");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
function KeyboardShortcutsEditMode() {
|
|
16
|
-
const {
|
|
17
|
-
replaceBlocks
|
|
18
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
19
|
-
const {
|
|
20
|
-
getBlockName,
|
|
21
|
-
getSelectedBlockClientId,
|
|
22
|
-
getBlockAttributes
|
|
23
|
-
} = (0, _data.useSelect)(_blockEditor.store);
|
|
24
|
-
const handleTextLevelShortcut = (event, level) => {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
|
|
27
|
-
const currentClientId = getSelectedBlockClientId();
|
|
28
|
-
if (currentClientId === null) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const blockName = getBlockName(currentClientId);
|
|
32
|
-
if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const attributes = getBlockAttributes(currentClientId);
|
|
36
|
-
const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
37
|
-
const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
38
|
-
replaceBlocks(currentClientId, (0, _blocks.createBlock)(destinationBlockName, {
|
|
39
|
-
level,
|
|
40
|
-
content: attributes.content,
|
|
41
|
-
...{
|
|
42
|
-
[destinationTextAlign]: attributes[textAlign]
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
(0, _keyboardShortcuts.useShortcut)('core/edit-site/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
47
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
48
|
-
//the loop is based off on a constant therefore
|
|
49
|
-
//the hook will execute the same way every time
|
|
50
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
51
|
-
(0, _keyboardShortcuts.useShortcut)(`core/edit-site/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
|
|
52
|
-
});
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
var _default = exports.default = KeyboardShortcutsEditMode;
|
|
56
|
-
//# sourceMappingURL=edit-mode.js.map
|