@wordpress/edit-site 5.2.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 +6 -0
- 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 -29
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -9
- package/build/components/add-new-template/utils.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/index.js +13 -11
- 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/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 +2 -2
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +17 -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 +39 -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 +49 -31
- 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 +27 -13
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-border.js +10 -4
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +16 -9
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +43 -34
- 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 +23 -16
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +3 -3
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +18 -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 +14 -7
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +18 -12
- package/build/components/global-styles/screen-typography.js.map +1 -1
- 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 +43 -29
- 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 +85 -34
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +5 -334
- package/build/components/global-styles/utils.js.map +1 -1
- 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 +6 -8
- 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} +1 -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 +2 -2
- 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/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 +65 -6
- 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/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 +4 -27
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +0 -5
- package/build-module/components/add-new-template/utils.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/index.js +14 -12
- 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/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 +2 -2
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +17 -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 +40 -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 +49 -32
- 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 +26 -15
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +10 -5
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +16 -11
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +43 -37
- 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 +23 -18
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -4
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +18 -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 +14 -9
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +16 -12
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- 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 +43 -31
- 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 +80 -35
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +4 -319
- package/build-module/components/global-styles/utils.js.map +1 -1
- 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 +6 -8
- 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} +1 -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 +2 -2
- 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/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 +62 -3
- 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/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 +314 -216
- package/build-style/style.css +314 -216
- 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 +11 -32
- package/src/components/add-new-template/style.scss +0 -4
- package/src/components/add-new-template/utils.js +0 -14
- package/src/components/app/index.js +2 -2
- package/src/components/block-editor/index.js +12 -25
- package/src/components/block-editor/inserter-media-categories.js +247 -0
- package/src/components/block-editor/style.scss +19 -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 +4 -2
- 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 +2 -2
- package/src/components/global-styles/border-panel.js +19 -17
- package/src/components/global-styles/color-palette-panel.js +10 -7
- package/src/components/global-styles/context-menu.js +114 -44
- package/src/components/global-styles/custom-css.js +76 -19
- package/src/components/global-styles/dimensions-panel.js +46 -36
- 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 +37 -21
- package/src/components/global-styles/screen-border.js +10 -5
- package/src/components/global-styles/screen-button-color.js +21 -19
- package/src/components/global-styles/screen-colors.js +48 -65
- 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 +4 -7
- package/src/components/global-styles/screen-link-color.js +26 -26
- 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 -19
- package/src/components/global-styles/screen-typography.js +27 -12
- package/src/components/global-styles/shadow-panel.js +174 -0
- package/src/components/global-styles/style.scss +85 -1
- package/src/components/global-styles/typography-panel.js +60 -48
- package/src/components/global-styles/typography-preview.js +28 -9
- package/src/components/global-styles/ui.js +78 -53
- package/src/components/global-styles/utils.js +4 -371
- 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 +9 -2
- package/src/components/layout/style.scss +4 -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} +1 -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 +0 -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 +1 -1
- 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/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 +63 -5
- package/src/index.js +51 -59
- 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 -943
- 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 -901
- 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 -1059
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
|
@@ -3,14 +3,19 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { LineHeightControl, __experimentalFontFamilyControl as FontFamilyControl, __experimentalFontAppearanceControl as FontAppearanceControl, __experimentalLetterSpacingControl as LetterSpacingControl, __experimentalTextTransformControl as TextTransformControl, __experimentalTextDecorationControl as TextDecorationControl } from '@wordpress/block-editor';
|
|
6
|
+
import { LineHeightControl, __experimentalFontFamilyControl as FontFamilyControl, __experimentalFontAppearanceControl as FontAppearanceControl, __experimentalLetterSpacingControl as LetterSpacingControl, __experimentalTextTransformControl as TextTransformControl, __experimentalTextDecorationControl as TextDecorationControl, experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
7
7
|
import { FontSizePicker, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { getSupportedGlobalStylesPanels
|
|
13
|
+
import { getSupportedGlobalStylesPanels } from './hooks';
|
|
14
|
+
import { unlock } from '../../experiments';
|
|
15
|
+
const {
|
|
16
|
+
useGlobalSetting,
|
|
17
|
+
useGlobalStyle
|
|
18
|
+
} = unlock(blockEditorExperiments);
|
|
14
19
|
export function useHasTypographyPanel(name) {
|
|
15
20
|
const hasFontFamily = useHasFontFamilyControl(name);
|
|
16
21
|
const hasLineHeight = useHasLineHeightControl(name);
|
|
@@ -22,26 +27,27 @@ export function useHasTypographyPanel(name) {
|
|
|
22
27
|
|
|
23
28
|
function useHasFontFamilyControl(name) {
|
|
24
29
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
25
|
-
const [
|
|
30
|
+
const [fontFamiliesPerOrigin] = useGlobalSetting('typography.fontFamilies', name);
|
|
31
|
+
const fontFamilies = (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default);
|
|
26
32
|
return supports.includes('fontFamily') && !!(fontFamilies !== null && fontFamilies !== void 0 && fontFamilies.length);
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
function useHasLineHeightControl(name) {
|
|
30
36
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
31
|
-
return
|
|
37
|
+
return useGlobalSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight');
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
function useHasAppearanceControl(name) {
|
|
35
41
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
36
|
-
const hasFontStyles =
|
|
37
|
-
const hasFontWeights =
|
|
42
|
+
const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
|
|
43
|
+
const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
|
|
38
44
|
return hasFontStyles || hasFontWeights;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
function useAppearanceControlLabel(name) {
|
|
42
48
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
43
|
-
const hasFontStyles =
|
|
44
|
-
const hasFontWeights =
|
|
49
|
+
const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
|
|
50
|
+
const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
|
|
45
51
|
|
|
46
52
|
if (!hasFontStyles) {
|
|
47
53
|
return __('Font weight');
|
|
@@ -55,7 +61,7 @@ function useAppearanceControlLabel(name) {
|
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
function useHasLetterSpacingControl(name, element) {
|
|
58
|
-
const setting =
|
|
64
|
+
const setting = useGlobalSetting('typography.letterSpacing', name)[0];
|
|
59
65
|
|
|
60
66
|
if (!setting) {
|
|
61
67
|
return false;
|
|
@@ -70,7 +76,7 @@ function useHasLetterSpacingControl(name, element) {
|
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
function useHasTextTransformControl(name, element) {
|
|
73
|
-
const setting =
|
|
79
|
+
const setting = useGlobalSetting('typography.textTransform', name)[0];
|
|
74
80
|
|
|
75
81
|
if (!setting) {
|
|
76
82
|
return false;
|
|
@@ -92,8 +98,8 @@ function useHasTextDecorationControl(name, element) {
|
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
function useStyleWithReset(path, blockName) {
|
|
95
|
-
const [style, setStyle] =
|
|
96
|
-
const [userStyle] =
|
|
101
|
+
const [style, setStyle] = useGlobalStyle(path, blockName);
|
|
102
|
+
const [userStyle] = useGlobalStyle(path, blockName, 'user');
|
|
97
103
|
|
|
98
104
|
const hasStyle = () => !!userStyle;
|
|
99
105
|
|
|
@@ -103,8 +109,8 @@ function useStyleWithReset(path, blockName) {
|
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
function useFontSizeWithReset(path, blockName) {
|
|
106
|
-
const [fontSize, setStyleCallback] =
|
|
107
|
-
const [userStyle] =
|
|
112
|
+
const [fontSize, setStyleCallback] = useGlobalStyle(path, blockName);
|
|
113
|
+
const [userStyle] = useGlobalStyle(path, blockName, 'user');
|
|
108
114
|
|
|
109
115
|
const hasFontSize = () => !!userStyle;
|
|
110
116
|
|
|
@@ -127,10 +133,10 @@ function useFontSizeWithReset(path, blockName) {
|
|
|
127
133
|
}
|
|
128
134
|
|
|
129
135
|
function useFontAppearance(prefix, name) {
|
|
130
|
-
const [fontStyle, setFontStyle] =
|
|
131
|
-
const [userFontStyle] =
|
|
132
|
-
const [fontWeight, setFontWeight] =
|
|
133
|
-
const [userFontWeight] =
|
|
136
|
+
const [fontStyle, setFontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name);
|
|
137
|
+
const [userFontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name, 'user');
|
|
138
|
+
const [fontWeight, setFontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name);
|
|
139
|
+
const [userFontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name, 'user');
|
|
134
140
|
|
|
135
141
|
const hasFontAppearance = () => !!userFontStyle || !!userFontWeight;
|
|
136
142
|
|
|
@@ -154,7 +160,7 @@ export default function TypographyPanel(_ref) {
|
|
|
154
160
|
name,
|
|
155
161
|
element,
|
|
156
162
|
headingLevel,
|
|
157
|
-
|
|
163
|
+
variation = ''
|
|
158
164
|
} = _ref;
|
|
159
165
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
160
166
|
let prefix = '';
|
|
@@ -165,11 +171,17 @@ export default function TypographyPanel(_ref) {
|
|
|
165
171
|
prefix = `elements.${element}.`;
|
|
166
172
|
}
|
|
167
173
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
174
|
+
if (variation) {
|
|
175
|
+
prefix = prefix ? `variations.${variation}.${prefix}` : `variations.${variation}`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const [fontSizesPerOrigin] = useGlobalSetting('typography.fontSizes', name);
|
|
179
|
+
const fontSizes = (fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.custom) || (fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.theme) || (fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.default);
|
|
180
|
+
const disableCustomFontSizes = !useGlobalSetting('typography.customFontSize', name)[0];
|
|
181
|
+
const [fontFamiliesPerOrigin] = useGlobalSetting('typography.fontFamilies', name);
|
|
182
|
+
const fontFamilies = (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default);
|
|
183
|
+
const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
|
|
184
|
+
const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
|
|
173
185
|
const hasFontFamilyEnabled = useHasFontFamilyControl(name);
|
|
174
186
|
const hasLineHeightEnabled = useHasLineHeightControl(name);
|
|
175
187
|
const hasAppearanceControl = useHasAppearanceControl(name);
|
|
@@ -185,13 +197,13 @@ export default function TypographyPanel(_ref) {
|
|
|
185
197
|
hasFontSizeEnabled = false;
|
|
186
198
|
}
|
|
187
199
|
|
|
188
|
-
const [fontFamily, setFontFamily, hasFontFamily, resetFontFamily] = useStyleWithReset(
|
|
200
|
+
const [fontFamily, setFontFamily, hasFontFamily, resetFontFamily] = useStyleWithReset(prefix + 'typography.fontFamily', name);
|
|
189
201
|
const {
|
|
190
202
|
fontSize,
|
|
191
203
|
setFontSize,
|
|
192
204
|
hasFontSize,
|
|
193
205
|
resetFontSize
|
|
194
|
-
} = useFontSizeWithReset(
|
|
206
|
+
} = useFontSizeWithReset(prefix + 'typography.fontSize', name);
|
|
195
207
|
const {
|
|
196
208
|
fontStyle,
|
|
197
209
|
setFontStyle,
|
|
@@ -199,11 +211,11 @@ export default function TypographyPanel(_ref) {
|
|
|
199
211
|
setFontWeight,
|
|
200
212
|
hasFontAppearance,
|
|
201
213
|
resetFontAppearance
|
|
202
|
-
} = useFontAppearance(
|
|
203
|
-
const [lineHeight, setLineHeight, hasLineHeight, resetLineHeight] = useStyleWithReset(
|
|
204
|
-
const [letterSpacing, setLetterSpacing, hasLetterSpacing, resetLetterSpacing] = useStyleWithReset(
|
|
205
|
-
const [textTransform, setTextTransform, hasTextTransform, resetTextTransform] = useStyleWithReset(
|
|
206
|
-
const [textDecoration, setTextDecoration, hasTextDecoration, resetTextDecoration] = useStyleWithReset(
|
|
214
|
+
} = useFontAppearance(prefix, name);
|
|
215
|
+
const [lineHeight, setLineHeight, hasLineHeight, resetLineHeight] = useStyleWithReset(prefix + 'typography.lineHeight', name);
|
|
216
|
+
const [letterSpacing, setLetterSpacing, hasLetterSpacing, resetLetterSpacing] = useStyleWithReset(prefix + 'typography.letterSpacing', name);
|
|
217
|
+
const [textTransform, setTextTransform, hasTextTransform, resetTextTransform] = useStyleWithReset(prefix + 'typography.textTransform', name);
|
|
218
|
+
const [textDecoration, setTextDecoration, hasTextDecoration, resetTextDecoration] = useStyleWithReset(prefix + 'typography.textDecoration', name);
|
|
207
219
|
|
|
208
220
|
const resetAll = () => {
|
|
209
221
|
resetFontFamily();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["LineHeightControl","__experimentalFontFamilyControl","FontFamilyControl","__experimentalFontAppearanceControl","FontAppearanceControl","__experimentalLetterSpacingControl","LetterSpacingControl","__experimentalTextTransformControl","TextTransformControl","__experimentalTextDecorationControl","TextDecorationControl","FontSizePicker","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","getSupportedGlobalStylesPanels","useSetting","useStyle","useHasTypographyPanel","name","hasFontFamily","useHasFontFamilyControl","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","fontFamilies","length","hasFontStyles","hasFontWeights","useAppearanceControlLabel","element","setting","useHasTextTransformControl","useHasTextDecorationControl","useStyleWithReset","path","blockName","style","setStyle","userStyle","hasStyle","resetStyle","undefined","useFontSizeWithReset","fontSize","setStyleCallback","hasFontSize","resetFontSize","setFontSize","newValue","metadata","slug","useFontAppearance","prefix","fontStyle","setFontStyle","userFontStyle","fontWeight","setFontWeight","userFontWeight","resetFontAppearance","TypographyPanel","headingLevel","variationPath","fontSizes","disableCustomFontSizes","hasFontFamilyEnabled","hasLineHeightEnabled","hasAppearanceControl","appearanceControlLabel","hasLetterSpacingControl","hasTextTransformControl","hasTextDecorationControl","hasFontSizeEnabled","fontFamily","setFontFamily","resetFontFamily","lineHeight","setLineHeight","resetLineHeight","letterSpacing","setLetterSpacing","resetLetterSpacing","textTransform","setTextTransform","hasTextTransform","resetTextTransform","textDecoration","setTextDecoration","hasTextDecoration","resetTextDecoration","resetAll","newFontStyle","newFontWeight"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,+BAA+B,IAAIC,iBAFpC,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,kCAAkC,IAAIC,oBAJvC,EAKCC,kCAAkC,IAAIC,oBALvC,EAMCC,mCAAmC,IAAIC,qBANxC,QAOO,yBAPP;AAQA,SACCC,cADD,EAECC,wBAAwB,IAAIC,UAF7B,EAGCC,4BAA4B,IAAIC,cAHjC,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,EAAyCC,UAAzC,EAAqDC,QAArD,QAAqE,SAArE;AAEA,OAAO,SAASC,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAAF,CAA7C;AACA,QAAMG,aAAa,GAAGC,uBAAuB,CAAEJ,IAAF,CAA7C;AACA,QAAMK,iBAAiB,GAAGC,uBAAuB,CAAEN,IAAF,CAAjD;AACA,QAAMO,gBAAgB,GAAGC,0BAA0B,CAAER,IAAF,CAAnD;AACA,QAAMS,QAAQ,GAAGb,8BAA8B,CAAEI,IAAF,CAA/C;AACA,SACCC,aAAa,IACbE,aADA,IAEAE,iBAFA,IAGAE,gBAHA,IAIAE,QAAQ,CAACC,QAAT,CAAmB,UAAnB,CALD;AAOA;;AAED,SAASR,uBAAT,CAAkCF,IAAlC,EAAyC;AACxC,QAAMS,QAAQ,GAAGb,8BAA8B,CAA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,MAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,IAAI,EAAC,kBALN;AAMC,IAAA,uBAAuB;AANxB,IAND,CAjGF,EAiHGZ,wBAAwB,IACzB,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,eADX;AAEC,IAAA,KAAK,EAAG/D,EAAE,CAAE,iBAAF,CAFX;AAGC,IAAA,QAAQ,EAAGgF,iBAHZ;AAIC,IAAA,UAAU,EAAGC,mBAJd;AAKC,IAAA,gBAAgB;AALjB,KAOC,cAAC,qBAAD;AACC,IAAA,KAAK,EAAGH,cADT;AAEC,IAAA,QAAQ,EAAGC,iBAFZ;AAGC,IAAA,IAAI,EAAC,kBAHN;AAIC,IAAA,oBAAoB,EAAC;AAJtB,IAPD,CAlHF,CADD;AAoIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n\t__experimentalTextTransformControl as TextTransformControl,\n\t__experimentalTextDecorationControl as TextDecorationControl,\n} from '@wordpress/block-editor';\nimport {\n\tFontSizePicker,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nexport function useHasTypographyPanel( name ) {\n\tconst hasFontFamily = useHasFontFamilyControl( name );\n\tconst hasLineHeight = useHasLineHeightControl( name );\n\tconst hasFontAppearance = useHasAppearanceControl( name );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( name );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\thasFontFamily ||\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasFontFamilyControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );\n\treturn supports.includes( 'fontFamily' ) && !! fontFamilies?.length;\n}\n\nfunction useHasLineHeightControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.lineHeight', name )[ 0 ] &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useAppearanceControlLabel( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\treturn __( 'Appearance' );\n}\n\nfunction useHasLetterSpacingControl( name, element ) {\n\tconst setting = useSetting( 'typography.letterSpacing', name )[ 0 ];\n\tif ( ! setting ) {\n\t\treturn false;\n\t}\n\tif ( ! name && element === 'heading' ) {\n\t\treturn true;\n\t}\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn supports.includes( 'letterSpacing' );\n}\n\nfunction useHasTextTransformControl( name, element ) {\n\tconst setting = useSetting( 'typography.textTransform', name )[ 0 ];\n\tif ( ! setting ) {\n\t\treturn false;\n\t}\n\tif ( ! name && element === 'heading' ) {\n\t\treturn true;\n\t}\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn supports.includes( 'textTransform' );\n}\n\nfunction useHasTextDecorationControl( name, element ) {\n\t// This is an exception for link elements.\n\t// We shouldn't allow other blocks or elements to set textDecoration\n\t// because this will be inherited by their children.\n\treturn ! name && element === 'link';\n}\n\nfunction useStyleWithReset( path, blockName ) {\n\tconst [ style, setStyle ] = useStyle( path, blockName );\n\tconst [ userStyle ] = useStyle( path, blockName, 'user' );\n\tconst hasStyle = () => !! userStyle;\n\tconst resetStyle = () => setStyle( undefined );\n\treturn [ style, setStyle, hasStyle, resetStyle ];\n}\n\nfunction useFontSizeWithReset( path, blockName ) {\n\tconst [ fontSize, setStyleCallback ] = useStyle( path, blockName );\n\tconst [ userStyle ] = useStyle( path, blockName, 'user' );\n\tconst hasFontSize = () => !! userStyle;\n\tconst resetFontSize = () => setStyleCallback( undefined );\n\tconst setFontSize = ( newValue, metadata ) => {\n\t\tif ( !! metadata?.slug ) {\n\t\t\tnewValue = `var:preset|font-size|${ metadata?.slug }`;\n\t\t}\n\t\tsetStyleCallback( newValue );\n\t};\n\n\treturn {\n\t\tfontSize,\n\t\tsetFontSize,\n\t\thasFontSize,\n\t\tresetFontSize,\n\t};\n}\n\nfunction useFontAppearance( prefix, name ) {\n\tconst [ fontStyle, setFontStyle ] = useStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ userFontStyle ] = useStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ fontWeight, setFontWeight ] = useStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ userFontWeight ] = useStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname,\n\t\t'user'\n\t);\n\tconst hasFontAppearance = () => !! userFontStyle || !! userFontWeight;\n\tconst resetFontAppearance = () => {\n\t\tsetFontStyle( undefined );\n\t\tsetFontWeight( undefined );\n\t};\n\treturn {\n\t\tfontStyle,\n\t\tsetFontStyle,\n\t\tfontWeight,\n\t\tsetFontWeight,\n\t\thasFontAppearance,\n\t\tresetFontAppearance,\n\t};\n}\n\nexport default function TypographyPanel( {\n\tname,\n\telement,\n\theadingLevel,\n\tvariationPath = '',\n} ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tlet prefix = '';\n\tif ( element === 'heading' ) {\n\t\tprefix = `elements.${ headingLevel }.`;\n\t} else if ( element && element !== 'text' ) {\n\t\tprefix = `elements.${ element }.`;\n\t}\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\n\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t)[ 0 ];\n\tconst [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasFontFamilyEnabled = useHasFontFamilyControl( name );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst appearanceControlLabel = useAppearanceControlLabel( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name, element );\n\tconst hasTextTransformControl = useHasTextTransformControl( name, element );\n\tconst hasTextDecorationControl = useHasTextDecorationControl(\n\t\tname,\n\t\telement\n\t);\n\n\t/* Disable font size controls when the option to style all headings is selected. */\n\tlet hasFontSizeEnabled = supports.includes( 'fontSize' );\n\tif ( element === 'heading' && headingLevel === 'heading' ) {\n\t\thasFontSizeEnabled = false;\n\t}\n\n\tconst [ fontFamily, setFontFamily, hasFontFamily, resetFontFamily ] =\n\t\tuseStyleWithReset(\n\t\t\tvariationPath + prefix + 'typography.fontFamily',\n\t\t\tname\n\t\t);\n\tconst { fontSize, setFontSize, hasFontSize, resetFontSize } =\n\t\tuseFontSizeWithReset(\n\t\t\tvariationPath + prefix + 'typography.fontSize',\n\t\t\tname\n\t\t);\n\tconst {\n\t\tfontStyle,\n\t\tsetFontStyle,\n\t\tfontWeight,\n\t\tsetFontWeight,\n\t\thasFontAppearance,\n\t\tresetFontAppearance,\n\t} = useFontAppearance( variationPath + prefix, name );\n\tconst [ lineHeight, setLineHeight, hasLineHeight, resetLineHeight ] =\n\t\tuseStyleWithReset(\n\t\t\tvariationPath + prefix + 'typography.lineHeight',\n\t\t\tname\n\t\t);\n\tconst [\n\t\tletterSpacing,\n\t\tsetLetterSpacing,\n\t\thasLetterSpacing,\n\t\tresetLetterSpacing,\n\t] = useStyleWithReset(\n\t\tvariationPath + prefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [\n\t\ttextTransform,\n\t\tsetTextTransform,\n\t\thasTextTransform,\n\t\tresetTextTransform,\n\t] = useStyleWithReset(\n\t\tvariationPath + prefix + 'typography.textTransform',\n\t\tname\n\t);\n\tconst [\n\t\ttextDecoration,\n\t\tsetTextDecoration,\n\t\thasTextDecoration,\n\t\tresetTextDecoration,\n\t] = useStyleWithReset(\n\t\tvariationPath + prefix + 'typography.textDecoration',\n\t\tname\n\t);\n\n\tconst resetAll = () => {\n\t\tresetFontFamily();\n\t\tresetFontSize();\n\t\tresetFontAppearance();\n\t\tresetLineHeight();\n\t\tresetLetterSpacing();\n\t\tresetTextTransform();\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Typography' ) } resetAll={ resetAll }>\n\t\t\t{ hasFontFamilyEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Font family' ) }\n\t\t\t\t\thasValue={ hasFontFamily }\n\t\t\t\t\tonDeselect={ resetFontFamily }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyControl\n\t\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasFontSizeEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\thasValue={ hasFontSize }\n\t\t\t\t\tonDeselect={ resetFontSize }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<FontSizePicker\n\t\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\twithReset={ false }\n\t\t\t\t\t\twithSlider\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ appearanceControlLabel }\n\t\t\t\t\thasValue={ hasFontAppearance }\n\t\t\t\t\tonDeselect={ resetFontAppearance }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceControl\n\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\t\t\t\tfontWeight: newFontWeight,\n\t\t\t\t\t\t} ) => {\n\t\t\t\t\t\t\tsetFontStyle( newFontStyle );\n\t\t\t\t\t\t\tsetFontWeight( newFontWeight );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\thasValue={ hasLineHeight }\n\t\t\t\t\tonDeselect={ resetLineHeight }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<LineHeightControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\t\t\thasValue={ hasLetterSpacing }\n\t\t\t\t\tonDeselect={ resetLetterSpacing }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingControl\n\t\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasTextTransformControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\thasValue={ hasTextTransform }\n\t\t\t\t\tonDeselect={ resetTextTransform }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<TextTransformControl\n\t\t\t\t\t\tvalue={ textTransform }\n\t\t\t\t\t\tonChange={ setTextTransform }\n\t\t\t\t\t\tshowNone\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasTextDecorationControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Text decoration' ) }\n\t\t\t\t\thasValue={ hasTextDecoration }\n\t\t\t\t\tonDeselect={ resetTextDecoration }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationControl\n\t\t\t\t\t\tvalue={ textDecoration }\n\t\t\t\t\t\tonChange={ setTextDecoration }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["LineHeightControl","__experimentalFontFamilyControl","FontFamilyControl","__experimentalFontAppearanceControl","FontAppearanceControl","__experimentalLetterSpacingControl","LetterSpacingControl","__experimentalTextTransformControl","TextTransformControl","__experimentalTextDecorationControl","TextDecorationControl","experiments","blockEditorExperiments","FontSizePicker","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","getSupportedGlobalStylesPanels","unlock","useGlobalSetting","useGlobalStyle","useHasTypographyPanel","name","hasFontFamily","useHasFontFamilyControl","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","fontFamiliesPerOrigin","fontFamilies","custom","theme","default","length","hasFontStyles","hasFontWeights","useAppearanceControlLabel","element","setting","useHasTextTransformControl","useHasTextDecorationControl","useStyleWithReset","path","blockName","style","setStyle","userStyle","hasStyle","resetStyle","undefined","useFontSizeWithReset","fontSize","setStyleCallback","hasFontSize","resetFontSize","setFontSize","newValue","metadata","slug","useFontAppearance","prefix","fontStyle","setFontStyle","userFontStyle","fontWeight","setFontWeight","userFontWeight","resetFontAppearance","TypographyPanel","headingLevel","variation","fontSizesPerOrigin","fontSizes","disableCustomFontSizes","hasFontFamilyEnabled","hasLineHeightEnabled","hasAppearanceControl","appearanceControlLabel","hasLetterSpacingControl","hasTextTransformControl","hasTextDecorationControl","hasFontSizeEnabled","fontFamily","setFontFamily","resetFontFamily","lineHeight","setLineHeight","resetLineHeight","letterSpacing","setLetterSpacing","resetLetterSpacing","textTransform","setTextTransform","hasTextTransform","resetTextTransform","textDecoration","setTextDecoration","hasTextDecoration","resetTextDecoration","resetAll","newFontStyle","newFontWeight"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,+BAA+B,IAAIC,iBAFpC,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,kCAAkC,IAAIC,oBAJvC,EAKCC,kCAAkC,IAAIC,oBALvC,EAMCC,mCAAmC,IAAIC,qBANxC,EAOCC,WAAW,IAAIC,sBAPhB,QAQO,yBARP;AASA,SACCC,cADD,EAECC,wBAAwB,IAAIC,UAF7B,EAGCC,4BAA4B,IAAIC,cAHjC,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,SAA/C;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuCF,MAAM,CAAER,sBAAF,CAAnD;AAEA,OAAO,SAASW,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAAF,CAA7C;AACA,QAAMG,aAAa,GAAGC,uBAAu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cAAC,cAAD;AACC,IAAA,SAAS,EAAC,eADX;AAEC,IAAA,KAAK,EAAGrE,EAAE,CAAE,iBAAF,CAFX;AAGC,IAAA,QAAQ,EAAGsF,iBAHZ;AAIC,IAAA,UAAU,EAAGC,mBAJd;AAKC,IAAA,gBAAgB;AALjB,KAOC,cAAC,qBAAD;AACC,IAAA,KAAK,EAAGH,cADT;AAEC,IAAA,QAAQ,EAAGC,iBAFZ;AAGC,IAAA,IAAI,EAAC,kBAHN;AAIC,IAAA,oBAAoB,EAAC;AAJtB,IAPD,CAlHF,CADD;AAoIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n\t__experimentalTextTransformControl as TextTransformControl,\n\t__experimentalTextDecorationControl as TextDecorationControl,\n\texperiments as blockEditorExperiments,\n} from '@wordpress/block-editor';\nimport {\n\tFontSizePicker,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels } from './hooks';\nimport { unlock } from '../../experiments';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );\n\nexport function useHasTypographyPanel( name ) {\n\tconst hasFontFamily = useHasFontFamilyControl( name );\n\tconst hasLineHeight = useHasLineHeightControl( name );\n\tconst hasFontAppearance = useHasAppearanceControl( name );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( name );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\thasFontFamily ||\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasFontFamilyControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ fontFamiliesPerOrigin ] = useGlobalSetting(\n\t\t'typography.fontFamilies',\n\t\tname\n\t);\n\tconst fontFamilies =\n\t\tfontFamiliesPerOrigin?.custom ||\n\t\tfontFamiliesPerOrigin?.theme ||\n\t\tfontFamiliesPerOrigin?.default;\n\treturn supports.includes( 'fontFamily' ) && !! fontFamilies?.length;\n}\n\nfunction useHasLineHeightControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseGlobalSetting( 'typography.lineHeight', name )[ 0 ] &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useAppearanceControlLabel( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\treturn __( 'Appearance' );\n}\n\nfunction useHasLetterSpacingControl( name, element ) {\n\tconst setting = useGlobalSetting( 'typography.letterSpacing', name )[ 0 ];\n\tif ( ! setting ) {\n\t\treturn false;\n\t}\n\tif ( ! name && element === 'heading' ) {\n\t\treturn true;\n\t}\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn supports.includes( 'letterSpacing' );\n}\n\nfunction useHasTextTransformControl( name, element ) {\n\tconst setting = useGlobalSetting( 'typography.textTransform', name )[ 0 ];\n\tif ( ! setting ) {\n\t\treturn false;\n\t}\n\tif ( ! name && element === 'heading' ) {\n\t\treturn true;\n\t}\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn supports.includes( 'textTransform' );\n}\n\nfunction useHasTextDecorationControl( name, element ) {\n\t// This is an exception for link elements.\n\t// We shouldn't allow other blocks or elements to set textDecoration\n\t// because this will be inherited by their children.\n\treturn ! name && element === 'link';\n}\n\nfunction useStyleWithReset( path, blockName ) {\n\tconst [ style, setStyle ] = useGlobalStyle( path, blockName );\n\tconst [ userStyle ] = useGlobalStyle( path, blockName, 'user' );\n\tconst hasStyle = () => !! userStyle;\n\tconst resetStyle = () => setStyle( undefined );\n\treturn [ style, setStyle, hasStyle, resetStyle ];\n}\n\nfunction useFontSizeWithReset( path, blockName ) {\n\tconst [ fontSize, setStyleCallback ] = useGlobalStyle( path, blockName );\n\tconst [ userStyle ] = useGlobalStyle( path, blockName, 'user' );\n\tconst hasFontSize = () => !! userStyle;\n\tconst resetFontSize = () => setStyleCallback( undefined );\n\tconst setFontSize = ( newValue, metadata ) => {\n\t\tif ( !! metadata?.slug ) {\n\t\t\tnewValue = `var:preset|font-size|${ metadata?.slug }`;\n\t\t}\n\t\tsetStyleCallback( newValue );\n\t};\n\n\treturn {\n\t\tfontSize,\n\t\tsetFontSize,\n\t\thasFontSize,\n\t\tresetFontSize,\n\t};\n}\n\nfunction useFontAppearance( prefix, name ) {\n\tconst [ fontStyle, setFontStyle ] = useGlobalStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ userFontStyle ] = useGlobalStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ fontWeight, setFontWeight ] = useGlobalStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ userFontWeight ] = useGlobalStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname,\n\t\t'user'\n\t);\n\tconst hasFontAppearance = () => !! userFontStyle || !! userFontWeight;\n\tconst resetFontAppearance = () => {\n\t\tsetFontStyle( undefined );\n\t\tsetFontWeight( undefined );\n\t};\n\treturn {\n\t\tfontStyle,\n\t\tsetFontStyle,\n\t\tfontWeight,\n\t\tsetFontWeight,\n\t\thasFontAppearance,\n\t\tresetFontAppearance,\n\t};\n}\n\nexport default function TypographyPanel( {\n\tname,\n\telement,\n\theadingLevel,\n\tvariation = '',\n} ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tlet prefix = '';\n\tif ( element === 'heading' ) {\n\t\tprefix = `elements.${ headingLevel }.`;\n\t} else if ( element && element !== 'text' ) {\n\t\tprefix = `elements.${ element }.`;\n\t}\n\tif ( variation ) {\n\t\tprefix = prefix\n\t\t\t? `variations.${ variation }.${ prefix }`\n\t\t\t: `variations.${ variation }`;\n\t}\n\tconst [ fontSizesPerOrigin ] = useGlobalSetting(\n\t\t'typography.fontSizes',\n\t\tname\n\t);\n\tconst fontSizes =\n\t\tfontSizesPerOrigin?.custom ||\n\t\tfontSizesPerOrigin?.theme ||\n\t\tfontSizesPerOrigin?.default;\n\n\tconst disableCustomFontSizes = ! useGlobalSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t)[ 0 ];\n\tconst [ fontFamiliesPerOrigin ] = useGlobalSetting(\n\t\t'typography.fontFamilies',\n\t\tname\n\t);\n\tconst fontFamilies =\n\t\tfontFamiliesPerOrigin?.custom ||\n\t\tfontFamiliesPerOrigin?.theme ||\n\t\tfontFamiliesPerOrigin?.default;\n\tconst hasFontStyles =\n\t\tuseGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasFontFamilyEnabled = useHasFontFamilyControl( name );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst appearanceControlLabel = useAppearanceControlLabel( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name, element );\n\tconst hasTextTransformControl = useHasTextTransformControl( name, element );\n\tconst hasTextDecorationControl = useHasTextDecorationControl(\n\t\tname,\n\t\telement\n\t);\n\n\t/* Disable font size controls when the option to style all headings is selected. */\n\tlet hasFontSizeEnabled = supports.includes( 'fontSize' );\n\tif ( element === 'heading' && headingLevel === 'heading' ) {\n\t\thasFontSizeEnabled = false;\n\t}\n\n\tconst [ fontFamily, setFontFamily, hasFontFamily, resetFontFamily ] =\n\t\tuseStyleWithReset( prefix + 'typography.fontFamily', name );\n\tconst { fontSize, setFontSize, hasFontSize, resetFontSize } =\n\t\tuseFontSizeWithReset( prefix + 'typography.fontSize', name );\n\tconst {\n\t\tfontStyle,\n\t\tsetFontStyle,\n\t\tfontWeight,\n\t\tsetFontWeight,\n\t\thasFontAppearance,\n\t\tresetFontAppearance,\n\t} = useFontAppearance( prefix, name );\n\tconst [ lineHeight, setLineHeight, hasLineHeight, resetLineHeight ] =\n\t\tuseStyleWithReset( prefix + 'typography.lineHeight', name );\n\tconst [\n\t\tletterSpacing,\n\t\tsetLetterSpacing,\n\t\thasLetterSpacing,\n\t\tresetLetterSpacing,\n\t] = useStyleWithReset( prefix + 'typography.letterSpacing', name );\n\tconst [\n\t\ttextTransform,\n\t\tsetTextTransform,\n\t\thasTextTransform,\n\t\tresetTextTransform,\n\t] = useStyleWithReset( prefix + 'typography.textTransform', name );\n\tconst [\n\t\ttextDecoration,\n\t\tsetTextDecoration,\n\t\thasTextDecoration,\n\t\tresetTextDecoration,\n\t] = useStyleWithReset( prefix + 'typography.textDecoration', name );\n\n\tconst resetAll = () => {\n\t\tresetFontFamily();\n\t\tresetFontSize();\n\t\tresetFontAppearance();\n\t\tresetLineHeight();\n\t\tresetLetterSpacing();\n\t\tresetTextTransform();\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Typography' ) } resetAll={ resetAll }>\n\t\t\t{ hasFontFamilyEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Font family' ) }\n\t\t\t\t\thasValue={ hasFontFamily }\n\t\t\t\t\tonDeselect={ resetFontFamily }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyControl\n\t\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasFontSizeEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\thasValue={ hasFontSize }\n\t\t\t\t\tonDeselect={ resetFontSize }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<FontSizePicker\n\t\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\twithReset={ false }\n\t\t\t\t\t\twithSlider\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ appearanceControlLabel }\n\t\t\t\t\thasValue={ hasFontAppearance }\n\t\t\t\t\tonDeselect={ resetFontAppearance }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceControl\n\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\t\t\t\tfontWeight: newFontWeight,\n\t\t\t\t\t\t} ) => {\n\t\t\t\t\t\t\tsetFontStyle( newFontStyle );\n\t\t\t\t\t\t\tsetFontWeight( newFontWeight );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\thasValue={ hasLineHeight }\n\t\t\t\t\tonDeselect={ resetLineHeight }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<LineHeightControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\t\t\thasValue={ hasLetterSpacing }\n\t\t\t\t\tonDeselect={ resetLetterSpacing }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingControl\n\t\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasTextTransformControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\thasValue={ hasTextTransform }\n\t\t\t\t\tonDeselect={ resetTextTransform }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<TextTransformControl\n\t\t\t\t\t\tvalue={ textTransform }\n\t\t\t\t\t\tonChange={ setTextTransform }\n\t\t\t\t\t\tshowNone\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasTextDecorationControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Text decoration' ) }\n\t\t\t\t\thasValue={ hasTextDecoration }\n\t\t\t\t\tonDeselect={ resetTextDecoration }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationControl\n\t\t\t\t\t\tvalue={ textDecoration }\n\t\t\t\t\t\tonChange={ setTextDecoration }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
3
7
|
/**
|
|
4
8
|
* Internal dependencies
|
|
5
9
|
*/
|
|
6
|
-
|
|
10
|
+
|
|
11
|
+
import { unlock } from '../../experiments';
|
|
12
|
+
const {
|
|
13
|
+
useGlobalStyle
|
|
14
|
+
} = unlock(blockEditorExperiments);
|
|
7
15
|
export default function TypographyPreview(_ref) {
|
|
8
16
|
let {
|
|
9
17
|
name,
|
|
@@ -18,14 +26,14 @@ export default function TypographyPreview(_ref) {
|
|
|
18
26
|
prefix = `elements.${element}.`;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
const [fontFamily] =
|
|
22
|
-
const [gradientValue] =
|
|
23
|
-
const [backgroundColor] =
|
|
24
|
-
const [color] =
|
|
25
|
-
const [fontSize] =
|
|
26
|
-
const [fontStyle] =
|
|
27
|
-
const [fontWeight] =
|
|
28
|
-
const [letterSpacing] =
|
|
29
|
+
const [fontFamily] = useGlobalStyle(prefix + 'typography.fontFamily', name);
|
|
30
|
+
const [gradientValue] = useGlobalStyle(prefix + 'color.gradient', name);
|
|
31
|
+
const [backgroundColor] = useGlobalStyle(prefix + 'color.background', name);
|
|
32
|
+
const [color] = useGlobalStyle(prefix + 'color.text', name);
|
|
33
|
+
const [fontSize] = useGlobalStyle(prefix + 'typography.fontSize', name);
|
|
34
|
+
const [fontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name);
|
|
35
|
+
const [fontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name);
|
|
36
|
+
const [letterSpacing] = useGlobalStyle(prefix + 'typography.letterSpacing', name);
|
|
29
37
|
const extraStyles = element === 'link' ? {
|
|
30
38
|
textDecoration: 'underline'
|
|
31
39
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-preview.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-preview.js"],"names":["experiments","blockEditorExperiments","unlock","useGlobalStyle","TypographyPreview","name","element","headingLevel","prefix","fontFamily","gradientValue","backgroundColor","color","fontSize","fontStyle","fontWeight","letterSpacing","extraStyles","textDecoration","background"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqBD,MAAM,CAAED,sBAAF,CAAjC;AAEA,eAAe,SAASG,iBAAT,OAA8D;AAAA,MAAlC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,OAAR;AAAiBC,IAAAA;AAAjB,GAAkC;AAC5E,MAAIC,MAAM,GAAG,EAAb;;AACA,MAAKF,OAAO,KAAK,SAAjB,EAA6B;AAC5BE,IAAAA,MAAM,GAAI,YAAYD,YAAc,GAApC;AACA,GAFD,MAEO,IAAKD,OAAO,IAAIA,OAAO,KAAK,MAA5B,EAAqC;AAC3CE,IAAAA,MAAM,GAAI,YAAYF,OAAS,GAA/B;AACA;;AAED,QAAM,CAAEG,UAAF,IAAiBN,cAAc,CACpCK,MAAM,GAAG,uBAD2B,EAEpCH,IAFoC,CAArC;AAIA,QAAM,CAAEK,aAAF,IAAoBP,cAAc,CAAEK,MAAM,GAAG,gBAAX,EAA6BH,IAA7B,CAAxC;AACA,QAAM,CAAEM,eAAF,IAAsBR,cAAc,CACzCK,MAAM,GAAG,kBADgC,EAEzCH,IAFyC,CAA1C;AAIA,QAAM,CAAEO,KAAF,IAAYT,cAAc,CAAEK,MAAM,GAAG,YAAX,EAAyBH,IAAzB,CAAhC;AACA,QAAM,CAAEQ,QAAF,IAAeV,cAAc,CAAEK,MAAM,GAAG,qBAAX,EAAkCH,IAAlC,CAAnC;AACA,QAAM,CAAES,SAAF,IAAgBX,cAAc,CACnCK,MAAM,GAAG,sBAD0B,EAEnCH,IAFmC,CAApC;AAIA,QAAM,CAAEU,UAAF,IAAiBZ,cAAc,CACpCK,MAAM,GAAG,uBAD2B,EAEpCH,IAFoC,CAArC;AAIA,QAAM,CAAEW,aAAF,IAAoBb,cAAc,CACvCK,MAAM,GAAG,0BAD8B,EAEvCH,IAFuC,CAAxC;AAIA,QAAMY,WAAW,GAChBX,OAAO,KAAK,MAAZ,GACG;AACAY,IAAAA,cAAc,EAAE;AADhB,GADH,GAIG,EALJ;AAOA,SACC;AACC,IAAA,SAAS,EAAC,8BADX;AAEC,IAAA,KAAK,EAAG;AACPT,MAAAA,UAAU,EAAEA,UAAF,aAAEA,UAAF,cAAEA,UAAF,GAAgB,OADnB;AAEPU,MAAAA,UAAU,EAAET,aAAF,aAAEA,aAAF,cAAEA,aAAF,GAAmBC,eAFtB;AAGPC,MAAAA,KAHO;AAIPC,MAAAA,QAJO;AAKPC,MAAAA,SALO;AAMPC,MAAAA,UANO;AAOPC,MAAAA,aAPO;AAQP,SAAGC;AARI;AAFT,UADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { experiments as blockEditorExperiments } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../experiments';\n\nconst { useGlobalStyle } = unlock( blockEditorExperiments );\n\nexport default function TypographyPreview( { name, element, headingLevel } ) {\n\tlet prefix = '';\n\tif ( element === 'heading' ) {\n\t\tprefix = `elements.${ headingLevel }.`;\n\t} else if ( element && element !== 'text' ) {\n\t\tprefix = `elements.${ element }.`;\n\t}\n\n\tconst [ fontFamily ] = useGlobalStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );\n\tconst [ backgroundColor ] = useGlobalStyle(\n\t\tprefix + 'color.background',\n\t\tname\n\t);\n\tconst [ color ] = useGlobalStyle( prefix + 'color.text', name );\n\tconst [ fontSize ] = useGlobalStyle( prefix + 'typography.fontSize', name );\n\tconst [ fontStyle ] = useGlobalStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight ] = useGlobalStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ letterSpacing ] = useGlobalStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"edit-site-typography-preview\"\n\t\t\tstyle={ {\n\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\tcolor,\n\t\t\t\tfontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tletterSpacing,\n\t\t\t\t...extraStyles,\n\t\t\t} }\n\t\t>\n\t\t\tAa\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -4,9 +4,13 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
/**
|
|
5
5
|
* WordPress dependencies
|
|
6
6
|
*/
|
|
7
|
-
import { __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen, __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
7
|
+
import { __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen, __experimentalUseNavigator as useNavigator, createSlotFill, DropdownMenu } from '@wordpress/components';
|
|
8
8
|
import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
12
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
|
+
import { moreVertical } from '@wordpress/icons';
|
|
10
14
|
/**
|
|
11
15
|
* Internal dependencies
|
|
12
16
|
*/
|
|
@@ -29,6 +33,43 @@ import { ScreenVariation } from './screen-variations';
|
|
|
29
33
|
import ScreenBorder from './screen-border';
|
|
30
34
|
import StyleBook from '../style-book';
|
|
31
35
|
import ScreenCSS from './screen-css';
|
|
36
|
+
import { unlock } from '../../experiments';
|
|
37
|
+
const SLOT_FILL_NAME = 'GlobalStylesMenu';
|
|
38
|
+
const {
|
|
39
|
+
Slot: GlobalStylesMenuSlot,
|
|
40
|
+
Fill: GlobalStylesMenuFill
|
|
41
|
+
} = createSlotFill(SLOT_FILL_NAME);
|
|
42
|
+
|
|
43
|
+
function GlobalStylesActionMenu() {
|
|
44
|
+
const {
|
|
45
|
+
toggle
|
|
46
|
+
} = useDispatch(preferencesStore);
|
|
47
|
+
const {
|
|
48
|
+
useGlobalStylesReset
|
|
49
|
+
} = unlock(blockEditorExperiments);
|
|
50
|
+
const [canReset, onReset] = useGlobalStylesReset();
|
|
51
|
+
const {
|
|
52
|
+
goTo
|
|
53
|
+
} = useNavigator();
|
|
54
|
+
|
|
55
|
+
const loadCustomCSS = () => goTo('/css');
|
|
56
|
+
|
|
57
|
+
return createElement(GlobalStylesMenuFill, null, createElement(DropdownMenu, {
|
|
58
|
+
icon: moreVertical,
|
|
59
|
+
label: __('More Styles actions'),
|
|
60
|
+
controls: [{
|
|
61
|
+
title: __('Reset to defaults'),
|
|
62
|
+
onClick: onReset,
|
|
63
|
+
isDisabled: !canReset
|
|
64
|
+
}, {
|
|
65
|
+
title: __('Welcome Guide'),
|
|
66
|
+
onClick: () => toggle('core/edit-site', 'welcomeGuideStyles')
|
|
67
|
+
}, {
|
|
68
|
+
title: __('Additional CSS'),
|
|
69
|
+
onClick: loadCustomCSS
|
|
70
|
+
}]
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
32
73
|
|
|
33
74
|
function GlobalStylesNavigationScreen(_ref) {
|
|
34
75
|
let {
|
|
@@ -58,43 +99,43 @@ function BlockStyleVariationsScreens(_ref2) {
|
|
|
58
99
|
return blockStyleVariations.map(variation => createElement(ContextScreens, {
|
|
59
100
|
key: variation.name + name,
|
|
60
101
|
name: name,
|
|
61
|
-
parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name)
|
|
102
|
+
parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name),
|
|
103
|
+
variation: variation.name
|
|
62
104
|
}));
|
|
63
105
|
}
|
|
64
106
|
|
|
65
|
-
function
|
|
107
|
+
function BlockStylesNavigationScreens(_ref3) {
|
|
66
108
|
let {
|
|
67
|
-
|
|
68
|
-
|
|
109
|
+
parentMenu,
|
|
110
|
+
blockStyles,
|
|
111
|
+
blockName
|
|
69
112
|
} = _ref3;
|
|
70
|
-
|
|
71
|
-
|
|
113
|
+
return blockStyles.map((style, index) => createElement(GlobalStylesNavigationScreen, {
|
|
114
|
+
key: index,
|
|
115
|
+
path: parentMenu + '/variations/' + style.name
|
|
116
|
+
}, createElement(ScreenVariation, {
|
|
117
|
+
blockName: blockName,
|
|
118
|
+
style: style
|
|
119
|
+
})));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function ContextScreens(_ref4) {
|
|
123
|
+
let {
|
|
124
|
+
name,
|
|
125
|
+
parentMenu = '',
|
|
126
|
+
variation = ''
|
|
127
|
+
} = _ref4;
|
|
72
128
|
const blockStyleVariations = useSelect(select => {
|
|
73
129
|
const {
|
|
74
130
|
getBlockStyles
|
|
75
131
|
} = select(blocksStore);
|
|
76
132
|
return getBlockStyles(name);
|
|
77
133
|
}, [name]);
|
|
78
|
-
|
|
79
|
-
const BlockStylesNavigationScreens = _ref4 => {
|
|
80
|
-
let {
|
|
81
|
-
blockStyles,
|
|
82
|
-
blockName
|
|
83
|
-
} = _ref4;
|
|
84
|
-
return blockStyles.map((style, index) => createElement(GlobalStylesNavigationScreen, {
|
|
85
|
-
key: index,
|
|
86
|
-
path: parentMenu + '/variations/' + style.name
|
|
87
|
-
}, createElement(ScreenVariation, {
|
|
88
|
-
blockName: blockName,
|
|
89
|
-
style: style
|
|
90
|
-
})));
|
|
91
|
-
};
|
|
92
|
-
|
|
93
134
|
return createElement(Fragment, null, createElement(GlobalStylesNavigationScreen, {
|
|
94
135
|
path: parentMenu + '/typography'
|
|
95
136
|
}, createElement(ScreenTypography, {
|
|
96
137
|
name: name,
|
|
97
|
-
|
|
138
|
+
variation: variation
|
|
98
139
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
99
140
|
path: parentMenu + '/typography/text'
|
|
100
141
|
}, createElement(ScreenTypographyElement, {
|
|
@@ -119,7 +160,7 @@ function ContextScreens(_ref3) {
|
|
|
119
160
|
path: parentMenu + '/colors'
|
|
120
161
|
}, createElement(ScreenColors, {
|
|
121
162
|
name: name,
|
|
122
|
-
|
|
163
|
+
variation: variation
|
|
123
164
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
124
165
|
path: parentMenu + '/colors/palette'
|
|
125
166
|
}, createElement(ScreenColorPalette, {
|
|
@@ -128,38 +169,43 @@ function ContextScreens(_ref3) {
|
|
|
128
169
|
path: parentMenu + '/colors/background'
|
|
129
170
|
}, createElement(ScreenBackgroundColor, {
|
|
130
171
|
name: name,
|
|
131
|
-
|
|
172
|
+
variation: variation
|
|
132
173
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
133
174
|
path: parentMenu + '/colors/text'
|
|
134
175
|
}, createElement(ScreenTextColor, {
|
|
135
176
|
name: name,
|
|
136
|
-
|
|
177
|
+
variation: variation
|
|
137
178
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
138
179
|
path: parentMenu + '/colors/link'
|
|
139
180
|
}, createElement(ScreenLinkColor, {
|
|
140
181
|
name: name,
|
|
141
|
-
|
|
182
|
+
variation: variation
|
|
142
183
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
143
184
|
path: parentMenu + '/colors/heading'
|
|
144
185
|
}, createElement(ScreenHeadingColor, {
|
|
145
186
|
name: name,
|
|
146
|
-
|
|
187
|
+
variation: variation
|
|
147
188
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
148
189
|
path: parentMenu + '/colors/button'
|
|
149
190
|
}, createElement(ScreenButtonColor, {
|
|
150
191
|
name: name,
|
|
151
|
-
|
|
192
|
+
variation: variation
|
|
152
193
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
153
194
|
path: parentMenu + '/border'
|
|
154
195
|
}, createElement(ScreenBorder, {
|
|
155
196
|
name: name,
|
|
156
|
-
|
|
197
|
+
variation: variation
|
|
157
198
|
})), createElement(GlobalStylesNavigationScreen, {
|
|
158
199
|
path: parentMenu + '/layout'
|
|
159
200
|
}, createElement(ScreenLayout, {
|
|
160
201
|
name: name,
|
|
161
|
-
|
|
202
|
+
variation: variation
|
|
203
|
+
})), createElement(GlobalStylesNavigationScreen, {
|
|
204
|
+
path: parentMenu + '/css'
|
|
205
|
+
}, createElement(ScreenCSS, {
|
|
206
|
+
name: name
|
|
162
207
|
})), !!(blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length) && createElement(BlockStylesNavigationScreens, {
|
|
208
|
+
parentMenu: parentMenu,
|
|
163
209
|
blockStyles: blockStyleVariations,
|
|
164
210
|
blockName: name
|
|
165
211
|
}));
|
|
@@ -224,10 +270,9 @@ function GlobalStylesUI(_ref6) {
|
|
|
224
270
|
});
|
|
225
271
|
}), isStyleBookOpened && createElement(GlobalStylesStyleBook, {
|
|
226
272
|
onClose: onCloseStyleBook
|
|
227
|
-
}), createElement(
|
|
228
|
-
path: "/css"
|
|
229
|
-
}, createElement(ScreenCSS, null)));
|
|
273
|
+
}), createElement(GlobalStylesActionMenu, null));
|
|
230
274
|
}
|
|
231
275
|
|
|
276
|
+
export { GlobalStylesMenuSlot };
|
|
232
277
|
export default GlobalStylesUI;
|
|
233
278
|
//# sourceMappingURL=ui.js.map
|