@wordpress/edit-site 5.24.1 → 5.25.1-next.79a6196f.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 +2 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +2 -3
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/back-button.js +3 -2
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +48 -23
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +2 -2
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +5 -54
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-post-link-props.js +27 -0
- package/build/components/block-editor/use-post-link-props.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +15 -23
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +15 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +21 -33
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +9 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +11 -7
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +6 -6
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +8 -4
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +38 -21
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +11 -7
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/local-fonts.js +26 -10
- package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +6 -6
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/index.js +35 -38
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/preview.js +43 -1
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +16 -12
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +54 -58
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +56 -15
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/ui.js +13 -62
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +15 -106
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +21 -47
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +19 -14
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -36
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +15 -21
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +2 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-main/index.js +4 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +102 -52
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +305 -0
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build/components/page-patterns/dataviews-patterns.js +307 -0
- package/build/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +4 -3
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +3 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +23 -13
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +312 -36
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/{page-patterns/pagination.js → pagination/index.js} +25 -12
- package/build/components/pagination/index.js.map +1 -0
- package/build/components/{page-pages/side-editor.js → post-preview/index.js} +8 -4
- package/build/components/post-preview/index.js.map +1 -0
- package/build/components/preferences-modal/enable-feature.js +3 -2
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/enable-panel-option.js +33 -0
- package/build/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build/components/preferences-modal/index.js +89 -25
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/revisions/index.js +3 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +6 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +3 -4
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +8 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +26 -20
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -10
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +19 -6
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +3 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +1 -5
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +62 -10
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +10 -4
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +1 -2
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +4 -13
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +69 -0
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +3 -89
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/template-areas.js +117 -0
- package/build/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +63 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +6 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +38 -8
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +3 -0
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +9 -1
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +1 -1
- package/build/hooks/navigation-menu-edit.js.map +1 -1
- package/build/hooks/template-part-edit.js +1 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +12 -7
- package/build/index.js.map +1 -1
- package/build/store/actions.js +54 -52
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +6 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +0 -64
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -47
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +15 -1
- 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-module/components/add-new-template/add-custom-template-modal-content.js +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +4 -3
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +50 -25
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +2 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +8 -56
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-post-link-props.js +20 -0
- package/build-module/components/block-editor/use-post-link-props.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +16 -24
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +14 -7
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +25 -37
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +9 -7
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +13 -8
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +8 -8
- 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 +8 -4
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +39 -22
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +13 -8
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/local-fonts.js +27 -11
- package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/resolvers.js +5 -5
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js +34 -36
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +17 -13
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +55 -59
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +56 -15
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/ui.js +15 -64
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +19 -109
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +25 -51
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +20 -15
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -36
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +15 -21
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +2 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-main/index.js +4 -4
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +101 -51
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +292 -0
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build-module/components/page-patterns/dataviews-patterns.js +299 -0
- package/build-module/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +4 -3
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -3
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +3 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -13
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +314 -38
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/{page-patterns/pagination.js → pagination/index.js} +24 -12
- package/build-module/components/pagination/index.js.map +1 -0
- package/build-module/components/{page-pages/side-editor.js → post-preview/index.js} +7 -3
- package/build-module/components/post-preview/index.js.map +1 -0
- package/build-module/components/preferences-modal/enable-feature.js +3 -2
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel-option.js +26 -0
- package/build-module/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +90 -26
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/revisions/index.js +4 -8
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +3 -4
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +8 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +26 -20
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -10
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +17 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +2 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +1 -5
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +64 -12
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +10 -4
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +2 -3
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +6 -15
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +61 -0
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +5 -90
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js +109 -0
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +64 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +6 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +40 -10
- 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 +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +3 -0
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +9 -1
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/navigation-menu-edit.js +1 -1
- package/build-module/hooks/navigation-menu-edit.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +1 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +12 -7
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +49 -47
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +6 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -61
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +40 -41
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +8 -0
- 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-style/style-rtl.css +607 -561
- package/build-style/style.css +607 -561
- package/package.json +42 -42
- package/src/components/add-new-template/add-custom-template-modal-content.js +1 -1
- package/src/components/add-new-template/style.scss +2 -1
- package/src/components/block-editor/back-button.js +4 -2
- package/src/components/block-editor/editor-canvas.js +63 -47
- package/src/components/block-editor/resizable-editor.js +1 -1
- package/src/components/block-editor/site-editor-canvas.js +32 -96
- package/src/components/block-editor/style.scss +7 -14
- package/src/components/block-editor/use-post-link-props.js +20 -0
- package/src/components/block-editor/use-site-editor-settings.js +38 -58
- package/src/components/code-editor/style.scss +0 -4
- package/src/components/create-template-part-modal/index.js +83 -82
- package/src/components/editor/index.js +34 -47
- package/src/components/editor-canvas-container/index.js +8 -6
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +18 -7
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/src/components/global-styles/font-library-modal/context.js +8 -8
- package/src/components/global-styles/font-library-modal/font-collection.js +10 -5
- package/src/components/global-styles/font-library-modal/index.js +44 -24
- package/src/components/global-styles/font-library-modal/installed-fonts.js +3 -3
- package/src/components/global-styles/font-library-modal/library-font-variant.js +18 -7
- package/src/components/global-styles/font-library-modal/local-fonts.js +53 -26
- package/src/components/global-styles/font-library-modal/resolvers.js +5 -5
- package/src/components/global-styles/font-library-modal/style.scss +5 -2
- package/src/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +9 -3
- package/src/components/global-styles/font-library-modal/utils/index.js +21 -23
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +58 -0
- package/src/components/global-styles/preview.js +55 -3
- package/src/components/global-styles/screen-color-palette.js +16 -26
- package/src/components/global-styles/screen-revisions/index.js +93 -101
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +85 -17
- package/src/components/global-styles/screen-revisions/style.scss +86 -21
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +67 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +73 -46
- package/src/components/global-styles/ui.js +13 -74
- package/src/components/header-edit-mode/document-tools/index.js +35 -167
- package/src/components/header-edit-mode/index.js +33 -78
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -4
- package/src/components/header-edit-mode/more-menu/index.js +25 -27
- package/src/components/header-edit-mode/style.scss +46 -68
- package/src/components/keyboard-shortcuts/edit-mode.js +1 -26
- package/src/components/keyboard-shortcuts/register.js +0 -43
- package/src/components/layout/index.js +29 -47
- package/src/components/layout/style.scss +10 -3
- package/src/components/page/header.js +2 -1
- package/src/components/page/style.scss +3 -3
- package/src/components/page-main/index.js +8 -8
- package/src/components/page-pages/index.js +157 -62
- package/src/components/page-pages/style.scss +4 -1
- package/src/components/page-patterns/dataviews-pattern-actions.js +329 -0
- package/src/components/page-patterns/dataviews-patterns.js +380 -0
- package/src/components/page-patterns/duplicate-menu-item.js +1 -1
- package/src/components/page-patterns/grid-item.js +3 -2
- package/src/components/page-patterns/patterns-list.js +7 -3
- package/src/components/page-patterns/rename-menu-item.js +7 -1
- package/src/components/page-patterns/style.scss +89 -26
- package/src/components/page-patterns/use-patterns.js +24 -15
- package/src/components/page-templates/index.js +399 -64
- package/src/components/{page-patterns/pagination.js → pagination/index.js} +21 -10
- package/src/components/pagination/style.scss +5 -0
- package/src/components/post-preview/index.js +16 -0
- package/src/components/preferences-modal/enable-feature.js +9 -5
- package/src/components/preferences-modal/enable-panel-option.js +23 -0
- package/src/components/preferences-modal/index.js +151 -40
- package/src/components/revisions/index.js +8 -15
- package/src/components/routes/link.js +11 -3
- package/src/components/routes/use-title.js +3 -10
- package/src/components/save-button/index.js +17 -3
- package/src/components/sidebar/index.js +45 -35
- package/src/components/sidebar/style.scss +10 -12
- package/src/components/sidebar-dataviews/add-new-view.js +1 -1
- package/src/components/sidebar-dataviews/dataview-item.js +3 -7
- package/src/components/sidebar-dataviews/default-views.js +23 -6
- package/src/components/sidebar-dataviews/index.js +2 -2
- package/src/components/sidebar-edit-mode/default-sidebar.js +0 -12
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +85 -14
- package/src/components/sidebar-edit-mode/page-panels/index.js +53 -25
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/style.scss +1 -42
- package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -12
- package/src/components/sidebar-edit-mode/style.scss +0 -10
- package/src/components/sidebar-edit-mode/template-panel/index.js +44 -40
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +3 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +7 -1
- package/src/components/sidebar-navigation-screen-page/index.js +2 -1
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +77 -0
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +1 -96
- package/src/components/sidebar-navigation-screen-template/index.js +8 -2
- package/src/components/sidebar-navigation-screen-template/template-areas.js +135 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +85 -28
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/site-hub/index.js +4 -5
- package/src/components/site-hub/style.scss +5 -2
- package/src/components/style-book/index.js +65 -21
- package/src/components/style-book/style.scss +3 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
- package/src/components/template-actions/rename-menu-item.js +7 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/hooks/commands/use-common-commands.js +10 -5
- package/src/hooks/commands/use-edit-mode-commands.js +8 -12
- package/src/hooks/navigation-menu-edit.js +1 -1
- package/src/hooks/template-part-edit.js +1 -1
- package/src/index.js +11 -5
- package/src/store/actions.js +50 -50
- package/src/store/private-actions.js +7 -3
- package/src/store/reducer.js +0 -62
- package/src/store/selectors.js +47 -41
- package/src/store/test/actions.js +11 -39
- package/src/store/test/reducer.js +1 -82
- package/src/store/test/selectors.js +0 -24
- package/src/style.scss +3 -3
- package/src/utils/constants.js +8 -0
- package/src/utils/get-is-list-page.js +2 -3
- package/build/components/dataviews/add-filter.js +0 -91
- package/build/components/dataviews/add-filter.js.map +0 -1
- package/build/components/dataviews/constants.js +0 -14
- package/build/components/dataviews/constants.js.map +0 -1
- package/build/components/dataviews/dataviews.js +0 -99
- package/build/components/dataviews/dataviews.js.map +0 -1
- package/build/components/dataviews/filter-summary.js +0 -62
- package/build/components/dataviews/filter-summary.js.map +0 -1
- package/build/components/dataviews/filters.js +0 -63
- package/build/components/dataviews/filters.js.map +0 -1
- package/build/components/dataviews/index.js +0 -21
- package/build/components/dataviews/index.js.map +0 -1
- package/build/components/dataviews/item-actions.js +0 -184
- package/build/components/dataviews/item-actions.js.map +0 -1
- package/build/components/dataviews/pagination.js +0 -123
- package/build/components/dataviews/pagination.js.map +0 -1
- package/build/components/dataviews/reset-filters.js +0 -33
- package/build/components/dataviews/reset-filters.js.map +0 -1
- package/build/components/dataviews/search.js +0 -51
- package/build/components/dataviews/search.js.map +0 -1
- package/build/components/dataviews/view-actions.js +0 -244
- package/build/components/dataviews/view-actions.js.map +0 -1
- package/build/components/dataviews/view-grid.js +0 -82
- package/build/components/dataviews/view-grid.js.map +0 -1
- package/build/components/dataviews/view-list.js +0 -399
- package/build/components/dataviews/view-list.js.map +0 -1
- package/build/components/dataviews/view-side-by-side.js +0 -20
- package/build/components/dataviews/view-side-by-side.js.map +0 -1
- package/build/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build/components/header-edit-mode/document-actions/index.js +0 -172
- package/build/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/redo.js +0 -41
- package/build/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/undo.js +0 -40
- package/build/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build/components/page-content-focus-notifications/back-to-page-notification.js +0 -61
- package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/edit-template-notification.js +0 -102
- package/build/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/index.js +0 -22
- package/build/components/page-content-focus-notifications/index.js.map +0 -1
- package/build/components/page-pages/side-editor.js.map +0 -1
- package/build/components/page-patterns/pagination.js.map +0 -1
- package/build/components/page-templates/dataviews-templates.js +0 -316
- package/build/components/page-templates/dataviews-templates.js.map +0 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +0 -60
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -109
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +0 -101
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +0 -79
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -48
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -84
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -35
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js +0 -73
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -219
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/build/utils/use-debounced-input.js +0 -22
- package/build/utils/use-debounced-input.js.map +0 -1
- package/build-module/components/dataviews/add-filter.js +0 -84
- package/build-module/components/dataviews/add-filter.js.map +0 -1
- package/build-module/components/dataviews/constants.js +0 -6
- package/build-module/components/dataviews/constants.js.map +0 -1
- package/build-module/components/dataviews/dataviews.js +0 -90
- package/build-module/components/dataviews/dataviews.js.map +0 -1
- package/build-module/components/dataviews/filter-summary.js +0 -55
- package/build-module/components/dataviews/filter-summary.js.map +0 -1
- package/build-module/components/dataviews/filters.js +0 -55
- package/build-module/components/dataviews/filters.js.map +0 -1
- package/build-module/components/dataviews/index.js +0 -2
- package/build-module/components/dataviews/index.js.map +0 -1
- package/build-module/components/dataviews/item-actions.js +0 -177
- package/build-module/components/dataviews/item-actions.js.map +0 -1
- package/build-module/components/dataviews/pagination.js +0 -115
- package/build-module/components/dataviews/pagination.js.map +0 -1
- package/build-module/components/dataviews/reset-filters.js +0 -26
- package/build-module/components/dataviews/reset-filters.js.map +0 -1
- package/build-module/components/dataviews/search.js +0 -43
- package/build-module/components/dataviews/search.js.map +0 -1
- package/build-module/components/dataviews/view-actions.js +0 -237
- package/build-module/components/dataviews/view-actions.js.map +0 -1
- package/build-module/components/dataviews/view-grid.js +0 -74
- package/build-module/components/dataviews/view-grid.js.map +0 -1
- package/build-module/components/dataviews/view-list.js +0 -390
- package/build-module/components/dataviews/view-list.js.map +0 -1
- package/build-module/components/dataviews/view-side-by-side.js +0 -12
- package/build-module/components/dataviews/view-side-by-side.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +0 -164
- package/build-module/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/redo.js +0 -33
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/undo.js +0 -32
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js +0 -54
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js +0 -96
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/index.js +0 -14
- package/build-module/components/page-content-focus-notifications/index.js.map +0 -1
- package/build-module/components/page-pages/side-editor.js.map +0 -1
- package/build-module/components/page-patterns/pagination.js.map +0 -1
- package/build-module/components/page-templates/dataviews-templates.js +0 -308
- package/build-module/components/page-templates/dataviews-templates.js.map +0 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -53
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -102
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +0 -93
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +0 -69
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -41
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -77
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -27
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +0 -65
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -209
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/build-module/utils/use-debounced-input.js +0 -15
- package/build-module/utils/use-debounced-input.js.map +0 -1
- package/src/components/dataviews/README.md +0 -191
- package/src/components/dataviews/add-filter.js +0 -108
- package/src/components/dataviews/constants.js +0 -5
- package/src/components/dataviews/dataviews.js +0 -99
- package/src/components/dataviews/filter-summary.js +0 -79
- package/src/components/dataviews/filters.js +0 -65
- package/src/components/dataviews/index.js +0 -1
- package/src/components/dataviews/item-actions.js +0 -208
- package/src/components/dataviews/pagination.js +0 -144
- package/src/components/dataviews/reset-filters.js +0 -26
- package/src/components/dataviews/search.js +0 -42
- package/src/components/dataviews/style.scss +0 -131
- package/src/components/dataviews/view-actions.js +0 -319
- package/src/components/dataviews/view-grid.js +0 -90
- package/src/components/dataviews/view-list.js +0 -512
- package/src/components/dataviews/view-side-by-side.js +0 -9
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamilies.spec.js +0 -62
- package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +0 -28
- package/src/components/header-edit-mode/document-actions/index.js +0 -204
- package/src/components/header-edit-mode/document-actions/style.scss +0 -145
- package/src/components/header-edit-mode/undo-redo/redo.js +0 -38
- package/src/components/header-edit-mode/undo-redo/undo.js +0 -34
- package/src/components/page-content-focus-notifications/back-to-page-notification.js +0 -58
- package/src/components/page-content-focus-notifications/edit-template-notification.js +0 -104
- package/src/components/page-content-focus-notifications/index.js +0 -14
- package/src/components/page-pages/side-editor.js +0 -14
- package/src/components/page-templates/dataviews-templates.js +0 -345
- package/src/components/secondary-sidebar/inserter-sidebar.js +0 -66
- package/src/components/secondary-sidebar/list-view-sidebar.js +0 -123
- package/src/components/secondary-sidebar/style.scss +0 -65
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +0 -108
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +0 -99
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -45
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -83
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -26
- package/src/components/sidebar-edit-mode/template-panel/last-revision.js +0 -82
- package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -279
- package/src/utils/use-debounced-input.js +0 -18
|
@@ -11,8 +11,12 @@ import {
|
|
|
11
11
|
__experimentalHStack as HStack,
|
|
12
12
|
__experimentalVStack as VStack,
|
|
13
13
|
} from '@wordpress/components';
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
useThrottle,
|
|
16
|
+
useReducedMotion,
|
|
17
|
+
useResizeObserver,
|
|
18
|
+
} from '@wordpress/compose';
|
|
19
|
+
import { useLayoutEffect, useState, useMemo } from '@wordpress/element';
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* Internal dependencies
|
|
@@ -60,6 +64,13 @@ const normalizedHeight = 152;
|
|
|
60
64
|
|
|
61
65
|
const normalizedColorSwatchSize = 32;
|
|
62
66
|
|
|
67
|
+
// Throttle options for useThrottle. Must be defined outside of the component,
|
|
68
|
+
// so that the object reference is the same on each render.
|
|
69
|
+
const THROTTLE_OPTIONS = {
|
|
70
|
+
leading: true,
|
|
71
|
+
trailing: true,
|
|
72
|
+
};
|
|
73
|
+
|
|
63
74
|
const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
64
75
|
const [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );
|
|
65
76
|
const [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );
|
|
@@ -79,7 +90,47 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
|
79
90
|
const disableMotion = useReducedMotion();
|
|
80
91
|
const [ isHovered, setIsHovered ] = useState( false );
|
|
81
92
|
const [ containerResizeListener, { width } ] = useResizeObserver();
|
|
82
|
-
const
|
|
93
|
+
const [ throttledWidth, setThrottledWidthState ] = useState( width );
|
|
94
|
+
const [ ratioState, setRatioState ] = useState();
|
|
95
|
+
|
|
96
|
+
const setThrottledWidth = useThrottle(
|
|
97
|
+
setThrottledWidthState,
|
|
98
|
+
250,
|
|
99
|
+
THROTTLE_OPTIONS
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
103
|
+
// size before the width is set.
|
|
104
|
+
useLayoutEffect( () => {
|
|
105
|
+
if ( width ) {
|
|
106
|
+
setThrottledWidth( width );
|
|
107
|
+
}
|
|
108
|
+
}, [ width, setThrottledWidth ] );
|
|
109
|
+
|
|
110
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
111
|
+
// size before the width is set.
|
|
112
|
+
useLayoutEffect( () => {
|
|
113
|
+
const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
|
|
114
|
+
const ratioDiff = newRatio - ( ratioState || 0 );
|
|
115
|
+
|
|
116
|
+
// Only update the ratio state if the difference is big enough
|
|
117
|
+
// or if the ratio state is not yet set. This is to avoid an
|
|
118
|
+
// endless loop of updates at particular viewport heights when the
|
|
119
|
+
// presence of a scrollbar causes the width to change slightly.
|
|
120
|
+
const isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;
|
|
121
|
+
|
|
122
|
+
if ( isRatioDiffBigEnough || ! ratioState ) {
|
|
123
|
+
setRatioState( newRatio );
|
|
124
|
+
}
|
|
125
|
+
}, [ throttledWidth, ratioState ] );
|
|
126
|
+
|
|
127
|
+
// Set a fallbackRatio to use before the throttled ratio has been set.
|
|
128
|
+
const fallbackRatio = width ? width / normalizedWidth : 1;
|
|
129
|
+
// Use the throttled ratio if it has been calculated, otherwise
|
|
130
|
+
// use the fallback ratio. The throttled ratio is used to avoid
|
|
131
|
+
// an endless loop of updates at particular viewport heights.
|
|
132
|
+
// See: https://github.com/WordPress/gutenberg/issues/55112
|
|
133
|
+
const ratio = ratioState ? ratioState : fallbackRatio;
|
|
83
134
|
|
|
84
135
|
const { paletteColors, highlightedColors } = useStylesPreviewColors();
|
|
85
136
|
|
|
@@ -108,6 +159,7 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
|
108
159
|
<Iframe
|
|
109
160
|
className="edit-site-global-styles-preview__iframe"
|
|
110
161
|
style={ {
|
|
162
|
+
width: '100%',
|
|
111
163
|
height: normalizedHeight * ratio,
|
|
112
164
|
} }
|
|
113
165
|
onMouseEnter={ () => setIsHovered( true ) }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -10,6 +10,9 @@ import { TabPanel } from '@wordpress/components';
|
|
|
10
10
|
import ColorPalettePanel from './color-palette-panel';
|
|
11
11
|
import GradientPalettePanel from './gradients-palette-panel';
|
|
12
12
|
import ScreenHeader from './header';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
|
|
15
|
+
const { Tabs } = unlock( componentsPrivateApis );
|
|
13
16
|
|
|
14
17
|
function ScreenColorPalette( { name } ) {
|
|
15
18
|
return (
|
|
@@ -20,31 +23,18 @@ function ScreenColorPalette( { name } ) {
|
|
|
20
23
|
'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'
|
|
21
24
|
) }
|
|
22
25
|
/>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
] }
|
|
36
|
-
>
|
|
37
|
-
{ ( tab ) => (
|
|
38
|
-
<>
|
|
39
|
-
{ tab.value === 'solid' && (
|
|
40
|
-
<ColorPalettePanel name={ name } />
|
|
41
|
-
) }
|
|
42
|
-
{ tab.value === 'gradient' && (
|
|
43
|
-
<GradientPalettePanel name={ name } />
|
|
44
|
-
) }
|
|
45
|
-
</>
|
|
46
|
-
) }
|
|
47
|
-
</TabPanel>
|
|
26
|
+
<Tabs>
|
|
27
|
+
<Tabs.TabList>
|
|
28
|
+
<Tabs.Tab tabId="solid">Solid</Tabs.Tab>
|
|
29
|
+
<Tabs.Tab tabId="gradient">Gradient</Tabs.Tab>
|
|
30
|
+
</Tabs.TabList>
|
|
31
|
+
<Tabs.TabPanel tabId="solid" focusable={ false }>
|
|
32
|
+
<ColorPalettePanel name={ name } />
|
|
33
|
+
</Tabs.TabPanel>
|
|
34
|
+
<Tabs.TabPanel tabId="gradient" focusable={ false }>
|
|
35
|
+
<GradientPalettePanel name={ name } />
|
|
36
|
+
</Tabs.TabPanel>
|
|
37
|
+
</Tabs>
|
|
48
38
|
</>
|
|
49
39
|
);
|
|
50
40
|
}
|
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
|
-
Button,
|
|
7
6
|
__experimentalUseNavigator as useNavigator,
|
|
8
7
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
9
8
|
Spinner,
|
|
10
|
-
__experimentalSpacer as Spacer,
|
|
11
9
|
} from '@wordpress/components';
|
|
12
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
14
11
|
import { useContext, useState, useEffect } from '@wordpress/element';
|
|
15
12
|
import {
|
|
16
13
|
privateApis as blockEditorPrivateApis,
|
|
@@ -23,51 +20,43 @@ import {
|
|
|
23
20
|
import ScreenHeader from '../header';
|
|
24
21
|
import { unlock } from '../../../lock-unlock';
|
|
25
22
|
import Revisions from '../../revisions';
|
|
26
|
-
import SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';
|
|
27
23
|
import { store as editSiteStore } from '../../../store';
|
|
28
24
|
import useGlobalStylesRevisions from './use-global-styles-revisions';
|
|
29
25
|
import RevisionsButtons from './revisions-buttons';
|
|
26
|
+
import StyleBook from '../../style-book';
|
|
27
|
+
import Pagination from '../../pagination';
|
|
30
28
|
|
|
31
29
|
const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
|
|
32
30
|
blockEditorPrivateApis
|
|
33
31
|
);
|
|
34
32
|
|
|
33
|
+
const PAGE_SIZE = 10;
|
|
34
|
+
|
|
35
35
|
function ScreenRevisions() {
|
|
36
36
|
const { goTo } = useNavigator();
|
|
37
37
|
const { user: currentEditorGlobalStyles, setUserConfig } =
|
|
38
38
|
useContext( GlobalStylesContext );
|
|
39
|
-
const { blocks, editorCanvasContainerView
|
|
40
|
-
( select ) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const isDirty = __experimentalGetDirtyEntityRecords().length > 0;
|
|
47
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
48
|
-
const globalStyles = globalStylesId
|
|
49
|
-
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
50
|
-
: undefined;
|
|
51
|
-
let _revisionsCount =
|
|
52
|
-
globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count || 0;
|
|
53
|
-
// one for the reset item.
|
|
54
|
-
_revisionsCount++;
|
|
55
|
-
// one for any dirty changes (unsaved).
|
|
56
|
-
if ( isDirty ) {
|
|
57
|
-
_revisionsCount++;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
editorCanvasContainerView: unlock(
|
|
61
|
-
select( editSiteStore )
|
|
62
|
-
).getEditorCanvasContainerView(),
|
|
63
|
-
blocks: select( blockEditorStore ).getBlocks(),
|
|
64
|
-
revisionsCount: _revisionsCount,
|
|
65
|
-
};
|
|
66
|
-
},
|
|
39
|
+
const { blocks, editorCanvasContainerView } = useSelect(
|
|
40
|
+
( select ) => ( {
|
|
41
|
+
editorCanvasContainerView: unlock(
|
|
42
|
+
select( editSiteStore )
|
|
43
|
+
).getEditorCanvasContainerView(),
|
|
44
|
+
blocks: select( blockEditorStore ).getBlocks(),
|
|
45
|
+
} ),
|
|
67
46
|
[]
|
|
68
47
|
);
|
|
69
|
-
const
|
|
70
|
-
|
|
48
|
+
const [ currentPage, setCurrentPage ] = useState( 1 );
|
|
49
|
+
const [ currentRevisions, setCurrentRevisions ] = useState( [] );
|
|
50
|
+
const { revisions, isLoading, hasUnsavedChanges, revisionsCount } =
|
|
51
|
+
useGlobalStylesRevisions( {
|
|
52
|
+
query: {
|
|
53
|
+
per_page: PAGE_SIZE,
|
|
54
|
+
page: currentPage,
|
|
55
|
+
},
|
|
56
|
+
} );
|
|
57
|
+
|
|
58
|
+
const numPages = Math.ceil( revisionsCount / PAGE_SIZE );
|
|
59
|
+
|
|
71
60
|
const [ currentlySelectedRevision, setCurrentlySelectedRevision ] =
|
|
72
61
|
useState( currentEditorGlobalStyles );
|
|
73
62
|
const [
|
|
@@ -105,12 +94,21 @@ function ScreenRevisions() {
|
|
|
105
94
|
};
|
|
106
95
|
|
|
107
96
|
useEffect( () => {
|
|
108
|
-
if (
|
|
97
|
+
if (
|
|
98
|
+
! editorCanvasContainerView ||
|
|
99
|
+
! editorCanvasContainerView.startsWith( 'global-styles-revisions' )
|
|
100
|
+
) {
|
|
109
101
|
goTo( '/' ); // Return to global styles main panel.
|
|
110
102
|
setEditorCanvasContainerView( editorCanvasContainerView );
|
|
111
103
|
}
|
|
112
104
|
}, [ editorCanvasContainerView ] );
|
|
113
105
|
|
|
106
|
+
useEffect( () => {
|
|
107
|
+
if ( ! isLoading && revisions.length ) {
|
|
108
|
+
setCurrentRevisions( revisions );
|
|
109
|
+
}
|
|
110
|
+
}, [ revisions, isLoading ] );
|
|
111
|
+
|
|
114
112
|
const firstRevision = revisions[ 0 ];
|
|
115
113
|
const currentlySelectedRevisionId = currentlySelectedRevision?.id;
|
|
116
114
|
const shouldSelectFirstItem =
|
|
@@ -135,10 +133,13 @@ function ScreenRevisions() {
|
|
|
135
133
|
}
|
|
136
134
|
}, [ shouldSelectFirstItem, firstRevision ] );
|
|
137
135
|
|
|
138
|
-
// Only display load button if there is a revision to load
|
|
136
|
+
// Only display load button if there is a revision to load,
|
|
137
|
+
// and it is different from the current editor styles.
|
|
139
138
|
const isLoadButtonEnabled =
|
|
140
|
-
!! currentlySelectedRevisionId &&
|
|
141
|
-
|
|
139
|
+
!! currentlySelectedRevisionId &&
|
|
140
|
+
currentlySelectedRevisionId !== 'unsaved' &&
|
|
141
|
+
! selectedRevisionMatchesEditorStyles;
|
|
142
|
+
const hasRevisions = !! currentRevisions.length;
|
|
142
143
|
|
|
143
144
|
return (
|
|
144
145
|
<>
|
|
@@ -153,76 +154,67 @@ function ScreenRevisions() {
|
|
|
153
154
|
) }
|
|
154
155
|
onBack={ onCloseRevisions }
|
|
155
156
|
/>
|
|
156
|
-
{
|
|
157
|
+
{ ! hasRevisions && (
|
|
157
158
|
<Spinner className="edit-site-global-styles-screen-revisions__loading" />
|
|
158
159
|
) }
|
|
159
|
-
{
|
|
160
|
-
|
|
160
|
+
{ hasRevisions &&
|
|
161
|
+
( editorCanvasContainerView ===
|
|
162
|
+
'global-styles-revisions:style-book' ? (
|
|
163
|
+
<StyleBook
|
|
164
|
+
userConfig={ currentlySelectedRevision }
|
|
165
|
+
isSelected={ () => {} }
|
|
166
|
+
onClose={ () => {
|
|
167
|
+
setEditorCanvasContainerView(
|
|
168
|
+
'global-styles-revisions'
|
|
169
|
+
);
|
|
170
|
+
} }
|
|
171
|
+
/>
|
|
172
|
+
) : (
|
|
161
173
|
<Revisions
|
|
162
174
|
blocks={ blocks }
|
|
163
175
|
userConfig={ currentlySelectedRevision }
|
|
164
|
-
|
|
176
|
+
closeButtonLabel={ __( 'Close revisions' ) }
|
|
165
177
|
/>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
</Button>
|
|
198
|
-
</SidebarFixedBottom>
|
|
199
|
-
) }
|
|
200
|
-
</div>
|
|
201
|
-
{ isLoadingRevisionWithUnsavedChanges && (
|
|
202
|
-
<ConfirmDialog
|
|
203
|
-
isOpen={ isLoadingRevisionWithUnsavedChanges }
|
|
204
|
-
confirmButtonText={ __( 'Apply' ) }
|
|
205
|
-
onConfirm={ () =>
|
|
206
|
-
restoreRevision( currentlySelectedRevision )
|
|
207
|
-
}
|
|
208
|
-
onCancel={ () =>
|
|
209
|
-
setIsLoadingRevisionWithUnsavedChanges( false )
|
|
210
|
-
}
|
|
211
|
-
>
|
|
212
|
-
{ __(
|
|
213
|
-
'Any unsaved changes will be lost when you apply this revision.'
|
|
214
|
-
) }
|
|
215
|
-
</ConfirmDialog>
|
|
216
|
-
) }
|
|
217
|
-
</>
|
|
218
|
-
) : (
|
|
219
|
-
<Spacer marginX={ 4 } data-testid="global-styles-no-revisions">
|
|
220
|
-
{
|
|
221
|
-
// Adding an existing translation here in case these changes are shipped to WordPress 6.3.
|
|
222
|
-
// Later we could update to something better, e.g., "There are currently no style revisions.".
|
|
223
|
-
__( 'No results found.' )
|
|
178
|
+
) ) }
|
|
179
|
+
<RevisionsButtons
|
|
180
|
+
onChange={ selectRevision }
|
|
181
|
+
selectedRevisionId={ currentlySelectedRevisionId }
|
|
182
|
+
userRevisions={ currentRevisions }
|
|
183
|
+
canApplyRevision={ isLoadButtonEnabled }
|
|
184
|
+
onApplyRevision={ () =>
|
|
185
|
+
hasUnsavedChanges
|
|
186
|
+
? setIsLoadingRevisionWithUnsavedChanges( true )
|
|
187
|
+
: restoreRevision( currentlySelectedRevision )
|
|
188
|
+
}
|
|
189
|
+
/>
|
|
190
|
+
{ numPages > 1 && (
|
|
191
|
+
<div className="edit-site-global-styles-screen-revisions__footer">
|
|
192
|
+
<Pagination
|
|
193
|
+
className="edit-site-global-styles-screen-revisions__pagination"
|
|
194
|
+
currentPage={ currentPage }
|
|
195
|
+
numPages={ numPages }
|
|
196
|
+
changePage={ setCurrentPage }
|
|
197
|
+
totalItems={ revisionsCount }
|
|
198
|
+
disabled={ isLoading }
|
|
199
|
+
label={ __( 'Global Styles pagination navigation' ) }
|
|
200
|
+
/>
|
|
201
|
+
</div>
|
|
202
|
+
) }
|
|
203
|
+
{ isLoadingRevisionWithUnsavedChanges && (
|
|
204
|
+
<ConfirmDialog
|
|
205
|
+
isOpen={ isLoadingRevisionWithUnsavedChanges }
|
|
206
|
+
confirmButtonText={ __( 'Apply' ) }
|
|
207
|
+
onConfirm={ () =>
|
|
208
|
+
restoreRevision( currentlySelectedRevision )
|
|
224
209
|
}
|
|
225
|
-
|
|
210
|
+
onCancel={ () =>
|
|
211
|
+
setIsLoadingRevisionWithUnsavedChanges( false )
|
|
212
|
+
}
|
|
213
|
+
>
|
|
214
|
+
{ __(
|
|
215
|
+
'Any unsaved changes will be lost when you apply this revision.'
|
|
216
|
+
) }
|
|
217
|
+
</ConfirmDialog>
|
|
226
218
|
) }
|
|
227
219
|
</>
|
|
228
220
|
);
|
|
@@ -11,23 +11,50 @@ import { Button } from '@wordpress/components';
|
|
|
11
11
|
import { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { unlock } from '../../../lock-unlock';
|
|
14
20
|
|
|
15
21
|
const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24;
|
|
22
|
+
const { getGlobalStylesChanges } = unlock( blockEditorPrivateApis );
|
|
23
|
+
|
|
24
|
+
function ChangesSummary( { revision, previousRevision } ) {
|
|
25
|
+
const changes = getGlobalStylesChanges( revision, previousRevision, {
|
|
26
|
+
maxResults: 7,
|
|
27
|
+
} );
|
|
28
|
+
const changesLength = changes.length;
|
|
29
|
+
|
|
30
|
+
if ( ! changesLength ) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<span
|
|
36
|
+
data-testid="global-styles-revision-changes"
|
|
37
|
+
className="edit-site-global-styles-screen-revisions__changes"
|
|
38
|
+
>
|
|
39
|
+
{ changes.join( ', ' ) }
|
|
40
|
+
</span>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
16
43
|
|
|
17
44
|
/**
|
|
18
45
|
* Returns a button label for the revision.
|
|
19
46
|
*
|
|
20
47
|
* @param {string|number} id A revision object.
|
|
21
|
-
* @param {boolean} isLatest Whether the revision is the most current.
|
|
22
48
|
* @param {string} authorDisplayName Author name.
|
|
23
49
|
* @param {string} formattedModifiedDate Revision modified date formatted.
|
|
50
|
+
* @param {boolean} areStylesEqual Whether the revision matches the current editor styles.
|
|
24
51
|
* @return {string} Translated label.
|
|
25
52
|
*/
|
|
26
53
|
function getRevisionLabel(
|
|
27
54
|
id,
|
|
28
|
-
isLatest,
|
|
29
55
|
authorDisplayName,
|
|
30
|
-
formattedModifiedDate
|
|
56
|
+
formattedModifiedDate,
|
|
57
|
+
areStylesEqual
|
|
31
58
|
) {
|
|
32
59
|
if ( 'parent' === id ) {
|
|
33
60
|
return __( 'Reset the styles to the theme defaults' );
|
|
@@ -35,21 +62,23 @@ function getRevisionLabel(
|
|
|
35
62
|
|
|
36
63
|
if ( 'unsaved' === id ) {
|
|
37
64
|
return sprintf(
|
|
38
|
-
/* translators: %s author display name */
|
|
65
|
+
/* translators: %s: author display name */
|
|
39
66
|
__( 'Unsaved changes by %s' ),
|
|
40
67
|
authorDisplayName
|
|
41
68
|
);
|
|
42
69
|
}
|
|
43
70
|
|
|
44
|
-
return
|
|
71
|
+
return areStylesEqual
|
|
45
72
|
? sprintf(
|
|
46
|
-
|
|
47
|
-
__(
|
|
73
|
+
// translators: %1$s: author display name, %2$s: revision creation date.
|
|
74
|
+
__(
|
|
75
|
+
'Changes saved by %1$s on %2$s. This revision matches current editor styles.'
|
|
76
|
+
),
|
|
48
77
|
authorDisplayName,
|
|
49
78
|
formattedModifiedDate
|
|
50
79
|
)
|
|
51
80
|
: sprintf(
|
|
52
|
-
|
|
81
|
+
// translators: %1$s: author display name, %2$s: revision creation date.
|
|
53
82
|
__( 'Changes saved by %1$s on %2$s' ),
|
|
54
83
|
authorDisplayName,
|
|
55
84
|
formattedModifiedDate
|
|
@@ -67,7 +96,13 @@ function getRevisionLabel(
|
|
|
67
96
|
* @param {props} Component props.
|
|
68
97
|
* @return {JSX.Element} The modal component.
|
|
69
98
|
*/
|
|
70
|
-
function RevisionsButtons( {
|
|
99
|
+
function RevisionsButtons( {
|
|
100
|
+
userRevisions,
|
|
101
|
+
selectedRevisionId,
|
|
102
|
+
onChange,
|
|
103
|
+
canApplyRevision,
|
|
104
|
+
onApplyRevision,
|
|
105
|
+
} ) {
|
|
71
106
|
const { currentThemeName, currentUser } = useSelect( ( select ) => {
|
|
72
107
|
const { getCurrentTheme, getCurrentUser } = select( coreStore );
|
|
73
108
|
const currentTheme = getCurrentTheme();
|
|
@@ -78,36 +113,38 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
|
|
|
78
113
|
};
|
|
79
114
|
}, [] );
|
|
80
115
|
const dateNowInMs = getDate().getTime();
|
|
81
|
-
const {
|
|
116
|
+
const { datetimeAbbreviated } = getSettings().formats;
|
|
82
117
|
|
|
83
118
|
return (
|
|
84
119
|
<ol
|
|
85
120
|
className="edit-site-global-styles-screen-revisions__revisions-list"
|
|
86
|
-
aria-label={ __( 'Global styles revisions' ) }
|
|
121
|
+
aria-label={ __( 'Global styles revisions list' ) }
|
|
87
122
|
role="group"
|
|
88
123
|
>
|
|
89
124
|
{ userRevisions.map( ( revision, index ) => {
|
|
90
|
-
const { id,
|
|
125
|
+
const { id, author, modified } = revision;
|
|
91
126
|
const isUnsaved = 'unsaved' === id;
|
|
92
127
|
// Unsaved changes are created by the current user.
|
|
93
128
|
const revisionAuthor = isUnsaved ? currentUser : author;
|
|
94
129
|
const authorDisplayName = revisionAuthor?.name || __( 'User' );
|
|
95
130
|
const authorAvatar = revisionAuthor?.avatar_urls?.[ '48' ];
|
|
131
|
+
const isFirstItem = index === 0;
|
|
96
132
|
const isSelected = selectedRevisionId
|
|
97
133
|
? selectedRevisionId === id
|
|
98
|
-
:
|
|
134
|
+
: isFirstItem;
|
|
135
|
+
const areStylesEqual = ! canApplyRevision && isSelected;
|
|
99
136
|
const isReset = 'parent' === id;
|
|
100
137
|
const modifiedDate = getDate( modified );
|
|
101
138
|
const displayDate =
|
|
102
139
|
modified &&
|
|
103
140
|
dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS
|
|
104
|
-
? dateI18n(
|
|
141
|
+
? dateI18n( datetimeAbbreviated, modifiedDate )
|
|
105
142
|
: humanTimeDiff( modified );
|
|
106
143
|
const revisionLabel = getRevisionLabel(
|
|
107
144
|
id,
|
|
108
|
-
isLatest,
|
|
109
145
|
authorDisplayName,
|
|
110
|
-
dateI18n( datetimeAbbreviated, modifiedDate )
|
|
146
|
+
dateI18n( datetimeAbbreviated, modifiedDate ),
|
|
147
|
+
areStylesEqual
|
|
111
148
|
);
|
|
112
149
|
|
|
113
150
|
return (
|
|
@@ -116,10 +153,12 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
|
|
|
116
153
|
'edit-site-global-styles-screen-revisions__revision-item',
|
|
117
154
|
{
|
|
118
155
|
'is-selected': isSelected,
|
|
156
|
+
'is-active': areStylesEqual,
|
|
119
157
|
'is-reset': isReset,
|
|
120
158
|
}
|
|
121
159
|
) }
|
|
122
160
|
key={ id }
|
|
161
|
+
aria-current={ isSelected }
|
|
123
162
|
>
|
|
124
163
|
<Button
|
|
125
164
|
className="edit-site-global-styles-screen-revisions__revision-button"
|
|
@@ -127,7 +166,7 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
|
|
|
127
166
|
onClick={ () => {
|
|
128
167
|
onChange( revision );
|
|
129
168
|
} }
|
|
130
|
-
label={ revisionLabel }
|
|
169
|
+
aria-label={ revisionLabel }
|
|
131
170
|
>
|
|
132
171
|
{ isReset ? (
|
|
133
172
|
<span className="edit-site-global-styles-screen-revisions__description">
|
|
@@ -157,9 +196,38 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
|
|
|
157
196
|
/>
|
|
158
197
|
{ authorDisplayName }
|
|
159
198
|
</span>
|
|
199
|
+
{ isSelected && (
|
|
200
|
+
<ChangesSummary
|
|
201
|
+
revision={ revision }
|
|
202
|
+
previousRevision={
|
|
203
|
+
index < userRevisions.length
|
|
204
|
+
? userRevisions[ index + 1 ]
|
|
205
|
+
: {}
|
|
206
|
+
}
|
|
207
|
+
/>
|
|
208
|
+
) }
|
|
160
209
|
</span>
|
|
161
210
|
) }
|
|
162
211
|
</Button>
|
|
212
|
+
{ isSelected &&
|
|
213
|
+
( areStylesEqual ? (
|
|
214
|
+
<p className="edit-site-global-styles-screen-revisions__applied-text">
|
|
215
|
+
{ __(
|
|
216
|
+
'These styles are already applied to your site.'
|
|
217
|
+
) }
|
|
218
|
+
</p>
|
|
219
|
+
) : (
|
|
220
|
+
<Button
|
|
221
|
+
disabled={ areStylesEqual }
|
|
222
|
+
variant="primary"
|
|
223
|
+
className="edit-site-global-styles-screen-revisions__apply-button"
|
|
224
|
+
onClick={ onApplyRevision }
|
|
225
|
+
>
|
|
226
|
+
{ isReset
|
|
227
|
+
? __( 'Reset to defaults' )
|
|
228
|
+
: __( 'Apply' ) }
|
|
229
|
+
</Button>
|
|
230
|
+
) ) }
|
|
163
231
|
</li>
|
|
164
232
|
);
|
|
165
233
|
} ) }
|