@wordpress/edit-site 4.19.0 → 5.1.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 +17 -0
- package/build/components/add-new-template/add-custom-template-modal.js +1 -0
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/index.js +8 -5
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +21 -6
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +12 -8
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +15 -30
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +64 -0
- package/build/components/block-editor/editor-canvas.js.map +1 -0
- package/build/components/block-editor/index.js +62 -59
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +10 -44
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/index.js +76 -135
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +57 -0
- package/build/components/global-styles/block-preview-panel.js.map +1 -0
- package/build/components/global-styles/border-panel.js +0 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +6 -2
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +62 -0
- package/build/components/global-styles/custom-css.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +2 -6
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +18 -4
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +0 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +5 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-border.js +47 -0
- package/build/components/global-styles/screen-border.js.map +1 -0
- package/build/components/global-styles/screen-button-color.js +0 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -1
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +42 -0
- package/build/components/global-styles/screen-css.js.map +1 -0
- package/build/components/global-styles/screen-heading-color.js +1 -3
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +0 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +20 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +3 -3
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +0 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/ui.js +50 -4
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +5 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +14 -4
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -8
- package/build/components/global-styles-renderer/index.js.map +1 -0
- package/build/components/header-edit-mode/document-actions/index.js +21 -45
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +19 -12
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +11 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +200 -0
- package/build/components/layout/index.js.map +1 -0
- package/build/components/list/header.js +5 -1
- package/build/components/list/header.js.map +1 -1
- package/build/components/list/index.js +4 -22
- package/build/components/list/index.js.map +1 -1
- package/build/components/navigate-to-link/index.js +1 -3
- package/build/components/navigate-to-link/index.js.map +1 -1
- package/build/components/routes/index.js +1 -1
- package/build/components/routes/index.js.map +1 -1
- package/build/components/sidebar/index.js +46 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +24 -4
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +4 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +53 -0
- package/build/components/sidebar-navigation-item/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen/index.js +49 -0
- package/build/components/sidebar-navigation-screen/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js +46 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +169 -0
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -0
- package/build/components/site-hub/index.js +149 -0
- package/build/components/site-hub/index.js.map +1 -0
- package/build/components/site-icon/index.js +70 -0
- package/build/components/site-icon/index.js.map +1 -0
- package/build/components/style-book/index.js +173 -0
- package/build/components/style-book/index.js.map +1 -0
- package/build/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +5 -4
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +53 -0
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +60 -0
- package/build/components/use-edited-entity-record/index.js.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +144 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build/index.js +7 -45
- package/build/index.js.map +1 -1
- package/build/store/actions.js +93 -43
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +35 -107
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +69 -78
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +1 -0
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/index.js +7 -5
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +18 -6
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +13 -9
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +15 -28
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +51 -0
- package/build-module/components/block-editor/editor-canvas.js.map +1 -0
- package/build-module/components/block-editor/index.js +62 -60
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +11 -40
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/index.js +75 -129
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +46 -0
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -0
- package/build-module/components/global-styles/border-panel.js +0 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +7 -3
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +52 -0
- package/build-module/components/global-styles/custom-css.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +3 -7
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +18 -4
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +2 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +4 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +30 -0
- package/build-module/components/global-styles/screen-border.js.map +1 -0
- package/build-module/components/global-styles/screen-button-color.js +0 -2
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +4 -1
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +28 -0
- package/build-module/components/global-styles/screen-css.js.map +1 -0
- package/build-module/components/global-styles/screen-heading-color.js +1 -3
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +3 -4
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +21 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -2
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/ui.js +48 -5
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +5 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +13 -5
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -7
- package/build-module/components/global-styles-renderer/index.js.map +1 -0
- package/build-module/components/header-edit-mode/document-actions/index.js +22 -43
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +16 -11
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +10 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +173 -0
- package/build-module/components/layout/index.js.map +1 -0
- package/build-module/components/list/header.js +5 -1
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/list/index.js +4 -19
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/navigate-to-link/index.js +1 -3
- package/build-module/components/navigate-to-link/index.js.map +1 -1
- package/build-module/components/routes/index.js +1 -1
- package/build-module/components/routes/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +33 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +27 -7
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +6 -4
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +40 -0
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen/index.js +39 -0
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js +32 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +147 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +126 -0
- package/build-module/components/site-hub/index.js.map +1 -0
- package/build-module/components/site-icon/index.js +55 -0
- package/build-module/components/site-icon/index.js.map +1 -0
- package/build-module/components/style-book/index.js +156 -0
- package/build-module/components/style-book/index.js.map +1 -0
- package/build-module/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +4 -3
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +48 -0
- package/build-module/components/use-edited-entity-record/index.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build-module/index.js +9 -36
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +87 -42
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +35 -102
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +60 -72
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +549 -352
- package/build-style/style.css +549 -352
- package/package.json +33 -31
- package/src/components/add-new-template/add-custom-template-modal.js +1 -0
- package/src/components/add-new-template/index.js +6 -3
- package/src/components/add-new-template/new-template-part.js +15 -3
- package/src/components/add-new-template/new-template.js +14 -7
- package/src/components/add-new-template/style.scss +0 -4
- package/src/components/app/index.js +14 -43
- package/src/components/block-editor/editor-canvas.js +69 -0
- package/src/components/block-editor/index.js +100 -87
- package/src/components/block-editor/resizable-editor.js +9 -64
- package/src/components/block-editor/style.scss +25 -1
- package/src/components/code-editor/style.scss +1 -1
- package/src/components/editor/index.js +157 -238
- package/src/components/editor/style.scss +0 -22
- package/src/components/global-styles/block-preview-panel.js +44 -0
- package/src/components/global-styles/border-panel.js +0 -1
- package/src/components/global-styles/context-menu.js +11 -2
- package/src/components/global-styles/custom-css.js +74 -0
- package/src/components/global-styles/dimensions-panel.js +2 -5
- package/src/components/global-styles/global-styles-provider.js +50 -22
- package/src/components/global-styles/hooks.js +8 -3
- package/src/components/global-styles/palette.js +1 -1
- package/src/components/global-styles/screen-background-color.js +0 -1
- package/src/components/global-styles/screen-block-list.js +2 -1
- package/src/components/global-styles/screen-block.js +6 -1
- package/src/components/global-styles/screen-border.js +25 -0
- package/src/components/global-styles/screen-button-color.js +0 -2
- package/src/components/global-styles/screen-colors.js +5 -1
- package/src/components/global-styles/screen-css.js +33 -0
- package/src/components/global-styles/screen-heading-color.js +1 -3
- package/src/components/global-styles/screen-layout.js +2 -3
- package/src/components/global-styles/screen-link-color.js +0 -1
- package/src/components/global-styles/screen-root.js +37 -1
- package/src/components/global-styles/screen-style-variations.js +5 -2
- package/src/components/global-styles/screen-text-color.js +0 -1
- package/src/components/global-styles/screen-typography.js +3 -0
- package/src/components/global-styles/style.scss +31 -2
- package/src/components/global-styles/test/typography-utils.js +72 -23
- package/src/components/global-styles/typography-utils.js +24 -4
- package/src/components/global-styles/ui.js +47 -4
- package/src/components/global-styles/use-global-styles-output.js +5 -0
- package/src/components/global-styles/utils.js +18 -6
- package/src/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +3 -9
- package/src/components/header-edit-mode/document-actions/index.js +31 -45
- package/src/components/header-edit-mode/document-actions/style.scss +8 -1
- package/src/components/header-edit-mode/index.js +96 -78
- package/src/components/header-edit-mode/style.scss +6 -33
- package/src/components/keyboard-shortcuts/index.js +13 -0
- package/src/components/layout/index.js +235 -0
- package/src/components/layout/style.scss +183 -0
- package/src/components/list/header.js +5 -1
- package/src/components/list/index.js +12 -31
- package/src/components/list/style.scss +3 -4
- package/src/components/navigate-to-link/index.js +2 -8
- package/src/components/routes/index.js +1 -1
- package/src/components/sidebar/index.js +37 -0
- package/src/components/sidebar/style.scss +8 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -7
- package/src/components/sidebar-edit-mode/index.js +4 -4
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +21 -3
- package/src/components/sidebar-edit-mode/settings-header/style.scss +47 -34
- package/src/components/sidebar-edit-mode/style.scss +0 -13
- package/src/components/sidebar-navigation-item/index.js +51 -0
- package/src/components/sidebar-navigation-item/style.scss +17 -0
- package/src/components/sidebar-navigation-screen/index.js +55 -0
- package/src/components/sidebar-navigation-screen/style.scss +39 -0
- package/src/components/sidebar-navigation-screen-main/index.js +44 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +163 -0
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/site-hub/index.js +150 -0
- package/src/components/site-hub/style.scss +31 -0
- package/src/components/site-icon/index.js +56 -0
- package/src/components/site-icon/style.scss +10 -0
- package/src/components/style-book/index.js +193 -0
- package/src/components/style-book/style.scss +78 -0
- package/src/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +3 -3
- package/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +36 -0
- package/src/components/template-details/style.scss +4 -0
- package/src/components/use-edited-entity-record/index.js +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +162 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/index.js +5 -53
- package/src/store/actions.js +93 -48
- package/src/store/reducer.js +29 -91
- package/src/store/selectors.js +61 -101
- package/src/store/test/actions.js +3 -15
- package/src/store/test/reducer.js +8 -192
- package/src/store/test/selectors.js +3 -42
- package/src/style.scss +21 -3
- package/build/components/editor/global-styles-renderer.js.map +0 -1
- package/build/components/navigation-sidebar/index.js +0 -62
- package/build/components/navigation-sidebar/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +0 -77
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +0 -152
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +0 -124
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
- package/build/components/url-query-controller/index.js.map +0 -1
- package/build-module/components/editor/global-styles-renderer.js.map +0 -1
- package/build-module/components/navigation-sidebar/index.js +0 -45
- package/build-module/components/navigation-sidebar/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -49
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +0 -131
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -66
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +0 -108
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
- package/build-module/components/url-query-controller/index.js.map +0 -1
- package/src/components/navigation-sidebar/index.js +0 -46
- package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -94
- package/src/components/navigation-sidebar/navigation-panel/index.js +0 -142
- package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -152
- package/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
- package/src/components/navigation-sidebar/navigation-toggle/index.js +0 -114
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +0 -71
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +0 -65
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Variables
|
|
2
|
+
$block-preview-height: 150px;
|
|
3
|
+
|
|
1
4
|
.edit-site-global-styles-preview {
|
|
2
5
|
display: flex;
|
|
3
6
|
align-items: center;
|
|
@@ -28,7 +31,8 @@
|
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
.edit-site-global-styles-screen-heading-color,
|
|
31
|
-
.edit-site-global-styles-screen-typography
|
|
34
|
+
.edit-site-global-styles-screen-typography,
|
|
35
|
+
.edit-site-global-styles-screen-css {
|
|
32
36
|
margin: $grid-unit-20;
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -52,8 +56,12 @@
|
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
.edit-site-global-styles-header__description
|
|
59
|
+
.edit-site-global-styles-header__description {
|
|
60
|
+
padding: 0 $grid-unit-20;
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
.edit-site-block-types-search {
|
|
64
|
+
margin-bottom: $grid-unit-10;
|
|
57
65
|
padding: 0 $grid-unit-20;
|
|
58
66
|
}
|
|
59
67
|
|
|
@@ -117,3 +125,24 @@
|
|
|
117
125
|
overflow: hidden;
|
|
118
126
|
text-overflow: ellipsis;
|
|
119
127
|
}
|
|
128
|
+
|
|
129
|
+
.edit-site-global-styles__block-preview-panel {
|
|
130
|
+
position: relative;
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: $block-preview-height + 2 * $border-width;
|
|
133
|
+
overflow: auto;
|
|
134
|
+
border: $gray-200 $border-width solid;
|
|
135
|
+
border-radius: $radius-block-ui;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.edit-site-global-styles__custom-css-input textarea {
|
|
139
|
+
font-family: $editor_html_font;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.edit-site-global-styles__custom-css-theme-css {
|
|
143
|
+
width: 100%;
|
|
144
|
+
line-break: anywhere;
|
|
145
|
+
white-space: break-spaces;
|
|
146
|
+
max-height: 200px;
|
|
147
|
+
overflow-y: scroll;
|
|
148
|
+
}
|
|
@@ -7,7 +7,8 @@ describe( 'typography utils', () => {
|
|
|
7
7
|
describe( 'getTypographyFontSizeValue', () => {
|
|
8
8
|
[
|
|
9
9
|
{
|
|
10
|
-
message:
|
|
10
|
+
message:
|
|
11
|
+
'should return value when fluid typography is not active',
|
|
11
12
|
preset: {
|
|
12
13
|
size: '28px',
|
|
13
14
|
},
|
|
@@ -16,7 +17,7 @@ describe( 'typography utils', () => {
|
|
|
16
17
|
},
|
|
17
18
|
|
|
18
19
|
{
|
|
19
|
-
message: '
|
|
20
|
+
message: 'should return value where font size is 0',
|
|
20
21
|
preset: {
|
|
21
22
|
size: 0,
|
|
22
23
|
},
|
|
@@ -25,7 +26,7 @@ describe( 'typography utils', () => {
|
|
|
25
26
|
},
|
|
26
27
|
|
|
27
28
|
{
|
|
28
|
-
message: "
|
|
29
|
+
message: "should return value where font size is '0'",
|
|
29
30
|
preset: {
|
|
30
31
|
size: '0',
|
|
31
32
|
},
|
|
@@ -34,7 +35,7 @@ describe( 'typography utils', () => {
|
|
|
34
35
|
},
|
|
35
36
|
|
|
36
37
|
{
|
|
37
|
-
message: '
|
|
38
|
+
message: 'should return value where `size` is `null`.',
|
|
38
39
|
preset: {
|
|
39
40
|
size: null,
|
|
40
41
|
},
|
|
@@ -43,7 +44,7 @@ describe( 'typography utils', () => {
|
|
|
43
44
|
},
|
|
44
45
|
|
|
45
46
|
{
|
|
46
|
-
message: '
|
|
47
|
+
message: 'should return value when fluid is `false`',
|
|
47
48
|
preset: {
|
|
48
49
|
size: '28px',
|
|
49
50
|
fluid: false,
|
|
@@ -55,7 +56,7 @@ describe( 'typography utils', () => {
|
|
|
55
56
|
},
|
|
56
57
|
|
|
57
58
|
{
|
|
58
|
-
message: '
|
|
59
|
+
message: 'should return already clamped value',
|
|
59
60
|
preset: {
|
|
60
61
|
size: 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
|
|
61
62
|
fluid: false,
|
|
@@ -68,7 +69,7 @@ describe( 'typography utils', () => {
|
|
|
68
69
|
},
|
|
69
70
|
|
|
70
71
|
{
|
|
71
|
-
message: '
|
|
72
|
+
message: 'should return value with unsupported unit',
|
|
72
73
|
preset: {
|
|
73
74
|
size: '1000%',
|
|
74
75
|
fluid: false,
|
|
@@ -80,7 +81,7 @@ describe( 'typography utils', () => {
|
|
|
80
81
|
},
|
|
81
82
|
|
|
82
83
|
{
|
|
83
|
-
message: '
|
|
84
|
+
message: 'should return clamp value with rem min and max units',
|
|
84
85
|
preset: {
|
|
85
86
|
size: '1.75rem',
|
|
86
87
|
},
|
|
@@ -92,7 +93,7 @@ describe( 'typography utils', () => {
|
|
|
92
93
|
},
|
|
93
94
|
|
|
94
95
|
{
|
|
95
|
-
message: '
|
|
96
|
+
message: 'should return clamp value with eem min and max units',
|
|
96
97
|
preset: {
|
|
97
98
|
size: '1.75em',
|
|
98
99
|
},
|
|
@@ -104,7 +105,7 @@ describe( 'typography utils', () => {
|
|
|
104
105
|
},
|
|
105
106
|
|
|
106
107
|
{
|
|
107
|
-
message: '
|
|
108
|
+
message: 'should return clamp value for floats',
|
|
108
109
|
preset: {
|
|
109
110
|
size: '100.175px',
|
|
110
111
|
},
|
|
@@ -116,7 +117,8 @@ describe( 'typography utils', () => {
|
|
|
116
117
|
},
|
|
117
118
|
|
|
118
119
|
{
|
|
119
|
-
message:
|
|
120
|
+
message:
|
|
121
|
+
'should coerce integer to `px` and returns clamp value',
|
|
120
122
|
preset: {
|
|
121
123
|
size: 33,
|
|
122
124
|
fluid: true,
|
|
@@ -129,7 +131,7 @@ describe( 'typography utils', () => {
|
|
|
129
131
|
},
|
|
130
132
|
|
|
131
133
|
{
|
|
132
|
-
message: '
|
|
134
|
+
message: 'should coerce float to `px` and returns clamp value',
|
|
133
135
|
preset: {
|
|
134
136
|
size: 100.23,
|
|
135
137
|
fluid: true,
|
|
@@ -142,7 +144,8 @@ describe( 'typography utils', () => {
|
|
|
142
144
|
},
|
|
143
145
|
|
|
144
146
|
{
|
|
145
|
-
message:
|
|
147
|
+
message:
|
|
148
|
+
'should return clamp value when `fluid` is empty array',
|
|
146
149
|
preset: {
|
|
147
150
|
size: '28px',
|
|
148
151
|
fluid: [],
|
|
@@ -155,7 +158,7 @@ describe( 'typography utils', () => {
|
|
|
155
158
|
},
|
|
156
159
|
|
|
157
160
|
{
|
|
158
|
-
message: '
|
|
161
|
+
message: 'should return clamp value when `fluid` is `null`',
|
|
159
162
|
preset: {
|
|
160
163
|
size: '28px',
|
|
161
164
|
fluid: null,
|
|
@@ -169,7 +172,7 @@ describe( 'typography utils', () => {
|
|
|
169
172
|
|
|
170
173
|
{
|
|
171
174
|
message:
|
|
172
|
-
'
|
|
175
|
+
'should return clamp value if min font size is greater than max',
|
|
173
176
|
preset: {
|
|
174
177
|
size: '3rem',
|
|
175
178
|
fluid: {
|
|
@@ -185,7 +188,7 @@ describe( 'typography utils', () => {
|
|
|
185
188
|
},
|
|
186
189
|
|
|
187
190
|
{
|
|
188
|
-
message: '
|
|
191
|
+
message: 'should return value with invalid min/max fluid units',
|
|
189
192
|
preset: {
|
|
190
193
|
size: '10em',
|
|
191
194
|
fluid: {
|
|
@@ -201,7 +204,7 @@ describe( 'typography utils', () => {
|
|
|
201
204
|
|
|
202
205
|
{
|
|
203
206
|
message:
|
|
204
|
-
'
|
|
207
|
+
'should return value when size is < lower bounds and no fluid min/max set',
|
|
205
208
|
preset: {
|
|
206
209
|
size: '3px',
|
|
207
210
|
},
|
|
@@ -213,7 +216,7 @@ describe( 'typography utils', () => {
|
|
|
213
216
|
|
|
214
217
|
{
|
|
215
218
|
message:
|
|
216
|
-
'
|
|
219
|
+
'should return value when size is equal to lower bounds and no fluid min/max set',
|
|
217
220
|
preset: {
|
|
218
221
|
size: '14px',
|
|
219
222
|
},
|
|
@@ -224,7 +227,8 @@ describe( 'typography utils', () => {
|
|
|
224
227
|
},
|
|
225
228
|
|
|
226
229
|
{
|
|
227
|
-
message:
|
|
230
|
+
message:
|
|
231
|
+
'should return clamp value with different min max units',
|
|
228
232
|
preset: {
|
|
229
233
|
size: '28px',
|
|
230
234
|
fluid: {
|
|
@@ -240,7 +244,8 @@ describe( 'typography utils', () => {
|
|
|
240
244
|
},
|
|
241
245
|
|
|
242
246
|
{
|
|
243
|
-
message:
|
|
247
|
+
message:
|
|
248
|
+
'should return clamp value where no fluid max size is set',
|
|
244
249
|
preset: {
|
|
245
250
|
size: '28px',
|
|
246
251
|
fluid: {
|
|
@@ -255,7 +260,8 @@ describe( 'typography utils', () => {
|
|
|
255
260
|
},
|
|
256
261
|
|
|
257
262
|
{
|
|
258
|
-
message:
|
|
263
|
+
message:
|
|
264
|
+
'should return clamp value where no fluid min size is set',
|
|
259
265
|
preset: {
|
|
260
266
|
size: '28px',
|
|
261
267
|
fluid: {
|
|
@@ -320,7 +326,7 @@ describe( 'typography utils', () => {
|
|
|
320
326
|
|
|
321
327
|
{
|
|
322
328
|
message:
|
|
323
|
-
'
|
|
329
|
+
'should return clamp value when min and max font sizes are equal',
|
|
324
330
|
preset: {
|
|
325
331
|
size: '4rem',
|
|
326
332
|
fluid: {
|
|
@@ -333,8 +339,51 @@ describe( 'typography utils', () => {
|
|
|
333
339
|
},
|
|
334
340
|
expected: 'clamp(30px, 1.875rem + ((1vw - 7.68px) * 1), 30px)',
|
|
335
341
|
},
|
|
342
|
+
|
|
343
|
+
{
|
|
344
|
+
message:
|
|
345
|
+
'should use default min font size value where min font size unit in fluid config is not supported',
|
|
346
|
+
preset: {
|
|
347
|
+
size: '15px',
|
|
348
|
+
},
|
|
349
|
+
typographySettings: {
|
|
350
|
+
fluid: {
|
|
351
|
+
minFontSize: '16%',
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
expected:
|
|
355
|
+
'clamp(14px, 0.875rem + ((1vw - 7.68px) * 0.12), 15px)',
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
// Equivalent custom config PHP unit tests in `test_should_covert_font_sizes_to_fluid_values()`.
|
|
359
|
+
{
|
|
360
|
+
message: 'should return clamp value using custom fluid config',
|
|
361
|
+
preset: {
|
|
362
|
+
size: '17px',
|
|
363
|
+
},
|
|
364
|
+
typographySettings: {
|
|
365
|
+
fluid: {
|
|
366
|
+
minFontSize: '16px',
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
expected: 'clamp(16px, 1rem + ((1vw - 7.68px) * 0.12), 17px)',
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
{
|
|
373
|
+
message:
|
|
374
|
+
'should return value when font size <= custom min font size bound',
|
|
375
|
+
preset: {
|
|
376
|
+
size: '15px',
|
|
377
|
+
},
|
|
378
|
+
typographySettings: {
|
|
379
|
+
fluid: {
|
|
380
|
+
minFontSize: '16px',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
expected: '15px',
|
|
384
|
+
},
|
|
336
385
|
].forEach( ( { message, preset, typographySettings, expected } ) => {
|
|
337
|
-
it(
|
|
386
|
+
it( `${ message }`, () => {
|
|
338
387
|
expect(
|
|
339
388
|
getTypographyFontSizeValue( preset, typographySettings )
|
|
340
389
|
).toBe( expected );
|
|
@@ -23,13 +23,23 @@ import { getComputedFluidTypographyValue } from '@wordpress/block-editor';
|
|
|
23
23
|
* @property {boolean|FluidPreset|undefined} fluid A font size slug
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} TypographySettings
|
|
28
|
+
* @property {?string|?number} size A default font size.
|
|
29
|
+
* @property {?string} minViewPortWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.
|
|
30
|
+
* @property {?string} maxViewPortWidth Maximum size up to which type will have fluidity. Optional if size is specified.
|
|
31
|
+
* @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
|
|
32
|
+
* @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
|
|
33
|
+
* @property {?string} minFontSize The smallest a calculated font size may be. Optional.
|
|
34
|
+
*/
|
|
35
|
+
|
|
26
36
|
/**
|
|
27
37
|
* Returns a font-size value based on a given font-size preset.
|
|
28
38
|
* Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.
|
|
29
39
|
*
|
|
30
|
-
* @param {Preset}
|
|
31
|
-
* @param {Object}
|
|
32
|
-
* @param {boolean} typographySettings.fluid Whether fluid typography is enabled.
|
|
40
|
+
* @param {Preset} preset
|
|
41
|
+
* @param {Object} typographySettings
|
|
42
|
+
* @param {boolean|TypographySettings} typographySettings.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.
|
|
33
43
|
*
|
|
34
44
|
* @return {string|*} A font-size value or the value of preset.size.
|
|
35
45
|
*/
|
|
@@ -44,7 +54,11 @@ export function getTypographyFontSizeValue( preset, typographySettings ) {
|
|
|
44
54
|
return defaultSize;
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
if (
|
|
57
|
+
if (
|
|
58
|
+
! typographySettings?.fluid ||
|
|
59
|
+
( typeof typographySettings?.fluid === 'object' &&
|
|
60
|
+
Object.keys( typographySettings.fluid ).length === 0 )
|
|
61
|
+
) {
|
|
48
62
|
return defaultSize;
|
|
49
63
|
}
|
|
50
64
|
|
|
@@ -53,10 +67,16 @@ export function getTypographyFontSizeValue( preset, typographySettings ) {
|
|
|
53
67
|
return defaultSize;
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
const fluidTypographySettings =
|
|
71
|
+
typeof typographySettings?.fluid === 'object'
|
|
72
|
+
? typographySettings?.fluid
|
|
73
|
+
: {};
|
|
74
|
+
|
|
56
75
|
const fluidFontSizeValue = getComputedFluidTypographyValue( {
|
|
57
76
|
minimumFontSize: preset?.fluid?.min,
|
|
58
77
|
maximumFontSize: preset?.fluid?.max,
|
|
59
78
|
fontSize: defaultSize,
|
|
79
|
+
minimumFontSizeLimit: fluidTypographySettings?.minFontSize,
|
|
60
80
|
} );
|
|
61
81
|
|
|
62
82
|
if ( !! fluidFontSizeValue ) {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__experimentalNavigatorProvider as NavigatorProvider,
|
|
6
6
|
__experimentalNavigatorScreen as NavigatorScreen,
|
|
7
|
+
__experimentalUseNavigator as useNavigator,
|
|
7
8
|
} from '@wordpress/components';
|
|
8
9
|
import { getBlockTypes } from '@wordpress/blocks';
|
|
9
10
|
|
|
@@ -24,6 +25,9 @@ import ScreenHeadingColor from './screen-heading-color';
|
|
|
24
25
|
import ScreenButtonColor from './screen-button-color';
|
|
25
26
|
import ScreenLayout from './screen-layout';
|
|
26
27
|
import ScreenStyleVariations from './screen-style-variations';
|
|
28
|
+
import ScreenBorder from './screen-border';
|
|
29
|
+
import StyleBook from '../style-book';
|
|
30
|
+
import ScreenCSS from './screen-css';
|
|
27
31
|
|
|
28
32
|
function GlobalStylesNavigationScreen( { className, ...props } ) {
|
|
29
33
|
return (
|
|
@@ -40,7 +44,8 @@ function GlobalStylesNavigationScreen( { className, ...props } ) {
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
function ContextScreens( { name } ) {
|
|
43
|
-
const parentMenu =
|
|
47
|
+
const parentMenu =
|
|
48
|
+
name === undefined ? '' : '/blocks/' + encodeURIComponent( name );
|
|
44
49
|
|
|
45
50
|
return (
|
|
46
51
|
<>
|
|
@@ -108,6 +113,10 @@ function ContextScreens( { name } ) {
|
|
|
108
113
|
<ScreenButtonColor name={ name } />
|
|
109
114
|
</GlobalStylesNavigationScreen>
|
|
110
115
|
|
|
116
|
+
<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>
|
|
117
|
+
<ScreenBorder name={ name } />
|
|
118
|
+
</GlobalStylesNavigationScreen>
|
|
119
|
+
|
|
111
120
|
<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>
|
|
112
121
|
<ScreenLayout name={ name } />
|
|
113
122
|
</GlobalStylesNavigationScreen>
|
|
@@ -115,9 +124,36 @@ function ContextScreens( { name } ) {
|
|
|
115
124
|
);
|
|
116
125
|
}
|
|
117
126
|
|
|
118
|
-
function
|
|
119
|
-
const
|
|
127
|
+
function GlobalStylesStyleBook( { onClose } ) {
|
|
128
|
+
const navigator = useNavigator();
|
|
129
|
+
const { path } = navigator.location;
|
|
130
|
+
return (
|
|
131
|
+
<StyleBook
|
|
132
|
+
isSelected={ ( blockName ) =>
|
|
133
|
+
// Match '/blocks/core%2Fbutton' and
|
|
134
|
+
// '/blocks/core%2Fbutton/typography', but not
|
|
135
|
+
// '/blocks/core%2Fbuttons'.
|
|
136
|
+
path === `/blocks/${ encodeURIComponent( blockName ) }` ||
|
|
137
|
+
path.startsWith(
|
|
138
|
+
`/blocks/${ encodeURIComponent( blockName ) }/`
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
onSelect={ ( blockName ) => {
|
|
142
|
+
// Clear navigator history by going back to the root.
|
|
143
|
+
const depth = path.match( /\//g ).length;
|
|
144
|
+
for ( let i = 0; i < depth; i++ ) {
|
|
145
|
+
navigator.goBack();
|
|
146
|
+
}
|
|
147
|
+
// Now go to the selected block.
|
|
148
|
+
navigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );
|
|
149
|
+
} }
|
|
150
|
+
onClose={ onClose }
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
120
154
|
|
|
155
|
+
function GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {
|
|
156
|
+
const blocks = getBlockTypes();
|
|
121
157
|
return (
|
|
122
158
|
<NavigatorProvider
|
|
123
159
|
className="edit-site-global-styles-sidebar__navigator-provider"
|
|
@@ -138,7 +174,7 @@ function GlobalStylesUI() {
|
|
|
138
174
|
{ blocks.map( ( block ) => (
|
|
139
175
|
<GlobalStylesNavigationScreen
|
|
140
176
|
key={ 'menu-block-' + block.name }
|
|
141
|
-
path={ '/blocks/' + block.name }
|
|
177
|
+
path={ '/blocks/' + encodeURIComponent( block.name ) }
|
|
142
178
|
>
|
|
143
179
|
<ScreenBlock name={ block.name } />
|
|
144
180
|
</GlobalStylesNavigationScreen>
|
|
@@ -152,6 +188,13 @@ function GlobalStylesUI() {
|
|
|
152
188
|
name={ block.name }
|
|
153
189
|
/>
|
|
154
190
|
) ) }
|
|
191
|
+
|
|
192
|
+
{ isStyleBookOpened && (
|
|
193
|
+
<GlobalStylesStyleBook onClose={ onCloseStyleBook } />
|
|
194
|
+
) }
|
|
195
|
+
<GlobalStylesNavigationScreen path="/css">
|
|
196
|
+
<ScreenCSS />
|
|
197
|
+
</GlobalStylesNavigationScreen>
|
|
155
198
|
</NavigatorProvider>
|
|
156
199
|
);
|
|
157
200
|
}
|
|
@@ -919,6 +919,11 @@ export function useGlobalStylesOutput() {
|
|
|
919
919
|
css: globalStyles,
|
|
920
920
|
isGlobalStyles: true,
|
|
921
921
|
},
|
|
922
|
+
// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
|
|
923
|
+
{
|
|
924
|
+
css: mergedConfig.styles.css ?? '',
|
|
925
|
+
isGlobalStyles: true,
|
|
926
|
+
},
|
|
922
927
|
];
|
|
923
928
|
|
|
924
929
|
return [ stylesheets, mergedConfig.settings, filters ];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -86,7 +86,7 @@ export const PRESET_METADATA = [
|
|
|
86
86
|
},
|
|
87
87
|
];
|
|
88
88
|
|
|
89
|
-
const STYLE_PATH_TO_CSS_VAR_INFIX = {
|
|
89
|
+
export const STYLE_PATH_TO_CSS_VAR_INFIX = {
|
|
90
90
|
'color.background': 'color',
|
|
91
91
|
'color.text': 'color',
|
|
92
92
|
'elements.link.color.text': 'color',
|
|
@@ -100,6 +100,15 @@ const STYLE_PATH_TO_CSS_VAR_INFIX = {
|
|
|
100
100
|
'typography.fontFamily': 'font-family',
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
// A static list of block attributes that store global style preset slugs.
|
|
104
|
+
export const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
|
|
105
|
+
'color.background': 'backgroundColor',
|
|
106
|
+
'color.text': 'textColor',
|
|
107
|
+
'color.gradient': 'gradient',
|
|
108
|
+
'typography.fontSize': 'fontSize',
|
|
109
|
+
'typography.fontFamily': 'fontFamily',
|
|
110
|
+
};
|
|
111
|
+
|
|
103
112
|
function findInPresetsBy(
|
|
104
113
|
features,
|
|
105
114
|
blockName,
|
|
@@ -120,8 +129,7 @@ function findInPresetsBy(
|
|
|
120
129
|
for ( const origin of origins ) {
|
|
121
130
|
const presets = presetByOrigin[ origin ];
|
|
122
131
|
if ( presets ) {
|
|
123
|
-
const presetObject = find(
|
|
124
|
-
presets,
|
|
132
|
+
const presetObject = presets.find(
|
|
125
133
|
( preset ) =>
|
|
126
134
|
preset[ presetProperty ] === presetValueValue
|
|
127
135
|
);
|
|
@@ -164,7 +172,9 @@ export function getPresetVariableFromValue(
|
|
|
164
172
|
|
|
165
173
|
const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];
|
|
166
174
|
|
|
167
|
-
const metadata = find(
|
|
175
|
+
const metadata = PRESET_METADATA.find(
|
|
176
|
+
( data ) => data.cssVarInfix === cssVarInfix
|
|
177
|
+
);
|
|
168
178
|
|
|
169
179
|
if ( ! metadata ) {
|
|
170
180
|
// The property doesn't have preset data
|
|
@@ -196,7 +206,9 @@ function getValueFromPresetVariable(
|
|
|
196
206
|
variable,
|
|
197
207
|
[ presetType, slug ]
|
|
198
208
|
) {
|
|
199
|
-
const metadata = find(
|
|
209
|
+
const metadata = PRESET_METADATA.find(
|
|
210
|
+
( data ) => data.cssVarInfix === presetType
|
|
211
|
+
);
|
|
200
212
|
if ( ! metadata ) {
|
|
201
213
|
return variable;
|
|
202
214
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -30,10 +25,9 @@ function useGlobalStylesRenderer() {
|
|
|
30
25
|
}
|
|
31
26
|
|
|
32
27
|
const currentStoreSettings = getSettings();
|
|
33
|
-
const nonGlobalStyles =
|
|
34
|
-
currentStoreSettings.styles
|
|
35
|
-
|
|
36
|
-
);
|
|
28
|
+
const nonGlobalStyles = Object.values(
|
|
29
|
+
currentStoreSettings.styles ?? []
|
|
30
|
+
).filter( ( style ) => ! style.isGlobalStyles );
|
|
37
31
|
updateSettings( {
|
|
38
32
|
...currentStoreSettings,
|
|
39
33
|
styles: [ ...nonGlobalStyles, ...styles ],
|
|
@@ -20,17 +20,18 @@ import {
|
|
|
20
20
|
} from '@wordpress/components';
|
|
21
21
|
import { chevronDown } from '@wordpress/icons';
|
|
22
22
|
import { useState, useMemo } from '@wordpress/element';
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
import {
|
|
24
|
+
store as blockEditorStore,
|
|
25
|
+
useBlockDisplayInformation,
|
|
26
|
+
BlockIcon,
|
|
27
|
+
} from '@wordpress/block-editor';
|
|
26
28
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
27
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Internal dependencies
|
|
31
32
|
*/
|
|
32
33
|
import TemplateDetails from '../../template-details';
|
|
33
|
-
import
|
|
34
|
+
import useEditedEntityRecord from '../../use-edited-entity-record';
|
|
34
35
|
|
|
35
36
|
function getBlockDisplayText( block ) {
|
|
36
37
|
if ( block ) {
|
|
@@ -52,10 +53,13 @@ function useSecondaryText() {
|
|
|
52
53
|
[]
|
|
53
54
|
);
|
|
54
55
|
|
|
56
|
+
const blockInformation = useBlockDisplayInformation( activeEntityBlockId );
|
|
57
|
+
|
|
55
58
|
if ( activeEntityBlockId ) {
|
|
56
59
|
return {
|
|
57
60
|
label: getBlockDisplayText( getBlock( activeEntityBlockId ) ),
|
|
58
61
|
isActive: true,
|
|
62
|
+
icon: blockInformation?.icon,
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
|
|
@@ -63,36 +67,16 @@ function useSecondaryText() {
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
export default function DocumentActions() {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'postType',
|
|
77
|
-
postType,
|
|
78
|
-
postId
|
|
79
|
-
);
|
|
80
|
-
const _isLoaded = !! postId;
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
showIconLabels: select( preferencesStore ).get(
|
|
84
|
-
'core/edit-site',
|
|
85
|
-
'showIconLabels'
|
|
86
|
-
),
|
|
87
|
-
entityTitle: getTemplateInfo( record ).title,
|
|
88
|
-
isLoaded: _isLoaded,
|
|
89
|
-
template: record,
|
|
90
|
-
templateType: postType,
|
|
91
|
-
};
|
|
92
|
-
}, [] );
|
|
93
|
-
const entityLabel =
|
|
94
|
-
templateType === 'wp_template_part' ? 'template part' : 'template';
|
|
95
|
-
const { label } = useSecondaryText();
|
|
70
|
+
const showIconLabels = useSelect(
|
|
71
|
+
( select ) =>
|
|
72
|
+
select( preferencesStore ).get(
|
|
73
|
+
'core/edit-site',
|
|
74
|
+
'showIconLabels'
|
|
75
|
+
),
|
|
76
|
+
[]
|
|
77
|
+
);
|
|
78
|
+
const { isLoaded, record, getTitle } = useEditedEntityRecord();
|
|
79
|
+
const { label, icon } = useSecondaryText();
|
|
96
80
|
|
|
97
81
|
// Use internal state instead of a ref to make sure that the component
|
|
98
82
|
// re-renders when the popover's anchor updates.
|
|
@@ -118,7 +102,7 @@ export default function DocumentActions() {
|
|
|
118
102
|
}
|
|
119
103
|
|
|
120
104
|
// Return feedback that the template does not seem to exist.
|
|
121
|
-
if ( !
|
|
105
|
+
if ( ! record ) {
|
|
122
106
|
return (
|
|
123
107
|
<div className="edit-site-document-actions">
|
|
124
108
|
{ __( 'Template not found' ) }
|
|
@@ -126,6 +110,11 @@ export default function DocumentActions() {
|
|
|
126
110
|
);
|
|
127
111
|
}
|
|
128
112
|
|
|
113
|
+
const entityLabel =
|
|
114
|
+
record.type === 'wp_template_part'
|
|
115
|
+
? __( 'template part' )
|
|
116
|
+
: __( 'template' );
|
|
117
|
+
|
|
129
118
|
return (
|
|
130
119
|
<div
|
|
131
120
|
className={ classnames( 'edit-site-document-actions', {
|
|
@@ -148,15 +137,12 @@ export default function DocumentActions() {
|
|
|
148
137
|
entityLabel
|
|
149
138
|
) }
|
|
150
139
|
</VisuallyHidden>
|
|
151
|
-
{
|
|
152
|
-
</Text>
|
|
153
|
-
|
|
154
|
-
<Text
|
|
155
|
-
size="body"
|
|
156
|
-
className="edit-site-document-actions__secondary-item"
|
|
157
|
-
>
|
|
158
|
-
{ label ?? '' }
|
|
140
|
+
{ getTitle() }
|
|
159
141
|
</Text>
|
|
142
|
+
<div className="edit-site-document-actions__secondary-item">
|
|
143
|
+
<BlockIcon icon={ icon } showColors />
|
|
144
|
+
<Text size="body">{ label ?? '' }</Text>
|
|
145
|
+
</div>
|
|
160
146
|
|
|
161
147
|
<Dropdown
|
|
162
148
|
popoverProps={ popoverProps }
|
|
@@ -181,7 +167,7 @@ export default function DocumentActions() {
|
|
|
181
167
|
contentClassName="edit-site-document-actions__info-dropdown"
|
|
182
168
|
renderContent={ ( { onClose } ) => (
|
|
183
169
|
<TemplateDetails
|
|
184
|
-
template={
|
|
170
|
+
template={ record }
|
|
185
171
|
onClose={ onClose }
|
|
186
172
|
/>
|
|
187
173
|
) }
|