@wordpress/edit-site 4.15.0 → 4.16.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-editor/resizable-editor.js +11 -35
  3. package/build/components/block-editor/resizable-editor.js.map +1 -1
  4. package/build/components/global-styles/palette.js +2 -2
  5. package/build/components/global-styles/palette.js.map +1 -1
  6. package/build/components/global-styles/preview.js +2 -2
  7. package/build/components/global-styles/preview.js.map +1 -1
  8. package/build/components/global-styles/screen-typography-element.js +49 -2
  9. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  10. package/build/components/global-styles/typography-panel.js +128 -81
  11. package/build/components/global-styles/typography-panel.js.map +1 -1
  12. package/build/components/global-styles/typography-preview.js +54 -0
  13. package/build/components/global-styles/typography-preview.js.map +1 -0
  14. package/build/components/global-styles/use-global-styles-output.js +7 -7
  15. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  16. package/build/components/main-dashboard-button/index.js +2 -2
  17. package/build/components/main-dashboard-button/index.js.map +1 -1
  18. package/build/index.js +20 -1
  19. package/build/index.js.map +1 -1
  20. package/build-module/components/block-editor/resizable-editor.js +10 -34
  21. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  22. package/build-module/components/global-styles/palette.js +2 -2
  23. package/build-module/components/global-styles/palette.js.map +1 -1
  24. package/build-module/components/global-styles/preview.js +2 -2
  25. package/build-module/components/global-styles/preview.js.map +1 -1
  26. package/build-module/components/global-styles/screen-typography-element.js +48 -2
  27. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  28. package/build-module/components/global-styles/typography-panel.js +129 -83
  29. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  30. package/build-module/components/global-styles/typography-preview.js +46 -0
  31. package/build-module/components/global-styles/typography-preview.js.map +1 -0
  32. package/build-module/components/global-styles/use-global-styles-output.js +7 -7
  33. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  34. package/build-module/components/main-dashboard-button/index.js +3 -3
  35. package/build-module/components/main-dashboard-button/index.js.map +1 -1
  36. package/build-module/index.js +19 -1
  37. package/build-module/index.js.map +1 -1
  38. package/build-style/style-rtl.css +4 -4
  39. package/build-style/style.css +4 -4
  40. package/package.json +29 -29
  41. package/src/components/block-editor/resizable-editor.js +8 -37
  42. package/src/components/global-styles/palette.js +9 -5
  43. package/src/components/global-styles/preview.js +2 -2
  44. package/src/components/global-styles/screen-typography-element.js +65 -1
  45. package/src/components/global-styles/style.scss +3 -3
  46. package/src/components/global-styles/typography-panel.js +192 -150
  47. package/src/components/global-styles/typography-preview.js +49 -0
  48. package/src/components/global-styles/use-global-styles-output.js +15 -9
  49. package/src/components/main-dashboard-button/index.js +3 -3
  50. package/src/components/sidebar/style.scss +1 -1
  51. package/src/index.js +21 -0
@@ -24,11 +24,18 @@ var _hooks = require("./hooks");
24
24
  * Internal dependencies
25
25
  */
26
26
  function useHasTypographyPanel(name) {
27
+ const hasFontFamily = useHasFontFamilyControl(name);
27
28
  const hasLineHeight = useHasLineHeightControl(name);
28
29
  const hasFontAppearance = useHasAppearanceControl(name);
29
30
  const hasLetterSpacing = useHasLetterSpacingControl(name);
30
31
  const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
31
- return hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize');
32
+ return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize');
33
+ }
34
+
35
+ function useHasFontFamilyControl(name) {
36
+ const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
37
+ const [fontFamilies] = (0, _hooks.useSetting)('typography.fontFamilies', name);
38
+ return supports.includes('fontFamily') && !!(fontFamilies !== null && fontFamilies !== void 0 && fontFamilies.length);
32
39
  }
33
40
 
34
41
  function useHasLineHeightControl(name) {
@@ -43,6 +50,22 @@ function useHasAppearanceControl(name) {
43
50
  return hasFontStyles || hasFontWeights;
44
51
  }
45
52
 
53
+ function useAppearanceControlLabel(name) {
54
+ const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
55
+ const hasFontStyles = (0, _hooks.useSetting)('typography.fontStyle', name)[0] && supports.includes('fontStyle');
56
+ const hasFontWeights = (0, _hooks.useSetting)('typography.fontWeight', name)[0] && supports.includes('fontWeight');
57
+
58
+ if (!hasFontStyles) {
59
+ return (0, _i18n.__)('Font weight');
60
+ }
61
+
62
+ if (!hasFontWeights) {
63
+ return (0, _i18n.__)('Font style');
64
+ }
65
+
66
+ return (0, _i18n.__)('Appearance');
67
+ }
68
+
46
69
  function useHasLetterSpacingControl(name, element) {
47
70
  const setting = (0, _hooks.useSetting)('typography.letterSpacing', name)[0];
48
71
 
@@ -73,17 +96,51 @@ function useHasTextTransformControl(name, element) {
73
96
  return supports.includes('textTransform');
74
97
  }
75
98
 
99
+ function useStyleWithReset(path, blockName) {
100
+ const [style, setStyle] = (0, _hooks.useStyle)(path, blockName);
101
+ const [userStyle] = (0, _hooks.useStyle)(path, blockName, 'user');
102
+
103
+ const hasStyle = () => !!userStyle;
104
+
105
+ const resetStyle = () => setStyle(undefined);
106
+
107
+ return [style, setStyle, hasStyle, resetStyle];
108
+ }
109
+
110
+ function useFontAppearance(prefix, name) {
111
+ const [fontStyle, setFontStyle] = (0, _hooks.useStyle)(prefix + 'typography.fontStyle', name);
112
+ const [userFontStyle] = (0, _hooks.useStyle)(prefix + 'typography.fontStyle', name, 'user');
113
+ const [fontWeight, setFontWeight] = (0, _hooks.useStyle)(prefix + 'typography.fontWeight', name);
114
+ const [userFontWeight] = (0, _hooks.useStyle)(prefix + 'typography.fontWeight', name, 'user');
115
+
116
+ const hasFontAppearance = () => !!userFontStyle || !!userFontWeight;
117
+
118
+ const resetFontAppearance = () => {
119
+ setFontStyle(undefined);
120
+ setFontWeight(undefined);
121
+ };
122
+
123
+ return {
124
+ fontStyle,
125
+ setFontStyle,
126
+ fontWeight,
127
+ setFontWeight,
128
+ hasFontAppearance,
129
+ resetFontAppearance
130
+ };
131
+ }
132
+
76
133
  function TypographyPanel(_ref) {
77
134
  let {
78
135
  name,
79
- element
136
+ element,
137
+ headingLevel
80
138
  } = _ref;
81
- const [selectedLevel, setCurrentTab] = (0, _element.useState)('heading');
82
139
  const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
83
140
  let prefix = '';
84
141
 
85
142
  if (element === 'heading') {
86
- prefix = `elements.${selectedLevel}.`;
143
+ prefix = `elements.${headingLevel}.`;
87
144
  } else if (element && element !== 'text') {
88
145
  prefix = `elements.${element}.`;
89
146
  }
@@ -93,102 +150,77 @@ function TypographyPanel(_ref) {
93
150
  const [fontFamilies] = (0, _hooks.useSetting)('typography.fontFamilies', name);
94
151
  const hasFontStyles = (0, _hooks.useSetting)('typography.fontStyle', name)[0] && supports.includes('fontStyle');
95
152
  const hasFontWeights = (0, _hooks.useSetting)('typography.fontWeight', name)[0] && supports.includes('fontWeight');
153
+ const hasFontFamilyEnabled = useHasFontFamilyControl(name);
96
154
  const hasLineHeightEnabled = useHasLineHeightControl(name);
97
155
  const hasAppearanceControl = useHasAppearanceControl(name);
156
+ const appearanceControlLabel = useAppearanceControlLabel(name);
98
157
  const hasLetterSpacingControl = useHasLetterSpacingControl(name, element);
99
158
  const hasTextTransformControl = useHasTextTransformControl(name, element);
100
159
  /* Disable font size controls when the option to style all headings is selected. */
101
160
 
102
161
  let hasFontSizeEnabled = supports.includes('fontSize');
103
162
 
104
- if (element === 'heading' && selectedLevel === 'heading') {
163
+ if (element === 'heading' && headingLevel === 'heading') {
105
164
  hasFontSizeEnabled = false;
106
165
  }
107
166
 
108
- const [fontFamily, setFontFamily] = (0, _hooks.useStyle)(prefix + 'typography.fontFamily', name);
109
- const [fontSize, setFontSize] = (0, _hooks.useStyle)(prefix + 'typography.fontSize', name);
110
- const [fontStyle, setFontStyle] = (0, _hooks.useStyle)(prefix + 'typography.fontStyle', name);
111
- const [fontWeight, setFontWeight] = (0, _hooks.useStyle)(prefix + 'typography.fontWeight', name);
112
- const [lineHeight, setLineHeight] = (0, _hooks.useStyle)(prefix + 'typography.lineHeight', name);
113
- const [letterSpacing, setLetterSpacing] = (0, _hooks.useStyle)(prefix + 'typography.letterSpacing', name);
114
- const [textTransform, setTextTransform] = (0, _hooks.useStyle)(prefix + 'typography.textTransform', name);
115
- const [backgroundColor] = (0, _hooks.useStyle)(prefix + 'color.background', name);
116
- const [gradientValue] = (0, _hooks.useStyle)(prefix + 'color.gradient', name);
117
- const [color] = (0, _hooks.useStyle)(prefix + 'color.text', name);
118
- const extraStyles = element === 'link' ? {
119
- textDecoration: 'underline'
120
- } : {};
121
- return (0, _element.createElement)(_components.PanelBody, {
122
- className: "edit-site-typography-panel",
123
- initialOpen: true
124
- }, (0, _element.createElement)("div", {
125
- className: "edit-site-typography-panel__preview",
126
- style: {
127
- fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
128
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
129
- color,
130
- fontSize,
131
- fontStyle,
132
- fontWeight,
133
- letterSpacing,
134
- ...extraStyles
135
- }
136
- }, "Aa"), (0, _element.createElement)(_components.__experimentalGrid, {
137
- columns: 2,
138
- rowGap: 16,
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"
167
+ const [fontFamily, setFontFamily, hasFontFamily, resetFontFamily] = useStyleWithReset(prefix + 'typography.fontFamily', name);
168
+ const [fontSize, setFontSize, hasFontSize, resetFontSize] = useStyleWithReset(prefix + 'typography.fontSize', name);
169
+ const {
170
+ fontStyle,
171
+ setFontStyle,
172
+ fontWeight,
173
+ setFontWeight,
174
+ hasFontAppearance,
175
+ resetFontAppearance
176
+ } = useFontAppearance(prefix, name);
177
+ const [lineHeight, setLineHeight, hasLineHeight, resetLineHeight] = useStyleWithReset(prefix + 'typography.lineHeight', name);
178
+ const [letterSpacing, setLetterSpacing, hasLetterSpacing, resetLetterSpacing] = useStyleWithReset(prefix + 'typography.letterSpacing', name);
179
+ const [textTransform, setTextTransform, hasTextTransform, resetTextTransform] = useStyleWithReset(prefix + 'typography.textTransform', name);
180
+
181
+ const resetAll = () => {
182
+ resetFontFamily();
183
+ resetFontSize();
184
+ resetFontAppearance();
185
+ resetLineHeight();
186
+ resetLetterSpacing();
187
+ resetTextTransform();
188
+ };
189
+
190
+ return (0, _element.createElement)(_components.__experimentalToolsPanel, {
191
+ label: (0, _i18n.__)('Typography'),
192
+ resetAll: resetAll
193
+ }, hasFontFamilyEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
194
+ label: (0, _i18n.__)('Font family'),
195
+ hasValue: hasFontFamily,
196
+ onDeselect: resetFontFamily,
197
+ isShownByDefault: true
176
198
  }, (0, _element.createElement)(_blockEditor.__experimentalFontFamilyControl, {
177
199
  fontFamilies: fontFamilies,
178
200
  value: fontFamily,
179
201
  onChange: setFontFamily,
180
202
  size: "__unstable-large",
181
203
  __nextHasNoMarginBottom: true
182
- })), hasFontSizeEnabled && (0, _element.createElement)("div", {
183
- className: "edit-site-typography-panel__full-width-control"
204
+ })), hasFontSizeEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
205
+ label: (0, _i18n.__)('Font size'),
206
+ hasValue: hasFontSize,
207
+ onDeselect: resetFontSize,
208
+ isShownByDefault: true
184
209
  }, (0, _element.createElement)(_components.FontSizePicker, {
185
210
  value: fontSize,
186
211
  onChange: setFontSize,
187
212
  fontSizes: fontSizes,
188
213
  disableCustomFontSizes: disableCustomFontSizes,
214
+ withReset: false,
189
215
  size: "__unstable-large",
190
216
  __nextHasNoMarginBottom: true
191
- })), hasAppearanceControl && (0, _element.createElement)(_blockEditor.__experimentalFontAppearanceControl, {
217
+ })), hasAppearanceControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
218
+ className: "single-column",
219
+ label: appearanceControlLabel,
220
+ hasValue: hasFontAppearance,
221
+ onDeselect: resetFontAppearance,
222
+ isShownByDefault: true
223
+ }, (0, _element.createElement)(_blockEditor.__experimentalFontAppearanceControl, {
192
224
  value: {
193
225
  fontStyle,
194
226
  fontWeight
@@ -205,19 +237,34 @@ function TypographyPanel(_ref) {
205
237
  hasFontWeights: hasFontWeights,
206
238
  size: "__unstable-large",
207
239
  __nextHasNoMarginBottom: true
208
- }), hasLineHeightEnabled && (0, _element.createElement)(_blockEditor.LineHeightControl, {
240
+ })), hasLineHeightEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
241
+ className: "single-column",
242
+ label: (0, _i18n.__)('Line height'),
243
+ hasValue: hasLineHeight,
244
+ onDeselect: resetLineHeight,
245
+ isShownByDefault: true
246
+ }, (0, _element.createElement)(_blockEditor.LineHeightControl, {
209
247
  __nextHasNoMarginBottom: true,
210
248
  __unstableInputWidth: "auto",
211
249
  value: lineHeight,
212
250
  onChange: setLineHeight,
213
251
  size: "__unstable-large"
214
- }), hasLetterSpacingControl && (0, _element.createElement)(_blockEditor.__experimentalLetterSpacingControl, {
252
+ })), hasLetterSpacingControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
253
+ className: "single-column",
254
+ label: (0, _i18n.__)('Letter spacing'),
255
+ hasValue: hasLetterSpacing,
256
+ onDeselect: resetLetterSpacing,
257
+ isShownByDefault: true
258
+ }, (0, _element.createElement)(_blockEditor.__experimentalLetterSpacingControl, {
215
259
  value: letterSpacing,
216
260
  onChange: setLetterSpacing,
217
261
  size: "__unstable-large",
218
262
  __unstableInputWidth: "auto"
219
- }), hasTextTransformControl && (0, _element.createElement)("div", {
220
- className: "edit-site-typography-panel__full-width-control"
263
+ })), hasTextTransformControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
264
+ label: (0, _i18n.__)('Letter case'),
265
+ hasValue: hasTextTransform,
266
+ onDeselect: resetTextTransform,
267
+ isShownByDefault: true
221
268
  }, (0, _element.createElement)(_blockEditor.__experimentalTextTransformControl, {
222
269
  value: textTransform,
223
270
  onChange: setTextTransform,
@@ -225,6 +272,6 @@ function TypographyPanel(_ref) {
225
272
  isBlock: true,
226
273
  size: "__unstable-large",
227
274
  __nextHasNoMarginBottom: true
228
- }))));
275
+ })));
229
276
  }
230
277
  //# 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,EAAyC;AACxC,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,QAAMS,aAAa,GAClB,uBAAY,sBAAZ,EAAoCT,IAApC,EAA4C,CAA5C,KACAO,QAAQ,CAACC,QAAT,CAAmB,WAAnB,CAFD;AAGA,QAAME,cAAc,GACnB,uBAAY,uBAAZ,EAAqCV,IAArC,EAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD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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","fontSizes","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;;AApBA;AACA;AACA;;AAeA;AACA;AACA;AAGO,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,CAAjB;AACA,SACCC,aAAa,IACbE,aADA,IAEAE,iBAFA,IAGAE,gBAHA,IAIAE,QAAQ,CAACC,QAAT,CAAmB,UAAnB,CALD;AAOA;;AAED,SAASR,uBAAT,CAAkCF,IAAlC,EAAyC;AACxC,QAAMS,QAAQ,GAAG,2CAAgCT,IAAhC,CAAjB;AACA,QAAM,CAAEW,YAAF,IAAmB,uBAAY,yBAAZ,EAAuCX,IAAvC,CAAzB;AACA,SAAOS,QAAQ,CAACC,QAAT,CAAmB,YAAnB,KAAqC,CAA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KAAK,EAAGF,UAHT;AAIC,IAAA,QAAQ,EAAGC,aAJZ;AAKC,IAAA,IAAI,EAAC;AALN,IAPD,CA/DF,EA+EGX,uBAAuB,IACxB,4BAAC,wCAAD;AACC,IAAA,SAAS,EAAC,eADX;AAEC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CAFT;AAGC,IAAA,QAAQ,EAAGtC,gBAHZ;AAIC,IAAA,UAAU,EAAGqD,kBAJd;AAKC,IAAA,gBAAgB;AALjB,KAOC,4BAAC,+CAAD;AACC,IAAA,KAAK,EAAGF,aADT;AAEC,IAAA,QAAQ,EAAGC,gBAFZ;AAGC,IAAA,IAAI,EAAC,kBAHN;AAIC,IAAA,oBAAoB,EAAC;AAJtB,IAPD,CAhFF,EA+FGb,uBAAuB,IACxB,4BAAC,wCAAD;AACC,IAAA,KAAK,EAAG,cAAI,aAAJ,CADT;AAEC,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';\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 [ 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 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={ fontSizes }\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;AAAA,MAAlC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,OAAR;AAAiBC,IAAAA;AAAjB,GAAkC;AAC5E,MAAIC,MAAM,GAAG,EAAb;;AACA,MAAKF,OAAO,KAAK,SAAjB,EAA6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O;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"]}
@@ -400,7 +400,7 @@ const getNodesWithStyles = (tree, blockSelectors) => {
400
400
  return nodes;
401
401
  }
402
402
 
403
- const pickStyleKeys = treeToPickFrom => (0, _lodash.pickBy)(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography', 'filter'].includes(key)); // Top-level.
403
+ const pickStyleKeys = treeToPickFrom => (0, _lodash.pickBy)(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography', 'filter', 'outline', 'shadow'].includes(key)); // Top-level.
404
404
 
405
405
 
406
406
  const styles = pickStyleKeys(tree.styles);
@@ -577,12 +577,12 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
577
577
  }
578
578
 
579
579
  if (useRootPaddingAlign) {
580
- ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
581
- .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
582
- .has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
583
- .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
584
- .has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
585
- .has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),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); }
580
+ ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
581
+ .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
582
+ .has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
583
+ .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
584
+ .has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
585
+ .has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),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); }
586
586
  .has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
587
587
  }
588
588