@wordpress/edit-site 5.8.0 → 5.10.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 +4 -0
- package/build/components/add-new-template/add-custom-template-modal.js +21 -6
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -2
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +8 -4
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +8 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/back-button.js +10 -3
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +39 -6
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +7 -7
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +43 -9
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +131 -0
- package/build/components/editor-canvas-container/index.js.map +1 -0
- package/build/components/global-styles/block-preview-panel.js +1 -1
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +53 -5
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +14 -3
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +17 -18
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +4 -18
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +14 -3
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/root-menu.js +61 -0
- package/build/components/global-styles/root-menu.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +3 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +158 -7
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +9 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -15
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -17
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +148 -0
- package/build/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +132 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +130 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -3
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +11 -39
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +3 -8
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +7 -11
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +66 -120
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +4 -28
- package/build/components/global-styles/variations-panel.js.map +1 -1
- package/build/components/header-edit-mode/index.js +11 -7
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +1 -1
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +22 -14
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/index.js +9 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +4 -4
- package/build/components/list/table.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +44 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build/components/revisions/index.js +95 -0
- package/build/components/revisions/index.js.map +1 -0
- package/build/components/routes/link.js +17 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +8 -2
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +31 -6
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +14 -31
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +20 -7
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +2 -7
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +16 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +35 -14
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +9 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build/components/sidebar-navigation-item/index.js +5 -7
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -4
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +24 -7
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -5
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +67 -0
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -3
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-subtitle/index.js +18 -0
- package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build/components/site-hub/index.js +64 -12
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +8 -7
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +21 -24
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +9 -41
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +13 -5
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +3 -1
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +9 -3
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/hooks/template-part-edit.js +8 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/store/private-actions.js +19 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +13 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +23 -1
- package/build/store/reducer.js.map +1 -1
- package/build/utils/is-previewing-theme.js +27 -0
- package/build/utils/is-previewing-theme.js.map +1 -0
- package/build/utils/use-activate-theme.js +46 -0
- package/build/utils/use-activate-theme.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-template-modal.js +21 -6
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +5 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +7 -3
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +6 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +6 -1
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +37 -6
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +6 -6
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +45 -11
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +115 -0
- package/build-module/components/editor-canvas-container/index.js.map +1 -0
- package/build-module/components/global-styles/block-preview-panel.js +1 -1
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +54 -5
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +13 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -18
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +5 -19
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +47 -0
- package/build-module/components/global-styles/root-menu.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +4 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +151 -7
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +9 -25
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +20 -15
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -16
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +128 -0
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +121 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +116 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +2 -2
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -3
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +11 -37
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +3 -7
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +7 -11
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +66 -118
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +3 -22
- package/build-module/components/global-styles/variations-panel.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +10 -7
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +1 -1
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +17 -10
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/index.js +5 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +4 -4
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +35 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build-module/components/revisions/index.js +77 -0
- package/build-module/components/revisions/index.js.map +1 -0
- package/build-module/components/routes/link.js +13 -1
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +5 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +28 -6
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +13 -32
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +19 -7
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -8
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +35 -16
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +10 -5
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-item/index.js +6 -8
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +13 -5
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +25 -8
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +13 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -3
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +64 -14
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +8 -7
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +22 -25
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +10 -41
- 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 +10 -4
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +3 -1
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +5 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +5 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-actions.js +15 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +23 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +17 -0
- package/build-module/utils/is-previewing-theme.js.map +1 -0
- package/build-module/utils/use-activate-theme.js +36 -0
- package/build-module/utils/use-activate-theme.js.map +1 -0
- package/build-style/style-rtl.css +310 -137
- package/build-style/style.css +310 -137
- package/package.json +37 -35
- package/src/components/add-new-template/add-custom-template-modal.js +31 -8
- package/src/components/add-new-template/new-template-part.js +4 -1
- package/src/components/add-new-template/new-template.js +6 -1
- package/src/components/add-new-template/style.scss +52 -48
- package/src/components/app/index.js +6 -3
- package/src/components/block-editor/back-button.js +4 -1
- package/src/components/block-editor/editor-canvas.js +36 -8
- package/src/components/block-editor/index.js +8 -8
- package/src/components/block-editor/style.scss +15 -8
- package/src/components/editor/index.js +48 -7
- package/src/components/editor-canvas-container/index.js +128 -0
- package/src/components/editor-canvas-container/style.scss +19 -0
- package/src/components/global-styles/block-preview-panel.js +1 -1
- package/src/components/global-styles/border-panel.js +46 -3
- package/src/components/global-styles/color-palette-panel.js +9 -0
- package/src/components/global-styles/dimensions-panel.js +15 -15
- package/src/components/global-styles/global-styles-provider.js +4 -18
- package/src/components/global-styles/gradients-palette-panel.js +8 -0
- package/src/components/global-styles/root-menu.js +66 -0
- package/src/components/global-styles/screen-block-list.js +2 -2
- package/src/components/global-styles/screen-block.js +184 -7
- package/src/components/global-styles/screen-colors.js +9 -16
- package/src/components/global-styles/screen-css.js +21 -21
- package/src/components/global-styles/screen-layout.js +5 -9
- package/src/components/global-styles/screen-revisions/index.js +177 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +131 -0
- package/src/components/global-styles/screen-revisions/style.scss +99 -0
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +125 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +103 -0
- package/src/components/global-styles/screen-root.js +2 -2
- package/src/components/global-styles/screen-typography-element.js +1 -3
- package/src/components/global-styles/screen-typography.js +44 -79
- package/src/components/global-styles/style-variations-container.js +4 -10
- package/src/components/global-styles/style.scss +1 -23
- package/src/components/global-styles/typography-panel.js +12 -13
- package/src/components/global-styles/ui.js +82 -107
- package/src/components/global-styles/variations-panel.js +3 -26
- package/src/components/header-edit-mode/index.js +17 -5
- package/src/components/keyboard-shortcuts/register.js +1 -1
- package/src/components/layout/index.js +16 -19
- package/src/components/layout/style.scss +32 -7
- package/src/components/list/index.js +4 -1
- package/src/components/list/style.scss +4 -0
- package/src/components/list/table.js +19 -3
- package/src/components/plugin-template-setting-panel/index.js +33 -0
- package/src/components/revisions/index.js +104 -0
- package/src/components/routes/link.js +16 -1
- package/src/components/routes/use-title.js +4 -1
- package/src/components/save-button/index.js +27 -6
- package/src/components/save-hub/index.js +17 -35
- package/src/components/save-panel/index.js +15 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +2 -6
- package/src/components/secondary-sidebar/style.scss +23 -5
- package/src/components/sidebar/index.js +12 -1
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +39 -18
- package/src/components/sidebar-edit-mode/index.js +17 -6
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
- package/src/components/sidebar-edit-mode/style.scss +10 -0
- package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
- package/src/components/sidebar-navigation-item/index.js +13 -14
- package/src/components/sidebar-navigation-item/style.scss +8 -1
- package/src/components/sidebar-navigation-screen/index.js +26 -5
- package/src/components/sidebar-navigation-screen-main/index.js +43 -22
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +13 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
- package/src/components/sidebar-navigation-screen-page/index.js +59 -0
- package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
- package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +5 -1
- package/src/components/sidebar-navigation-subtitle/index.js +5 -0
- package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
- package/src/components/site-hub/index.js +92 -33
- package/src/components/site-hub/style.scss +8 -0
- package/src/components/site-icon/index.js +6 -11
- package/src/components/site-icon/style.scss +8 -3
- package/src/components/start-template-options/index.js +32 -39
- package/src/components/start-template-options/style.scss +36 -46
- package/src/components/style-book/index.js +7 -51
- package/src/components/style-book/style.scss +0 -18
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -4
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
- package/src/components/template-details/index.js +1 -0
- package/src/components/template-details/template-areas.js +4 -1
- package/src/hooks/template-part-edit.js +4 -1
- package/src/index.js +1 -0
- package/src/store/private-actions.js +14 -0
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +18 -0
- package/src/store/test/actions.js +6 -14
- package/src/style.scss +5 -1
- package/src/utils/is-previewing-theme.js +18 -0
- package/src/utils/use-activate-theme.js +38 -0
- package/build/components/global-styles/context-menu.js +0 -126
- package/build/components/global-styles/context-menu.js.map +0 -1
- package/build/components/global-styles/custom-css.js +0 -113
- package/build/components/global-styles/custom-css.js.map +0 -1
- package/build/components/global-styles/effects-panel.js +0 -53
- package/build/components/global-styles/effects-panel.js.map +0 -1
- package/build/components/global-styles/filters-panel.js +0 -45
- package/build/components/global-styles/filters-panel.js.map +0 -1
- package/build/components/global-styles/screen-border.js +0 -61
- package/build/components/global-styles/screen-border.js.map +0 -1
- package/build/components/global-styles/screen-effects.js +0 -61
- package/build/components/global-styles/screen-effects.js.map +0 -1
- package/build/components/global-styles/screen-filters.js +0 -46
- package/build/components/global-styles/screen-filters.js.map +0 -1
- package/build/components/global-styles/screen-variations.js +0 -71
- package/build/components/global-styles/screen-variations.js.map +0 -1
- package/build/components/routes/index.js +0 -60
- package/build/components/routes/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build/hooks/commands/index.js +0 -19
- package/build/hooks/commands/index.js.map +0 -1
- package/build/hooks/commands/use-navigation-commands.js +0 -117
- package/build/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build/hooks/commands/use-wp-admin-commands.js +0 -94
- package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build/utils/history.js +0 -41
- package/build/utils/history.js.map +0 -1
- package/build-module/components/global-styles/context-menu.js +0 -107
- package/build-module/components/global-styles/context-menu.js.map +0 -1
- package/build-module/components/global-styles/custom-css.js +0 -98
- package/build-module/components/global-styles/custom-css.js.map +0 -1
- package/build-module/components/global-styles/effects-panel.js +0 -43
- package/build-module/components/global-styles/effects-panel.js.map +0 -1
- package/build-module/components/global-styles/filters-panel.js +0 -35
- package/build-module/components/global-styles/filters-panel.js.map +0 -1
- package/build-module/components/global-styles/screen-border.js +0 -44
- package/build-module/components/global-styles/screen-border.js.map +0 -1
- package/build-module/components/global-styles/screen-effects.js +0 -44
- package/build-module/components/global-styles/screen-effects.js.map +0 -1
- package/build-module/components/global-styles/screen-filters.js +0 -33
- package/build-module/components/global-styles/screen-filters.js.map +0 -1
- package/build-module/components/global-styles/screen-variations.js +0 -54
- package/build-module/components/global-styles/screen-variations.js.map +0 -1
- package/build-module/components/routes/index.js +0 -47
- package/build-module/components/routes/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build-module/hooks/commands/index.js +0 -10
- package/build-module/hooks/commands/index.js.map +0 -1
- package/build-module/hooks/commands/use-navigation-commands.js +0 -101
- package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build-module/hooks/commands/use-wp-admin-commands.js +0 -79
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build-module/utils/history.js +0 -31
- package/build-module/utils/history.js.map +0 -1
- package/src/components/global-styles/context-menu.js +0 -175
- package/src/components/global-styles/custom-css.js +0 -131
- package/src/components/global-styles/effects-panel.js +0 -40
- package/src/components/global-styles/filters-panel.js +0 -33
- package/src/components/global-styles/screen-border.js +0 -35
- package/src/components/global-styles/screen-effects.js +0 -35
- package/src/components/global-styles/screen-filters.js +0 -27
- package/src/components/global-styles/screen-variations.js +0 -46
- package/src/components/routes/index.js +0 -53
- package/src/hooks/commands/index.js +0 -10
- package/src/hooks/commands/use-navigation-commands.js +0 -103
- package/src/hooks/commands/use-wp-admin-commands.js +0 -77
- package/src/utils/history.js +0 -39
- /package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +0 -0
|
@@ -2,25 +2,202 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { getBlockType } from '@wordpress/blocks';
|
|
5
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
6
|
+
import { useMemo } from '@wordpress/element';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
8
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
+
import {
|
|
10
|
+
PanelBody,
|
|
11
|
+
__experimentalVStack as VStack,
|
|
12
|
+
} from '@wordpress/components';
|
|
13
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* Internal dependencies
|
|
8
17
|
*/
|
|
9
|
-
import ContextMenu from './context-menu';
|
|
10
18
|
import ScreenHeader from './header';
|
|
11
19
|
import BlockPreviewPanel from './block-preview-panel';
|
|
20
|
+
import { unlock } from '../../private-apis';
|
|
21
|
+
import Subtitle from './subtitle';
|
|
22
|
+
import { useBlockVariations, VariationsPanel } from './variations-panel';
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
const {
|
|
25
|
+
useHasDimensionsPanel,
|
|
26
|
+
useHasTypographyPanel,
|
|
27
|
+
useHasBorderPanel,
|
|
28
|
+
useGlobalSetting,
|
|
29
|
+
useSettingsForBlockElement,
|
|
30
|
+
useHasColorPanel,
|
|
31
|
+
useHasEffectsPanel,
|
|
32
|
+
useHasFiltersPanel,
|
|
33
|
+
useGlobalStyle,
|
|
34
|
+
BorderPanel: StylesBorderPanel,
|
|
35
|
+
ColorPanel: StylesColorPanel,
|
|
36
|
+
TypographyPanel: StylesTypographyPanel,
|
|
37
|
+
DimensionsPanel: StylesDimensionsPanel,
|
|
38
|
+
EffectsPanel: StylesEffectsPanel,
|
|
39
|
+
FiltersPanel: StylesFiltersPanel,
|
|
40
|
+
AdvancedPanel: StylesAdvancedPanel,
|
|
41
|
+
} = unlock( blockEditorPrivateApis );
|
|
42
|
+
|
|
43
|
+
function ScreenBlock( { name, variation } ) {
|
|
44
|
+
let prefixParts = [];
|
|
45
|
+
if ( variation ) {
|
|
46
|
+
prefixParts = [ 'variations', variation ].concat( prefixParts );
|
|
47
|
+
}
|
|
48
|
+
const prefix = prefixParts.join( '.' );
|
|
49
|
+
|
|
50
|
+
const [ style ] = useGlobalStyle( prefix, name, 'user', {
|
|
51
|
+
shouldDecodeEncode: false,
|
|
52
|
+
} );
|
|
53
|
+
const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {
|
|
54
|
+
shouldDecodeEncode: false,
|
|
55
|
+
} );
|
|
56
|
+
const [ rawSettings, setSettings ] = useGlobalSetting( '', name );
|
|
57
|
+
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
14
58
|
const blockType = getBlockType( name );
|
|
59
|
+
const blockVariations = useBlockVariations( name );
|
|
60
|
+
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
61
|
+
const hasColorPanel = useHasColorPanel( settings );
|
|
62
|
+
const hasBorderPanel = useHasBorderPanel( settings );
|
|
63
|
+
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
64
|
+
const hasEffectsPanel = useHasEffectsPanel( settings );
|
|
65
|
+
const hasFiltersPanel = useHasFiltersPanel( settings );
|
|
66
|
+
const hasVariationsPanel = !! blockVariations?.length && ! variation;
|
|
67
|
+
const { canEditCSS } = useSelect( ( select ) => {
|
|
68
|
+
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
69
|
+
select( coreStore );
|
|
70
|
+
|
|
71
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
72
|
+
const globalStyles = globalStylesId
|
|
73
|
+
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
74
|
+
: undefined;
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
canEditCSS:
|
|
78
|
+
!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
|
|
79
|
+
};
|
|
80
|
+
}, [] );
|
|
81
|
+
const currentBlockStyle = variation
|
|
82
|
+
? blockVariations.find( ( s ) => s.name === variation )
|
|
83
|
+
: null;
|
|
84
|
+
|
|
85
|
+
// These intermediary objects are needed because the "layout" property is stored
|
|
86
|
+
// in settings rather than styles.
|
|
87
|
+
const inheritedStyleWithLayout = useMemo( () => {
|
|
88
|
+
return {
|
|
89
|
+
...inheritedStyle,
|
|
90
|
+
layout: settings.layout,
|
|
91
|
+
};
|
|
92
|
+
}, [ inheritedStyle, settings.layout ] );
|
|
93
|
+
const styleWithLayout = useMemo( () => {
|
|
94
|
+
return {
|
|
95
|
+
...style,
|
|
96
|
+
layout: settings.layout,
|
|
97
|
+
};
|
|
98
|
+
}, [ style, settings.layout ] );
|
|
99
|
+
const onChangeDimensions = ( newStyle ) => {
|
|
100
|
+
const updatedStyle = { ...newStyle };
|
|
101
|
+
delete updatedStyle.layout;
|
|
102
|
+
setStyle( updatedStyle );
|
|
103
|
+
|
|
104
|
+
if ( newStyle.layout !== settings.layout ) {
|
|
105
|
+
setSettings( {
|
|
106
|
+
...rawSettings,
|
|
107
|
+
layout: newStyle.layout,
|
|
108
|
+
} );
|
|
109
|
+
}
|
|
110
|
+
};
|
|
15
111
|
|
|
16
112
|
return (
|
|
17
113
|
<>
|
|
18
|
-
<ScreenHeader
|
|
19
|
-
|
|
20
|
-
<ContextMenu
|
|
21
|
-
parentMenu={ '/blocks/' + encodeURIComponent( name ) }
|
|
22
|
-
name={ name }
|
|
114
|
+
<ScreenHeader
|
|
115
|
+
title={ variation ? currentBlockStyle.label : blockType.title }
|
|
23
116
|
/>
|
|
117
|
+
<BlockPreviewPanel name={ name } variation={ variation } />
|
|
118
|
+
{ hasVariationsPanel && (
|
|
119
|
+
<div className="edit-site-global-styles-screen-variations">
|
|
120
|
+
<VStack spacing={ 3 }>
|
|
121
|
+
<Subtitle>{ __( 'Style Variations' ) }</Subtitle>
|
|
122
|
+
<VariationsPanel name={ name } />
|
|
123
|
+
</VStack>
|
|
124
|
+
</div>
|
|
125
|
+
) }
|
|
126
|
+
{ hasColorPanel && (
|
|
127
|
+
<StylesColorPanel
|
|
128
|
+
inheritedValue={ inheritedStyle }
|
|
129
|
+
value={ style }
|
|
130
|
+
onChange={ setStyle }
|
|
131
|
+
settings={ settings }
|
|
132
|
+
/>
|
|
133
|
+
) }
|
|
134
|
+
{ hasTypographyPanel && (
|
|
135
|
+
<StylesTypographyPanel
|
|
136
|
+
inheritedValue={ inheritedStyle }
|
|
137
|
+
value={ style }
|
|
138
|
+
onChange={ setStyle }
|
|
139
|
+
settings={ settings }
|
|
140
|
+
/>
|
|
141
|
+
) }
|
|
142
|
+
{ hasDimensionsPanel && (
|
|
143
|
+
<StylesDimensionsPanel
|
|
144
|
+
inheritedValue={ inheritedStyleWithLayout }
|
|
145
|
+
value={ styleWithLayout }
|
|
146
|
+
onChange={ onChangeDimensions }
|
|
147
|
+
settings={ settings }
|
|
148
|
+
includeLayoutControls
|
|
149
|
+
/>
|
|
150
|
+
) }
|
|
151
|
+
{ hasBorderPanel && (
|
|
152
|
+
<StylesBorderPanel
|
|
153
|
+
inheritedValue={ inheritedStyle }
|
|
154
|
+
value={ style }
|
|
155
|
+
onChange={ setStyle }
|
|
156
|
+
settings={ settings }
|
|
157
|
+
/>
|
|
158
|
+
) }
|
|
159
|
+
{ hasEffectsPanel && (
|
|
160
|
+
<StylesEffectsPanel
|
|
161
|
+
inheritedValue={ inheritedStyleWithLayout }
|
|
162
|
+
value={ styleWithLayout }
|
|
163
|
+
onChange={ onChangeDimensions }
|
|
164
|
+
settings={ settings }
|
|
165
|
+
includeLayoutControls
|
|
166
|
+
/>
|
|
167
|
+
) }
|
|
168
|
+
{ hasFiltersPanel && (
|
|
169
|
+
<StylesFiltersPanel
|
|
170
|
+
inheritedValue={ inheritedStyleWithLayout }
|
|
171
|
+
value={ styleWithLayout }
|
|
172
|
+
onChange={ onChangeDimensions }
|
|
173
|
+
settings={ {
|
|
174
|
+
...settings,
|
|
175
|
+
color: {
|
|
176
|
+
...settings.color,
|
|
177
|
+
customDuotone: false, //TO FIX: Custom duotone only works on the block level right now
|
|
178
|
+
},
|
|
179
|
+
} }
|
|
180
|
+
includeLayoutControls
|
|
181
|
+
/>
|
|
182
|
+
) }
|
|
183
|
+
{ canEditCSS && (
|
|
184
|
+
<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>
|
|
185
|
+
<p>
|
|
186
|
+
{ sprintf(
|
|
187
|
+
// translators: %s: is the name of a block e.g., 'Image' or 'Table'.
|
|
188
|
+
__(
|
|
189
|
+
'Add your own CSS to customize the appearance of the %s block.'
|
|
190
|
+
),
|
|
191
|
+
blockType?.title
|
|
192
|
+
) }
|
|
193
|
+
</p>
|
|
194
|
+
<StylesAdvancedPanel
|
|
195
|
+
value={ style }
|
|
196
|
+
onChange={ setStyle }
|
|
197
|
+
inheritedValue={ inheritedStyle }
|
|
198
|
+
/>
|
|
199
|
+
</PanelBody>
|
|
200
|
+
) }
|
|
24
201
|
</>
|
|
25
202
|
);
|
|
26
203
|
}
|
|
@@ -11,7 +11,6 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
11
11
|
import ScreenHeader from './header';
|
|
12
12
|
import Palette from './palette';
|
|
13
13
|
import BlockPreviewPanel from './block-preview-panel';
|
|
14
|
-
import { getVariationClassName } from './utils';
|
|
15
14
|
import { unlock } from '../../private-apis';
|
|
16
15
|
|
|
17
16
|
const {
|
|
@@ -21,21 +20,15 @@ const {
|
|
|
21
20
|
ColorPanel: StylesColorPanel,
|
|
22
21
|
} = unlock( blockEditorPrivateApis );
|
|
23
22
|
|
|
24
|
-
function ScreenColors(
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
prefixParts = [ 'variations', variation ].concat( prefixParts );
|
|
30
|
-
}
|
|
31
|
-
const prefix = prefixParts.join( '.' );
|
|
32
|
-
|
|
33
|
-
const [ style ] = useGlobalStyle( prefix, name, 'user', false );
|
|
34
|
-
const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {
|
|
23
|
+
function ScreenColors() {
|
|
24
|
+
const [ style ] = useGlobalStyle( '', undefined, 'user', {
|
|
25
|
+
shouldDecodeEncode: false,
|
|
26
|
+
} );
|
|
27
|
+
const [ inheritedStyle, setStyle ] = useGlobalStyle( '', undefined, 'all', {
|
|
35
28
|
shouldDecodeEncode: false,
|
|
36
29
|
} );
|
|
37
|
-
const [ rawSettings ] = useGlobalSetting( ''
|
|
38
|
-
const settings = useSettingsForBlockElement( rawSettings
|
|
30
|
+
const [ rawSettings ] = useGlobalSetting( '' );
|
|
31
|
+
const settings = useSettingsForBlockElement( rawSettings );
|
|
39
32
|
|
|
40
33
|
return (
|
|
41
34
|
<>
|
|
@@ -46,11 +39,11 @@ function ScreenColors( { name, variation = '' } ) {
|
|
|
46
39
|
) }
|
|
47
40
|
/>
|
|
48
41
|
|
|
49
|
-
<BlockPreviewPanel
|
|
42
|
+
<BlockPreviewPanel />
|
|
50
43
|
|
|
51
44
|
<div className="edit-site-global-styles-screen-colors">
|
|
52
45
|
<VStack spacing={ 10 }>
|
|
53
|
-
<Palette
|
|
46
|
+
<Palette />
|
|
54
47
|
|
|
55
48
|
<StylesColorPanel
|
|
56
49
|
inheritedValue={ inheritedStyle }
|
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { ExternalLink } from '@wordpress/components';
|
|
6
|
-
import {
|
|
6
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
+
import { unlock } from '../../private-apis';
|
|
11
12
|
import ScreenHeader from './header';
|
|
12
|
-
import CustomCSSControl from './custom-css';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const blockType = getBlockType( name );
|
|
18
|
-
const title = blockType?.title;
|
|
14
|
+
const { useGlobalStyle, AdvancedPanel: StylesAdvancedPanel } = unlock(
|
|
15
|
+
blockEditorPrivateApis
|
|
16
|
+
);
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'Add your own CSS to customize the appearance and layout of your site.'
|
|
31
|
-
);
|
|
18
|
+
function ScreenCSS() {
|
|
19
|
+
const description = __(
|
|
20
|
+
'Add your own CSS to customize the appearance and layout of your site.'
|
|
21
|
+
);
|
|
22
|
+
const [ style ] = useGlobalStyle( '', undefined, 'user', {
|
|
23
|
+
shouldDecodeEncode: false,
|
|
24
|
+
} );
|
|
25
|
+
const [ inheritedStyle, setStyle ] = useGlobalStyle( '', undefined, 'all', {
|
|
26
|
+
shouldDecodeEncode: false,
|
|
27
|
+
} );
|
|
32
28
|
|
|
33
29
|
return (
|
|
34
30
|
<>
|
|
@@ -47,7 +43,11 @@ function ScreenCSS( { name } ) {
|
|
|
47
43
|
}
|
|
48
44
|
/>
|
|
49
45
|
<div className="edit-site-global-styles-screen-css">
|
|
50
|
-
<
|
|
46
|
+
<StylesAdvancedPanel
|
|
47
|
+
value={ style }
|
|
48
|
+
onChange={ setStyle }
|
|
49
|
+
inheritedValue={ inheritedStyle }
|
|
50
|
+
/>
|
|
51
51
|
</div>
|
|
52
52
|
</>
|
|
53
53
|
);
|
|
@@ -10,24 +10,20 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
10
10
|
import DimensionsPanel from './dimensions-panel';
|
|
11
11
|
import ScreenHeader from './header';
|
|
12
12
|
import BlockPreviewPanel from './block-preview-panel';
|
|
13
|
-
import { getVariationClassName } from './utils';
|
|
14
13
|
import { unlock } from '../../private-apis';
|
|
15
14
|
|
|
16
15
|
const { useHasDimensionsPanel, useGlobalSetting, useSettingsForBlockElement } =
|
|
17
16
|
unlock( blockEditorPrivateApis );
|
|
18
17
|
|
|
19
|
-
function ScreenLayout(
|
|
20
|
-
const [ rawSettings ] = useGlobalSetting( ''
|
|
21
|
-
const settings = useSettingsForBlockElement( rawSettings
|
|
18
|
+
function ScreenLayout() {
|
|
19
|
+
const [ rawSettings ] = useGlobalSetting( '' );
|
|
20
|
+
const settings = useSettingsForBlockElement( rawSettings );
|
|
22
21
|
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
23
|
-
const variationClassName = getVariationClassName( variation );
|
|
24
22
|
return (
|
|
25
23
|
<>
|
|
26
24
|
<ScreenHeader title={ __( 'Layout' ) } />
|
|
27
|
-
<BlockPreviewPanel
|
|
28
|
-
{ hasDimensionsPanel &&
|
|
29
|
-
<DimensionsPanel name={ name } variation={ variation } />
|
|
30
|
-
) }
|
|
25
|
+
<BlockPreviewPanel />
|
|
26
|
+
{ hasDimensionsPanel && <DimensionsPanel /> }
|
|
31
27
|
</>
|
|
32
28
|
);
|
|
33
29
|
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
__experimentalUseNavigator as useNavigator,
|
|
8
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
9
|
+
Spinner,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
+
import { useContext, useState, useEffect } from '@wordpress/element';
|
|
13
|
+
import {
|
|
14
|
+
privateApis as blockEditorPrivateApis,
|
|
15
|
+
store as blockEditorStore,
|
|
16
|
+
} from '@wordpress/block-editor';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
import ScreenHeader from '../header';
|
|
22
|
+
import { unlock } from '../../../private-apis';
|
|
23
|
+
import Revisions from '../../revisions';
|
|
24
|
+
import SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';
|
|
25
|
+
import { store as editSiteStore } from '../../../store';
|
|
26
|
+
import useGlobalStylesRevisions from './use-global-styles-revisions';
|
|
27
|
+
import RevisionsButtons from './revisions-buttons';
|
|
28
|
+
|
|
29
|
+
const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
|
|
30
|
+
blockEditorPrivateApis
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
function ScreenRevisions() {
|
|
34
|
+
const { goBack } = useNavigator();
|
|
35
|
+
const { user: userConfig, setUserConfig } =
|
|
36
|
+
useContext( GlobalStylesContext );
|
|
37
|
+
const { blocks, editorCanvasContainerView } = useSelect( ( select ) => {
|
|
38
|
+
return {
|
|
39
|
+
editorCanvasContainerView: unlock(
|
|
40
|
+
select( editSiteStore )
|
|
41
|
+
).getEditorCanvasContainerView(),
|
|
42
|
+
blocks: select( blockEditorStore ).getBlocks(),
|
|
43
|
+
};
|
|
44
|
+
}, [] );
|
|
45
|
+
|
|
46
|
+
const { revisions, isLoading, hasUnsavedChanges } =
|
|
47
|
+
useGlobalStylesRevisions();
|
|
48
|
+
const [ globalStylesRevision, setGlobalStylesRevision ] =
|
|
49
|
+
useState( userConfig );
|
|
50
|
+
|
|
51
|
+
const [ currentRevisionId, setCurrentRevisionId ] = useState(
|
|
52
|
+
/*
|
|
53
|
+
* We need this for the first render,
|
|
54
|
+
* otherwise the unsaved changes haven't been merged into the revisions array yet.
|
|
55
|
+
*/
|
|
56
|
+
hasUnsavedChanges ? 'unsaved' : revisions?.[ 0 ]?.id
|
|
57
|
+
);
|
|
58
|
+
const [
|
|
59
|
+
isLoadingRevisionWithUnsavedChanges,
|
|
60
|
+
setIsLoadingRevisionWithUnsavedChanges,
|
|
61
|
+
] = useState( false );
|
|
62
|
+
const { setEditorCanvasContainerView } = unlock(
|
|
63
|
+
useDispatch( editSiteStore )
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
useEffect( () => {
|
|
67
|
+
if ( editorCanvasContainerView !== 'global-styles-revisions' ) {
|
|
68
|
+
goBack();
|
|
69
|
+
setEditorCanvasContainerView( editorCanvasContainerView );
|
|
70
|
+
}
|
|
71
|
+
}, [ editorCanvasContainerView ] );
|
|
72
|
+
|
|
73
|
+
const onCloseRevisions = () => {
|
|
74
|
+
goBack();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const restoreRevision = ( revision ) => {
|
|
78
|
+
setUserConfig( () => ( {
|
|
79
|
+
styles: revision?.styles,
|
|
80
|
+
settings: revision?.settings,
|
|
81
|
+
} ) );
|
|
82
|
+
setIsLoadingRevisionWithUnsavedChanges( false );
|
|
83
|
+
onCloseRevisions();
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const selectRevision = ( revision ) => {
|
|
87
|
+
setGlobalStylesRevision( {
|
|
88
|
+
styles: revision?.styles,
|
|
89
|
+
settings: revision?.settings,
|
|
90
|
+
id: revision?.id,
|
|
91
|
+
} );
|
|
92
|
+
setCurrentRevisionId( revision?.id );
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const isLoadButtonEnabled =
|
|
96
|
+
!! globalStylesRevision?.id &&
|
|
97
|
+
! areGlobalStyleConfigsEqual( globalStylesRevision, userConfig );
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<>
|
|
101
|
+
<ScreenHeader
|
|
102
|
+
title={ __( 'Revisions' ) }
|
|
103
|
+
description={ __(
|
|
104
|
+
'Revisions are added to the timeline when style changes are saved.'
|
|
105
|
+
) }
|
|
106
|
+
/>
|
|
107
|
+
{ isLoading && (
|
|
108
|
+
<Spinner className="edit-site-global-styles-screen-revisions__loading" />
|
|
109
|
+
) }
|
|
110
|
+
{ ! isLoading && (
|
|
111
|
+
<Revisions
|
|
112
|
+
blocks={ blocks }
|
|
113
|
+
userConfig={ globalStylesRevision }
|
|
114
|
+
onClose={ onCloseRevisions }
|
|
115
|
+
/>
|
|
116
|
+
) }
|
|
117
|
+
<div className="edit-site-global-styles-screen-revisions">
|
|
118
|
+
<RevisionsButtons
|
|
119
|
+
onChange={ selectRevision }
|
|
120
|
+
currentRevisionId={ currentRevisionId }
|
|
121
|
+
userRevisions={ revisions }
|
|
122
|
+
/>
|
|
123
|
+
{ isLoadButtonEnabled && (
|
|
124
|
+
<SidebarFixedBottom>
|
|
125
|
+
<Button
|
|
126
|
+
variant="primary"
|
|
127
|
+
className="edit-site-global-styles-screen-revisions__button"
|
|
128
|
+
disabled={
|
|
129
|
+
! globalStylesRevision?.id ||
|
|
130
|
+
globalStylesRevision?.id === 'unsaved'
|
|
131
|
+
}
|
|
132
|
+
onClick={ () => {
|
|
133
|
+
if ( hasUnsavedChanges ) {
|
|
134
|
+
setIsLoadingRevisionWithUnsavedChanges(
|
|
135
|
+
true
|
|
136
|
+
);
|
|
137
|
+
} else {
|
|
138
|
+
restoreRevision( globalStylesRevision );
|
|
139
|
+
}
|
|
140
|
+
} }
|
|
141
|
+
>
|
|
142
|
+
{ __( 'Apply' ) }
|
|
143
|
+
</Button>
|
|
144
|
+
</SidebarFixedBottom>
|
|
145
|
+
) }
|
|
146
|
+
</div>
|
|
147
|
+
{ isLoadingRevisionWithUnsavedChanges && (
|
|
148
|
+
<ConfirmDialog
|
|
149
|
+
title={ __(
|
|
150
|
+
'Loading this revision will discard all unsaved changes.'
|
|
151
|
+
) }
|
|
152
|
+
isOpen={ isLoadingRevisionWithUnsavedChanges }
|
|
153
|
+
confirmButtonText={ __( ' Discard unsaved changes' ) }
|
|
154
|
+
onConfirm={ () => restoreRevision( globalStylesRevision ) }
|
|
155
|
+
onCancel={ () =>
|
|
156
|
+
setIsLoadingRevisionWithUnsavedChanges( false )
|
|
157
|
+
}
|
|
158
|
+
>
|
|
159
|
+
<>
|
|
160
|
+
<h2>
|
|
161
|
+
{ __(
|
|
162
|
+
'Loading this revision will discard all unsaved changes.'
|
|
163
|
+
) }
|
|
164
|
+
</h2>
|
|
165
|
+
<p>
|
|
166
|
+
{ __(
|
|
167
|
+
'Do you want to replace your unsaved changes in the editor?'
|
|
168
|
+
) }
|
|
169
|
+
</p>
|
|
170
|
+
</>
|
|
171
|
+
</ConfirmDialog>
|
|
172
|
+
) }
|
|
173
|
+
</>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export default ScreenRevisions;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
10
|
+
import { Button } from '@wordpress/components';
|
|
11
|
+
import { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns a button label for the revision.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} revision A revision object.
|
|
17
|
+
* @return {string} Translated label.
|
|
18
|
+
*/
|
|
19
|
+
function getRevisionLabel( revision ) {
|
|
20
|
+
const authorDisplayName = revision?.author?.name || __( 'User' );
|
|
21
|
+
const isUnsaved = 'unsaved' === revision?.id;
|
|
22
|
+
|
|
23
|
+
if ( isUnsaved ) {
|
|
24
|
+
return sprintf(
|
|
25
|
+
/* translators: %(name)s author display name */
|
|
26
|
+
__( 'Unsaved changes by %(name)s' ),
|
|
27
|
+
{
|
|
28
|
+
name: authorDisplayName,
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const formattedDate = dateI18n(
|
|
33
|
+
getSettings().formats.datetimeAbbreviated,
|
|
34
|
+
getDate( revision?.modified )
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return revision?.isLatest
|
|
38
|
+
? sprintf(
|
|
39
|
+
/* translators: %(name)s author display name, %(date)s: revision creation date */
|
|
40
|
+
__( 'Changes saved by %(name)s on %(date)s (current)' ),
|
|
41
|
+
{
|
|
42
|
+
name: authorDisplayName,
|
|
43
|
+
date: formattedDate,
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
: sprintf(
|
|
47
|
+
/* translators: %(name)s author display name, %(date)s: revision creation date */
|
|
48
|
+
__( 'Changes saved by %(name)s on %(date)s' ),
|
|
49
|
+
{
|
|
50
|
+
name: authorDisplayName,
|
|
51
|
+
date: formattedDate,
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns a rendered list of revisions buttons.
|
|
58
|
+
*
|
|
59
|
+
* @typedef {Object} props
|
|
60
|
+
* @property {Array<Object>} userRevisions A collection of user revisions.
|
|
61
|
+
* @property {number} currentRevisionId Callback fired when the modal is closed or action cancelled.
|
|
62
|
+
* @property {Function} onChange Callback fired when a revision is selected.
|
|
63
|
+
*
|
|
64
|
+
* @param {props} Component props.
|
|
65
|
+
* @return {JSX.Element} The modal component.
|
|
66
|
+
*/
|
|
67
|
+
function RevisionsButtons( { userRevisions, currentRevisionId, onChange } ) {
|
|
68
|
+
return (
|
|
69
|
+
<ol
|
|
70
|
+
className="edit-site-global-styles-screen-revisions__revisions-list"
|
|
71
|
+
aria-label={ __( 'Global styles revisions' ) }
|
|
72
|
+
role="group"
|
|
73
|
+
>
|
|
74
|
+
{ userRevisions.map( ( revision ) => {
|
|
75
|
+
const { id, author, isLatest, modified } = revision;
|
|
76
|
+
const authorDisplayName = author?.name || __( 'User' );
|
|
77
|
+
const authorAvatar = author?.avatar_urls?.[ '48' ];
|
|
78
|
+
/*
|
|
79
|
+
* If the currentId hasn't been selected yet, the first revision is
|
|
80
|
+
* the current one so long as the API returns revisions in descending order.
|
|
81
|
+
*/
|
|
82
|
+
const isActive = !! currentRevisionId
|
|
83
|
+
? id === currentRevisionId
|
|
84
|
+
: isLatest;
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<li
|
|
88
|
+
className={ classnames(
|
|
89
|
+
'edit-site-global-styles-screen-revisions__revision-item',
|
|
90
|
+
{
|
|
91
|
+
'is-current': isActive,
|
|
92
|
+
}
|
|
93
|
+
) }
|
|
94
|
+
key={ id }
|
|
95
|
+
>
|
|
96
|
+
<Button
|
|
97
|
+
className="edit-site-global-styles-screen-revisions__revision-button"
|
|
98
|
+
disabled={ isActive }
|
|
99
|
+
onClick={ () => {
|
|
100
|
+
onChange( revision );
|
|
101
|
+
} }
|
|
102
|
+
label={ getRevisionLabel( revision ) }
|
|
103
|
+
>
|
|
104
|
+
<span className="edit-site-global-styles-screen-revisions__description">
|
|
105
|
+
<time dateTime={ modified }>
|
|
106
|
+
{ humanTimeDiff( modified ) }
|
|
107
|
+
</time>
|
|
108
|
+
<span className="edit-site-global-styles-screen-revisions__meta">
|
|
109
|
+
{ sprintf(
|
|
110
|
+
/* translators: %(name)s author display name */
|
|
111
|
+
__( 'Changes saved by %(name)s' ),
|
|
112
|
+
{
|
|
113
|
+
name: authorDisplayName,
|
|
114
|
+
}
|
|
115
|
+
) }
|
|
116
|
+
|
|
117
|
+
<img
|
|
118
|
+
alt={ author?.name }
|
|
119
|
+
src={ authorAvatar }
|
|
120
|
+
/>
|
|
121
|
+
</span>
|
|
122
|
+
</span>
|
|
123
|
+
</Button>
|
|
124
|
+
</li>
|
|
125
|
+
);
|
|
126
|
+
} ) }
|
|
127
|
+
</ol>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default RevisionsButtons;
|