@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
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { Button, __experimentalUseNavigator as useNavigator, __experimentalConfirmDialog as ConfirmDialog, Spinner } from '@wordpress/components';
|
|
8
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
+
import { useContext, useState, useEffect } from '@wordpress/element';
|
|
10
|
+
import { privateApis as blockEditorPrivateApis, store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import ScreenHeader from '../header';
|
|
16
|
+
import { unlock } from '../../../private-apis';
|
|
17
|
+
import Revisions from '../../revisions';
|
|
18
|
+
import SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';
|
|
19
|
+
import { store as editSiteStore } from '../../../store';
|
|
20
|
+
import useGlobalStylesRevisions from './use-global-styles-revisions';
|
|
21
|
+
import RevisionsButtons from './revisions-buttons';
|
|
22
|
+
const {
|
|
23
|
+
GlobalStylesContext,
|
|
24
|
+
areGlobalStyleConfigsEqual
|
|
25
|
+
} = unlock(blockEditorPrivateApis);
|
|
26
|
+
|
|
27
|
+
function ScreenRevisions() {
|
|
28
|
+
var _revisions$;
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
goBack
|
|
32
|
+
} = useNavigator();
|
|
33
|
+
const {
|
|
34
|
+
user: userConfig,
|
|
35
|
+
setUserConfig
|
|
36
|
+
} = useContext(GlobalStylesContext);
|
|
37
|
+
const {
|
|
38
|
+
blocks,
|
|
39
|
+
editorCanvasContainerView
|
|
40
|
+
} = useSelect(select => {
|
|
41
|
+
return {
|
|
42
|
+
editorCanvasContainerView: unlock(select(editSiteStore)).getEditorCanvasContainerView(),
|
|
43
|
+
blocks: select(blockEditorStore).getBlocks()
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
const {
|
|
47
|
+
revisions,
|
|
48
|
+
isLoading,
|
|
49
|
+
hasUnsavedChanges
|
|
50
|
+
} = useGlobalStylesRevisions();
|
|
51
|
+
const [globalStylesRevision, setGlobalStylesRevision] = useState(userConfig);
|
|
52
|
+
const [currentRevisionId, setCurrentRevisionId] = useState(
|
|
53
|
+
/*
|
|
54
|
+
* We need this for the first render,
|
|
55
|
+
* otherwise the unsaved changes haven't been merged into the revisions array yet.
|
|
56
|
+
*/
|
|
57
|
+
hasUnsavedChanges ? 'unsaved' : revisions === null || revisions === void 0 ? void 0 : (_revisions$ = revisions[0]) === null || _revisions$ === void 0 ? void 0 : _revisions$.id);
|
|
58
|
+
const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = useState(false);
|
|
59
|
+
const {
|
|
60
|
+
setEditorCanvasContainerView
|
|
61
|
+
} = unlock(useDispatch(editSiteStore));
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (editorCanvasContainerView !== 'global-styles-revisions') {
|
|
64
|
+
goBack();
|
|
65
|
+
setEditorCanvasContainerView(editorCanvasContainerView);
|
|
66
|
+
}
|
|
67
|
+
}, [editorCanvasContainerView]);
|
|
68
|
+
|
|
69
|
+
const onCloseRevisions = () => {
|
|
70
|
+
goBack();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const restoreRevision = revision => {
|
|
74
|
+
setUserConfig(() => ({
|
|
75
|
+
styles: revision === null || revision === void 0 ? void 0 : revision.styles,
|
|
76
|
+
settings: revision === null || revision === void 0 ? void 0 : revision.settings
|
|
77
|
+
}));
|
|
78
|
+
setIsLoadingRevisionWithUnsavedChanges(false);
|
|
79
|
+
onCloseRevisions();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const selectRevision = revision => {
|
|
83
|
+
setGlobalStylesRevision({
|
|
84
|
+
styles: revision === null || revision === void 0 ? void 0 : revision.styles,
|
|
85
|
+
settings: revision === null || revision === void 0 ? void 0 : revision.settings,
|
|
86
|
+
id: revision === null || revision === void 0 ? void 0 : revision.id
|
|
87
|
+
});
|
|
88
|
+
setCurrentRevisionId(revision === null || revision === void 0 ? void 0 : revision.id);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const isLoadButtonEnabled = !!(globalStylesRevision !== null && globalStylesRevision !== void 0 && globalStylesRevision.id) && !areGlobalStyleConfigsEqual(globalStylesRevision, userConfig);
|
|
92
|
+
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
93
|
+
title: __('Revisions'),
|
|
94
|
+
description: __('Revisions are added to the timeline when style changes are saved.')
|
|
95
|
+
}), isLoading && createElement(Spinner, {
|
|
96
|
+
className: "edit-site-global-styles-screen-revisions__loading"
|
|
97
|
+
}), !isLoading && createElement(Revisions, {
|
|
98
|
+
blocks: blocks,
|
|
99
|
+
userConfig: globalStylesRevision,
|
|
100
|
+
onClose: onCloseRevisions
|
|
101
|
+
}), createElement("div", {
|
|
102
|
+
className: "edit-site-global-styles-screen-revisions"
|
|
103
|
+
}, createElement(RevisionsButtons, {
|
|
104
|
+
onChange: selectRevision,
|
|
105
|
+
currentRevisionId: currentRevisionId,
|
|
106
|
+
userRevisions: revisions
|
|
107
|
+
}), isLoadButtonEnabled && createElement(SidebarFixedBottom, null, createElement(Button, {
|
|
108
|
+
variant: "primary",
|
|
109
|
+
className: "edit-site-global-styles-screen-revisions__button",
|
|
110
|
+
disabled: !(globalStylesRevision !== null && globalStylesRevision !== void 0 && globalStylesRevision.id) || (globalStylesRevision === null || globalStylesRevision === void 0 ? void 0 : globalStylesRevision.id) === 'unsaved',
|
|
111
|
+
onClick: () => {
|
|
112
|
+
if (hasUnsavedChanges) {
|
|
113
|
+
setIsLoadingRevisionWithUnsavedChanges(true);
|
|
114
|
+
} else {
|
|
115
|
+
restoreRevision(globalStylesRevision);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, __('Apply')))), isLoadingRevisionWithUnsavedChanges && createElement(ConfirmDialog, {
|
|
119
|
+
title: __('Loading this revision will discard all unsaved changes.'),
|
|
120
|
+
isOpen: isLoadingRevisionWithUnsavedChanges,
|
|
121
|
+
confirmButtonText: __(' Discard unsaved changes'),
|
|
122
|
+
onConfirm: () => restoreRevision(globalStylesRevision),
|
|
123
|
+
onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false)
|
|
124
|
+
}, createElement(Fragment, null, createElement("h2", null, __('Loading this revision will discard all unsaved changes.')), createElement("p", null, __('Do you want to replace your unsaved changes in the editor?')))));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default ScreenRevisions;
|
|
128
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/index.js"],"names":["__","Button","__experimentalUseNavigator","useNavigator","__experimentalConfirmDialog","ConfirmDialog","Spinner","useSelect","useDispatch","useContext","useState","useEffect","privateApis","blockEditorPrivateApis","store","blockEditorStore","ScreenHeader","unlock","Revisions","SidebarFixedBottom","editSiteStore","useGlobalStylesRevisions","RevisionsButtons","GlobalStylesContext","areGlobalStyleConfigsEqual","ScreenRevisions","goBack","user","userConfig","setUserConfig","blocks","editorCanvasContainerView","select","getEditorCanvasContainerView","getBlocks","revisions","isLoading","hasUnsavedChanges","globalStylesRevision","setGlobalStylesRevision","currentRevisionId","setCurrentRevisionId","id","isLoadingRevisionWithUnsavedChanges","setIsLoadingRevisionWithUnsavedChanges","setEditorCanvasContainerView","onCloseRevisions","restoreRevision","revision","styles","settings","selectRevision","isLoadButtonEnabled"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,0BAA0B,IAAIC,YAF/B,EAGCC,2BAA2B,IAAIC,aAHhC,EAICC,OAJD,QAKO,uBALP;AAMA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,UAAT,EAAqBC,QAArB,EAA+BC,SAA/B,QAAgD,oBAAhD;AACA,SACCC,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAKA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,OAAOC,SAAP,MAAsB,iBAAtB;AACA,OAAOC,kBAAP,MAA+B,8CAA/B;AACA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,gBAAvC;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AAEA,MAAM;AAAEC,EAAAA,mBAAF;AAAuBC,EAAAA;AAAvB,IAAsDP,MAAM,CACjEJ,sBADiE,CAAlE;;AAIA,SAASY,eAAT,GAA2B;AAAA;;AAC1B,QAAM;AAAEC,IAAAA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,EAiBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,gBAAD;AACC,IAAA,QAAQ,EAAGK,cADZ;AAEC,IAAA,iBAAiB,EAAGX,iBAFrB;AAGC,IAAA,aAAa,EAAGL;AAHjB,IADD,EAMGiB,mBAAmB,IACpB,cAAC,kBAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,SAAS,EAAC,kDAFX;AAGC,IAAA,QAAQ,EACP,EAAEd,oBAAF,aAAEA,oBAAF,eAAEA,oBAAoB,CAAEI,EAAxB,KACA,CAAAJ,oBAAoB,SAApB,IAAAA,oBAAoB,WAApB,YAAAA,oBAAoB,CAAEI,EAAtB,MAA6B,SAL/B;AAOC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKL,iBAAL,EAAyB;AACxBO,QAAAA,sCAAsC,CACrC,IADqC,CAAtC;AAGA,OAJD,MAIO;AACNG,QAAAA,eAAe,CAAET,oBAAF,CAAf;AACA;AACD;AAfF,KAiBGtC,EAAE,CAAE,OAAF,CAjBL,CADD,CAPF,CAjBD,EA+CG2C,mCAAmC,IACpC,cAAC,aAAD;AACC,IAAA,KAAK,EAAG3C,EAAE,CACT,yDADS,CADX;AAIC,IAAA,MAAM,EAAG2C,mCAJV;AAKC,IAAA,iBAAiB,EAAG3C,EAAE,CAAE,0BAAF,CALvB;AAMC,IAAA,SAAS,EAAG,MAAM+C,eAAe,CAAET,oBAAF,CANlC;AAOC,IAAA,QAAQ,EAAG,MACVM,sCAAsC,CAAE,KAAF;AARxC,KAWC,8BACC,0BACG5C,EAAE,CACH,yDADG,CADL,CADD,EAMC,yBACGA,EAAE,CACH,4DADG,CADL,CAND,CAXD,CAhDF,CADD;AA4EA;;AAED,eAAeyB,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext, useState, useEffect } from '@wordpress/element';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from '../header';\nimport { unlock } from '../../../private-apis';\nimport Revisions from '../../revisions';\nimport SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';\nimport { store as editSiteStore } from '../../../store';\nimport useGlobalStylesRevisions from './use-global-styles-revisions';\nimport RevisionsButtons from './revisions-buttons';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenRevisions() {\n\tconst { goBack } = useNavigator();\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\tconst { blocks, editorCanvasContainerView } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\teditorCanvasContainerView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tblocks: select( blockEditorStore ).getBlocks(),\n\t\t};\n\t}, [] );\n\n\tconst { revisions, isLoading, hasUnsavedChanges } =\n\t\tuseGlobalStylesRevisions();\n\tconst [ globalStylesRevision, setGlobalStylesRevision ] =\n\t\tuseState( userConfig );\n\n\tconst [ currentRevisionId, setCurrentRevisionId ] = useState(\n\t\t/*\n\t\t * We need this for the first render,\n\t\t * otherwise the unsaved changes haven't been merged into the revisions array yet.\n\t\t */\n\t\thasUnsavedChanges ? 'unsaved' : revisions?.[ 0 ]?.id\n\t);\n\tconst [\n\t\tisLoadingRevisionWithUnsavedChanges,\n\t\tsetIsLoadingRevisionWithUnsavedChanges,\n\t] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorCanvasContainerView !== 'global-styles-revisions' ) {\n\t\t\tgoBack();\n\t\t\tsetEditorCanvasContainerView( editorCanvasContainerView );\n\t\t}\n\t}, [ editorCanvasContainerView ] );\n\n\tconst onCloseRevisions = () => {\n\t\tgoBack();\n\t};\n\n\tconst restoreRevision = ( revision ) => {\n\t\tsetUserConfig( () => ( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t} ) );\n\t\tsetIsLoadingRevisionWithUnsavedChanges( false );\n\t\tonCloseRevisions();\n\t};\n\n\tconst selectRevision = ( revision ) => {\n\t\tsetGlobalStylesRevision( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t\tid: revision?.id,\n\t\t} );\n\t\tsetCurrentRevisionId( revision?.id );\n\t};\n\n\tconst isLoadButtonEnabled =\n\t\t!! globalStylesRevision?.id &&\n\t\t! areGlobalStyleConfigsEqual( globalStylesRevision, userConfig );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Revisions are added to the timeline when style changes are saved.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isLoading && (\n\t\t\t\t<Spinner className=\"edit-site-global-styles-screen-revisions__loading\" />\n\t\t\t) }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<Revisions\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tuserConfig={ globalStylesRevision }\n\t\t\t\t\tonClose={ onCloseRevisions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div className=\"edit-site-global-styles-screen-revisions\">\n\t\t\t\t<RevisionsButtons\n\t\t\t\t\tonChange={ selectRevision }\n\t\t\t\t\tcurrentRevisionId={ currentRevisionId }\n\t\t\t\t\tuserRevisions={ revisions }\n\t\t\t\t/>\n\t\t\t\t{ isLoadButtonEnabled && (\n\t\t\t\t\t<SidebarFixedBottom>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__button\"\n\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t! globalStylesRevision?.id ||\n\t\t\t\t\t\t\t\tglobalStylesRevision?.id === 'unsaved'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( hasUnsavedChanges ) {\n\t\t\t\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges(\n\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trestoreRevision( globalStylesRevision );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</SidebarFixedBottom>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isLoadingRevisionWithUnsavedChanges && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t) }\n\t\t\t\t\tisOpen={ isLoadingRevisionWithUnsavedChanges }\n\t\t\t\t\tconfirmButtonText={ __( ' Discard unsaved changes' ) }\n\t\t\t\t\tonConfirm={ () => restoreRevision( globalStylesRevision ) }\n\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Do you want to replace your unsaved changes in the editor?'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</>\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenRevisions;\n"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
+
import { Button } from '@wordpress/components';
|
|
13
|
+
import { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';
|
|
14
|
+
/**
|
|
15
|
+
* Returns a button label for the revision.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} revision A revision object.
|
|
18
|
+
* @return {string} Translated label.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function getRevisionLabel(revision) {
|
|
22
|
+
var _revision$author;
|
|
23
|
+
|
|
24
|
+
const authorDisplayName = (revision === null || revision === void 0 ? void 0 : (_revision$author = revision.author) === null || _revision$author === void 0 ? void 0 : _revision$author.name) || __('User');
|
|
25
|
+
|
|
26
|
+
const isUnsaved = 'unsaved' === (revision === null || revision === void 0 ? void 0 : revision.id);
|
|
27
|
+
|
|
28
|
+
if (isUnsaved) {
|
|
29
|
+
return sprintf(
|
|
30
|
+
/* translators: %(name)s author display name */
|
|
31
|
+
__('Unsaved changes by %(name)s'), {
|
|
32
|
+
name: authorDisplayName
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const formattedDate = dateI18n(getSettings().formats.datetimeAbbreviated, getDate(revision === null || revision === void 0 ? void 0 : revision.modified));
|
|
37
|
+
return revision !== null && revision !== void 0 && revision.isLatest ? sprintf(
|
|
38
|
+
/* translators: %(name)s author display name, %(date)s: revision creation date */
|
|
39
|
+
__('Changes saved by %(name)s on %(date)s (current)'), {
|
|
40
|
+
name: authorDisplayName,
|
|
41
|
+
date: formattedDate
|
|
42
|
+
}) : sprintf(
|
|
43
|
+
/* translators: %(name)s author display name, %(date)s: revision creation date */
|
|
44
|
+
__('Changes saved by %(name)s on %(date)s'), {
|
|
45
|
+
name: authorDisplayName,
|
|
46
|
+
date: formattedDate
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns a rendered list of revisions buttons.
|
|
51
|
+
*
|
|
52
|
+
* @typedef {Object} props
|
|
53
|
+
* @property {Array<Object>} userRevisions A collection of user revisions.
|
|
54
|
+
* @property {number} currentRevisionId Callback fired when the modal is closed or action cancelled.
|
|
55
|
+
* @property {Function} onChange Callback fired when a revision is selected.
|
|
56
|
+
*
|
|
57
|
+
* @param {props} Component props.
|
|
58
|
+
* @return {JSX.Element} The modal component.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
function RevisionsButtons(_ref) {
|
|
63
|
+
let {
|
|
64
|
+
userRevisions,
|
|
65
|
+
currentRevisionId,
|
|
66
|
+
onChange
|
|
67
|
+
} = _ref;
|
|
68
|
+
return createElement("ol", {
|
|
69
|
+
className: "edit-site-global-styles-screen-revisions__revisions-list",
|
|
70
|
+
"aria-label": __('Global styles revisions'),
|
|
71
|
+
role: "group"
|
|
72
|
+
}, userRevisions.map(revision => {
|
|
73
|
+
var _author$avatar_urls;
|
|
74
|
+
|
|
75
|
+
const {
|
|
76
|
+
id,
|
|
77
|
+
author,
|
|
78
|
+
isLatest,
|
|
79
|
+
modified
|
|
80
|
+
} = revision;
|
|
81
|
+
|
|
82
|
+
const authorDisplayName = (author === null || author === void 0 ? void 0 : author.name) || __('User');
|
|
83
|
+
|
|
84
|
+
const authorAvatar = author === null || author === void 0 ? void 0 : (_author$avatar_urls = author.avatar_urls) === null || _author$avatar_urls === void 0 ? void 0 : _author$avatar_urls['48'];
|
|
85
|
+
/*
|
|
86
|
+
* If the currentId hasn't been selected yet, the first revision is
|
|
87
|
+
* the current one so long as the API returns revisions in descending order.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
const isActive = !!currentRevisionId ? id === currentRevisionId : isLatest;
|
|
91
|
+
return createElement("li", {
|
|
92
|
+
className: classnames('edit-site-global-styles-screen-revisions__revision-item', {
|
|
93
|
+
'is-current': isActive
|
|
94
|
+
}),
|
|
95
|
+
key: id
|
|
96
|
+
}, createElement(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
|
+
}, createElement("span", {
|
|
104
|
+
className: "edit-site-global-styles-screen-revisions__description"
|
|
105
|
+
}, createElement("time", {
|
|
106
|
+
dateTime: modified
|
|
107
|
+
}, humanTimeDiff(modified)), createElement("span", {
|
|
108
|
+
className: "edit-site-global-styles-screen-revisions__meta"
|
|
109
|
+
}, sprintf(
|
|
110
|
+
/* translators: %(name)s author display name */
|
|
111
|
+
__('Changes saved by %(name)s'), {
|
|
112
|
+
name: authorDisplayName
|
|
113
|
+
}), createElement("img", {
|
|
114
|
+
alt: author === null || author === void 0 ? void 0 : author.name,
|
|
115
|
+
src: authorAvatar
|
|
116
|
+
})))));
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default RevisionsButtons;
|
|
121
|
+
//# sourceMappingURL=revisions-buttons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"names":["classnames","__","sprintf","Button","dateI18n","getDate","humanTimeDiff","getSettings","getRevisionLabel","revision","authorDisplayName","author","name","isUnsaved","id","formattedDate","formats","datetimeAbbreviated","modified","isLatest","date","RevisionsButtons","userRevisions","currentRevisionId","onChange","map","authorAvatar","avatar_urls","isActive"],"mappings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SAAS,EAAC;AAAhB,OACGhB,OAAO;AACR;AACAD,IAAAA,EAAE,CAAE,2BAAF,CAFM,EAGR;AACCW,MAAAA,IAAI,EAAEF;AADP,KAHQ,CADV,EASC;AACC,MAAA,GAAG,EAAGC,MAAH,aAAGA,MAAH,uBAAGA,MAAM,CAAEC,IADf;AAEC,MAAA,GAAG,EAAGc;AAFP,MATD,CAJD,CARD,CATD,CADD;AAwCA,GApDC,CALH,CADD;AA6DA;;AAED,eAAeL,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\n\n/**\n * Returns a button label for the revision.\n *\n * @param {Object} revision A revision object.\n * @return {string} Translated label.\n */\nfunction getRevisionLabel( revision ) {\n\tconst authorDisplayName = revision?.author?.name || __( 'User' );\n\tconst isUnsaved = 'unsaved' === revision?.id;\n\n\tif ( isUnsaved ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %(name)s author display name */\n\t\t\t__( 'Unsaved changes by %(name)s' ),\n\t\t\t{\n\t\t\t\tname: authorDisplayName,\n\t\t\t}\n\t\t);\n\t}\n\tconst formattedDate = dateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( revision?.modified )\n\t);\n\n\treturn revision?.isLatest\n\t\t? sprintf(\n\t\t\t\t/* translators: %(name)s author display name, %(date)s: revision creation date */\n\t\t\t\t__( 'Changes saved by %(name)s on %(date)s (current)' ),\n\t\t\t\t{\n\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\tdate: formattedDate,\n\t\t\t\t}\n\t\t )\n\t\t: sprintf(\n\t\t\t\t/* translators: %(name)s author display name, %(date)s: revision creation date */\n\t\t\t\t__( 'Changes saved by %(name)s on %(date)s' ),\n\t\t\t\t{\n\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\tdate: formattedDate,\n\t\t\t\t}\n\t\t );\n}\n\n/**\n * Returns a rendered list of revisions buttons.\n *\n * @typedef {Object} props\n * @property {Array<Object>} userRevisions A collection of user revisions.\n * @property {number} currentRevisionId Callback fired when the modal is closed or action cancelled.\n * @property {Function} onChange Callback fired when a revision is selected.\n *\n * @param {props} Component props.\n * @return {JSX.Element} The modal component.\n */\nfunction RevisionsButtons( { userRevisions, currentRevisionId, onChange } ) {\n\treturn (\n\t\t<ol\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revisions-list\"\n\t\t\taria-label={ __( 'Global styles revisions' ) }\n\t\t\trole=\"group\"\n\t\t>\n\t\t\t{ userRevisions.map( ( revision ) => {\n\t\t\t\tconst { id, author, isLatest, modified } = revision;\n\t\t\t\tconst authorDisplayName = author?.name || __( 'User' );\n\t\t\t\tconst authorAvatar = author?.avatar_urls?.[ '48' ];\n\t\t\t\t/*\n\t\t\t\t * If the currentId hasn't been selected yet, the first revision is\n\t\t\t\t * the current one so long as the API returns revisions in descending order.\n\t\t\t\t */\n\t\t\t\tconst isActive = !! currentRevisionId\n\t\t\t\t\t? id === currentRevisionId\n\t\t\t\t\t: isLatest;\n\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-global-styles-screen-revisions__revision-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-current': isActive,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revision-button\"\n\t\t\t\t\t\t\tdisabled={ isActive }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ getRevisionLabel( revision ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %(name)s author display name */\n\t\t\t\t\t\t\t\t\t\t__( 'Changes saved by %(name)s' ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\talt={ author?.name }\n\t\t\t\t\t\t\t\t\t\tsrc={ authorAvatar }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ol>\n\t);\n}\n\nexport default RevisionsButtons;\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { useContext, useMemo } from '@wordpress/element';
|
|
7
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
|
+
/**
|
|
9
|
+
* External dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { isEmpty } from 'lodash';
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { unlock } from '../../../private-apis';
|
|
18
|
+
const SITE_EDITOR_AUTHORS_QUERY = {
|
|
19
|
+
per_page: -1,
|
|
20
|
+
_fields: 'id,name,avatar_urls',
|
|
21
|
+
context: 'view',
|
|
22
|
+
capabilities: ['edit_theme_options']
|
|
23
|
+
};
|
|
24
|
+
const {
|
|
25
|
+
GlobalStylesContext
|
|
26
|
+
} = unlock(blockEditorPrivateApis);
|
|
27
|
+
export default function useGlobalStylesRevisions() {
|
|
28
|
+
const {
|
|
29
|
+
user: userConfig
|
|
30
|
+
} = useContext(GlobalStylesContext);
|
|
31
|
+
const {
|
|
32
|
+
authors,
|
|
33
|
+
currentUser,
|
|
34
|
+
isDirty,
|
|
35
|
+
revisions,
|
|
36
|
+
isLoading
|
|
37
|
+
} = useSelect(select => {
|
|
38
|
+
const {
|
|
39
|
+
__experimentalGetDirtyEntityRecords,
|
|
40
|
+
getCurrentUser,
|
|
41
|
+
getUsers,
|
|
42
|
+
getCurrentThemeGlobalStylesRevisions,
|
|
43
|
+
isResolving
|
|
44
|
+
} = select(coreStore);
|
|
45
|
+
|
|
46
|
+
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
47
|
+
|
|
48
|
+
const _currentUser = getCurrentUser();
|
|
49
|
+
|
|
50
|
+
const _isDirty = dirtyEntityRecords.length > 0;
|
|
51
|
+
|
|
52
|
+
const globalStylesRevisions = getCurrentThemeGlobalStylesRevisions() || [];
|
|
53
|
+
|
|
54
|
+
const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
authors: _authors,
|
|
58
|
+
currentUser: _currentUser,
|
|
59
|
+
isDirty: _isDirty,
|
|
60
|
+
revisions: globalStylesRevisions,
|
|
61
|
+
isLoading: !globalStylesRevisions.length || isResolving('getUsers', [SITE_EDITOR_AUTHORS_QUERY])
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
return useMemo(() => {
|
|
65
|
+
var _modifiedRevisions$;
|
|
66
|
+
|
|
67
|
+
let _modifiedRevisions = [];
|
|
68
|
+
|
|
69
|
+
if (isLoading || !revisions.length) {
|
|
70
|
+
return {
|
|
71
|
+
revisions: _modifiedRevisions,
|
|
72
|
+
hasUnsavedChanges: isDirty,
|
|
73
|
+
isLoading
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/*
|
|
77
|
+
* Adds a flag to the first revision, which is the latest.
|
|
78
|
+
* Also adds author information to the revision.
|
|
79
|
+
* Then, if there are unsaved changes in the editor, create a
|
|
80
|
+
* new "revision" item that represents the unsaved changes.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
_modifiedRevisions = revisions.map(revision => {
|
|
85
|
+
return { ...revision,
|
|
86
|
+
author: authors.find(author => author.id === revision.author)
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (((_modifiedRevisions$ = _modifiedRevisions[0]) === null || _modifiedRevisions$ === void 0 ? void 0 : _modifiedRevisions$.id) !== 'unsaved') {
|
|
91
|
+
_modifiedRevisions[0].isLatest = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (isDirty && !isEmpty(userConfig) && currentUser) {
|
|
95
|
+
const unsavedRevision = {
|
|
96
|
+
id: 'unsaved',
|
|
97
|
+
styles: userConfig === null || userConfig === void 0 ? void 0 : userConfig.styles,
|
|
98
|
+
settings: userConfig === null || userConfig === void 0 ? void 0 : userConfig.settings,
|
|
99
|
+
author: {
|
|
100
|
+
name: currentUser === null || currentUser === void 0 ? void 0 : currentUser.name,
|
|
101
|
+
avatar_urls: currentUser === null || currentUser === void 0 ? void 0 : currentUser.avatar_urls
|
|
102
|
+
},
|
|
103
|
+
modified: new Date()
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
_modifiedRevisions.unshift(unsavedRevision);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
revisions: _modifiedRevisions,
|
|
111
|
+
hasUnsavedChanges: isDirty,
|
|
112
|
+
isLoading
|
|
113
|
+
};
|
|
114
|
+
}, [revisions.length, isDirty, isLoading]);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=use-global-styles-revisions.js.map
|
package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/use-global-styles-revisions.js"],"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","isEmpty","unlock","SITE_EDITOR_AUTHORS_QUERY","per_page","_fields","context","capabilities","GlobalStylesContext","useGlobalStylesRevisions","user","userConfig","authors","currentUser","isDirty","revisions","isLoading","select","__experimentalGetDirtyEntityRecords","getCurrentUser","getUsers","getCurrentThemeGlobalStylesRevisions","isResolving","dirtyEntityRecords","_currentUser","_isDirty","length","globalStylesRevisions","_authors","_modifiedRevisions","hasUnsavedChanges","map","revision","author","find","id","isLatest","unsavedRevision","styles","settings","name","avatar_urls","modified","Date","unshift"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,oBAApC;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,QAAxB;AACA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,uBAAvB;AAEA,MAAMC,yBAAyB,GAAG;AACjCC,EAAAA,QAAQ,EAAE,CAAC,CADsB;AAEjCC,EAAAA,OAAO,EAAE,qBAFwB;AAGjCC,EAAAA,OAAO,EAAE,MAHwB;AAIjCC,EAAAA,YAAY,EAAE,CAAE,oBAAF;AAJmB,CAAlC;AAOA,MAAM;AAAEC,EAAAA;AAAF,IAA0BN,MAAM,CAAEF,sBAAF,CAAtC;AACA,eAAe,SAASS,wBAAT,GAAoC;AAClD,QAAM;AAAEC,IAAAA,IAAI,EAAEC;AAAR,MAAuBd,UAAU,C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D,aAAO,EACN,GAAGA,QADG;AAENC,QAAAA,MAAM,EAAErB,OAAO,CAACsB,IAAR,CACLD,MAAF,IAAcA,MAAM,CAACE,EAAP,KAAcH,QAAQ,CAACC,MAD9B;AAFF,OAAP;AAMA,KAPoB,CAArB;;AASA,QAAK,wBAAAJ,kBAAkB,CAAE,CAAF,CAAlB,4EAAyBM,EAAzB,MAAgC,SAArC,EAAiD;AAChDN,MAAAA,kBAAkB,CAAE,CAAF,CAAlB,CAAwBO,QAAxB,GAAmC,IAAnC;AACA;;AAED,QAAKtB,OAAO,IAAI,CAAEb,OAAO,CAAEU,UAAF,CAApB,IAAsCE,WAA3C,EAAyD;AACxD,YAAMwB,eAAe,GAAG;AACvBF,QAAAA,EAAE,EAAE,SADmB;AAEvBG,QAAAA,MAAM,EAAE3B,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAE2B,MAFG;AAGvBC,QAAAA,QAAQ,EAAE5B,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAE4B,QAHC;AAIvBN,QAAAA,MAAM,EAAE;AACPO,UAAAA,IAAI,EAAE3B,WAAF,aAAEA,WAAF,uBAAEA,WAAW,CAAE2B,IADZ;AAEPC,UAAAA,WAAW,EAAE5B,WAAF,aAAEA,WAAF,uBAAEA,WAAW,CAAE4B;AAFnB,SAJe;AAQvBC,QAAAA,QAAQ,EAAE,IAAIC,IAAJ;AARa,OAAxB;;AAWAd,MAAAA,kBAAkB,CAACe,OAAnB,CAA4BP,eAA5B;AACA;;AACD,WAAO;AACNtB,MAAAA,SAAS,EAAEc,kBADL;AAENC,MAAAA,iBAAiB,EAAEhB,OAFb;AAGNE,MAAAA;AAHM,KAAP;AAKA,GA/Ca,EA+CX,CAAED,SAAS,CAACW,MAAZ,EAAoBZ,OAApB,EAA6BE,SAA7B,CA/CW,CAAd;AAgDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../private-apis';\n\nconst SITE_EDITOR_AUTHORS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,avatar_urls',\n\tcontext: 'view',\n\tcapabilities: [ 'edit_theme_options' ],\n};\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nexport default function useGlobalStylesRevisions() {\n\tconst { user: userConfig } = useContext( GlobalStylesContext );\n\tconst { authors, currentUser, isDirty, revisions, isLoading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tgetCurrentUser,\n\t\t\t\tgetUsers,\n\t\t\t\tgetCurrentThemeGlobalStylesRevisions,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst _currentUser = getCurrentUser();\n\t\t\tconst _isDirty = dirtyEntityRecords.length > 0;\n\t\t\tconst globalStylesRevisions =\n\t\t\t\tgetCurrentThemeGlobalStylesRevisions() || [];\n\t\t\tconst _authors = getUsers( SITE_EDITOR_AUTHORS_QUERY );\n\n\t\t\treturn {\n\t\t\t\tauthors: _authors,\n\t\t\t\tcurrentUser: _currentUser,\n\t\t\t\tisDirty: _isDirty,\n\t\t\t\trevisions: globalStylesRevisions,\n\t\t\t\tisLoading:\n\t\t\t\t\t! globalStylesRevisions.length ||\n\t\t\t\t\tisResolving( 'getUsers', [ SITE_EDITOR_AUTHORS_QUERY ] ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tlet _modifiedRevisions = [];\n\t\tif ( isLoading || ! revisions.length ) {\n\t\t\treturn {\n\t\t\t\trevisions: _modifiedRevisions,\n\t\t\t\thasUnsavedChanges: isDirty,\n\t\t\t\tisLoading,\n\t\t\t};\n\t\t}\n\t\t/*\n\t\t * Adds a flag to the first revision, which is the latest.\n\t\t * Also adds author information to the revision.\n\t\t * Then, if there are unsaved changes in the editor, create a\n\t\t * new \"revision\" item that represents the unsaved changes.\n\t\t */\n\t\t_modifiedRevisions = revisions.map( ( revision ) => {\n\t\t\treturn {\n\t\t\t\t...revision,\n\t\t\t\tauthor: authors.find(\n\t\t\t\t\t( author ) => author.id === revision.author\n\t\t\t\t),\n\t\t\t};\n\t\t} );\n\n\t\tif ( _modifiedRevisions[ 0 ]?.id !== 'unsaved' ) {\n\t\t\t_modifiedRevisions[ 0 ].isLatest = true;\n\t\t}\n\n\t\tif ( isDirty && ! isEmpty( userConfig ) && currentUser ) {\n\t\t\tconst unsavedRevision = {\n\t\t\t\tid: 'unsaved',\n\t\t\t\tstyles: userConfig?.styles,\n\t\t\t\tsettings: userConfig?.settings,\n\t\t\t\tauthor: {\n\t\t\t\t\tname: currentUser?.name,\n\t\t\t\t\tavatar_urls: currentUser?.avatar_urls,\n\t\t\t\t},\n\t\t\t\tmodified: new Date(),\n\t\t\t};\n\n\t\t\t_modifiedRevisions.unshift( unsavedRevision );\n\t\t}\n\t\treturn {\n\t\t\trevisions: _modifiedRevisions,\n\t\t\thasUnsavedChanges: isDirty,\n\t\t\tisLoading,\n\t\t};\n\t}, [ revisions.length, isDirty, isLoading ] );\n}\n"]}
|
|
@@ -15,7 +15,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
15
15
|
|
|
16
16
|
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
17
17
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
18
|
-
import
|
|
18
|
+
import RootMenu from './root-menu';
|
|
19
19
|
import StylesPreview from './preview';
|
|
20
20
|
import { unlock } from '../../private-apis';
|
|
21
21
|
|
|
@@ -56,7 +56,7 @@ function ScreenRoot() {
|
|
|
56
56
|
justify: "space-between"
|
|
57
57
|
}, createElement(FlexItem, null, __('Browse styles')), createElement(IconWithCurrentColor, {
|
|
58
58
|
icon: isRTL() ? chevronLeft : chevronRight
|
|
59
|
-
})))), createElement(
|
|
59
|
+
})))), createElement(RootMenu, null))), createElement(CardDivider, null), createElement(CardBody, null, createElement(Spacer, {
|
|
60
60
|
as: "p",
|
|
61
61
|
paddingTop: 2
|
|
62
62
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-root.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalSpacer","Spacer","__experimentalVStack","VStack","FlexItem","CardBody","Card","CardDivider","CardMedia","isRTL","__","chevronLeft","chevronRight","useSelect","store","coreStore","privateApis","blockEditorPrivateApis","IconWithCurrentColor","NavigationButtonAsItem","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-root.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalSpacer","Spacer","__experimentalVStack","VStack","FlexItem","CardBody","Card","CardDivider","CardMedia","isRTL","__","chevronLeft","chevronRight","useSelect","store","coreStore","privateApis","blockEditorPrivateApis","IconWithCurrentColor","NavigationButtonAsItem","RootMenu","StylesPreview","unlock","ScreenRoot","useGlobalStyle","customCSS","variations","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","__experimentalGetCurrentThemeGlobalStylesVariations","globalStylesId","globalStyles","undefined","_links","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,QALD,EAMCC,QAND,EAOCC,IAPD,EAQCC,WARD,EASCC,SATD,QAUO,uBAVP;AAWA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,WAAT,EAAsBC,YAAtB,QAA0C,kBAA1C;AACA,SAASC,SAAT,QA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CADD,EAWC,cAAC,SAAD,QACC,cAAC,sBAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,kBAAaA,EAAE,CAAE,gBAAF;AAFhB,KAIC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,QAAD,QACGA,EAAE,CAAE,gBAAF,CADL,CADD,EAIC,cAAC,oBAAD;AACC,IAAA,IAAI,EACHD,KAAK,KAAKE,WAAL,GAAmBC;AAF1B,IAJD,CAJD,CADD,CAXD,CAFD,CAjEF,CADD;AAqGA;;AAED,eAAeW,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalVStack as VStack,\n\tFlexItem,\n\tCardBody,\n\tCard,\n\tCardDivider,\n\tCardMedia,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport RootMenu from './root-menu';\nimport StylesPreview from './preview';\nimport { unlock } from '../../private-apis';\n\nfunction ScreenRoot() {\n\tconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\tconst [ customCSS ] = useGlobalStyle( 'css' );\n\n\tconst { variations, canEditCSS } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEntityRecord,\n\t\t\t__experimentalGetCurrentGlobalStylesId,\n\t\t\t__experimentalGetCurrentThemeGlobalStylesVariations,\n\t\t} = select( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tvariations: __experimentalGetCurrentThemeGlobalStylesVariations(),\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Card size=\"small\" className=\"edit-site-global-styles-screen-root\">\n\t\t\t<CardBody>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Card>\n\t\t\t\t\t\t<CardMedia>\n\t\t\t\t\t\t\t<StylesPreview />\n\t\t\t\t\t\t</CardMedia>\n\t\t\t\t\t</Card>\n\t\t\t\t\t{ !! variations?.length && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\t\t\tpath=\"/variations\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Browse styles' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Browse styles' ) }\n\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronLeft : chevronRight\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<RootMenu />\n\t\t\t\t</VStack>\n\t\t\t</CardBody>\n\n\t\t\t<CardDivider />\n\n\t\t\t<CardBody>\n\t\t\t\t<Spacer\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tpaddingTop={ 2 }\n\t\t\t\t\t/*\n\t\t\t\t\t * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).\n\t\t\t\t\t * This is an ad hoc override for this instance and the Addtional CSS option below. Other options for matching the\n\t\t\t\t\t * the nav button inset should be looked at before reusing further.\n\t\t\t\t\t */\n\t\t\t\t\tpaddingX=\"13px\"\n\t\t\t\t\tmarginBottom={ 4 }\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the appearance of specific blocks for the whole site.'\n\t\t\t\t\t) }\n\t\t\t\t</Spacer>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\tpath=\"/blocks\"\n\t\t\t\t\t\taria-label={ __( 'Blocks styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t<FlexItem>{ __( 'Blocks' ) }</FlexItem>\n\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t</ItemGroup>\n\t\t\t</CardBody>\n\n\t\t\t{ canEditCSS && !! customCSS && (\n\t\t\t\t<>\n\t\t\t\t\t<CardDivider />\n\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t<Spacer\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tpaddingTop={ 2 }\n\t\t\t\t\t\t\tpaddingX=\"13px\"\n\t\t\t\t\t\t\tmarginBottom={ 4 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance and layout of your site.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\t\t\tpath=\"/css\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Additional CSS' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Additional CSS' ) }\n\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronLeft : chevronRight\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</CardBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Card>\n\t);\n}\n\nexport default ScreenRoot;\n"]}
|
|
@@ -38,7 +38,6 @@ const elements = {
|
|
|
38
38
|
|
|
39
39
|
function ScreenTypographyElement(_ref) {
|
|
40
40
|
let {
|
|
41
|
-
name,
|
|
42
41
|
element
|
|
43
42
|
} = _ref;
|
|
44
43
|
const [headingLevel, setHeadingLevel] = useState('heading');
|
|
@@ -48,7 +47,6 @@ function ScreenTypographyElement(_ref) {
|
|
|
48
47
|
}), createElement(Spacer, {
|
|
49
48
|
marginX: 4
|
|
50
49
|
}, createElement(TypographyPreview, {
|
|
51
|
-
name: name,
|
|
52
50
|
element: element,
|
|
53
51
|
headingLevel: headingLevel
|
|
54
52
|
})), element === 'heading' && createElement(Spacer, {
|
|
@@ -87,7 +85,6 @@ function ScreenTypographyElement(_ref) {
|
|
|
87
85
|
value: "h6",
|
|
88
86
|
label: __('H6')
|
|
89
87
|
}))), createElement(TypographyPanel, {
|
|
90
|
-
name: name,
|
|
91
88
|
element: element,
|
|
92
89
|
headingLevel: headingLevel
|
|
93
90
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography-element.js"],"names":["__","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalSpacer","Spacer","useState","TypographyPanel","ScreenHeader","TypographyPreview","elements","text","description","title","link","heading","caption","button","ScreenTypographyElement","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography-element.js"],"names":["__","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalSpacer","Spacer","useState","TypographyPanel","ScreenHeader","TypographyPreview","elements","text","description","title","link","heading","caption","button","ScreenTypographyElement","element","headingLevel","setHeadingLevel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,gCAAgC,IAAIC,kBADrC,EAECC,sCAAsC,IAAIC,wBAF3C,EAGCC,oBAAoB,IAAIC,MAHzB,QAIO,uBAJP;AAKA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;AAEA,MAAMC,QAAQ,GAAG;AAChBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,WAAW,EAAEb,EAAE,CAAE,oCAAF,CADV;AAELc,IAAAA,KAAK,EAAEd,EAAE,CAAE,MAAF;AAFJ,GADU;AAKhBe,EAAAA,IAAI,EAAE;AACLF,IAAAA,WAAW,EAAEb,EAAE,CAAE,oDAAF,CADV;AAELc,IAAAA,KAAK,EAAEd,EAAE,CAAE,OAAF;AAFJ,GALU;AAShBgB,EAAAA,OAAO,EAAE;AACRH,IAAAA,WAAW,EAAEb,EAAE,CAAE,mDAAF,CADP;AAERc,IAAAA,KAAK,EAAEd,EAAE,CAAE,UAAF;AAFD,GATO;AAahBiB,EAAAA,OAAO,EAAE;AACRJ,IAAAA,WAAW,EAAEb,EAAE,CAAE,mDAAF,CADP;AAERc,IAAAA,KAAK,EAAEd,EAAE,CAAE,UAAF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AA,KAAK,EAAGA,EAAE,CAAE,IAAF;AAFX,IAnBD,EAuBC,cAAC,wBAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAGA,EAAE,CAAE,IAAF;AAFX,IAvBD,EA2BC,cAAC,wBAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAGA,EAAE,CAAE,IAAF;AAFX,IA3BD,EA+BC,cAAC,wBAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAGA,EAAE,CAAE,IAAF;AAFX,IA/BD,EAmCC,cAAC,wBAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAGA,EAAE,CAAE,IAAF;AAFX,IAnCD,CADD,CAZF,EAuDC,cAAC,eAAD;AACC,IAAA,OAAO,EAAGoB,OADX;AAEC,IAAA,YAAY,EAAGC;AAFhB,IAvDD,CADD;AA8DA;;AAED,eAAeF,uBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TypographyPanel from './typography-panel';\nimport ScreenHeader from './header';\nimport TypographyPreview from './typography-preview';\n\nconst elements = {\n\ttext: {\n\t\tdescription: __( 'Manage the fonts used on the site.' ),\n\t\ttitle: __( 'Text' ),\n\t},\n\tlink: {\n\t\tdescription: __( 'Manage the fonts and typography used on the links.' ),\n\t\ttitle: __( 'Links' ),\n\t},\n\theading: {\n\t\tdescription: __( 'Manage the fonts and typography used on headings.' ),\n\t\ttitle: __( 'Headings' ),\n\t},\n\tcaption: {\n\t\tdescription: __( 'Manage the fonts and typography used on captions.' ),\n\t\ttitle: __( 'Captions' ),\n\t},\n\tbutton: {\n\t\tdescription: __( 'Manage the fonts and typography used on buttons.' ),\n\t\ttitle: __( 'Buttons' ),\n\t},\n};\n\nfunction ScreenTypographyElement( { element } ) {\n\tconst [ headingLevel, setHeadingLevel ] = useState( 'heading' );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ elements[ element ].title }\n\t\t\t\tdescription={ elements[ element ].description }\n\t\t\t/>\n\t\t\t<Spacer marginX={ 4 }>\n\t\t\t\t<TypographyPreview\n\t\t\t\t\telement={ element }\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t</Spacer>\n\t\t\t{ element === 'heading' && (\n\t\t\t\t<Spacer marginX={ 4 } marginBottom=\"1em\">\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tvalue={ headingLevel }\n\t\t\t\t\t\tonChange={ setHeadingLevel }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels \n\t\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h1\"\n\t\t\t\t\t\t\tlabel={ __( 'H1' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h2\"\n\t\t\t\t\t\t\tlabel={ __( 'H2' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h3\"\n\t\t\t\t\t\t\tlabel={ __( 'H3' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h4\"\n\t\t\t\t\t\t\tlabel={ __( 'H4' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h5\"\n\t\t\t\t\t\t\tlabel={ __( 'H5' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h6\"\n\t\t\t\t\t\t\tlabel={ __( 'H6' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t\t<TypographyPanel\n\t\t\t\telement={ element }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTypographyElement;\n"]}
|