@wordpress/edit-site 5.1.0 → 5.3.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 +8 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal.js +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +5 -9
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/app/index.js +2 -7
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +25 -59
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +237 -0
- package/build/components/block-editor/inserter-media-categories.js.map +1 -0
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/canvas-spinner/index.js +20 -0
- package/build/components/canvas-spinner/index.js.map +1 -0
- package/build/components/create-template-part-modal/index.js +4 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +4 -2
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +2 -12
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +5 -28
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +10 -4
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +18 -9
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +13 -7
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +47 -4
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +65 -14
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +50 -27
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +13 -3
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +17 -11
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +21 -142
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +0 -28
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/palette.js +11 -4
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +18 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +28 -13
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +16 -4
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +17 -9
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +59 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -8
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +24 -16
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +9 -3
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +19 -11
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +25 -9
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +8 -4
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +15 -7
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +23 -11
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- package/build/components/global-styles/shadow-panel.js +196 -0
- package/build/components/global-styles/shadow-panel.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +37 -22
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +19 -9
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +139 -21
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -290
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- package/build/components/global-styles-renderer/index.js +7 -5
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +2 -2
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/layout/index.js +86 -15
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +8 -11
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
- package/build/components/navigation-inspector/index.js.map +1 -0
- package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -14
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +3 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +23 -1
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +11 -11
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +1 -1
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/style-book/index.js +7 -4
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +5 -9
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/experiments.js +19 -0
- package/build/experiments.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +68 -9
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +53 -60
- package/build/index.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +7 -27
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +77 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/template-part-create.js +71 -0
- package/build/utils/template-part-create.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
- 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 -9
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/app/index.js +2 -7
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +27 -57
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +225 -0
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/canvas-spinner/index.js +12 -0
- package/build-module/components/canvas-spinner/index.js.map +1 -0
- package/build-module/components/create-template-part-modal/index.js +5 -3
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +3 -2
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +5 -28
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +10 -4
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +18 -11
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +11 -7
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +46 -8
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +61 -15
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +50 -28
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +7 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +23 -134
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +0 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +10 -5
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +18 -14
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +27 -15
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +14 -4
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +17 -11
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +56 -27
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +21 -9
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +24 -18
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +8 -3
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +19 -13
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +23 -9
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +5 -2
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +15 -9
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +19 -10
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- package/build-module/components/global-styles/shadow-panel.js +177 -0
- package/build-module/components/global-styles/shadow-panel.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +37 -24
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +17 -9
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +132 -22
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -277
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- package/build-module/components/global-styles-renderer/index.js +5 -5
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +86 -17
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +9 -12
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
- package/build-module/components/navigation-inspector/index.js.map +1 -0
- package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
- package/build-module/components/sidebar/index.js +2 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -13
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +3 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +12 -11
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +1 -1
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/style-book/index.js +8 -5
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/experiments.js +9 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +65 -6
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +52 -60
- package/build-module/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -26
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +66 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/template-part-create.js +53 -0
- package/build-module/utils/template-part-create.js.map +1 -0
- package/build-style/style-rtl.css +448 -278
- package/build-style/style.css +448 -278
- package/package.json +32 -30
- package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
- package/src/components/add-new-template/add-custom-template-modal.js +0 -1
- package/src/components/add-new-template/new-template-part.js +12 -11
- package/src/components/add-new-template/style.scss +0 -4
- package/src/components/app/index.js +2 -2
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +21 -77
- package/src/components/block-editor/inserter-media-categories.js +247 -0
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +55 -7
- package/src/components/canvas-spinner/index.js +12 -0
- package/src/components/canvas-spinner/style.scss +7 -0
- package/src/components/create-template-part-modal/index.js +75 -67
- package/src/components/create-template-part-modal/style.scss +0 -10
- package/src/components/editor/index.js +5 -3
- package/src/components/error-boundary/index.js +2 -10
- package/src/components/error-boundary/warning.js +6 -35
- package/src/components/global-styles/README.md +1 -75
- package/src/components/global-styles/block-preview-panel.js +16 -4
- package/src/components/global-styles/border-panel.js +22 -16
- package/src/components/global-styles/color-palette-panel.js +10 -7
- package/src/components/global-styles/context-menu.js +117 -41
- package/src/components/global-styles/custom-css.js +76 -19
- package/src/components/global-styles/dimensions-panel.js +58 -31
- package/src/components/global-styles/global-styles-provider.js +6 -2
- package/src/components/global-styles/gradients-palette-panel.js +17 -11
- package/src/components/global-styles/hooks.js +31 -155
- package/src/components/global-styles/index.js +0 -2
- package/src/components/global-styles/palette.js +9 -5
- package/src/components/global-styles/preview.js +19 -13
- package/src/components/global-styles/screen-background-color.js +42 -19
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-border.js +13 -5
- package/src/components/global-styles/screen-button-color.js +21 -19
- package/src/components/global-styles/screen-colors.js +66 -22
- package/src/components/global-styles/screen-css.js +30 -14
- package/src/components/global-styles/screen-heading-color.js +32 -27
- package/src/components/global-styles/screen-layout.js +7 -4
- package/src/components/global-styles/screen-link-color.js +34 -22
- package/src/components/global-styles/screen-root.js +24 -9
- package/src/components/global-styles/screen-style-variations.js +7 -2
- package/src/components/global-styles/screen-text-color.js +15 -15
- package/src/components/global-styles/screen-typography.js +34 -12
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/shadow-panel.js +174 -0
- package/src/components/global-styles/style.scss +94 -1
- package/src/components/global-styles/typography-panel.js +58 -23
- package/src/components/global-styles/typography-preview.js +28 -9
- package/src/components/global-styles/ui.js +130 -17
- package/src/components/global-styles/utils.js +7 -330
- package/src/components/global-styles/variations-panel.js +78 -0
- package/src/components/global-styles-renderer/index.js +3 -4
- package/src/components/header-edit-mode/document-actions/index.js +1 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/src/components/layout/index.js +116 -21
- package/src/components/layout/style.scss +29 -5
- package/src/components/list/actions/rename-menu-item.js +14 -23
- package/src/components/list/style.scss +0 -4
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -4
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +4 -17
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
- package/src/components/sidebar-edit-mode/index.js +0 -11
- package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
- package/src/components/sidebar-navigation-item/style.scss +28 -3
- package/src/components/sidebar-navigation-screen/index.js +4 -3
- package/src/components/sidebar-navigation-screen/style.scss +2 -0
- package/src/components/sidebar-navigation-screen-main/index.js +23 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
- package/src/components/site-hub/index.js +120 -109
- package/src/components/site-hub/style.scss +7 -1
- package/src/components/site-icon/index.js +1 -1
- package/src/components/site-icon/style.scss +2 -2
- package/src/components/style-book/index.js +10 -5
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- package/src/components/template-part-converter/convert-to-template-part.js +12 -10
- package/src/experiments.js +10 -0
- package/src/hooks/push-changes-to-global-styles/index.js +66 -8
- package/src/index.js +51 -59
- package/src/store/reducer.js +1 -1
- package/src/store/selectors.js +6 -26
- package/src/store/test/utils.js +181 -0
- package/src/store/utils.js +69 -0
- package/src/style.scss +4 -2
- package/src/utils/template-part-create.js +62 -0
- package/src/utils/test/template-part-create.js +63 -0
- package/build/components/global-styles/context.js +0 -22
- package/build/components/global-styles/context.js.map +0 -1
- package/build/components/global-styles/typography-utils.js +0 -92
- package/build/components/global-styles/typography-utils.js.map +0 -1
- package/build/components/global-styles/use-global-styles-output.js +0 -857
- package/build/components/global-styles/use-global-styles-output.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/build-module/components/global-styles/context.js +0 -12
- package/build-module/components/global-styles/context.js.map +0 -1
- package/build-module/components/global-styles/typography-utils.js +0 -84
- package/build-module/components/global-styles/typography-utils.js.map +0 -1
- package/build-module/components/global-styles/use-global-styles-output.js +0 -815
- package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/src/components/global-styles/context.js +0 -15
- package/src/components/global-styles/test/typography-utils.js +0 -393
- package/src/components/global-styles/test/use-global-styles-output.js +0 -814
- package/src/components/global-styles/test/utils.js +0 -206
- package/src/components/global-styles/typography-utils.js +0 -87
- package/src/components/global-styles/use-global-styles-output.js +0 -936
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
|
@@ -18,15 +18,19 @@ import {
|
|
|
18
18
|
} from '@wordpress/components';
|
|
19
19
|
import {
|
|
20
20
|
__experimentalUseCustomSides as useCustomSides,
|
|
21
|
-
|
|
21
|
+
HeightControl,
|
|
22
22
|
__experimentalSpacingSizesControl as SpacingSizesControl,
|
|
23
|
+
experiments as blockEditorExperiments,
|
|
23
24
|
} from '@wordpress/block-editor';
|
|
24
25
|
import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Internal dependencies
|
|
28
29
|
*/
|
|
29
|
-
import { getSupportedGlobalStylesPanels
|
|
30
|
+
import { getSupportedGlobalStylesPanels } from './hooks';
|
|
31
|
+
import { unlock } from '../../experiments';
|
|
32
|
+
|
|
33
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
|
|
30
34
|
|
|
31
35
|
const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
|
|
32
36
|
|
|
@@ -50,50 +54,52 @@ export function useHasDimensionsPanel( name ) {
|
|
|
50
54
|
|
|
51
55
|
function useHasContentSize( name ) {
|
|
52
56
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
53
|
-
const [ settings ] =
|
|
57
|
+
const [ settings ] = useGlobalSetting( 'layout.contentSize', name );
|
|
54
58
|
|
|
55
59
|
return settings && supports.includes( 'contentSize' );
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
function useHasWideSize( name ) {
|
|
59
63
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
60
|
-
const [ settings ] =
|
|
64
|
+
const [ settings ] = useGlobalSetting( 'layout.wideSize', name );
|
|
61
65
|
|
|
62
66
|
return settings && supports.includes( 'wideSize' );
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
function useHasPadding( name ) {
|
|
66
70
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
67
|
-
const [ settings ] =
|
|
71
|
+
const [ settings ] = useGlobalSetting( 'spacing.padding', name );
|
|
68
72
|
|
|
69
73
|
return settings && supports.includes( 'padding' );
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
function useHasMargin( name ) {
|
|
73
77
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
74
|
-
const [ settings ] =
|
|
78
|
+
const [ settings ] = useGlobalSetting( 'spacing.margin', name );
|
|
75
79
|
|
|
76
80
|
return settings && supports.includes( 'margin' );
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
function useHasGap( name ) {
|
|
80
84
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
81
|
-
const [ settings ] =
|
|
85
|
+
const [ settings ] = useGlobalSetting( 'spacing.blockGap', name );
|
|
82
86
|
|
|
83
87
|
return settings && supports.includes( 'blockGap' );
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
function useHasMinHeight( name ) {
|
|
87
91
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
88
|
-
const [ settings ] =
|
|
92
|
+
const [ settings ] = useGlobalSetting( 'dimensions.minHeight', name );
|
|
89
93
|
|
|
90
94
|
return settings && supports.includes( 'minHeight' );
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
function useHasSpacingPresets() {
|
|
94
|
-
const [ settings ] =
|
|
98
|
+
const [ settings ] = useGlobalSetting( 'spacing.spacingSizes' );
|
|
99
|
+
const { custom, theme, default: defaultPresets } = settings || {};
|
|
100
|
+
const presets = custom ?? theme ?? defaultPresets ?? [];
|
|
95
101
|
|
|
96
|
-
return settings &&
|
|
102
|
+
return settings && presets.length > 0;
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
function filterValuesBySides( values, sides ) {
|
|
@@ -156,11 +162,11 @@ function splitGapValue( value ) {
|
|
|
156
162
|
|
|
157
163
|
// Props for managing `layout.contentSize`.
|
|
158
164
|
function useContentSizeProps( name ) {
|
|
159
|
-
const [ contentSizeValue, setContentSizeValue ] =
|
|
165
|
+
const [ contentSizeValue, setContentSizeValue ] = useGlobalSetting(
|
|
160
166
|
'layout.contentSize',
|
|
161
167
|
name
|
|
162
168
|
);
|
|
163
|
-
const [ userSetContentSizeValue ] =
|
|
169
|
+
const [ userSetContentSizeValue ] = useGlobalSetting(
|
|
164
170
|
'layout.contentSize',
|
|
165
171
|
name,
|
|
166
172
|
'user'
|
|
@@ -177,11 +183,11 @@ function useContentSizeProps( name ) {
|
|
|
177
183
|
|
|
178
184
|
// Props for managing `layout.wideSize`.
|
|
179
185
|
function useWideSizeProps( name ) {
|
|
180
|
-
const [ wideSizeValue, setWideSizeValue ] =
|
|
186
|
+
const [ wideSizeValue, setWideSizeValue ] = useGlobalSetting(
|
|
181
187
|
'layout.wideSize',
|
|
182
188
|
name
|
|
183
189
|
);
|
|
184
|
-
const [ userSetWideSizeValue ] =
|
|
190
|
+
const [ userSetWideSizeValue ] = useGlobalSetting(
|
|
185
191
|
'layout.wideSize',
|
|
186
192
|
name,
|
|
187
193
|
'user'
|
|
@@ -197,8 +203,12 @@ function useWideSizeProps( name ) {
|
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
// Props for managing `spacing.padding`.
|
|
200
|
-
function usePaddingProps( name ) {
|
|
201
|
-
const
|
|
206
|
+
function usePaddingProps( name, variation = '' ) {
|
|
207
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
208
|
+
const [ rawPadding, setRawPadding ] = useGlobalStyle(
|
|
209
|
+
prefix + 'spacing.padding',
|
|
210
|
+
name
|
|
211
|
+
);
|
|
202
212
|
const paddingValues = splitStyleValue( rawPadding );
|
|
203
213
|
const paddingSides = useCustomSides( name, 'padding' );
|
|
204
214
|
const isAxialPadding =
|
|
@@ -210,7 +220,11 @@ function usePaddingProps( name ) {
|
|
|
210
220
|
setRawPadding( padding );
|
|
211
221
|
};
|
|
212
222
|
const resetPaddingValue = () => setPaddingValues( {} );
|
|
213
|
-
const [ userSetPaddingValue ] =
|
|
223
|
+
const [ userSetPaddingValue ] = useGlobalStyle(
|
|
224
|
+
prefix + 'spacing.padding',
|
|
225
|
+
name,
|
|
226
|
+
'user'
|
|
227
|
+
);
|
|
214
228
|
// The `hasPaddingValue` check does not need a parsed value, as `userSetPaddingValue` will be `undefined` if not set.
|
|
215
229
|
const hasPaddingValue = () => !! userSetPaddingValue;
|
|
216
230
|
|
|
@@ -225,8 +239,12 @@ function usePaddingProps( name ) {
|
|
|
225
239
|
}
|
|
226
240
|
|
|
227
241
|
// Props for managing `spacing.margin`.
|
|
228
|
-
function useMarginProps( name ) {
|
|
229
|
-
const
|
|
242
|
+
function useMarginProps( name, variation = '' ) {
|
|
243
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
244
|
+
const [ rawMargin, setRawMargin ] = useGlobalStyle(
|
|
245
|
+
prefix + 'spacing.margin',
|
|
246
|
+
name
|
|
247
|
+
);
|
|
230
248
|
const marginValues = splitStyleValue( rawMargin );
|
|
231
249
|
const marginSides = useCustomSides( name, 'margin' );
|
|
232
250
|
const isAxialMargin =
|
|
@@ -252,14 +270,22 @@ function useMarginProps( name ) {
|
|
|
252
270
|
}
|
|
253
271
|
|
|
254
272
|
// Props for managing `spacing.blockGap`.
|
|
255
|
-
function useBlockGapProps( name ) {
|
|
256
|
-
const
|
|
273
|
+
function useBlockGapProps( name, variation = '' ) {
|
|
274
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
275
|
+
const [ gapValue, setGapValue ] = useGlobalStyle(
|
|
276
|
+
prefix + 'spacing.blockGap',
|
|
277
|
+
name
|
|
278
|
+
);
|
|
257
279
|
const gapValues = splitGapValue( gapValue );
|
|
258
280
|
const gapSides = useCustomSides( name, 'blockGap' );
|
|
259
281
|
const isAxialGap =
|
|
260
282
|
gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );
|
|
261
283
|
const resetGapValue = () => setGapValue( undefined );
|
|
262
|
-
const [ userSetGapValue ] =
|
|
284
|
+
const [ userSetGapValue ] = useGlobalStyle(
|
|
285
|
+
prefix + 'spacing.blockGap',
|
|
286
|
+
name,
|
|
287
|
+
'user'
|
|
288
|
+
);
|
|
263
289
|
const hasGapValue = () => !! userSetGapValue;
|
|
264
290
|
const setGapValues = ( nextBoxGapValue ) => {
|
|
265
291
|
if ( ! nextBoxGapValue ) {
|
|
@@ -288,9 +314,10 @@ function useBlockGapProps( name ) {
|
|
|
288
314
|
}
|
|
289
315
|
|
|
290
316
|
// Props for managing `dimensions.minHeight`.
|
|
291
|
-
function useMinHeightProps( name ) {
|
|
292
|
-
const
|
|
293
|
-
|
|
317
|
+
function useMinHeightProps( name, variation = '' ) {
|
|
318
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
319
|
+
const [ minHeightValue, setMinHeightValue ] = useGlobalStyle(
|
|
320
|
+
prefix + 'dimensions.minHeight',
|
|
294
321
|
name
|
|
295
322
|
);
|
|
296
323
|
const resetMinHeightValue = () => setMinHeightValue( undefined );
|
|
@@ -303,7 +330,7 @@ function useMinHeightProps( name ) {
|
|
|
303
330
|
};
|
|
304
331
|
}
|
|
305
332
|
|
|
306
|
-
export default function DimensionsPanel( { name } ) {
|
|
333
|
+
export default function DimensionsPanel( { name, variation = '' } ) {
|
|
307
334
|
const showContentSizeControl = useHasContentSize( name );
|
|
308
335
|
const showWideSizeControl = useHasWideSize( name );
|
|
309
336
|
const showPaddingControl = useHasPadding( name );
|
|
@@ -312,7 +339,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
312
339
|
const showMinHeightControl = useHasMinHeight( name );
|
|
313
340
|
const showSpacingPresetsControl = useHasSpacingPresets();
|
|
314
341
|
const units = useCustomUnits( {
|
|
315
|
-
availableUnits:
|
|
342
|
+
availableUnits: useGlobalSetting( 'spacing.units', name )[ 0 ] || [
|
|
316
343
|
'%',
|
|
317
344
|
'px',
|
|
318
345
|
'em',
|
|
@@ -345,7 +372,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
345
372
|
setPaddingValues,
|
|
346
373
|
resetPaddingValue,
|
|
347
374
|
hasPaddingValue,
|
|
348
|
-
} = usePaddingProps( name );
|
|
375
|
+
} = usePaddingProps( name, variation );
|
|
349
376
|
|
|
350
377
|
// Props for managing `spacing.margin`.
|
|
351
378
|
const {
|
|
@@ -355,7 +382,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
355
382
|
setMarginValues,
|
|
356
383
|
resetMarginValue,
|
|
357
384
|
hasMarginValue,
|
|
358
|
-
} = useMarginProps( name );
|
|
385
|
+
} = useMarginProps( name, variation );
|
|
359
386
|
|
|
360
387
|
// Props for managing `spacing.blockGap`.
|
|
361
388
|
const {
|
|
@@ -367,7 +394,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
367
394
|
setGapValues,
|
|
368
395
|
resetGapValue,
|
|
369
396
|
hasGapValue,
|
|
370
|
-
} = useBlockGapProps( name );
|
|
397
|
+
} = useBlockGapProps( name, variation );
|
|
371
398
|
|
|
372
399
|
// Props for managing `dimensions.minHeight`.
|
|
373
400
|
const {
|
|
@@ -375,7 +402,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
375
402
|
setMinHeightValue,
|
|
376
403
|
resetMinHeightValue,
|
|
377
404
|
hasMinHeightValue,
|
|
378
|
-
} = useMinHeightProps( name );
|
|
405
|
+
} = useMinHeightProps( name, variation );
|
|
379
406
|
|
|
380
407
|
const resetAll = () => {
|
|
381
408
|
resetPaddingValue();
|
|
@@ -9,11 +9,15 @@ import { mergeWith, isEmpty, mapValues } from 'lodash';
|
|
|
9
9
|
import { useMemo, useCallback } from '@wordpress/element';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
|
-
import
|
|
17
|
+
import CanvasSpinner from '../canvas-spinner';
|
|
18
|
+
import { unlock } from '../../experiments';
|
|
19
|
+
|
|
20
|
+
const { GlobalStylesContext } = unlock( blockEditorExperiments );
|
|
17
21
|
|
|
18
22
|
function mergeTreesCustomizer( _, srcValue ) {
|
|
19
23
|
// We only pass as arrays the presets,
|
|
@@ -165,7 +169,7 @@ function useGlobalStylesContext() {
|
|
|
165
169
|
export function GlobalStylesProvider( { children } ) {
|
|
166
170
|
const context = useGlobalStylesContext();
|
|
167
171
|
if ( ! context.isReady ) {
|
|
168
|
-
return
|
|
172
|
+
return <CanvasSpinner />;
|
|
169
173
|
}
|
|
170
174
|
|
|
171
175
|
return (
|
|
@@ -8,48 +8,54 @@ import {
|
|
|
8
8
|
DuotonePicker,
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
14
15
|
*/
|
|
15
|
-
import { useSetting } from './hooks';
|
|
16
16
|
import Subtitle from './subtitle';
|
|
17
|
+
import { unlock } from '../../experiments';
|
|
18
|
+
|
|
19
|
+
const { useGlobalSetting } = unlock( blockEditorExperiments );
|
|
17
20
|
|
|
18
21
|
const noop = () => {};
|
|
19
22
|
|
|
20
23
|
export default function GradientPalettePanel( { name } ) {
|
|
21
|
-
const [ themeGradients, setThemeGradients ] =
|
|
24
|
+
const [ themeGradients, setThemeGradients ] = useGlobalSetting(
|
|
22
25
|
'color.gradients.theme',
|
|
23
26
|
name
|
|
24
27
|
);
|
|
25
|
-
const [ baseThemeGradients ] =
|
|
28
|
+
const [ baseThemeGradients ] = useGlobalSetting(
|
|
26
29
|
'color.gradients.theme',
|
|
27
30
|
name,
|
|
28
31
|
'base'
|
|
29
32
|
);
|
|
30
|
-
const [ defaultGradients, setDefaultGradients ] =
|
|
33
|
+
const [ defaultGradients, setDefaultGradients ] = useGlobalSetting(
|
|
31
34
|
'color.gradients.default',
|
|
32
35
|
name
|
|
33
36
|
);
|
|
34
|
-
const [ baseDefaultGradients ] =
|
|
37
|
+
const [ baseDefaultGradients ] = useGlobalSetting(
|
|
35
38
|
'color.gradients.default',
|
|
36
39
|
name,
|
|
37
40
|
'base'
|
|
38
41
|
);
|
|
39
|
-
const [ customGradients, setCustomGradients ] =
|
|
42
|
+
const [ customGradients, setCustomGradients ] = useGlobalSetting(
|
|
40
43
|
'color.gradients.custom',
|
|
41
44
|
name
|
|
42
45
|
);
|
|
43
46
|
|
|
44
|
-
const [ defaultPaletteEnabled ] =
|
|
47
|
+
const [ defaultPaletteEnabled ] = useGlobalSetting(
|
|
45
48
|
'color.defaultGradients',
|
|
46
49
|
name
|
|
47
50
|
);
|
|
48
51
|
|
|
49
|
-
const [ customDuotone ] =
|
|
50
|
-
const [ defaultDuotone ] =
|
|
51
|
-
|
|
52
|
-
const [
|
|
52
|
+
const [ customDuotone ] = useGlobalSetting( 'color.duotone.custom' ) || [];
|
|
53
|
+
const [ defaultDuotone ] =
|
|
54
|
+
useGlobalSetting( 'color.duotone.default' ) || [];
|
|
55
|
+
const [ themeDuotone ] = useGlobalSetting( 'color.duotone.theme' ) || [];
|
|
56
|
+
const [ defaultDuotoneEnabled ] = useGlobalSetting(
|
|
57
|
+
'color.defaultDuotone'
|
|
58
|
+
);
|
|
53
59
|
|
|
54
60
|
const duotonePalette = [
|
|
55
61
|
...( customDuotone || [] ),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import { get, set } from 'lodash';
|
|
4
|
+
import { get } from 'lodash';
|
|
6
5
|
import { colord, extend } from 'colord';
|
|
7
6
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
8
7
|
|
|
@@ -10,162 +9,23 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
10
9
|
* WordPress dependencies
|
|
11
10
|
*/
|
|
12
11
|
import { _x } from '@wordpress/i18n';
|
|
13
|
-
import {
|
|
12
|
+
import { useMemo } from '@wordpress/element';
|
|
14
13
|
import {
|
|
15
14
|
getBlockType,
|
|
16
|
-
__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,
|
|
17
15
|
__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
|
|
18
16
|
} from '@wordpress/blocks';
|
|
17
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Internal dependencies
|
|
22
21
|
*/
|
|
23
|
-
import {
|
|
24
|
-
|
|
22
|
+
import { unlock } from '../../experiments';
|
|
23
|
+
|
|
24
|
+
const { useGlobalSetting } = unlock( blockEditorExperiments );
|
|
25
25
|
|
|
26
26
|
// Enable colord's a11y plugin.
|
|
27
27
|
extend( [ a11yPlugin ] );
|
|
28
28
|
|
|
29
|
-
const EMPTY_CONFIG = { settings: {}, styles: {} };
|
|
30
|
-
|
|
31
|
-
export const useGlobalStylesReset = () => {
|
|
32
|
-
const { user: config, setUserConfig } = useContext( GlobalStylesContext );
|
|
33
|
-
const canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );
|
|
34
|
-
return [
|
|
35
|
-
canReset,
|
|
36
|
-
useCallback(
|
|
37
|
-
() => setUserConfig( () => EMPTY_CONFIG ),
|
|
38
|
-
[ setUserConfig ]
|
|
39
|
-
),
|
|
40
|
-
];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export function useSetting( path, blockName, source = 'all' ) {
|
|
44
|
-
const {
|
|
45
|
-
merged: mergedConfig,
|
|
46
|
-
base: baseConfig,
|
|
47
|
-
user: userConfig,
|
|
48
|
-
setUserConfig,
|
|
49
|
-
} = useContext( GlobalStylesContext );
|
|
50
|
-
|
|
51
|
-
const fullPath = ! blockName
|
|
52
|
-
? `settings.${ path }`
|
|
53
|
-
: `settings.blocks.${ blockName }.${ path }`;
|
|
54
|
-
|
|
55
|
-
const setSetting = ( newValue ) => {
|
|
56
|
-
setUserConfig( ( currentConfig ) => {
|
|
57
|
-
// Deep clone `currentConfig` to avoid mutating it later.
|
|
58
|
-
const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
|
|
59
|
-
const pathToSet = PATHS_WITH_MERGE[ path ]
|
|
60
|
-
? fullPath + '.custom'
|
|
61
|
-
: fullPath;
|
|
62
|
-
set( newUserConfig, pathToSet, newValue );
|
|
63
|
-
|
|
64
|
-
return newUserConfig;
|
|
65
|
-
} );
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const getSettingValueForContext = ( name ) => {
|
|
69
|
-
const currentPath = ! name
|
|
70
|
-
? `settings.${ path }`
|
|
71
|
-
: `settings.blocks.${ name }.${ path }`;
|
|
72
|
-
|
|
73
|
-
const getSettingValue = ( configToUse ) => {
|
|
74
|
-
const result = get( configToUse, currentPath );
|
|
75
|
-
if ( PATHS_WITH_MERGE[ path ] ) {
|
|
76
|
-
return result?.custom ?? result?.theme ?? result?.default;
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
let result;
|
|
82
|
-
switch ( source ) {
|
|
83
|
-
case 'all':
|
|
84
|
-
result = getSettingValue( mergedConfig );
|
|
85
|
-
break;
|
|
86
|
-
case 'user':
|
|
87
|
-
result = getSettingValue( userConfig );
|
|
88
|
-
break;
|
|
89
|
-
case 'base':
|
|
90
|
-
result = getSettingValue( baseConfig );
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
throw 'Unsupported source';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return result;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// Unlike styles settings get inherited from top level settings.
|
|
100
|
-
const resultWithFallback =
|
|
101
|
-
getSettingValueForContext( blockName ) ?? getSettingValueForContext();
|
|
102
|
-
|
|
103
|
-
return [ resultWithFallback, setSetting ];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function useStyle( path, blockName, source = 'all' ) {
|
|
107
|
-
const {
|
|
108
|
-
merged: mergedConfig,
|
|
109
|
-
base: baseConfig,
|
|
110
|
-
user: userConfig,
|
|
111
|
-
setUserConfig,
|
|
112
|
-
} = useContext( GlobalStylesContext );
|
|
113
|
-
const finalPath = ! blockName
|
|
114
|
-
? `styles.${ path }`
|
|
115
|
-
: `styles.blocks.${ blockName }.${ path }`;
|
|
116
|
-
|
|
117
|
-
const setStyle = ( newValue ) => {
|
|
118
|
-
setUserConfig( ( currentConfig ) => {
|
|
119
|
-
// Deep clone `currentConfig` to avoid mutating it later.
|
|
120
|
-
const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
|
|
121
|
-
set(
|
|
122
|
-
newUserConfig,
|
|
123
|
-
finalPath,
|
|
124
|
-
getPresetVariableFromValue(
|
|
125
|
-
mergedConfig.settings,
|
|
126
|
-
blockName,
|
|
127
|
-
path,
|
|
128
|
-
newValue
|
|
129
|
-
)
|
|
130
|
-
);
|
|
131
|
-
return newUserConfig;
|
|
132
|
-
} );
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
let result;
|
|
136
|
-
switch ( source ) {
|
|
137
|
-
case 'all':
|
|
138
|
-
result = getValueFromVariable(
|
|
139
|
-
mergedConfig,
|
|
140
|
-
blockName,
|
|
141
|
-
// The stlyes.css path is allowed to be empty, so don't revert to base if undefined.
|
|
142
|
-
finalPath === 'styles.css'
|
|
143
|
-
? get( userConfig, finalPath )
|
|
144
|
-
: get( userConfig, finalPath ) ??
|
|
145
|
-
get( baseConfig, finalPath )
|
|
146
|
-
);
|
|
147
|
-
break;
|
|
148
|
-
case 'user':
|
|
149
|
-
result = getValueFromVariable(
|
|
150
|
-
mergedConfig,
|
|
151
|
-
blockName,
|
|
152
|
-
get( userConfig, finalPath )
|
|
153
|
-
);
|
|
154
|
-
break;
|
|
155
|
-
case 'base':
|
|
156
|
-
result = getValueFromVariable(
|
|
157
|
-
baseConfig,
|
|
158
|
-
blockName,
|
|
159
|
-
get( baseConfig, finalPath )
|
|
160
|
-
);
|
|
161
|
-
break;
|
|
162
|
-
default:
|
|
163
|
-
throw 'Unsupported source';
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return [ result, setStyle ];
|
|
167
|
-
}
|
|
168
|
-
|
|
169
29
|
const ROOT_BLOCK_SUPPORTS = [
|
|
170
30
|
'background',
|
|
171
31
|
'backgroundColor',
|
|
@@ -211,6 +71,11 @@ export function getSupportedGlobalStylesPanels( name ) {
|
|
|
211
71
|
supportKeys.push( 'blockGap' );
|
|
212
72
|
}
|
|
213
73
|
|
|
74
|
+
// check for shadow support
|
|
75
|
+
if ( blockType?.supports?.shadow ) {
|
|
76
|
+
supportKeys.push( 'shadow' );
|
|
77
|
+
}
|
|
78
|
+
|
|
214
79
|
Object.keys( STYLE_PROPERTY ).forEach( ( styleName ) => {
|
|
215
80
|
if ( ! STYLE_PROPERTY[ styleName ].support ) {
|
|
216
81
|
return;
|
|
@@ -247,10 +112,12 @@ export function getSupportedGlobalStylesPanels( name ) {
|
|
|
247
112
|
}
|
|
248
113
|
|
|
249
114
|
export function useColorsPerOrigin( name ) {
|
|
250
|
-
const [ customColors ] =
|
|
251
|
-
const [ themeColors ] =
|
|
252
|
-
const [ defaultColors ] =
|
|
253
|
-
const [ shouldDisplayDefaultColors ] =
|
|
115
|
+
const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
|
|
116
|
+
const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
|
|
117
|
+
const [ defaultColors ] = useGlobalSetting( 'color.palette.default', name );
|
|
118
|
+
const [ shouldDisplayDefaultColors ] = useGlobalSetting(
|
|
119
|
+
'color.defaultPalette'
|
|
120
|
+
);
|
|
254
121
|
|
|
255
122
|
return useMemo( () => {
|
|
256
123
|
const result = [];
|
|
@@ -290,10 +157,19 @@ export function useColorsPerOrigin( name ) {
|
|
|
290
157
|
}
|
|
291
158
|
|
|
292
159
|
export function useGradientsPerOrigin( name ) {
|
|
293
|
-
const [ customGradients ] =
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
160
|
+
const [ customGradients ] = useGlobalSetting(
|
|
161
|
+
'color.gradients.custom',
|
|
162
|
+
name
|
|
163
|
+
);
|
|
164
|
+
const [ themeGradients ] = useGlobalSetting(
|
|
165
|
+
'color.gradients.theme',
|
|
166
|
+
name
|
|
167
|
+
);
|
|
168
|
+
const [ defaultGradients ] = useGlobalSetting(
|
|
169
|
+
'color.gradients.default',
|
|
170
|
+
name
|
|
171
|
+
);
|
|
172
|
+
const [ shouldDisplayDefaultGradients ] = useGlobalSetting(
|
|
297
173
|
'color.defaultGradients'
|
|
298
174
|
);
|
|
299
175
|
|
|
@@ -335,7 +211,7 @@ export function useGradientsPerOrigin( name ) {
|
|
|
335
211
|
}
|
|
336
212
|
|
|
337
213
|
export function useColorRandomizer( name ) {
|
|
338
|
-
const [ themeColors, setThemeColors ] =
|
|
214
|
+
const [ themeColors, setThemeColors ] = useGlobalSetting(
|
|
339
215
|
'color.palette.theme',
|
|
340
216
|
name
|
|
341
217
|
);
|
|
@@ -13,23 +13,27 @@ import {
|
|
|
13
13
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
14
14
|
import { shuffle } from '@wordpress/icons';
|
|
15
15
|
import { useMemo } from '@wordpress/element';
|
|
16
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
19
20
|
*/
|
|
20
21
|
import Subtitle from './subtitle';
|
|
21
22
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
22
|
-
import { useColorRandomizer
|
|
23
|
+
import { useColorRandomizer } from './hooks';
|
|
23
24
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
25
|
+
import { unlock } from '../../experiments';
|
|
26
|
+
|
|
27
|
+
const { useGlobalSetting } = unlock( blockEditorExperiments );
|
|
24
28
|
|
|
25
29
|
const EMPTY_COLORS = [];
|
|
26
30
|
|
|
27
31
|
function Palette( { name } ) {
|
|
28
|
-
const [ customColors ] =
|
|
29
|
-
const [ themeColors ] =
|
|
30
|
-
const [ defaultColors ] =
|
|
32
|
+
const [ customColors ] = useGlobalSetting( 'color.palette.custom' );
|
|
33
|
+
const [ themeColors ] = useGlobalSetting( 'color.palette.theme' );
|
|
34
|
+
const [ defaultColors ] = useGlobalSetting( 'color.palette.default' );
|
|
31
35
|
|
|
32
|
-
const [ defaultPaletteEnabled ] =
|
|
36
|
+
const [ defaultPaletteEnabled ] = useGlobalSetting(
|
|
33
37
|
'color.defaultPalette',
|
|
34
38
|
name
|
|
35
39
|
);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__unstableIframe as Iframe,
|
|
6
6
|
__unstableEditorStyles as EditorStyles,
|
|
7
|
+
experiments as blockEditorExperiments,
|
|
7
8
|
} from '@wordpress/block-editor';
|
|
8
9
|
import {
|
|
9
10
|
__unstableMotion as motion,
|
|
@@ -16,8 +17,11 @@ import { useState, useMemo } from '@wordpress/element';
|
|
|
16
17
|
/**
|
|
17
18
|
* Internal dependencies
|
|
18
19
|
*/
|
|
19
|
-
import {
|
|
20
|
-
|
|
20
|
+
import { unlock } from '../../experiments';
|
|
21
|
+
|
|
22
|
+
const { useGlobalSetting, useGlobalStyle, useGlobalStylesOutput } = unlock(
|
|
23
|
+
blockEditorExperiments
|
|
24
|
+
);
|
|
21
25
|
|
|
22
26
|
const firstFrame = {
|
|
23
27
|
start: {
|
|
@@ -56,23 +60,25 @@ const normalizedHeight = 152;
|
|
|
56
60
|
const normalizedColorSwatchSize = 32;
|
|
57
61
|
|
|
58
62
|
const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
59
|
-
const [ fontWeight ] =
|
|
60
|
-
const [ fontFamily = 'serif' ] =
|
|
61
|
-
const [ headingFontFamily = fontFamily ] =
|
|
63
|
+
const [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );
|
|
64
|
+
const [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );
|
|
65
|
+
const [ headingFontFamily = fontFamily ] = useGlobalStyle(
|
|
62
66
|
'elements.h1.typography.fontFamily'
|
|
63
67
|
);
|
|
64
|
-
const [ headingFontWeight = fontWeight ] =
|
|
68
|
+
const [ headingFontWeight = fontWeight ] = useGlobalStyle(
|
|
65
69
|
'elements.h1.typography.fontWeight'
|
|
66
70
|
);
|
|
67
|
-
const [ textColor = 'black' ] =
|
|
68
|
-
const [ headingColor = textColor ] =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
const [ textColor = 'black' ] = useGlobalStyle( 'color.text' );
|
|
72
|
+
const [ headingColor = textColor ] = useGlobalStyle(
|
|
73
|
+
'elements.h1.color.text'
|
|
74
|
+
);
|
|
75
|
+
const [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );
|
|
76
|
+
const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
|
|
71
77
|
const [ styles ] = useGlobalStylesOutput();
|
|
72
78
|
const disableMotion = useReducedMotion();
|
|
73
|
-
const [ coreColors ] =
|
|
74
|
-
const [ themeColors ] =
|
|
75
|
-
const [ customColors ] =
|
|
79
|
+
const [ coreColors ] = useGlobalSetting( 'color.palette.core' );
|
|
80
|
+
const [ themeColors ] = useGlobalSetting( 'color.palette.theme' );
|
|
81
|
+
const [ customColors ] = useGlobalSetting( 'color.palette.custom' );
|
|
76
82
|
const [ isHovered, setIsHovered ] = useState( false );
|
|
77
83
|
const [ containerResizeListener, { width } ] = useResizeObserver();
|
|
78
84
|
const ratio = width ? width / normalizedWidth : 1;
|