@wordpress/edit-site 4.15.1-next.4d3b314fd5.0 → 4.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/block-editor/block-inspector-button.js +1 -1
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/index.js +17 -11
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +11 -35
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/index.js +5 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/preview.js +85 -50
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +35 -4
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +49 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +143 -83
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +54 -0
- package/build/components/global-styles/typography-preview.js.map +1 -0
- package/build/components/global-styles/typography-utils.js +39 -176
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +34 -16
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/{header → header-edit-mode}/document-actions/index.js +58 -24
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/index.js +13 -49
- package/build/components/header-edit-mode/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/mode-switcher/index.js +0 -0
- package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/copy-content-menu-item.js +0 -0
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/index.js +0 -0
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/site-export.js +0 -0
- package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/welcome-guide-menu-item.js +0 -0
- package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/{header → header-edit-mode}/plugin-more-menu-item/index.js +0 -0
- package/build/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/plugin-sidebar-more-menu-item/index.js +0 -0
- package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/tools-more-menu-group/index.js +0 -0
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/undo-redo/redo.js +0 -0
- package/build/components/header-edit-mode/undo-redo/redo.js.map +1 -0
- package/build/components/{header → header-edit-mode}/undo-redo/undo.js +0 -0
- package/build/components/header-edit-mode/undo-redo/undo.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/main-dashboard-button/index.js +2 -2
- package/build/components/main-dashboard-button/index.js.map +1 -1
- package/build/components/{sidebar → sidebar-edit-mode}/constants.js +0 -0
- package/build/components/sidebar-edit-mode/constants.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/default-sidebar.js +0 -0
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/global-styles-sidebar.js +0 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/index.js +1 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/index.js +0 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-inspector.js +0 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-menu.js +0 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/plugin-sidebar/index.js +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/settings-header/index.js +2 -2
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/template-card/index.js +0 -0
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/template-card/template-actions.js +0 -0
- package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/template-card/template-areas.js +0 -0
- package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +1 -0
- package/build/index.js +23 -4
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/block-inspector-button.js +1 -1
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +16 -10
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +10 -34
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/index.js +4 -6
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/preview.js +85 -50
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +36 -6
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +48 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +143 -85
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +46 -0
- package/build-module/components/global-styles/typography-preview.js.map +1 -0
- package/build-module/components/global-styles/typography-utils.js +37 -169
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +33 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/{header → header-edit-mode}/document-actions/index.js +53 -24
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/index.js +13 -46
- package/build-module/components/header-edit-mode/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/mode-switcher/index.js +0 -0
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/copy-content-menu-item.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/index.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/site-export.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/welcome-guide-menu-item.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/plugin-more-menu-item/index.js +0 -0
- package/build-module/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/plugin-sidebar-more-menu-item/index.js +0 -0
- package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/tools-more-menu-group/index.js +0 -0
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/undo-redo/redo.js +0 -0
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/undo-redo/undo.js +0 -0
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/main-dashboard-button/index.js +3 -3
- package/build-module/components/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/{sidebar → sidebar-edit-mode}/constants.js +0 -0
- package/build-module/components/sidebar-edit-mode/constants.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/default-sidebar.js +0 -0
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/global-styles-sidebar.js +0 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/index.js +0 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-inspector.js +0 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-menu.js +0 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/plugin-sidebar/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/settings-header/index.js +2 -2
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/template-card/index.js +0 -0
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/template-card/template-actions.js +0 -0
- package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/template-card/template-areas.js +0 -0
- package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +1 -0
- package/build-module/index.js +22 -4
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +64 -89
- package/build-style/style.css +64 -89
- package/package.json +29 -29
- package/src/components/block-editor/block-inspector-button.js +1 -1
- package/src/components/block-editor/index.js +29 -11
- package/src/components/block-editor/resizable-editor.js +8 -37
- package/src/components/editor/index.js +2 -4
- package/src/components/global-styles/preview.js +81 -60
- package/src/components/global-styles/screen-style-variations.js +39 -4
- package/src/components/global-styles/screen-typography-element.js +65 -1
- package/src/components/global-styles/style.scss +2 -2
- package/src/components/global-styles/test/typography-utils.js +333 -103
- package/src/components/global-styles/test/use-global-styles-output.js +57 -3
- package/src/components/global-styles/typography-panel.js +205 -150
- package/src/components/global-styles/typography-preview.js +49 -0
- package/src/components/global-styles/typography-utils.js +34 -195
- package/src/components/global-styles/use-global-styles-output.js +31 -9
- package/src/components/{header → header-edit-mode}/document-actions/index.js +67 -46
- package/src/components/{header → header-edit-mode}/document-actions/style.scss +0 -0
- package/src/components/{header → header-edit-mode}/index.js +12 -44
- package/src/components/{header → header-edit-mode}/mode-switcher/index.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/copy-content-menu-item.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/index.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/site-export.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/welcome-guide-menu-item.js +0 -0
- package/src/components/{header → header-edit-mode}/plugin-more-menu-item/index.js +0 -0
- package/src/components/{header → header-edit-mode}/plugin-sidebar-more-menu-item/index.js +0 -0
- package/src/components/{header → header-edit-mode}/style.scss +20 -50
- package/src/components/{header → header-edit-mode}/tools-more-menu-group/index.js +0 -0
- package/src/components/{header → header-edit-mode}/undo-redo/redo.js +0 -0
- package/src/components/{header → header-edit-mode}/undo-redo/undo.js +0 -0
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/main-dashboard-button/index.js +3 -3
- package/src/components/{sidebar → sidebar-edit-mode}/constants.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/default-sidebar.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/global-styles-sidebar.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/index.js +1 -1
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/index.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-inspector.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-menu.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/style.scss +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/plugin-sidebar/index.js +1 -1
- package/src/components/{sidebar → sidebar-edit-mode}/settings-header/index.js +2 -2
- package/src/components/{sidebar → sidebar-edit-mode}/settings-header/style.scss +2 -2
- package/src/components/{sidebar → sidebar-edit-mode}/style.scss +2 -2
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/index.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/style.scss +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/template-actions.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/template-areas.js +0 -0
- package/src/index.js +24 -3
- package/src/style.scss +6 -6
- package/build/components/header/document-actions/index.js.map +0 -1
- package/build/components/header/index.js.map +0 -1
- package/build/components/header/mode-switcher/index.js.map +0 -1
- package/build/components/header/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header/more-menu/index.js.map +0 -1
- package/build/components/header/more-menu/site-export.js.map +0 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build/components/header/undo-redo/redo.js.map +0 -1
- package/build/components/header/undo-redo/undo.js.map +0 -1
- package/build/components/sidebar/constants.js.map +0 -1
- package/build/components/sidebar/default-sidebar.js.map +0 -1
- package/build/components/sidebar/global-styles-sidebar.js.map +0 -1
- package/build/components/sidebar/index.js.map +0 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +0 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build/components/sidebar/settings-header/index.js.map +0 -1
- package/build/components/sidebar/template-card/index.js.map +0 -1
- package/build/components/sidebar/template-card/template-actions.js.map +0 -1
- package/build/components/sidebar/template-card/template-areas.js.map +0 -1
- package/build-module/components/header/document-actions/index.js.map +0 -1
- package/build-module/components/header/index.js.map +0 -1
- package/build-module/components/header/mode-switcher/index.js.map +0 -1
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header/more-menu/index.js.map +0 -1
- package/build-module/components/header/more-menu/site-export.js.map +0 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/header/undo-redo/redo.js.map +0 -1
- package/build-module/components/header/undo-redo/undo.js.map +0 -1
- package/build-module/components/sidebar/constants.js.map +0 -1
- package/build-module/components/sidebar/default-sidebar.js.map +0 -1
- package/build-module/components/sidebar/global-styles-sidebar.js.map +0 -1
- package/build-module/components/sidebar/index.js.map +0 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +0 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build-module/components/sidebar/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar/template-card/index.js.map +0 -1
- package/build-module/components/sidebar/template-card/template-actions.js.map +0 -1
- package/build-module/components/sidebar/template-card/template-areas.js.map +0 -1
|
@@ -16,6 +16,8 @@ var _i18n = require("@wordpress/i18n");
|
|
|
16
16
|
|
|
17
17
|
var _hooks = require("./hooks");
|
|
18
18
|
|
|
19
|
+
var _typographyUtils = require("./typography-utils");
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* WordPress dependencies
|
|
21
23
|
*/
|
|
@@ -24,11 +26,18 @@ var _hooks = require("./hooks");
|
|
|
24
26
|
* Internal dependencies
|
|
25
27
|
*/
|
|
26
28
|
function useHasTypographyPanel(name) {
|
|
29
|
+
const hasFontFamily = useHasFontFamilyControl(name);
|
|
27
30
|
const hasLineHeight = useHasLineHeightControl(name);
|
|
28
31
|
const hasFontAppearance = useHasAppearanceControl(name);
|
|
29
32
|
const hasLetterSpacing = useHasLetterSpacingControl(name);
|
|
30
33
|
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
31
|
-
return hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize');
|
|
34
|
+
return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function useHasFontFamilyControl(name) {
|
|
38
|
+
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
39
|
+
const [fontFamilies] = (0, _hooks.useSetting)('typography.fontFamilies', name);
|
|
40
|
+
return supports.includes('fontFamily') && !!(fontFamilies !== null && fontFamilies !== void 0 && fontFamilies.length);
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
function useHasLineHeightControl(name) {
|
|
@@ -43,6 +52,22 @@ function useHasAppearanceControl(name) {
|
|
|
43
52
|
return hasFontStyles || hasFontWeights;
|
|
44
53
|
}
|
|
45
54
|
|
|
55
|
+
function useAppearanceControlLabel(name) {
|
|
56
|
+
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
57
|
+
const hasFontStyles = (0, _hooks.useSetting)('typography.fontStyle', name)[0] && supports.includes('fontStyle');
|
|
58
|
+
const hasFontWeights = (0, _hooks.useSetting)('typography.fontWeight', name)[0] && supports.includes('fontWeight');
|
|
59
|
+
|
|
60
|
+
if (!hasFontStyles) {
|
|
61
|
+
return (0, _i18n.__)('Font weight');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!hasFontWeights) {
|
|
65
|
+
return (0, _i18n.__)('Font style');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (0, _i18n.__)('Appearance');
|
|
69
|
+
}
|
|
70
|
+
|
|
46
71
|
function useHasLetterSpacingControl(name, element) {
|
|
47
72
|
const setting = (0, _hooks.useSetting)('typography.letterSpacing', name)[0];
|
|
48
73
|
|
|
@@ -73,122 +98,142 @@ function useHasTextTransformControl(name, element) {
|
|
|
73
98
|
return supports.includes('textTransform');
|
|
74
99
|
}
|
|
75
100
|
|
|
101
|
+
function useStyleWithReset(path, blockName) {
|
|
102
|
+
const [style, setStyle] = (0, _hooks.useStyle)(path, blockName);
|
|
103
|
+
const [userStyle] = (0, _hooks.useStyle)(path, blockName, 'user');
|
|
104
|
+
|
|
105
|
+
const hasStyle = () => !!userStyle;
|
|
106
|
+
|
|
107
|
+
const resetStyle = () => setStyle(undefined);
|
|
108
|
+
|
|
109
|
+
return [style, setStyle, hasStyle, resetStyle];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function useFontAppearance(prefix, name) {
|
|
113
|
+
const [fontStyle, setFontStyle] = (0, _hooks.useStyle)(prefix + 'typography.fontStyle', name);
|
|
114
|
+
const [userFontStyle] = (0, _hooks.useStyle)(prefix + 'typography.fontStyle', name, 'user');
|
|
115
|
+
const [fontWeight, setFontWeight] = (0, _hooks.useStyle)(prefix + 'typography.fontWeight', name);
|
|
116
|
+
const [userFontWeight] = (0, _hooks.useStyle)(prefix + 'typography.fontWeight', name, 'user');
|
|
117
|
+
|
|
118
|
+
const hasFontAppearance = () => !!userFontStyle || !!userFontWeight;
|
|
119
|
+
|
|
120
|
+
const resetFontAppearance = () => {
|
|
121
|
+
setFontStyle(undefined);
|
|
122
|
+
setFontWeight(undefined);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
fontStyle,
|
|
127
|
+
setFontStyle,
|
|
128
|
+
fontWeight,
|
|
129
|
+
setFontWeight,
|
|
130
|
+
hasFontAppearance,
|
|
131
|
+
resetFontAppearance
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
76
135
|
function TypographyPanel(_ref) {
|
|
77
136
|
let {
|
|
78
137
|
name,
|
|
79
|
-
element
|
|
138
|
+
element,
|
|
139
|
+
headingLevel
|
|
80
140
|
} = _ref;
|
|
81
|
-
const [selectedLevel, setCurrentTab] = (0, _element.useState)('heading');
|
|
82
141
|
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
83
142
|
let prefix = '';
|
|
84
143
|
|
|
85
144
|
if (element === 'heading') {
|
|
86
|
-
prefix = `elements.${
|
|
145
|
+
prefix = `elements.${headingLevel}.`;
|
|
87
146
|
} else if (element && element !== 'text') {
|
|
88
147
|
prefix = `elements.${element}.`;
|
|
89
148
|
}
|
|
90
149
|
|
|
91
|
-
const [
|
|
150
|
+
const [fluidTypography] = (0, _hooks.useSetting)('typography.fluid', name);
|
|
151
|
+
const [fontSizes] = (0, _hooks.useSetting)('typography.fontSizes', name); // Convert static font size values to fluid font sizes if fluidTypography is activated.
|
|
152
|
+
|
|
153
|
+
const fontSizesWithFluidValues = fontSizes.map(font => {
|
|
154
|
+
if (!!fluidTypography) {
|
|
155
|
+
font.size = (0, _typographyUtils.getTypographyFontSizeValue)(font, {
|
|
156
|
+
fluid: fluidTypography
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return font;
|
|
161
|
+
});
|
|
92
162
|
const disableCustomFontSizes = !(0, _hooks.useSetting)('typography.customFontSize', name)[0];
|
|
93
163
|
const [fontFamilies] = (0, _hooks.useSetting)('typography.fontFamilies', name);
|
|
94
164
|
const hasFontStyles = (0, _hooks.useSetting)('typography.fontStyle', name)[0] && supports.includes('fontStyle');
|
|
95
165
|
const hasFontWeights = (0, _hooks.useSetting)('typography.fontWeight', name)[0] && supports.includes('fontWeight');
|
|
166
|
+
const hasFontFamilyEnabled = useHasFontFamilyControl(name);
|
|
96
167
|
const hasLineHeightEnabled = useHasLineHeightControl(name);
|
|
97
168
|
const hasAppearanceControl = useHasAppearanceControl(name);
|
|
169
|
+
const appearanceControlLabel = useAppearanceControlLabel(name);
|
|
98
170
|
const hasLetterSpacingControl = useHasLetterSpacingControl(name, element);
|
|
99
171
|
const hasTextTransformControl = useHasTextTransformControl(name, element);
|
|
100
172
|
/* Disable font size controls when the option to style all headings is selected. */
|
|
101
173
|
|
|
102
174
|
let hasFontSizeEnabled = supports.includes('fontSize');
|
|
103
175
|
|
|
104
|
-
if (element === 'heading' &&
|
|
176
|
+
if (element === 'heading' && headingLevel === 'heading') {
|
|
105
177
|
hasFontSizeEnabled = false;
|
|
106
178
|
}
|
|
107
179
|
|
|
108
|
-
const [fontFamily, setFontFamily] = (
|
|
109
|
-
const [fontSize, setFontSize] = (
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
columnGap: 8
|
|
140
|
-
}, element === 'heading' && (0, _element.createElement)("div", {
|
|
141
|
-
className: "edit-site-typography-panel__full-width-control"
|
|
142
|
-
}, (0, _element.createElement)(_components.__experimentalToggleGroupControl, {
|
|
143
|
-
label: (0, _i18n.__)('Select heading level'),
|
|
144
|
-
hideLabelFromVision: true,
|
|
145
|
-
value: selectedLevel,
|
|
146
|
-
onChange: setCurrentTab,
|
|
147
|
-
isBlock: true,
|
|
148
|
-
size: "__unstable-large",
|
|
149
|
-
__nextHasNoMarginBottom: true
|
|
150
|
-
}, (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
|
|
151
|
-
value: "heading"
|
|
152
|
-
/* translators: 'All' refers to selecting all heading levels
|
|
153
|
-
and applying the same style to h1-h6. */
|
|
154
|
-
,
|
|
155
|
-
label: (0, _i18n.__)('All')
|
|
156
|
-
}), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
|
|
157
|
-
value: "h1",
|
|
158
|
-
label: (0, _i18n.__)('H1')
|
|
159
|
-
}), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
|
|
160
|
-
value: "h2",
|
|
161
|
-
label: (0, _i18n.__)('H2')
|
|
162
|
-
}), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
|
|
163
|
-
value: "h3",
|
|
164
|
-
label: (0, _i18n.__)('H3')
|
|
165
|
-
}), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
|
|
166
|
-
value: "h4",
|
|
167
|
-
label: (0, _i18n.__)('H4')
|
|
168
|
-
}), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
|
|
169
|
-
value: "h5",
|
|
170
|
-
label: (0, _i18n.__)('H5')
|
|
171
|
-
}), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
|
|
172
|
-
value: "h6",
|
|
173
|
-
label: (0, _i18n.__)('H6')
|
|
174
|
-
}))), supports.includes('fontFamily') && (0, _element.createElement)("div", {
|
|
175
|
-
className: "edit-site-typography-panel__full-width-control"
|
|
180
|
+
const [fontFamily, setFontFamily, hasFontFamily, resetFontFamily] = useStyleWithReset(prefix + 'typography.fontFamily', name);
|
|
181
|
+
const [fontSize, setFontSize, hasFontSize, resetFontSize] = useStyleWithReset(prefix + 'typography.fontSize', name);
|
|
182
|
+
const {
|
|
183
|
+
fontStyle,
|
|
184
|
+
setFontStyle,
|
|
185
|
+
fontWeight,
|
|
186
|
+
setFontWeight,
|
|
187
|
+
hasFontAppearance,
|
|
188
|
+
resetFontAppearance
|
|
189
|
+
} = useFontAppearance(prefix, name);
|
|
190
|
+
const [lineHeight, setLineHeight, hasLineHeight, resetLineHeight] = useStyleWithReset(prefix + 'typography.lineHeight', name);
|
|
191
|
+
const [letterSpacing, setLetterSpacing, hasLetterSpacing, resetLetterSpacing] = useStyleWithReset(prefix + 'typography.letterSpacing', name);
|
|
192
|
+
const [textTransform, setTextTransform, hasTextTransform, resetTextTransform] = useStyleWithReset(prefix + 'typography.textTransform', name);
|
|
193
|
+
|
|
194
|
+
const resetAll = () => {
|
|
195
|
+
resetFontFamily();
|
|
196
|
+
resetFontSize();
|
|
197
|
+
resetFontAppearance();
|
|
198
|
+
resetLineHeight();
|
|
199
|
+
resetLetterSpacing();
|
|
200
|
+
resetTextTransform();
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
return (0, _element.createElement)(_components.__experimentalToolsPanel, {
|
|
204
|
+
label: (0, _i18n.__)('Typography'),
|
|
205
|
+
resetAll: resetAll
|
|
206
|
+
}, hasFontFamilyEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
207
|
+
label: (0, _i18n.__)('Font family'),
|
|
208
|
+
hasValue: hasFontFamily,
|
|
209
|
+
onDeselect: resetFontFamily,
|
|
210
|
+
isShownByDefault: true
|
|
176
211
|
}, (0, _element.createElement)(_blockEditor.__experimentalFontFamilyControl, {
|
|
177
212
|
fontFamilies: fontFamilies,
|
|
178
213
|
value: fontFamily,
|
|
179
214
|
onChange: setFontFamily,
|
|
180
215
|
size: "__unstable-large",
|
|
181
216
|
__nextHasNoMarginBottom: true
|
|
182
|
-
})), hasFontSizeEnabled && (0, _element.createElement)(
|
|
183
|
-
|
|
217
|
+
})), hasFontSizeEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
218
|
+
label: (0, _i18n.__)('Font size'),
|
|
219
|
+
hasValue: hasFontSize,
|
|
220
|
+
onDeselect: resetFontSize,
|
|
221
|
+
isShownByDefault: true
|
|
184
222
|
}, (0, _element.createElement)(_components.FontSizePicker, {
|
|
185
223
|
value: fontSize,
|
|
186
224
|
onChange: setFontSize,
|
|
187
|
-
fontSizes:
|
|
225
|
+
fontSizes: fontSizesWithFluidValues,
|
|
188
226
|
disableCustomFontSizes: disableCustomFontSizes,
|
|
227
|
+
withReset: false,
|
|
189
228
|
size: "__unstable-large",
|
|
190
229
|
__nextHasNoMarginBottom: true
|
|
191
|
-
})), hasAppearanceControl && (0, _element.createElement)(
|
|
230
|
+
})), hasAppearanceControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
231
|
+
className: "single-column",
|
|
232
|
+
label: appearanceControlLabel,
|
|
233
|
+
hasValue: hasFontAppearance,
|
|
234
|
+
onDeselect: resetFontAppearance,
|
|
235
|
+
isShownByDefault: true
|
|
236
|
+
}, (0, _element.createElement)(_blockEditor.__experimentalFontAppearanceControl, {
|
|
192
237
|
value: {
|
|
193
238
|
fontStyle,
|
|
194
239
|
fontWeight
|
|
@@ -205,19 +250,34 @@ function TypographyPanel(_ref) {
|
|
|
205
250
|
hasFontWeights: hasFontWeights,
|
|
206
251
|
size: "__unstable-large",
|
|
207
252
|
__nextHasNoMarginBottom: true
|
|
208
|
-
}), hasLineHeightEnabled && (0, _element.createElement)(
|
|
253
|
+
})), hasLineHeightEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
254
|
+
className: "single-column",
|
|
255
|
+
label: (0, _i18n.__)('Line height'),
|
|
256
|
+
hasValue: hasLineHeight,
|
|
257
|
+
onDeselect: resetLineHeight,
|
|
258
|
+
isShownByDefault: true
|
|
259
|
+
}, (0, _element.createElement)(_blockEditor.LineHeightControl, {
|
|
209
260
|
__nextHasNoMarginBottom: true,
|
|
210
261
|
__unstableInputWidth: "auto",
|
|
211
262
|
value: lineHeight,
|
|
212
263
|
onChange: setLineHeight,
|
|
213
264
|
size: "__unstable-large"
|
|
214
|
-
}), hasLetterSpacingControl && (0, _element.createElement)(
|
|
265
|
+
})), hasLetterSpacingControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
266
|
+
className: "single-column",
|
|
267
|
+
label: (0, _i18n.__)('Letter spacing'),
|
|
268
|
+
hasValue: hasLetterSpacing,
|
|
269
|
+
onDeselect: resetLetterSpacing,
|
|
270
|
+
isShownByDefault: true
|
|
271
|
+
}, (0, _element.createElement)(_blockEditor.__experimentalLetterSpacingControl, {
|
|
215
272
|
value: letterSpacing,
|
|
216
273
|
onChange: setLetterSpacing,
|
|
217
274
|
size: "__unstable-large",
|
|
218
275
|
__unstableInputWidth: "auto"
|
|
219
|
-
}), hasTextTransformControl && (0, _element.createElement)(
|
|
220
|
-
|
|
276
|
+
})), hasTextTransformControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
277
|
+
label: (0, _i18n.__)('Letter case'),
|
|
278
|
+
hasValue: hasTextTransform,
|
|
279
|
+
onDeselect: resetTextTransform,
|
|
280
|
+
isShownByDefault: true
|
|
221
281
|
}, (0, _element.createElement)(_blockEditor.__experimentalTextTransformControl, {
|
|
222
282
|
value: textTransform,
|
|
223
283
|
onChange: setTextTransform,
|
|
@@ -225,6 +285,6 @@ function TypographyPanel(_ref) {
|
|
|
225
285
|
isBlock: true,
|
|
226
286
|
size: "__unstable-large",
|
|
227
287
|
__nextHasNoMarginBottom: true
|
|
228
|
-
})))
|
|
288
|
+
})));
|
|
229
289
|
}
|
|
230
290
|
//# sourceMappingURL=typography-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["useHasTypographyPanel","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","hasFontStyles","hasFontWeights","element","setting","useHasTextTransformControl","TypographyPanel","selectedLevel","setCurrentTab","prefix","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","hasTextTransformControl","hasFontSizeEnabled","fontFamily","setFontFamily","fontSize","setFontSize","fontStyle","setFontStyle","fontWeight","setFontWeight","lineHeight","setLineHeight","letterSpacing","setLetterSpacing","textTransform","setTextTransform","backgroundColor","gradientValue","color","extraStyles","textDecoration","background","newFontStyle","newFontWeight"],"mappings":";;;;;;;;AAkBA;;AAfA;;AAOA;;AAOA;;AAKA;;AAtBA;AACA;AACA;;AAiBA;AACA;AACA;AAGO,SAASA,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAAF,CAA7C;AACA,QAAMG,iBAAiB,GAAGC,uBAAuB,CAAEJ,IAAF,CAAjD;AACA,QAAMK,gBAAgB,GAAGC,0BAA0B,CAAEN,IAAF,CAAnD;AACA,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACCC,aAAa,IACbE,iBADA,IAEAE,gBAFA,IAGAE,QAAQ,CAACC,QAAT,CAAmB,UAAnB,CAJD;AAMA;;AAED,SAASN,uBAAT,CAAkCF,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACC,uBAAY,uBAAZ,EAAqCA,IAArC,EAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD;AAIA;;AAED,SAASJ,uBAAT,CAAkCJ,IAAlC,EAAy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,QAAQ,EAAGC,aAJZ;AAKC,IAAA,IAAI,EAAC;AALN,IAxFF,EAgGGZ,uBAAuB,IACxB,4BAAC,+CAAD;AACC,IAAA,KAAK,EAAGa,aADT;AAEC,IAAA,QAAQ,EAAGC,gBAFZ;AAGC,IAAA,IAAI,EAAC,kBAHN;AAIC,IAAA,oBAAoB,EAAC;AAJtB,IAjGF,EAwGGb,uBAAuB,IACxB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,+CAAD;AACC,IAAA,KAAK,EAAGc,aADT;AAEC,IAAA,QAAQ,EAAGC,gBAFZ;AAGC,IAAA,QAAQ,MAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,IAAI,EAAC,kBALN;AAMC,IAAA,uBAAuB;AANxB,IADD,CAzGF,CAhBD,CADD;AAwIA","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} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tFontSizePicker,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalGrid as Grid,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nexport function useHasTypographyPanel( 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\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\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 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\nexport default function TypographyPanel( { name, element } ) {\n\tconst [ selectedLevel, setCurrentTab ] = useState( 'heading' );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tlet prefix = '';\n\tif ( element === 'heading' ) {\n\t\tprefix = `elements.${ selectedLevel }.`;\n\t} else if ( element && element !== 'text' ) {\n\t\tprefix = `elements.${ element }.`;\n\t}\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\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 hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name, element );\n\tconst hasTextTransformControl = useHasTextTransformControl( name, element );\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' && selectedLevel === 'heading' ) {\n\t\thasFontSizeEnabled = false;\n\t}\n\n\tconst [ fontFamily, setFontFamily ] = useStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontSize, setFontSize ] = useStyle(\n\t\tprefix + 'typography.fontSize',\n\t\tname\n\t);\n\n\tconst [ fontStyle, setFontStyle ] = useStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight, setFontWeight ] = useStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ lineHeight, setLineHeight ] = useStyle(\n\t\tprefix + 'typography.lineHeight',\n\t\tname\n\t);\n\tconst [ letterSpacing, setLetterSpacing ] = useStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ textTransform, setTextTransform ] = useStyle(\n\t\tprefix + 'typography.textTransform',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useStyle( prefix + 'color.background', name );\n\tconst [ gradientValue ] = useStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useStyle( prefix + 'color.text', name );\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<PanelBody className=\"edit-site-typography-panel\" initialOpen={ true }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-typography-panel__preview\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\tcolor,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tfontStyle,\n\t\t\t\t\tfontWeight,\n\t\t\t\t\tletterSpacing,\n\t\t\t\t\t...extraStyles,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\tAa\n\t\t\t</div>\n\t\t\t<Grid columns={ 2 } rowGap={ 16 } columnGap={ 8 }>\n\t\t\t\t{ element === 'heading' && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ selectedLevel }\n\t\t\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels \n\t\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h1\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H1' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h2\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H2' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h3\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H3' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h4\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H4' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h5\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H5' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h6\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H6' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<FontFamilyControl\n\t\t\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ hasFontSizeEnabled && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<FontSizePicker\n\t\t\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ hasAppearanceControl && (\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) }\n\t\t\t\t{ hasLineHeightEnabled && (\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) }\n\t\t\t\t{ hasLetterSpacingControl && (\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) }\n\t\t\t\t{ hasTextTransformControl && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<TextTransformControl\n\t\t\t\t\t\t\tvalue={ textTransform }\n\t\t\t\t\t\t\tonChange={ setTextTransform }\n\t\t\t\t\t\t\tshowNone\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</Grid>\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["useHasTypographyPanel","name","hasFontFamily","useHasFontFamilyControl","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","fontFamilies","length","hasFontStyles","hasFontWeights","useAppearanceControlLabel","element","setting","useHasTextTransformControl","useStyleWithReset","path","blockName","style","setStyle","userStyle","hasStyle","resetStyle","undefined","useFontAppearance","prefix","fontStyle","setFontStyle","userFontStyle","fontWeight","setFontWeight","userFontWeight","resetFontAppearance","TypographyPanel","headingLevel","fluidTypography","fontSizes","fontSizesWithFluidValues","map","font","size","fluid","disableCustomFontSizes","hasFontFamilyEnabled","hasLineHeightEnabled","hasAppearanceControl","appearanceControlLabel","hasLetterSpacingControl","hasTextTransformControl","hasFontSizeEnabled","fontFamily","setFontFamily","resetFontFamily","fontSize","setFontSize","hasFontSize","resetFontSize","lineHeight","setLineHeight","resetLineHeight","letterSpacing","setLetterSpacing","resetLetterSpacing","textTransform","setTextTransform","hasTextTransform","resetTextTransform","resetAll","newFontStyle","newFontWeight"],"mappings":";;;;;;;;;;AAGA;;AAOA;;AAKA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAeA;AACA;AACA;AAIO,SAASA,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,GAAG,2CAAgCT,IAAhC,CAAj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IAAA,QAAQ,EAAGiB,gBAFZ;AAGC,IAAA,UAAU,EAAGC,kBAHd;AAIC,IAAA,gBAAgB;AAJjB,KAMC,4BAAC,+CAAD;AACC,IAAA,KAAK,EAAGH,aADT;AAEC,IAAA,QAAQ,EAAGC,gBAFZ;AAGC,IAAA,QAAQ,MAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,IAAI,EAAC,kBALN;AAMC,IAAA,uBAAuB;AANxB,IAND,CAhGF,CADD;AAmHA","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} 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';\nimport { getTypographyFontSizeValue } from './typography-utils';\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 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 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( { name, element, headingLevel } ) {\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 [ fluidTypography ] = useSetting( 'typography.fluid', name );\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\n\n\t// Convert static font size values to fluid font sizes if fluidTypography is activated.\n\tconst fontSizesWithFluidValues = fontSizes.map( ( font ) => {\n\t\tif ( !! fluidTypography ) {\n\t\t\tfont.size = getTypographyFontSizeValue( font, {\n\t\t\t\tfluid: fluidTypography,\n\t\t\t} );\n\t\t}\n\t\treturn font;\n\t} );\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\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\tuseStyleWithReset( 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\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={ fontSizesWithFluidValues }\n\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\twithReset={ false }\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</ToolsPanel>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TypographyPreview;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _hooks = require("./hooks");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
function TypographyPreview(_ref) {
|
|
16
|
+
let {
|
|
17
|
+
name,
|
|
18
|
+
element,
|
|
19
|
+
headingLevel
|
|
20
|
+
} = _ref;
|
|
21
|
+
let prefix = '';
|
|
22
|
+
|
|
23
|
+
if (element === 'heading') {
|
|
24
|
+
prefix = `elements.${headingLevel}.`;
|
|
25
|
+
} else if (element && element !== 'text') {
|
|
26
|
+
prefix = `elements.${element}.`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const [fontFamily] = (0, _hooks.useStyle)(prefix + 'typography.fontFamily', name);
|
|
30
|
+
const [gradientValue] = (0, _hooks.useStyle)(prefix + 'color.gradient', name);
|
|
31
|
+
const [backgroundColor] = (0, _hooks.useStyle)(prefix + 'color.background', name);
|
|
32
|
+
const [color] = (0, _hooks.useStyle)(prefix + 'color.text', name);
|
|
33
|
+
const [fontSize] = (0, _hooks.useStyle)(prefix + 'typography.fontSize', name);
|
|
34
|
+
const [fontStyle] = (0, _hooks.useStyle)(prefix + 'typography.fontStyle', name);
|
|
35
|
+
const [fontWeight] = (0, _hooks.useStyle)(prefix + 'typography.fontWeight', name);
|
|
36
|
+
const [letterSpacing] = (0, _hooks.useStyle)(prefix + 'typography.letterSpacing', name);
|
|
37
|
+
const extraStyles = element === 'link' ? {
|
|
38
|
+
textDecoration: 'underline'
|
|
39
|
+
} : {};
|
|
40
|
+
return (0, _element.createElement)("div", {
|
|
41
|
+
className: "edit-site-typography-preview",
|
|
42
|
+
style: {
|
|
43
|
+
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
|
|
44
|
+
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
|
|
45
|
+
color,
|
|
46
|
+
fontSize,
|
|
47
|
+
fontStyle,
|
|
48
|
+
fontWeight,
|
|
49
|
+
letterSpacing,
|
|
50
|
+
...extraStyles
|
|
51
|
+
}
|
|
52
|
+
}, "Aa");
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=typography-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-preview.js"],"names":["TypographyPreview","name","element","headingLevel","prefix","fontFamily","gradientValue","backgroundColor","color","fontSize","fontStyle","fontWeight","letterSpacing","extraStyles","textDecoration","background"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,iBAAT,OAA8D;AAA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AAET,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 * Internal dependencies\n */\nimport { useStyle } from './hooks';\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 ] = useStyle( prefix + 'typography.fontFamily', name );\n\tconst [ gradientValue ] = useStyle( prefix + 'color.gradient', name );\n\tconst [ backgroundColor ] = useStyle( prefix + 'color.background', name );\n\tconst [ color ] = useStyle( prefix + 'color.text', name );\n\tconst [ fontSize ] = useStyle( prefix + 'typography.fontSize', name );\n\tconst [ fontStyle ] = useStyle( prefix + 'typography.fontStyle', name );\n\tconst [ fontWeight ] = useStyle( prefix + 'typography.fontWeight', name );\n\tconst [ letterSpacing ] = useStyle(\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"]}
|