@wordpress/block-editor 11.3.6 → 11.5.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 +3 -1
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-popover/inbetween.js +10 -33
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +2 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -0
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +107 -0
- package/build/components/child-layout-control/index.js.map +1 -0
- package/build/components/colors-gradients/control.js +6 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +3 -3
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +0 -3
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +594 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +142 -45
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +38 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +434 -0
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/global-styles/use-global-styles-output.js +7 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +17 -11
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -11
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +23 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +9 -15
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +4 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +4 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +38 -9
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/link-control/index.js +55 -28
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +72 -30
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +53 -0
- package/build/components/link-control/settings.js.map +1 -0
- package/build/components/list-view/block.js +4 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/expander.js +2 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/index.js +6 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +5 -10
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +3 -2
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +1 -0
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +7 -3
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +24 -4
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +2 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -0
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/index.js +9 -45
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-delete.js +73 -0
- package/build/components/rich-text/use-delete.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +14 -6
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/url-input/index.js +2 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +4 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/align.js +3 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/dimensions.js +78 -190
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +94 -25
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +2 -76
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +3 -51
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +0 -201
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +14 -5
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js +0 -42
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/margin.js +7 -163
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +7 -163
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/typography.js +98 -128
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +75 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +1 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +24 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +53 -47
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +22 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +36 -3
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +10 -33
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -0
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +98 -0
- package/build-module/components/child-layout-control/index.js.map +1 -0
- package/build-module/components/colors-gradients/control.js +6 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -4
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +2 -1
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +574 -0
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +138 -46
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +415 -0
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/global-styles/use-global-styles-output.js +7 -3
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +17 -11
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-size-control/index.js +7 -12
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +9 -15
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +3 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +3 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +39 -9
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/link-control/index.js +56 -28
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +68 -30
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +44 -0
- package/build-module/components/link-control/settings.js.map +1 -0
- package/build-module/components/list-view/block.js +4 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/expander.js +2 -1
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/index.js +6 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +5 -10
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +3 -2
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +1 -0
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +7 -3
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +27 -7
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +2 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -0
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +9 -45
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-delete.js +62 -0
- package/build-module/components/rich-text/use-delete.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +14 -6
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +4 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/align.js +3 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/dimensions.js +81 -187
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +86 -24
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -69
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +6 -47
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +0 -182
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +14 -5
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -38
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/margin.js +4 -143
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +4 -143
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/typography.js +97 -123
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +70 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +1 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +24 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +53 -45
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +36 -3
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +54 -64
- package/build-style/style.css +54 -64
- package/package.json +31 -31
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +0 -9
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/block-popover/inbetween.js +21 -53
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-styles/index.js +5 -1
- package/src/components/block-types-list/index.native.js +2 -0
- package/src/components/child-layout-control/index.js +106 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +3 -0
- package/src/components/date-format-picker/index.js +6 -8
- package/src/components/date-format-picker/style.scss +0 -5
- package/src/components/font-appearance-control/index.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +627 -0
- package/src/components/global-styles/hooks.js +229 -66
- package/src/components/global-styles/index.js +9 -0
- package/src/components/global-styles/typography-panel.js +428 -0
- package/src/components/global-styles/use-global-styles-output.js +10 -5
- package/src/components/global-styles/utils.js +2 -0
- package/src/components/iframe/index.js +20 -18
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
- package/src/components/image-size-control/index.js +10 -12
- package/src/components/image-size-control/style.scss +3 -21
- package/src/components/index.native.js +5 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inserter/block-patterns-tab.js +9 -23
- package/src/components/inserter/block-types-tab.native.js +2 -0
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
- package/src/components/inserter/search-results.native.js +2 -0
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/src/components/inspector-controls/fill.js +32 -8
- package/src/components/link-control/index.js +69 -34
- package/src/components/link-control/settings-drawer.js +85 -29
- package/src/components/link-control/settings.js +42 -0
- package/src/components/link-control/style.scss +63 -37
- package/src/components/link-control/test/index.js +347 -9
- package/src/components/list-view/block.js +7 -1
- package/src/components/list-view/expander.js +1 -0
- package/src/components/list-view/index.js +5 -0
- package/src/components/media-replace-flow/style.scss +7 -9
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/off-canvas-editor/appender.js +13 -16
- package/src/components/off-canvas-editor/block-contents.js +2 -1
- package/src/components/off-canvas-editor/branch.js +1 -0
- package/src/components/off-canvas-editor/index.js +8 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +52 -15
- package/src/components/off-canvas-editor/link-ui.js +2 -0
- package/src/components/responsive-block-control/index.js +1 -0
- package/src/components/rich-text/index.js +8 -46
- package/src/components/rich-text/use-delete.js +59 -0
- package/src/components/rich-text/use-input-rules.js +13 -5
- package/src/components/url-input/index.js +3 -2
- package/src/components/url-popover/stories/index.js +1 -0
- package/src/components/writing-flow/use-selection-observer.js +5 -1
- package/src/hooks/align.js +1 -1
- package/src/hooks/dimensions.js +97 -269
- package/src/hooks/duotone.js +100 -30
- package/src/hooks/font-family.js +0 -58
- package/src/hooks/font-size.js +1 -36
- package/src/hooks/gap.js +0 -201
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +19 -6
- package/src/hooks/line-height.js +0 -33
- package/src/hooks/margin.js +1 -164
- package/src/hooks/padding.js +1 -163
- package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
- package/src/hooks/test/duotone.js +102 -0
- package/src/hooks/typography.js +112 -213
- package/src/hooks/utils.js +90 -0
- package/src/layouts/flex.js +1 -0
- package/src/store/actions.js +12 -4
- package/src/store/reducer.js +68 -43
- package/src/store/selectors.js +20 -1
- package/src/store/test/actions.js +4 -2
- package/src/utils/parse-css-unit-to-px.js +35 -5
- package/src/utils/test/parse-css-unit-to-px.js +12 -0
- package/build/hooks/child-layout.js +0 -213
- package/build/hooks/child-layout.js.map +0 -1
- package/build/hooks/font-appearance.js +0 -188
- package/build/hooks/font-appearance.js.map +0 -1
- package/build/hooks/letter-spacing.js +0 -129
- package/build/hooks/letter-spacing.js.map +0 -1
- package/build/hooks/min-height.js +0 -139
- package/build/hooks/min-height.js.map +0 -1
- package/build/hooks/text-decoration.js +0 -130
- package/build/hooks/text-decoration.js.map +0 -1
- package/build/hooks/text-transform.js +0 -130
- package/build/hooks/text-transform.js.map +0 -1
- package/build-module/hooks/child-layout.js +0 -193
- package/build-module/hooks/child-layout.js.map +0 -1
- package/build-module/hooks/font-appearance.js +0 -161
- package/build-module/hooks/font-appearance.js.map +0 -1
- package/build-module/hooks/letter-spacing.js +0 -107
- package/build-module/hooks/letter-spacing.js.map +0 -1
- package/build-module/hooks/min-height.js +0 -116
- package/build-module/hooks/min-height.js.map +0 -1
- package/build-module/hooks/text-decoration.js +0 -108
- package/build-module/hooks/text-decoration.js.map +0 -1
- package/build-module/hooks/text-transform.js +0 -108
- package/build-module/hooks/text-transform.js.map +0 -1
- package/src/hooks/child-layout.js +0 -195
- package/src/hooks/font-appearance.js +0 -146
- package/src/hooks/letter-spacing.js +0 -101
- package/src/hooks/min-height.js +0 -104
- package/src/hooks/text-decoration.js +0 -102
- package/src/hooks/text-transform.js +0 -101
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = TypographyPanel;
|
|
9
|
+
exports.useHasTypographyPanel = useHasTypographyPanel;
|
|
10
|
+
|
|
11
|
+
var _element = require("@wordpress/element");
|
|
12
|
+
|
|
13
|
+
var _components = require("@wordpress/components");
|
|
14
|
+
|
|
15
|
+
var _i18n = require("@wordpress/i18n");
|
|
16
|
+
|
|
17
|
+
var _fontFamily = _interopRequireDefault(require("../font-family"));
|
|
18
|
+
|
|
19
|
+
var _fontAppearanceControl = _interopRequireDefault(require("../font-appearance-control"));
|
|
20
|
+
|
|
21
|
+
var _lineHeightControl = _interopRequireDefault(require("../line-height-control"));
|
|
22
|
+
|
|
23
|
+
var _letterSpacingControl = _interopRequireDefault(require("../letter-spacing-control"));
|
|
24
|
+
|
|
25
|
+
var _textTransformControl = _interopRequireDefault(require("../text-transform-control"));
|
|
26
|
+
|
|
27
|
+
var _textDecorationControl = _interopRequireDefault(require("../text-decoration-control"));
|
|
28
|
+
|
|
29
|
+
var _utils = require("./utils");
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* WordPress dependencies
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Internal dependencies
|
|
37
|
+
*/
|
|
38
|
+
function useHasTypographyPanel(settings) {
|
|
39
|
+
const hasFontFamily = useHasFontFamilyControl(settings);
|
|
40
|
+
const hasLineHeight = useHasLineHeightControl(settings);
|
|
41
|
+
const hasFontAppearance = useHasAppearanceControl(settings);
|
|
42
|
+
const hasLetterSpacing = useHasLetterSpacingControl(settings);
|
|
43
|
+
const hasTextTransform = useHasTextTransformControl(settings);
|
|
44
|
+
const hasTextDecoration = useHasTextDecorationControl(settings);
|
|
45
|
+
const hasFontSize = useHasFontSizeControl(settings);
|
|
46
|
+
return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextTransform || hasFontSize || hasTextDecoration;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function useHasFontSizeControl(settings) {
|
|
50
|
+
var _settings$typography, _settings$typography$, _settings$typography2, _ref, _fontSizesPerOrigin$c;
|
|
51
|
+
|
|
52
|
+
const disableCustomFontSizes = !(settings !== null && settings !== void 0 && (_settings$typography = settings.typography) !== null && _settings$typography !== void 0 && _settings$typography.customFontSize);
|
|
53
|
+
const fontSizesPerOrigin = (_settings$typography$ = settings === null || settings === void 0 ? void 0 : (_settings$typography2 = settings.typography) === null || _settings$typography2 === void 0 ? void 0 : _settings$typography2.fontSizes) !== null && _settings$typography$ !== void 0 ? _settings$typography$ : {};
|
|
54
|
+
const fontSizes = (_ref = (_fontSizesPerOrigin$c = fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.custom) !== null && _fontSizesPerOrigin$c !== void 0 ? _fontSizesPerOrigin$c : fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.theme) !== null && _ref !== void 0 ? _ref : fontSizesPerOrigin.default;
|
|
55
|
+
return !!(fontSizes !== null && fontSizes !== void 0 && fontSizes.length) || !disableCustomFontSizes;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function useHasFontFamilyControl(settings) {
|
|
59
|
+
var _settings$typography3, _ref2, _fontFamiliesPerOrigi;
|
|
60
|
+
|
|
61
|
+
const fontFamiliesPerOrigin = settings === null || settings === void 0 ? void 0 : (_settings$typography3 = settings.typography) === null || _settings$typography3 === void 0 ? void 0 : _settings$typography3.fontFamilies;
|
|
62
|
+
const fontFamilies = (_ref2 = (_fontFamiliesPerOrigi = fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) !== null && _fontFamiliesPerOrigi !== void 0 ? _fontFamiliesPerOrigi : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) !== null && _ref2 !== void 0 ? _ref2 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default;
|
|
63
|
+
return !!(fontFamilies !== null && fontFamilies !== void 0 && fontFamilies.length);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function useHasLineHeightControl(settings) {
|
|
67
|
+
var _settings$typography4;
|
|
68
|
+
|
|
69
|
+
return settings === null || settings === void 0 ? void 0 : (_settings$typography4 = settings.typography) === null || _settings$typography4 === void 0 ? void 0 : _settings$typography4.lineHeight;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function useHasAppearanceControl(settings) {
|
|
73
|
+
var _settings$typography5, _settings$typography6;
|
|
74
|
+
|
|
75
|
+
const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$typography5 = settings.typography) === null || _settings$typography5 === void 0 ? void 0 : _settings$typography5.fontStyle;
|
|
76
|
+
const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$typography6 = settings.typography) === null || _settings$typography6 === void 0 ? void 0 : _settings$typography6.fontWeight;
|
|
77
|
+
return hasFontStyles || hasFontWeights;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function useAppearanceControlLabel(settings) {
|
|
81
|
+
var _settings$typography7, _settings$typography8;
|
|
82
|
+
|
|
83
|
+
const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$typography7 = settings.typography) === null || _settings$typography7 === void 0 ? void 0 : _settings$typography7.fontStyle;
|
|
84
|
+
const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$typography8 = settings.typography) === null || _settings$typography8 === void 0 ? void 0 : _settings$typography8.fontWeight;
|
|
85
|
+
|
|
86
|
+
if (!hasFontStyles) {
|
|
87
|
+
return (0, _i18n.__)('Font weight');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!hasFontWeights) {
|
|
91
|
+
return (0, _i18n.__)('Font style');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (0, _i18n.__)('Appearance');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function useHasLetterSpacingControl(settings) {
|
|
98
|
+
var _settings$typography9;
|
|
99
|
+
|
|
100
|
+
return settings === null || settings === void 0 ? void 0 : (_settings$typography9 = settings.typography) === null || _settings$typography9 === void 0 ? void 0 : _settings$typography9.letterSpacing;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function useHasTextTransformControl(settings) {
|
|
104
|
+
var _settings$typography10;
|
|
105
|
+
|
|
106
|
+
return settings === null || settings === void 0 ? void 0 : (_settings$typography10 = settings.typography) === null || _settings$typography10 === void 0 ? void 0 : _settings$typography10.textTransform;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function useHasTextDecorationControl(settings) {
|
|
110
|
+
var _settings$typography11;
|
|
111
|
+
|
|
112
|
+
return settings === null || settings === void 0 ? void 0 : (_settings$typography11 = settings.typography) === null || _settings$typography11 === void 0 ? void 0 : _settings$typography11.textDecoration;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function TypographyToolsPanel(_ref3) {
|
|
116
|
+
let {
|
|
117
|
+
resetAllFilter,
|
|
118
|
+
onChange,
|
|
119
|
+
value,
|
|
120
|
+
panelId,
|
|
121
|
+
children
|
|
122
|
+
} = _ref3;
|
|
123
|
+
|
|
124
|
+
const resetAll = () => {
|
|
125
|
+
const updatedValue = resetAllFilter(value);
|
|
126
|
+
onChange(updatedValue);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
return (0, _element.createElement)(_components.__experimentalToolsPanel, {
|
|
130
|
+
label: (0, _i18n.__)('Typography'),
|
|
131
|
+
resetAll: resetAll,
|
|
132
|
+
panelId: panelId
|
|
133
|
+
}, children);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const DEFAULT_CONTROLS = {
|
|
137
|
+
fontFamily: true,
|
|
138
|
+
fontSize: true,
|
|
139
|
+
fontAppearance: true,
|
|
140
|
+
lineHeight: true,
|
|
141
|
+
letterSpacing: true,
|
|
142
|
+
textTransform: true,
|
|
143
|
+
textDecoration: true
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
function TypographyPanel(_ref4) {
|
|
147
|
+
var _settings$typography12, _ref5, _fontFamiliesPerOrigi2, _inheritedValue$typog, _settings$typography13, _settings$typography$2, _settings$typography14, _ref7, _fontSizesPerOrigin$c2, _inheritedValue$typog2, _settings$typography15, _settings$typography16, _inheritedValue$typog3, _inheritedValue$typog4, _inheritedValue$typog5, _inheritedValue$typog6, _inheritedValue$typog7, _inheritedValue$typog8;
|
|
148
|
+
|
|
149
|
+
let {
|
|
150
|
+
as: Wrapper = TypographyToolsPanel,
|
|
151
|
+
value,
|
|
152
|
+
onChange,
|
|
153
|
+
inheritedValue = value,
|
|
154
|
+
settings,
|
|
155
|
+
panelId,
|
|
156
|
+
defaultControls = DEFAULT_CONTROLS
|
|
157
|
+
} = _ref4;
|
|
158
|
+
|
|
159
|
+
const decodeValue = rawValue => (0, _utils.getValueFromVariable)({
|
|
160
|
+
settings
|
|
161
|
+
}, '', rawValue); // Font Family
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
const hasFontFamilyEnabled = useHasFontFamilyControl(settings);
|
|
165
|
+
const fontFamiliesPerOrigin = settings === null || settings === void 0 ? void 0 : (_settings$typography12 = settings.typography) === null || _settings$typography12 === void 0 ? void 0 : _settings$typography12.fontFamilies;
|
|
166
|
+
const fontFamilies = (_ref5 = (_fontFamiliesPerOrigi2 = fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) !== null && _fontFamiliesPerOrigi2 !== void 0 ? _fontFamiliesPerOrigi2 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) !== null && _ref5 !== void 0 ? _ref5 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default;
|
|
167
|
+
const fontFamily = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog = inheritedValue.typography) === null || _inheritedValue$typog === void 0 ? void 0 : _inheritedValue$typog.fontFamily);
|
|
168
|
+
|
|
169
|
+
const setFontFamily = newValue => {
|
|
170
|
+
var _fontFamilies$find;
|
|
171
|
+
|
|
172
|
+
const slug = fontFamilies === null || fontFamilies === void 0 ? void 0 : (_fontFamilies$find = fontFamilies.find(_ref6 => {
|
|
173
|
+
let {
|
|
174
|
+
fontFamily: f
|
|
175
|
+
} = _ref6;
|
|
176
|
+
return f === newValue;
|
|
177
|
+
})) === null || _fontFamilies$find === void 0 ? void 0 : _fontFamilies$find.slug;
|
|
178
|
+
onChange({ ...value,
|
|
179
|
+
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
180
|
+
fontFamily: slug ? `var:preset|font-family|${slug}` : newValue
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const hasFontFamily = () => {
|
|
186
|
+
var _value$typography;
|
|
187
|
+
|
|
188
|
+
return !!(value !== null && value !== void 0 && (_value$typography = value.typography) !== null && _value$typography !== void 0 && _value$typography.fontFamily);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const resetFontFamily = () => setFontFamily(undefined); // Font Size
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
const hasFontSizeEnabled = useHasFontSizeControl(settings);
|
|
195
|
+
const disableCustomFontSizes = !(settings !== null && settings !== void 0 && (_settings$typography13 = settings.typography) !== null && _settings$typography13 !== void 0 && _settings$typography13.customFontSize);
|
|
196
|
+
const fontSizesPerOrigin = (_settings$typography$2 = settings === null || settings === void 0 ? void 0 : (_settings$typography14 = settings.typography) === null || _settings$typography14 === void 0 ? void 0 : _settings$typography14.fontSizes) !== null && _settings$typography$2 !== void 0 ? _settings$typography$2 : {};
|
|
197
|
+
const fontSizes = (_ref7 = (_fontSizesPerOrigin$c2 = fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.custom) !== null && _fontSizesPerOrigin$c2 !== void 0 ? _fontSizesPerOrigin$c2 : fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.theme) !== null && _ref7 !== void 0 ? _ref7 : fontSizesPerOrigin.default;
|
|
198
|
+
const fontSize = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog2 = inheritedValue.typography) === null || _inheritedValue$typog2 === void 0 ? void 0 : _inheritedValue$typog2.fontSize);
|
|
199
|
+
|
|
200
|
+
const setFontSize = (newValue, metadata) => {
|
|
201
|
+
const actualValue = !!(metadata !== null && metadata !== void 0 && metadata.slug) ? `var:preset|font-size|${metadata === null || metadata === void 0 ? void 0 : metadata.slug}` : newValue;
|
|
202
|
+
onChange({ ...value,
|
|
203
|
+
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
204
|
+
fontSize: actualValue
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const hasFontSize = () => {
|
|
210
|
+
var _value$typography2;
|
|
211
|
+
|
|
212
|
+
return !!(value !== null && value !== void 0 && (_value$typography2 = value.typography) !== null && _value$typography2 !== void 0 && _value$typography2.fontSize);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const resetFontSize = () => setFontSize(undefined); // Appearance
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
const hasAppearanceControl = useHasAppearanceControl(settings);
|
|
219
|
+
const appearanceControlLabel = useAppearanceControlLabel(settings);
|
|
220
|
+
const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$typography15 = settings.typography) === null || _settings$typography15 === void 0 ? void 0 : _settings$typography15.fontStyle;
|
|
221
|
+
const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$typography16 = settings.typography) === null || _settings$typography16 === void 0 ? void 0 : _settings$typography16.fontWeight;
|
|
222
|
+
const fontStyle = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog3 = inheritedValue.typography) === null || _inheritedValue$typog3 === void 0 ? void 0 : _inheritedValue$typog3.fontStyle);
|
|
223
|
+
const fontWeight = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog4 = inheritedValue.typography) === null || _inheritedValue$typog4 === void 0 ? void 0 : _inheritedValue$typog4.fontWeight);
|
|
224
|
+
|
|
225
|
+
const setFontAppearance = _ref8 => {
|
|
226
|
+
let {
|
|
227
|
+
fontStyle: newFontStyle,
|
|
228
|
+
fontWeight: newFontWeight
|
|
229
|
+
} = _ref8;
|
|
230
|
+
onChange({ ...value,
|
|
231
|
+
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
232
|
+
fontStyle: newFontStyle,
|
|
233
|
+
fontWeight: newFontWeight
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const hasFontAppearance = () => {
|
|
239
|
+
var _value$typography3, _value$typography4;
|
|
240
|
+
|
|
241
|
+
return !!(value !== null && value !== void 0 && (_value$typography3 = value.typography) !== null && _value$typography3 !== void 0 && _value$typography3.fontStyle) || !!(value !== null && value !== void 0 && (_value$typography4 = value.typography) !== null && _value$typography4 !== void 0 && _value$typography4.fontWeight);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const resetFontAppearance = () => {
|
|
245
|
+
setFontAppearance({});
|
|
246
|
+
}; // Line Height
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
const hasLineHeightEnabled = useHasLineHeightControl(settings);
|
|
250
|
+
const lineHeight = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog5 = inheritedValue.typography) === null || _inheritedValue$typog5 === void 0 ? void 0 : _inheritedValue$typog5.lineHeight);
|
|
251
|
+
|
|
252
|
+
const setLineHeight = newValue => {
|
|
253
|
+
onChange({ ...value,
|
|
254
|
+
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
255
|
+
lineHeight: newValue
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const hasLineHeight = () => {
|
|
261
|
+
var _value$typography5;
|
|
262
|
+
|
|
263
|
+
return !!(value !== null && value !== void 0 && (_value$typography5 = value.typography) !== null && _value$typography5 !== void 0 && _value$typography5.lineHeight);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const resetLineHeight = () => setLineHeight(undefined); // Letter Spacing
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
const hasLetterSpacingControl = useHasLetterSpacingControl(settings);
|
|
270
|
+
const letterSpacing = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog6 = inheritedValue.typography) === null || _inheritedValue$typog6 === void 0 ? void 0 : _inheritedValue$typog6.letterSpacing);
|
|
271
|
+
|
|
272
|
+
const setLetterSpacing = newValue => {
|
|
273
|
+
onChange({ ...value,
|
|
274
|
+
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
275
|
+
letterSpacing: newValue
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const hasLetterSpacing = () => {
|
|
281
|
+
var _value$typography6;
|
|
282
|
+
|
|
283
|
+
return !!(value !== null && value !== void 0 && (_value$typography6 = value.typography) !== null && _value$typography6 !== void 0 && _value$typography6.letterSpacing);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const resetLetterSpacing = () => setLetterSpacing(undefined); // Text Transform
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
const hasTextTransformControl = useHasTextTransformControl(settings);
|
|
290
|
+
const textTransform = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog7 = inheritedValue.typography) === null || _inheritedValue$typog7 === void 0 ? void 0 : _inheritedValue$typog7.textTransform);
|
|
291
|
+
|
|
292
|
+
const setTextTransform = newValue => {
|
|
293
|
+
onChange({ ...value,
|
|
294
|
+
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
295
|
+
textTransform: newValue
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const hasTextTransform = () => {
|
|
301
|
+
var _value$typography7;
|
|
302
|
+
|
|
303
|
+
return !!(value !== null && value !== void 0 && (_value$typography7 = value.typography) !== null && _value$typography7 !== void 0 && _value$typography7.textTransform);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const resetTextTransform = () => setTextTransform(undefined); // Text Decoration
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
const hasTextDecorationControl = useHasTextDecorationControl(settings);
|
|
310
|
+
const textDecoration = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog8 = inheritedValue.typography) === null || _inheritedValue$typog8 === void 0 ? void 0 : _inheritedValue$typog8.textDecoration);
|
|
311
|
+
|
|
312
|
+
const setTextDecoration = newValue => {
|
|
313
|
+
onChange({ ...value,
|
|
314
|
+
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
315
|
+
textDecoration: newValue
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const hasTextDecoration = () => {
|
|
321
|
+
var _value$typography8;
|
|
322
|
+
|
|
323
|
+
return !!(value !== null && value !== void 0 && (_value$typography8 = value.typography) !== null && _value$typography8 !== void 0 && _value$typography8.textDecoration);
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const resetTextDecoration = () => setTextDecoration(undefined);
|
|
327
|
+
|
|
328
|
+
const resetAllFilter = (0, _element.useCallback)(previousValue => {
|
|
329
|
+
return { ...previousValue,
|
|
330
|
+
typography: {}
|
|
331
|
+
};
|
|
332
|
+
}, []);
|
|
333
|
+
return (0, _element.createElement)(Wrapper, {
|
|
334
|
+
resetAllFilter: resetAllFilter,
|
|
335
|
+
value: value,
|
|
336
|
+
onChange: onChange,
|
|
337
|
+
panelId: panelId
|
|
338
|
+
}, hasFontFamilyEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
339
|
+
label: (0, _i18n.__)('Font family'),
|
|
340
|
+
hasValue: hasFontFamily,
|
|
341
|
+
onDeselect: resetFontFamily,
|
|
342
|
+
isShownByDefault: defaultControls.fontFamily,
|
|
343
|
+
panelId: panelId
|
|
344
|
+
}, (0, _element.createElement)(_fontFamily.default, {
|
|
345
|
+
fontFamilies: fontFamilies,
|
|
346
|
+
value: fontFamily,
|
|
347
|
+
onChange: setFontFamily,
|
|
348
|
+
size: "__unstable-large",
|
|
349
|
+
__nextHasNoMarginBottom: true
|
|
350
|
+
})), hasFontSizeEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
351
|
+
label: (0, _i18n.__)('Font size'),
|
|
352
|
+
hasValue: hasFontSize,
|
|
353
|
+
onDeselect: resetFontSize,
|
|
354
|
+
isShownByDefault: defaultControls.fontSize,
|
|
355
|
+
panelId: panelId
|
|
356
|
+
}, (0, _element.createElement)(_components.FontSizePicker, {
|
|
357
|
+
value: fontSize,
|
|
358
|
+
onChange: setFontSize,
|
|
359
|
+
fontSizes: fontSizes,
|
|
360
|
+
disableCustomFontSizes: disableCustomFontSizes,
|
|
361
|
+
withReset: false,
|
|
362
|
+
withSlider: true,
|
|
363
|
+
size: "__unstable-large",
|
|
364
|
+
__nextHasNoMarginBottom: true
|
|
365
|
+
})), hasAppearanceControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
366
|
+
className: "single-column",
|
|
367
|
+
label: appearanceControlLabel,
|
|
368
|
+
hasValue: hasFontAppearance,
|
|
369
|
+
onDeselect: resetFontAppearance,
|
|
370
|
+
isShownByDefault: defaultControls.fontAppearance,
|
|
371
|
+
panelId: panelId
|
|
372
|
+
}, (0, _element.createElement)(_fontAppearanceControl.default, {
|
|
373
|
+
value: {
|
|
374
|
+
fontStyle,
|
|
375
|
+
fontWeight
|
|
376
|
+
},
|
|
377
|
+
onChange: setFontAppearance,
|
|
378
|
+
hasFontStyles: hasFontStyles,
|
|
379
|
+
hasFontWeights: hasFontWeights,
|
|
380
|
+
size: "__unstable-large",
|
|
381
|
+
__nextHasNoMarginBottom: true
|
|
382
|
+
})), hasLineHeightEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
383
|
+
className: "single-column",
|
|
384
|
+
label: (0, _i18n.__)('Line height'),
|
|
385
|
+
hasValue: hasLineHeight,
|
|
386
|
+
onDeselect: resetLineHeight,
|
|
387
|
+
isShownByDefault: defaultControls.lineHeight,
|
|
388
|
+
panelId: panelId
|
|
389
|
+
}, (0, _element.createElement)(_lineHeightControl.default, {
|
|
390
|
+
__nextHasNoMarginBottom: true,
|
|
391
|
+
__unstableInputWidth: "auto",
|
|
392
|
+
value: lineHeight,
|
|
393
|
+
onChange: setLineHeight,
|
|
394
|
+
size: "__unstable-large"
|
|
395
|
+
})), hasLetterSpacingControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
396
|
+
className: "single-column",
|
|
397
|
+
label: (0, _i18n.__)('Letter spacing'),
|
|
398
|
+
hasValue: hasLetterSpacing,
|
|
399
|
+
onDeselect: resetLetterSpacing,
|
|
400
|
+
isShownByDefault: defaultControls.letterSpacing,
|
|
401
|
+
panelId: panelId
|
|
402
|
+
}, (0, _element.createElement)(_letterSpacingControl.default, {
|
|
403
|
+
value: letterSpacing,
|
|
404
|
+
onChange: setLetterSpacing,
|
|
405
|
+
size: "__unstable-large",
|
|
406
|
+
__unstableInputWidth: "auto"
|
|
407
|
+
})), hasTextDecorationControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
408
|
+
className: "single-column",
|
|
409
|
+
label: (0, _i18n.__)('Text decoration'),
|
|
410
|
+
hasValue: hasTextDecoration,
|
|
411
|
+
onDeselect: resetTextDecoration,
|
|
412
|
+
isShownByDefault: defaultControls.textDecoration,
|
|
413
|
+
panelId: panelId
|
|
414
|
+
}, (0, _element.createElement)(_textDecorationControl.default, {
|
|
415
|
+
value: textDecoration,
|
|
416
|
+
onChange: setTextDecoration,
|
|
417
|
+
size: "__unstable-large",
|
|
418
|
+
__unstableInputWidth: "auto"
|
|
419
|
+
})), hasTextTransformControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
420
|
+
label: (0, _i18n.__)('Letter case'),
|
|
421
|
+
hasValue: hasTextTransform,
|
|
422
|
+
onDeselect: resetTextTransform,
|
|
423
|
+
isShownByDefault: defaultControls.textTransform,
|
|
424
|
+
panelId: panelId
|
|
425
|
+
}, (0, _element.createElement)(_textTransformControl.default, {
|
|
426
|
+
value: textTransform,
|
|
427
|
+
onChange: setTextTransform,
|
|
428
|
+
showNone: true,
|
|
429
|
+
isBlock: true,
|
|
430
|
+
size: "__unstable-large",
|
|
431
|
+
__nextHasNoMarginBottom: true
|
|
432
|
+
})));
|
|
433
|
+
}
|
|
434
|
+
//# sourceMappingURL=typography-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/typography-panel.js"],"names":["useHasTypographyPanel","settings","hasFontFamily","useHasFontFamilyControl","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","hasTextTransform","useHasTextTransformControl","hasTextDecoration","useHasTextDecorationControl","hasFontSize","useHasFontSizeControl","disableCustomFontSizes","typography","customFontSize","fontSizesPerOrigin","fontSizes","custom","theme","default","length","fontFamiliesPerOrigin","fontFamilies","lineHeight","hasFontStyles","fontStyle","hasFontWeights","fontWeight","useAppearanceControlLabel","letterSpacing","textTransform","textDecoration","TypographyToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","DEFAULT_CONTROLS","fontFamily","fontSize","fontAppearance","TypographyPanel","as","Wrapper","inheritedValue","defaultControls","decodeValue","rawValue","hasFontFamilyEnabled","setFontFamily","newValue","slug","find","f","resetFontFamily","undefined","hasFontSizeEnabled","setFontSize","metadata","actualValue","resetFontSize","hasAppearanceControl","appearanceControlLabel","setFontAppearance","newFontStyle","newFontWeight","resetFontAppearance","hasLineHeightEnabled","setLineHeight","resetLineHeight","hasLetterSpacingControl","setLetterSpacing","resetLetterSpacing","hasTextTransformControl","setTextTransform","resetTextTransform","hasTextDecorationControl","setTextDecoration","resetTextDecoration","previousValue"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;A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AALX,KAOC,4BAAC,6BAAD;AACC,IAAA,KAAK,EAAGN,aADT;AAEC,IAAA,QAAQ,EAAG+C,gBAFZ;AAGC,IAAA,QAAQ,MAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,IAAI,EAAC,kBALN;AAMC,IAAA,uBAAuB;AANxB,IAPD,CAtHF,CADD;AA0IA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFontSizePicker,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FontFamilyControl from '../font-family';\nimport FontAppearanceControl from '../font-appearance-control';\nimport LineHeightControl from '../line-height-control';\nimport LetterSpacingControl from '../letter-spacing-control';\nimport TextTransformControl from '../text-transform-control';\nimport TextDecorationControl from '../text-decoration-control';\nimport { getValueFromVariable } from './utils';\n\nexport function useHasTypographyPanel( settings ) {\n\tconst hasFontFamily = useHasFontFamilyControl( settings );\n\tconst hasLineHeight = useHasLineHeightControl( settings );\n\tconst hasFontAppearance = useHasAppearanceControl( settings );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( settings );\n\tconst hasTextTransform = useHasTextTransformControl( settings );\n\tconst hasTextDecoration = useHasTextDecorationControl( settings );\n\tconst hasFontSize = useHasFontSizeControl( settings );\n\n\treturn (\n\t\thasFontFamily ||\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\thasTextTransform ||\n\t\thasFontSize ||\n\t\thasTextDecoration\n\t);\n}\n\nfunction useHasFontSizeControl( settings ) {\n\tconst disableCustomFontSizes = ! settings?.typography?.customFontSize;\n\tconst fontSizesPerOrigin = settings?.typography?.fontSizes ?? {};\n\tconst fontSizes =\n\t\tfontSizesPerOrigin?.custom ??\n\t\tfontSizesPerOrigin?.theme ??\n\t\tfontSizesPerOrigin.default;\n\treturn !! fontSizes?.length || ! disableCustomFontSizes;\n}\n\nfunction useHasFontFamilyControl( settings ) {\n\tconst fontFamiliesPerOrigin = settings?.typography?.fontFamilies;\n\tconst fontFamilies =\n\t\tfontFamiliesPerOrigin?.custom ??\n\t\tfontFamiliesPerOrigin?.theme ??\n\t\tfontFamiliesPerOrigin?.default;\n\treturn !! fontFamilies?.length;\n}\n\nfunction useHasLineHeightControl( settings ) {\n\treturn settings?.typography?.lineHeight;\n}\n\nfunction useHasAppearanceControl( settings ) {\n\tconst hasFontStyles = settings?.typography?.fontStyle;\n\tconst hasFontWeights = settings?.typography?.fontWeight;\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useAppearanceControlLabel( settings ) {\n\tconst hasFontStyles = settings?.typography?.fontStyle;\n\tconst hasFontWeights = settings?.typography?.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( settings ) {\n\treturn settings?.typography?.letterSpacing;\n}\n\nfunction useHasTextTransformControl( settings ) {\n\treturn settings?.typography?.textTransform;\n}\n\nfunction useHasTextDecorationControl( settings ) {\n\treturn settings?.typography?.textDecoration;\n}\n\nfunction TypographyToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Typography' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tfontFamily: true,\n\tfontSize: true,\n\tfontAppearance: true,\n\tlineHeight: true,\n\tletterSpacing: true,\n\ttextTransform: true,\n\ttextDecoration: true,\n};\n\nexport default function TypographyPanel( {\n\tas: Wrapper = TypographyToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\t// Font Family\n\tconst hasFontFamilyEnabled = useHasFontFamilyControl( settings );\n\tconst fontFamiliesPerOrigin = settings?.typography?.fontFamilies;\n\tconst fontFamilies =\n\t\tfontFamiliesPerOrigin?.custom ??\n\t\tfontFamiliesPerOrigin?.theme ??\n\t\tfontFamiliesPerOrigin?.default;\n\tconst fontFamily = decodeValue( inheritedValue?.typography?.fontFamily );\n\tconst setFontFamily = ( newValue ) => {\n\t\tconst slug = fontFamilies?.find(\n\t\t\t( { fontFamily: f } ) => f === newValue\n\t\t)?.slug;\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tfontFamily: slug\n\t\t\t\t\t? `var:preset|font-family|${ slug }`\n\t\t\t\t\t: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasFontFamily = () => !! value?.typography?.fontFamily;\n\tconst resetFontFamily = () => setFontFamily( undefined );\n\n\t// Font Size\n\tconst hasFontSizeEnabled = useHasFontSizeControl( settings );\n\tconst disableCustomFontSizes = ! settings?.typography?.customFontSize;\n\tconst fontSizesPerOrigin = settings?.typography?.fontSizes ?? {};\n\tconst fontSizes =\n\t\tfontSizesPerOrigin?.custom ??\n\t\tfontSizesPerOrigin?.theme ??\n\t\tfontSizesPerOrigin.default;\n\tconst fontSize = decodeValue( inheritedValue?.typography?.fontSize );\n\tconst setFontSize = ( newValue, metadata ) => {\n\t\tconst actualValue = !! metadata?.slug\n\t\t\t? `var:preset|font-size|${ metadata?.slug }`\n\t\t\t: newValue;\n\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tfontSize: actualValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasFontSize = () => !! value?.typography?.fontSize;\n\tconst resetFontSize = () => setFontSize( undefined );\n\n\t// Appearance\n\tconst hasAppearanceControl = useHasAppearanceControl( settings );\n\tconst appearanceControlLabel = useAppearanceControlLabel( settings );\n\tconst hasFontStyles = settings?.typography?.fontStyle;\n\tconst hasFontWeights = settings?.typography?.fontWeight;\n\tconst fontStyle = decodeValue( inheritedValue?.typography?.fontStyle );\n\tconst fontWeight = decodeValue( inheritedValue?.typography?.fontWeight );\n\tconst setFontAppearance = ( {\n\t\tfontStyle: newFontStyle,\n\t\tfontWeight: newFontWeight,\n\t} ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\tfontWeight: newFontWeight,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasFontAppearance = () =>\n\t\t!! value?.typography?.fontStyle || !! value?.typography?.fontWeight;\n\tconst resetFontAppearance = () => {\n\t\tsetFontAppearance( {} );\n\t};\n\n\t// Line Height\n\tconst hasLineHeightEnabled = useHasLineHeightControl( settings );\n\tconst lineHeight = decodeValue( inheritedValue?.typography?.lineHeight );\n\tconst setLineHeight = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tlineHeight: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasLineHeight = () => !! value?.typography?.lineHeight;\n\tconst resetLineHeight = () => setLineHeight( undefined );\n\n\t// Letter Spacing\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( settings );\n\tconst letterSpacing = decodeValue(\n\t\tinheritedValue?.typography?.letterSpacing\n\t);\n\tconst setLetterSpacing = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tletterSpacing: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasLetterSpacing = () => !! value?.typography?.letterSpacing;\n\tconst resetLetterSpacing = () => setLetterSpacing( undefined );\n\n\t// Text Transform\n\tconst hasTextTransformControl = useHasTextTransformControl( settings );\n\tconst textTransform = decodeValue(\n\t\tinheritedValue?.typography?.textTransform\n\t);\n\tconst setTextTransform = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\ttextTransform: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasTextTransform = () => !! value?.typography?.textTransform;\n\tconst resetTextTransform = () => setTextTransform( undefined );\n\n\t// Text Decoration\n\tconst hasTextDecorationControl = useHasTextDecorationControl( settings );\n\tconst textDecoration = decodeValue(\n\t\tinheritedValue?.typography?.textDecoration\n\t);\n\tconst setTextDecoration = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\ttextDecoration: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasTextDecoration = () => !! value?.typography?.textDecoration;\n\tconst resetTextDecoration = () => setTextDecoration( undefined );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\ttypography: {},\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\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={ defaultControls.fontFamily }\n\t\t\t\t\tpanelId={ panelId }\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={ defaultControls.fontSize }\n\t\t\t\t\tpanelId={ panelId }\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={ defaultControls.fontAppearance }\n\t\t\t\t\tpanelId={ panelId }\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={ setFontAppearance }\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={ defaultControls.lineHeight }\n\t\t\t\t\tpanelId={ panelId }\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={ defaultControls.letterSpacing }\n\t\t\t\t\tpanelId={ panelId }\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{ 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={ defaultControls.textDecoration }\n\t\t\t\t\tpanelId={ panelId }\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\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={ defaultControls.textTransform }\n\t\t\t\t\tpanelId={ panelId }\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</Wrapper>\n\t);\n}\n"]}
|
|
@@ -630,13 +630,17 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
|
|
|
630
630
|
}
|
|
631
631
|
|
|
632
632
|
if (useRootPaddingAlign) {
|
|
633
|
+
/*
|
|
634
|
+
* These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508
|
|
635
|
+
* almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.
|
|
636
|
+
*/
|
|
633
637
|
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
634
638
|
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
635
639
|
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
|
|
636
640
|
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
637
641
|
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
638
|
-
.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where(
|
|
639
|
-
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(
|
|
642
|
+
.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
643
|
+
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
|
|
640
644
|
}
|
|
641
645
|
|
|
642
646
|
ruleset += '}';
|
|
@@ -723,7 +727,7 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
|
|
|
723
727
|
const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
|
|
724
728
|
|
|
725
729
|
if (duotoneDeclarations.length > 0) {
|
|
726
|
-
ruleset = ruleset + `${duotoneSelector}{${duotoneDeclarations.join(';')};}`;
|
|
730
|
+
ruleset = ruleset + `${(0, _utils.scopeSelector)(selector, duotoneSelector)}{${duotoneDeclarations.join(';')};}`;
|
|
727
731
|
}
|
|
728
732
|
} // Process blockGap and layout styles.
|
|
729
733
|
|