@wordpress/block-editor 11.3.2 → 11.4.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 (262) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -4
  3. package/build/components/block-actions/index.js +2 -7
  4. package/build/components/block-actions/index.js.map +1 -1
  5. package/build/components/block-alignment-control/use-available-alignments.js +5 -3
  6. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  7. package/build/components/block-popover/inbetween.js +10 -33
  8. package/build/components/block-popover/inbetween.js.map +1 -1
  9. package/build/components/block-tools/selected-block-popover.js +2 -2
  10. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  11. package/build/components/block-types-list/index.native.js +2 -0
  12. package/build/components/block-types-list/index.native.js.map +1 -1
  13. package/build/components/colors-gradients/control.js +6 -3
  14. package/build/components/colors-gradients/control.js.map +1 -1
  15. package/build/components/font-appearance-control/index.js +0 -3
  16. package/build/components/font-appearance-control/index.js.map +1 -1
  17. package/build/components/global-styles/hooks.js +106 -45
  18. package/build/components/global-styles/hooks.js.map +1 -1
  19. package/build/components/global-styles/index.js +24 -0
  20. package/build/components/global-styles/index.js.map +1 -1
  21. package/build/components/global-styles/typography-panel.js +421 -0
  22. package/build/components/global-styles/typography-panel.js.map +1 -0
  23. package/build/components/global-styles/use-global-styles-output.js +6 -2
  24. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  25. package/build/components/iframe/index.js +17 -11
  26. package/build/components/iframe/index.js.map +1 -1
  27. package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
  28. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  29. package/build/components/image-size-control/index.js +6 -11
  30. package/build/components/image-size-control/index.js.map +1 -1
  31. package/build/components/inserter/block-patterns-tab.js +9 -15
  32. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  33. package/build/components/inserter/block-types-tab.native.js +4 -1
  34. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  35. package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
  36. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  37. package/build/components/inserter/search-results.native.js +4 -1
  38. package/build/components/inserter/search-results.native.js.map +1 -1
  39. package/build/components/link-control/index.js +15 -15
  40. package/build/components/link-control/index.js.map +1 -1
  41. package/build/components/link-control/settings-drawer.js +72 -30
  42. package/build/components/link-control/settings-drawer.js.map +1 -1
  43. package/build/components/link-control/settings.js +52 -0
  44. package/build/components/link-control/settings.js.map +1 -0
  45. package/build/components/list-view/index.js +6 -1
  46. package/build/components/list-view/index.js.map +1 -1
  47. package/build/components/off-canvas-editor/block-contents.js +5 -4
  48. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  49. package/build/components/off-canvas-editor/leaf-more-menu.js +116 -0
  50. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
  51. package/build/components/off-canvas-editor/link-ui.js +1 -0
  52. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  53. package/build/components/provider/index.js +2 -2
  54. package/build/components/provider/index.js.map +1 -1
  55. package/build/components/rich-text/index.js +0 -2
  56. package/build/components/rich-text/index.js.map +1 -1
  57. package/build/components/url-input/index.js +2 -2
  58. package/build/components/url-input/index.js.map +1 -1
  59. package/build/components/url-popover/index.js +6 -1
  60. package/build/components/url-popover/index.js.map +1 -1
  61. package/build/hooks/dimensions.js +8 -2
  62. package/build/hooks/dimensions.js.map +1 -1
  63. package/build/hooks/font-family.js +2 -76
  64. package/build/hooks/font-family.js.map +1 -1
  65. package/build/hooks/font-size.js +3 -51
  66. package/build/hooks/font-size.js.map +1 -1
  67. package/build/hooks/gap.js +2 -1
  68. package/build/hooks/gap.js.map +1 -1
  69. package/build/hooks/index.js +2 -0
  70. package/build/hooks/index.js.map +1 -1
  71. package/build/hooks/line-height.js +0 -42
  72. package/build/hooks/line-height.js.map +1 -1
  73. package/build/hooks/metadata.js +6 -0
  74. package/build/hooks/metadata.js.map +1 -1
  75. package/build/hooks/position.js +6 -1
  76. package/build/hooks/position.js.map +1 -1
  77. package/build/hooks/typography.js +112 -127
  78. package/build/hooks/typography.js.map +1 -1
  79. package/build/index.js +6 -6
  80. package/build/index.js.map +1 -1
  81. package/build/layouts/flow.js +23 -2
  82. package/build/layouts/flow.js.map +1 -1
  83. package/build/lock-unlock.js +19 -0
  84. package/build/lock-unlock.js.map +1 -0
  85. package/build/{experiments.js → private-apis.js} +12 -19
  86. package/build/private-apis.js.map +1 -0
  87. package/build/{experiments.native.js → private-apis.native.js} +9 -19
  88. package/build/private-apis.native.js.map +1 -0
  89. package/build/store/index.js +3 -3
  90. package/build/store/index.js.map +1 -1
  91. package/build/store/selectors.js +18 -1
  92. package/build/store/selectors.js.map +1 -1
  93. package/build-module/components/block-actions/index.js +2 -7
  94. package/build-module/components/block-actions/index.js.map +1 -1
  95. package/build-module/components/block-alignment-control/use-available-alignments.js +5 -3
  96. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  97. package/build-module/components/block-popover/inbetween.js +10 -33
  98. package/build-module/components/block-popover/inbetween.js.map +1 -1
  99. package/build-module/components/block-tools/selected-block-popover.js +1 -1
  100. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  101. package/build-module/components/block-types-list/index.native.js +2 -0
  102. package/build-module/components/block-types-list/index.native.js.map +1 -1
  103. package/build-module/components/colors-gradients/control.js +6 -3
  104. package/build-module/components/colors-gradients/control.js.map +1 -1
  105. package/build-module/components/font-appearance-control/index.js +2 -1
  106. package/build-module/components/font-appearance-control/index.js.map +1 -1
  107. package/build-module/components/global-styles/hooks.js +100 -46
  108. package/build-module/components/global-styles/hooks.js.map +1 -1
  109. package/build-module/components/global-styles/index.js +2 -1
  110. package/build-module/components/global-styles/index.js.map +1 -1
  111. package/build-module/components/global-styles/typography-panel.js +400 -0
  112. package/build-module/components/global-styles/typography-panel.js.map +1 -0
  113. package/build-module/components/global-styles/use-global-styles-output.js +6 -2
  114. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  115. package/build-module/components/iframe/index.js +17 -11
  116. package/build-module/components/iframe/index.js.map +1 -1
  117. package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
  118. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  119. package/build-module/components/image-size-control/index.js +7 -12
  120. package/build-module/components/image-size-control/index.js.map +1 -1
  121. package/build-module/components/inserter/block-patterns-tab.js +9 -15
  122. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  123. package/build-module/components/inserter/block-types-tab.native.js +3 -1
  124. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  125. package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
  126. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  127. package/build-module/components/inserter/search-results.native.js +3 -1
  128. package/build-module/components/inserter/search-results.native.js.map +1 -1
  129. package/build-module/components/link-control/index.js +16 -16
  130. package/build-module/components/link-control/index.js.map +1 -1
  131. package/build-module/components/link-control/settings-drawer.js +68 -30
  132. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  133. package/build-module/components/link-control/settings.js +43 -0
  134. package/build-module/components/link-control/settings.js.map +1 -0
  135. package/build-module/components/list-view/index.js +6 -1
  136. package/build-module/components/list-view/index.js.map +1 -1
  137. package/build-module/components/off-canvas-editor/block-contents.js +4 -3
  138. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  139. package/build-module/components/off-canvas-editor/leaf-more-menu.js +99 -0
  140. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
  141. package/build-module/components/off-canvas-editor/link-ui.js +1 -0
  142. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  143. package/build-module/components/provider/index.js +1 -1
  144. package/build-module/components/provider/index.js.map +1 -1
  145. package/build-module/components/rich-text/index.js +0 -2
  146. package/build-module/components/rich-text/index.js.map +1 -1
  147. package/build-module/components/url-input/index.js +2 -2
  148. package/build-module/components/url-input/index.js.map +1 -1
  149. package/build-module/components/url-popover/index.js +6 -2
  150. package/build-module/components/url-popover/index.js.map +1 -1
  151. package/build-module/hooks/dimensions.js +7 -1
  152. package/build-module/hooks/dimensions.js.map +1 -1
  153. package/build-module/hooks/font-family.js +3 -69
  154. package/build-module/hooks/font-family.js.map +1 -1
  155. package/build-module/hooks/font-size.js +6 -47
  156. package/build-module/hooks/font-size.js.map +1 -1
  157. package/build-module/hooks/gap.js +3 -2
  158. package/build-module/hooks/gap.js.map +1 -1
  159. package/build-module/hooks/index.js +1 -0
  160. package/build-module/hooks/index.js.map +1 -1
  161. package/build-module/hooks/line-height.js +0 -38
  162. package/build-module/hooks/line-height.js.map +1 -1
  163. package/build-module/hooks/metadata.js +6 -0
  164. package/build-module/hooks/metadata.js.map +1 -1
  165. package/build-module/hooks/position.js +5 -1
  166. package/build-module/hooks/position.js.map +1 -1
  167. package/build-module/hooks/typography.js +110 -123
  168. package/build-module/hooks/typography.js.map +1 -1
  169. package/build-module/index.js +1 -1
  170. package/build-module/index.js.map +1 -1
  171. package/build-module/layouts/flow.js +23 -2
  172. package/build-module/layouts/flow.js.map +1 -1
  173. package/build-module/lock-unlock.js +9 -0
  174. package/build-module/lock-unlock.js.map +1 -0
  175. package/build-module/private-apis.js +19 -0
  176. package/build-module/private-apis.js.map +1 -0
  177. package/build-module/private-apis.native.js +15 -0
  178. package/build-module/private-apis.native.js.map +1 -0
  179. package/build-module/store/index.js +1 -1
  180. package/build-module/store/index.js.map +1 -1
  181. package/build-module/store/selectors.js +18 -1
  182. package/build-module/store/selectors.js.map +1 -1
  183. package/build-style/style-rtl.css +35 -22
  184. package/build-style/style.css +35 -22
  185. package/package.json +31 -31
  186. package/src/components/block-actions/index.js +0 -9
  187. package/src/components/block-alignment-control/use-available-alignments.js +17 -12
  188. package/src/components/block-popover/inbetween.js +21 -53
  189. package/src/components/block-tools/selected-block-popover.js +1 -1
  190. package/src/components/block-types-list/index.native.js +2 -0
  191. package/src/components/colors-gradients/control.js +3 -0
  192. package/src/components/font-appearance-control/index.js +1 -1
  193. package/src/components/global-styles/hooks.js +186 -66
  194. package/src/components/global-styles/index.js +5 -0
  195. package/src/components/global-styles/typography-panel.js +403 -0
  196. package/src/components/global-styles/use-global-styles-output.js +6 -2
  197. package/src/components/iframe/index.js +20 -18
  198. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
  199. package/src/components/image-size-control/index.js +10 -12
  200. package/src/components/image-size-control/style.scss +3 -21
  201. package/src/components/inserter/block-patterns-tab.js +9 -23
  202. package/src/components/inserter/block-types-tab.native.js +2 -0
  203. package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
  204. package/src/components/inserter/search-results.native.js +2 -0
  205. package/src/components/link-control/index.js +22 -22
  206. package/src/components/link-control/settings-drawer.js +85 -30
  207. package/src/components/link-control/settings.js +41 -0
  208. package/src/components/link-control/style.scss +39 -7
  209. package/src/components/link-control/test/index.js +213 -4
  210. package/src/components/list-view/index.js +5 -0
  211. package/src/components/off-canvas-editor/block-contents.js +3 -2
  212. package/src/components/off-canvas-editor/leaf-more-menu.js +115 -0
  213. package/src/components/off-canvas-editor/link-ui.js +1 -0
  214. package/src/components/provider/index.js +1 -1
  215. package/src/components/rich-text/index.js +0 -2
  216. package/src/components/url-input/index.js +3 -2
  217. package/src/components/url-popover/index.js +8 -2
  218. package/src/hooks/dimensions.js +13 -1
  219. package/src/hooks/font-family.js +0 -58
  220. package/src/hooks/font-size.js +1 -36
  221. package/src/hooks/gap.js +9 -2
  222. package/src/hooks/index.js +1 -0
  223. package/src/hooks/line-height.js +0 -33
  224. package/src/hooks/metadata.js +4 -0
  225. package/src/hooks/position.js +7 -1
  226. package/src/hooks/typography.js +133 -212
  227. package/src/index.js +1 -1
  228. package/src/layouts/flow.js +16 -1
  229. package/src/lock-unlock.js +10 -0
  230. package/src/private-apis.js +19 -0
  231. package/src/private-apis.native.js +15 -0
  232. package/src/store/index.js +1 -1
  233. package/src/store/selectors.js +16 -1
  234. package/tsconfig.json +20 -1
  235. package/build/experiments.js.map +0 -1
  236. package/build/experiments.native.js.map +0 -1
  237. package/build/hooks/font-appearance.js +0 -188
  238. package/build/hooks/font-appearance.js.map +0 -1
  239. package/build/hooks/letter-spacing.js +0 -129
  240. package/build/hooks/letter-spacing.js.map +0 -1
  241. package/build/hooks/text-decoration.js +0 -130
  242. package/build/hooks/text-decoration.js.map +0 -1
  243. package/build/hooks/text-transform.js +0 -130
  244. package/build/hooks/text-transform.js.map +0 -1
  245. package/build-module/experiments.js +0 -25
  246. package/build-module/experiments.js.map +0 -1
  247. package/build-module/experiments.native.js +0 -23
  248. package/build-module/experiments.native.js.map +0 -1
  249. package/build-module/hooks/font-appearance.js +0 -161
  250. package/build-module/hooks/font-appearance.js.map +0 -1
  251. package/build-module/hooks/letter-spacing.js +0 -107
  252. package/build-module/hooks/letter-spacing.js.map +0 -1
  253. package/build-module/hooks/text-decoration.js +0 -108
  254. package/build-module/hooks/text-decoration.js.map +0 -1
  255. package/build-module/hooks/text-transform.js +0 -108
  256. package/build-module/hooks/text-transform.js.map +0 -1
  257. package/src/experiments.js +0 -27
  258. package/src/experiments.native.js +0 -25
  259. package/src/hooks/font-appearance.js +0 -146
  260. package/src/hooks/letter-spacing.js +0 -101
  261. package/src/hooks/text-decoration.js +0 -102
  262. package/src/hooks/text-transform.js +0 -101
@@ -0,0 +1,400 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { createElement } from "@wordpress/element";
3
+
4
+ /**
5
+ * WordPress dependencies
6
+ */
7
+ import { FontSizePicker, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+
13
+ import FontFamilyControl from '../font-family';
14
+ import FontAppearanceControl from '../font-appearance-control';
15
+ import LineHeightControl from '../line-height-control';
16
+ import LetterSpacingControl from '../letter-spacing-control';
17
+ import TextTransformControl from '../text-transform-control';
18
+ import TextDecorationControl from '../text-decoration-control';
19
+ import { getValueFromVariable } from './utils';
20
+ export function useHasTypographyPanel(settings) {
21
+ const hasFontFamily = useHasFontFamilyControl(settings);
22
+ const hasLineHeight = useHasLineHeightControl(settings);
23
+ const hasFontAppearance = useHasAppearanceControl(settings);
24
+ const hasLetterSpacing = useHasLetterSpacingControl(settings);
25
+ const hasTextTransform = useHasTextTransformControl(settings);
26
+ const hasTextDecoration = useHasTextDecorationControl(settings);
27
+ const hasFontSize = useHasFontSizeControl(settings);
28
+ return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextTransform || hasFontSize || hasTextDecoration;
29
+ }
30
+
31
+ function useHasFontSizeControl(settings) {
32
+ var _settings$typography, _settings$typography$, _settings$typography2, _ref, _fontSizesPerOrigin$c;
33
+
34
+ const disableCustomFontSizes = !(settings !== null && settings !== void 0 && (_settings$typography = settings.typography) !== null && _settings$typography !== void 0 && _settings$typography.customFontSize);
35
+ const fontSizesPerOrigin = (_settings$typography$ = settings === null || settings === void 0 ? void 0 : (_settings$typography2 = settings.typography) === null || _settings$typography2 === void 0 ? void 0 : _settings$typography2.fontSizes) !== null && _settings$typography$ !== void 0 ? _settings$typography$ : {};
36
+ const fontSizes = (_ref = (_fontSizesPerOrigin$c = fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.custom) !== null && _fontSizesPerOrigin$c !== void 0 ? _fontSizesPerOrigin$c : fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.theme) !== null && _ref !== void 0 ? _ref : fontSizesPerOrigin.default;
37
+ return !!(fontSizes !== null && fontSizes !== void 0 && fontSizes.length) || !disableCustomFontSizes;
38
+ }
39
+
40
+ function useHasFontFamilyControl(settings) {
41
+ var _settings$typography3, _ref2, _fontFamiliesPerOrigi;
42
+
43
+ const fontFamiliesPerOrigin = settings === null || settings === void 0 ? void 0 : (_settings$typography3 = settings.typography) === null || _settings$typography3 === void 0 ? void 0 : _settings$typography3.fontFamilies;
44
+ const fontFamilies = (_ref2 = (_fontFamiliesPerOrigi = fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) !== null && _fontFamiliesPerOrigi !== void 0 ? _fontFamiliesPerOrigi : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) !== null && _ref2 !== void 0 ? _ref2 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default;
45
+ return !!(fontFamilies !== null && fontFamilies !== void 0 && fontFamilies.length);
46
+ }
47
+
48
+ function useHasLineHeightControl(settings) {
49
+ var _settings$typography4;
50
+
51
+ return settings === null || settings === void 0 ? void 0 : (_settings$typography4 = settings.typography) === null || _settings$typography4 === void 0 ? void 0 : _settings$typography4.lineHeight;
52
+ }
53
+
54
+ function useHasAppearanceControl(settings) {
55
+ var _settings$typography5, _settings$typography6;
56
+
57
+ const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$typography5 = settings.typography) === null || _settings$typography5 === void 0 ? void 0 : _settings$typography5.fontStyle;
58
+ const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$typography6 = settings.typography) === null || _settings$typography6 === void 0 ? void 0 : _settings$typography6.fontWeight;
59
+ return hasFontStyles || hasFontWeights;
60
+ }
61
+
62
+ function useAppearanceControlLabel(settings) {
63
+ var _settings$typography7, _settings$typography8;
64
+
65
+ const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$typography7 = settings.typography) === null || _settings$typography7 === void 0 ? void 0 : _settings$typography7.fontStyle;
66
+ const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$typography8 = settings.typography) === null || _settings$typography8 === void 0 ? void 0 : _settings$typography8.fontWeight;
67
+
68
+ if (!hasFontStyles) {
69
+ return __('Font weight');
70
+ }
71
+
72
+ if (!hasFontWeights) {
73
+ return __('Font style');
74
+ }
75
+
76
+ return __('Appearance');
77
+ }
78
+
79
+ function useHasLetterSpacingControl(settings) {
80
+ var _settings$typography9;
81
+
82
+ return settings === null || settings === void 0 ? void 0 : (_settings$typography9 = settings.typography) === null || _settings$typography9 === void 0 ? void 0 : _settings$typography9.letterSpacing;
83
+ }
84
+
85
+ function useHasTextTransformControl(settings) {
86
+ var _settings$typography10;
87
+
88
+ return settings === null || settings === void 0 ? void 0 : (_settings$typography10 = settings.typography) === null || _settings$typography10 === void 0 ? void 0 : _settings$typography10.textTransform;
89
+ }
90
+
91
+ function useHasTextDecorationControl(settings) {
92
+ var _settings$typography11;
93
+
94
+ return settings === null || settings === void 0 ? void 0 : (_settings$typography11 = settings.typography) === null || _settings$typography11 === void 0 ? void 0 : _settings$typography11.textDecoration;
95
+ }
96
+
97
+ function TypographyToolsPanel(_ref3) {
98
+ let { ...props
99
+ } = _ref3;
100
+ return createElement(ToolsPanel, _extends({
101
+ label: __('Typography')
102
+ }, props));
103
+ }
104
+
105
+ const DEFAULT_CONTROLS = {
106
+ fontFamily: true,
107
+ fontSize: true,
108
+ fontAppearance: true,
109
+ lineHeight: true,
110
+ letterSpacing: true,
111
+ textTransform: true,
112
+ textDecoration: true
113
+ };
114
+ export default function TypographyPanel(_ref4) {
115
+ var _settings$typography12, _ref5, _fontFamiliesPerOrigi2, _inheritedValue$typog, _settings$typography13, _settings$typography$2, _settings$typography14, _ref7, _fontSizesPerOrigin$c2, _inheritedValue$typog2, _settings$typography15, _settings$typography16, _inheritedValue$typog3, _inheritedValue$typog4, _inheritedValue$typog5, _inheritedValue$typog6, _inheritedValue$typog7, _inheritedValue$typog8;
116
+
117
+ let {
118
+ as: Wrapper = TypographyToolsPanel,
119
+ value,
120
+ onChange,
121
+ inheritedValue = value,
122
+ settings,
123
+ panelId,
124
+ defaultControls = DEFAULT_CONTROLS
125
+ } = _ref4;
126
+
127
+ const decodeValue = rawValue => getValueFromVariable({
128
+ settings
129
+ }, '', rawValue); // Font Family
130
+
131
+
132
+ const hasFontFamilyEnabled = useHasFontFamilyControl(settings);
133
+ const fontFamiliesPerOrigin = settings === null || settings === void 0 ? void 0 : (_settings$typography12 = settings.typography) === null || _settings$typography12 === void 0 ? void 0 : _settings$typography12.fontFamilies;
134
+ const fontFamilies = (_ref5 = (_fontFamiliesPerOrigi2 = fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) !== null && _fontFamiliesPerOrigi2 !== void 0 ? _fontFamiliesPerOrigi2 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) !== null && _ref5 !== void 0 ? _ref5 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default;
135
+ const fontFamily = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog = inheritedValue.typography) === null || _inheritedValue$typog === void 0 ? void 0 : _inheritedValue$typog.fontFamily);
136
+
137
+ const setFontFamily = newValue => {
138
+ var _fontFamilies$find;
139
+
140
+ const slug = fontFamilies === null || fontFamilies === void 0 ? void 0 : (_fontFamilies$find = fontFamilies.find(_ref6 => {
141
+ let {
142
+ fontFamily: f
143
+ } = _ref6;
144
+ return f === newValue;
145
+ })) === null || _fontFamilies$find === void 0 ? void 0 : _fontFamilies$find.slug;
146
+ onChange({ ...value,
147
+ typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
148
+ fontFamily: slug ? `var:preset|font-family|${slug}` : newValue
149
+ }
150
+ });
151
+ };
152
+
153
+ const hasFontFamily = () => {
154
+ var _value$typography;
155
+
156
+ return !!(value !== null && value !== void 0 && (_value$typography = value.typography) !== null && _value$typography !== void 0 && _value$typography.fontFamily);
157
+ };
158
+
159
+ const resetFontFamily = () => setFontFamily(undefined); // Font Size
160
+
161
+
162
+ const hasFontSizeEnabled = useHasFontSizeControl(settings);
163
+ const disableCustomFontSizes = !(settings !== null && settings !== void 0 && (_settings$typography13 = settings.typography) !== null && _settings$typography13 !== void 0 && _settings$typography13.customFontSize);
164
+ const fontSizesPerOrigin = (_settings$typography$2 = settings === null || settings === void 0 ? void 0 : (_settings$typography14 = settings.typography) === null || _settings$typography14 === void 0 ? void 0 : _settings$typography14.fontSizes) !== null && _settings$typography$2 !== void 0 ? _settings$typography$2 : {};
165
+ const fontSizes = (_ref7 = (_fontSizesPerOrigin$c2 = fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.custom) !== null && _fontSizesPerOrigin$c2 !== void 0 ? _fontSizesPerOrigin$c2 : fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.theme) !== null && _ref7 !== void 0 ? _ref7 : fontSizesPerOrigin.default;
166
+ const fontSize = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog2 = inheritedValue.typography) === null || _inheritedValue$typog2 === void 0 ? void 0 : _inheritedValue$typog2.fontSize);
167
+
168
+ const setFontSize = (newValue, metadata) => {
169
+ const actualValue = !!(metadata !== null && metadata !== void 0 && metadata.slug) ? `var:preset|font-size|${metadata === null || metadata === void 0 ? void 0 : metadata.slug}` : newValue;
170
+ onChange({ ...value,
171
+ typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
172
+ fontSize: actualValue
173
+ }
174
+ });
175
+ };
176
+
177
+ const hasFontSize = () => {
178
+ var _value$typography2;
179
+
180
+ return !!(value !== null && value !== void 0 && (_value$typography2 = value.typography) !== null && _value$typography2 !== void 0 && _value$typography2.fontSize);
181
+ };
182
+
183
+ const resetFontSize = () => setFontSize(undefined); // Appearance
184
+
185
+
186
+ const hasAppearanceControl = useHasAppearanceControl(settings);
187
+ const appearanceControlLabel = useAppearanceControlLabel(settings);
188
+ const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$typography15 = settings.typography) === null || _settings$typography15 === void 0 ? void 0 : _settings$typography15.fontStyle;
189
+ const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$typography16 = settings.typography) === null || _settings$typography16 === void 0 ? void 0 : _settings$typography16.fontWeight;
190
+ const fontStyle = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog3 = inheritedValue.typography) === null || _inheritedValue$typog3 === void 0 ? void 0 : _inheritedValue$typog3.fontStyle);
191
+ const fontWeight = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog4 = inheritedValue.typography) === null || _inheritedValue$typog4 === void 0 ? void 0 : _inheritedValue$typog4.fontWeight);
192
+
193
+ const setFontAppearance = _ref8 => {
194
+ let {
195
+ fontStyle: newFontStyle,
196
+ fontWeight: newFontWeight
197
+ } = _ref8;
198
+ onChange({ ...value,
199
+ typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
200
+ fontStyle: newFontStyle,
201
+ fontWeight: newFontWeight
202
+ }
203
+ });
204
+ };
205
+
206
+ const hasFontAppearance = () => {
207
+ var _value$typography3, _value$typography4;
208
+
209
+ return !!(value !== null && value !== void 0 && (_value$typography3 = value.typography) !== null && _value$typography3 !== void 0 && _value$typography3.fontStyle) || !!(value !== null && value !== void 0 && (_value$typography4 = value.typography) !== null && _value$typography4 !== void 0 && _value$typography4.fontWeight);
210
+ };
211
+
212
+ const resetFontAppearance = () => {
213
+ setFontAppearance({});
214
+ }; // Line Height
215
+
216
+
217
+ const hasLineHeightEnabled = useHasLineHeightControl(settings);
218
+ const lineHeight = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog5 = inheritedValue.typography) === null || _inheritedValue$typog5 === void 0 ? void 0 : _inheritedValue$typog5.lineHeight);
219
+
220
+ const setLineHeight = newValue => {
221
+ onChange({ ...value,
222
+ typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
223
+ lineHeight: newValue
224
+ }
225
+ });
226
+ };
227
+
228
+ const hasLineHeight = () => {
229
+ var _value$typography5;
230
+
231
+ return !!(value !== null && value !== void 0 && (_value$typography5 = value.typography) !== null && _value$typography5 !== void 0 && _value$typography5.lineHeight);
232
+ };
233
+
234
+ const resetLineHeight = () => setLineHeight(undefined); // Letter Spacing
235
+
236
+
237
+ const hasLetterSpacingControl = useHasLetterSpacingControl(settings);
238
+ const letterSpacing = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog6 = inheritedValue.typography) === null || _inheritedValue$typog6 === void 0 ? void 0 : _inheritedValue$typog6.letterSpacing);
239
+
240
+ const setLetterSpacing = newValue => {
241
+ onChange({ ...value,
242
+ typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
243
+ letterSpacing: newValue
244
+ }
245
+ });
246
+ };
247
+
248
+ const hasLetterSpacing = () => {
249
+ var _value$typography6;
250
+
251
+ return !!(value !== null && value !== void 0 && (_value$typography6 = value.typography) !== null && _value$typography6 !== void 0 && _value$typography6.letterSpacing);
252
+ };
253
+
254
+ const resetLetterSpacing = () => setLetterSpacing(undefined); // Text Transform
255
+
256
+
257
+ const hasTextTransformControl = useHasTextTransformControl(settings);
258
+ const textTransform = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog7 = inheritedValue.typography) === null || _inheritedValue$typog7 === void 0 ? void 0 : _inheritedValue$typog7.textTransform);
259
+
260
+ const setTextTransform = newValue => {
261
+ onChange({ ...value,
262
+ typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
263
+ textTransform: newValue
264
+ }
265
+ });
266
+ };
267
+
268
+ const hasTextTransform = () => {
269
+ var _value$typography7;
270
+
271
+ return !!(value !== null && value !== void 0 && (_value$typography7 = value.typography) !== null && _value$typography7 !== void 0 && _value$typography7.textTransform);
272
+ };
273
+
274
+ const resetTextTransform = () => setTextTransform(undefined); // Text Decoration
275
+
276
+
277
+ const hasTextDecorationControl = useHasTextDecorationControl(settings);
278
+ const textDecoration = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog8 = inheritedValue.typography) === null || _inheritedValue$typog8 === void 0 ? void 0 : _inheritedValue$typog8.textDecoration);
279
+
280
+ const setTextDecoration = newValue => {
281
+ onChange({ ...value,
282
+ typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
283
+ textDecoration: newValue
284
+ }
285
+ });
286
+ };
287
+
288
+ const hasTextDecoration = () => {
289
+ var _value$typography8;
290
+
291
+ return !!(value !== null && value !== void 0 && (_value$typography8 = value.typography) !== null && _value$typography8 !== void 0 && _value$typography8.textDecoration);
292
+ };
293
+
294
+ const resetTextDecoration = () => setTextDecoration(undefined);
295
+
296
+ const resetAll = () => {
297
+ onChange({ ...value,
298
+ typography: {}
299
+ });
300
+ };
301
+
302
+ return createElement(Wrapper, {
303
+ resetAll: resetAll
304
+ }, hasFontFamilyEnabled && createElement(ToolsPanelItem, {
305
+ label: __('Font family'),
306
+ hasValue: hasFontFamily,
307
+ onDeselect: resetFontFamily,
308
+ isShownByDefault: defaultControls.fontFamily,
309
+ panelId: panelId
310
+ }, createElement(FontFamilyControl, {
311
+ fontFamilies: fontFamilies,
312
+ value: fontFamily,
313
+ onChange: setFontFamily,
314
+ size: "__unstable-large",
315
+ __nextHasNoMarginBottom: true
316
+ })), hasFontSizeEnabled && createElement(ToolsPanelItem, {
317
+ label: __('Font size'),
318
+ hasValue: hasFontSize,
319
+ onDeselect: resetFontSize,
320
+ isShownByDefault: defaultControls.fontSize,
321
+ panelId: panelId
322
+ }, createElement(FontSizePicker, {
323
+ value: fontSize,
324
+ onChange: setFontSize,
325
+ fontSizes: fontSizes,
326
+ disableCustomFontSizes: disableCustomFontSizes,
327
+ withReset: false,
328
+ withSlider: true,
329
+ size: "__unstable-large",
330
+ __nextHasNoMarginBottom: true
331
+ })), hasAppearanceControl && createElement(ToolsPanelItem, {
332
+ className: "single-column",
333
+ label: appearanceControlLabel,
334
+ hasValue: hasFontAppearance,
335
+ onDeselect: resetFontAppearance,
336
+ isShownByDefault: defaultControls.fontAppearance,
337
+ panelId: panelId
338
+ }, createElement(FontAppearanceControl, {
339
+ value: {
340
+ fontStyle,
341
+ fontWeight
342
+ },
343
+ onChange: setFontAppearance,
344
+ hasFontStyles: hasFontStyles,
345
+ hasFontWeights: hasFontWeights,
346
+ size: "__unstable-large",
347
+ __nextHasNoMarginBottom: true
348
+ })), hasLineHeightEnabled && createElement(ToolsPanelItem, {
349
+ className: "single-column",
350
+ label: __('Line height'),
351
+ hasValue: hasLineHeight,
352
+ onDeselect: resetLineHeight,
353
+ isShownByDefault: defaultControls.lineHeight,
354
+ panelId: panelId
355
+ }, createElement(LineHeightControl, {
356
+ __nextHasNoMarginBottom: true,
357
+ __unstableInputWidth: "auto",
358
+ value: lineHeight,
359
+ onChange: setLineHeight,
360
+ size: "__unstable-large"
361
+ })), hasLetterSpacingControl && createElement(ToolsPanelItem, {
362
+ className: "single-column",
363
+ label: __('Letter spacing'),
364
+ hasValue: hasLetterSpacing,
365
+ onDeselect: resetLetterSpacing,
366
+ isShownByDefault: defaultControls.letterSpacing,
367
+ panelId: panelId
368
+ }, createElement(LetterSpacingControl, {
369
+ value: letterSpacing,
370
+ onChange: setLetterSpacing,
371
+ size: "__unstable-large",
372
+ __unstableInputWidth: "auto"
373
+ })), hasTextDecorationControl && createElement(ToolsPanelItem, {
374
+ className: "single-column",
375
+ label: __('Text decoration'),
376
+ hasValue: hasTextDecoration,
377
+ onDeselect: resetTextDecoration,
378
+ isShownByDefault: defaultControls.textDecoration,
379
+ panelId: panelId
380
+ }, createElement(TextDecorationControl, {
381
+ value: textDecoration,
382
+ onChange: setTextDecoration,
383
+ size: "__unstable-large",
384
+ __unstableInputWidth: "auto"
385
+ })), hasTextTransformControl && createElement(ToolsPanelItem, {
386
+ label: __('Letter case'),
387
+ hasValue: hasTextTransform,
388
+ onDeselect: resetTextTransform,
389
+ isShownByDefault: defaultControls.textTransform,
390
+ panelId: panelId
391
+ }, createElement(TextTransformControl, {
392
+ value: textTransform,
393
+ onChange: setTextTransform,
394
+ showNone: true,
395
+ isBlock: true,
396
+ size: "__unstable-large",
397
+ __nextHasNoMarginBottom: true
398
+ })));
399
+ }
400
+ //# sourceMappingURL=typography-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/typography-panel.js"],"names":["FontSizePicker","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","FontFamilyControl","FontAppearanceControl","LineHeightControl","LetterSpacingControl","TextTransformControl","TextDecorationControl","getValueFromVariable","useHasTypographyPanel","settings","hasFontFamily","useHasFontFamilyControl","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","hasTextTransform","useHasTextTransformControl","hasTextDecoration","useHasTextDecorationControl","hasFontSize","useHasFontSizeControl","disableCustomFontSizes","typography","customFontSize","fontSizesPerOrigin","fontSizes","custom","theme","default","length","fontFamiliesPerOrigin","fontFamilies","lineHeight","hasFontStyles","fontStyle","hasFontWeights","fontWeight","useAppearanceControlLabel","letterSpacing","textTransform","textDecoration","TypographyToolsPanel","props","DEFAULT_CONTROLS","fontFamily","fontSize","fontAppearance","TypographyPanel","as","Wrapper","value","onChange","inheritedValue","panelId","defaultControls","decodeValue","rawValue","hasFontFamilyEnabled","setFontFamily","newValue","slug","find","f","resetFontFamily","undefined","hasFontSizeEnabled","setFontSize","metadata","actualValue","resetFontSize","hasAppearanceControl","appearanceControlLabel","setFontAppearance","newFontStyle","newFontWeight","resetFontAppearance","hasLineHeightEnabled","setLineHeight","resetLineHeight","hasLetterSpacingControl","setLetterSpacing","resetLetterSpacing","hasTextTransformControl","setTextTransform","resetTextTransform","hasTextDecorationControl","setTextDecoration","resetTextDecoration","resetAll"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,wBAAwB,IAAIC,UAF7B,EAGCC,4BAA4B,IAAIC,cAHjC,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,gBAA9B;AAC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AAA,IAAI,EAAC,kBALN;AAMC,IAAA,uBAAuB;AANxB,IAPD,CAjHF,CADD;AAqIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFontSizePicker,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport FontFamilyControl from '../font-family';\nimport FontAppearanceControl from '../font-appearance-control';\nimport LineHeightControl from '../line-height-control';\nimport LetterSpacingControl from '../letter-spacing-control';\nimport TextTransformControl from '../text-transform-control';\nimport TextDecorationControl from '../text-decoration-control';\nimport { getValueFromVariable } from './utils';\n\nexport function useHasTypographyPanel( settings ) {\n\tconst hasFontFamily = useHasFontFamilyControl( settings );\n\tconst hasLineHeight = useHasLineHeightControl( settings );\n\tconst hasFontAppearance = useHasAppearanceControl( settings );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( settings );\n\tconst hasTextTransform = useHasTextTransformControl( settings );\n\tconst hasTextDecoration = useHasTextDecorationControl( settings );\n\tconst hasFontSize = useHasFontSizeControl( settings );\n\n\treturn (\n\t\thasFontFamily ||\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\thasTextTransform ||\n\t\thasFontSize ||\n\t\thasTextDecoration\n\t);\n}\n\nfunction useHasFontSizeControl( settings ) {\n\tconst disableCustomFontSizes = ! settings?.typography?.customFontSize;\n\tconst fontSizesPerOrigin = settings?.typography?.fontSizes ?? {};\n\tconst fontSizes =\n\t\tfontSizesPerOrigin?.custom ??\n\t\tfontSizesPerOrigin?.theme ??\n\t\tfontSizesPerOrigin.default;\n\treturn !! fontSizes?.length || ! disableCustomFontSizes;\n}\n\nfunction useHasFontFamilyControl( settings ) {\n\tconst fontFamiliesPerOrigin = settings?.typography?.fontFamilies;\n\tconst fontFamilies =\n\t\tfontFamiliesPerOrigin?.custom ??\n\t\tfontFamiliesPerOrigin?.theme ??\n\t\tfontFamiliesPerOrigin?.default;\n\treturn !! fontFamilies?.length;\n}\n\nfunction useHasLineHeightControl( settings ) {\n\treturn settings?.typography?.lineHeight;\n}\n\nfunction useHasAppearanceControl( settings ) {\n\tconst hasFontStyles = settings?.typography?.fontStyle;\n\tconst hasFontWeights = settings?.typography?.fontWeight;\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useAppearanceControlLabel( settings ) {\n\tconst hasFontStyles = settings?.typography?.fontStyle;\n\tconst hasFontWeights = settings?.typography?.fontWeight;\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\treturn __( 'Appearance' );\n}\n\nfunction useHasLetterSpacingControl( settings ) {\n\treturn settings?.typography?.letterSpacing;\n}\n\nfunction useHasTextTransformControl( settings ) {\n\treturn settings?.typography?.textTransform;\n}\n\nfunction useHasTextDecorationControl( settings ) {\n\treturn settings?.typography?.textDecoration;\n}\n\nfunction TypographyToolsPanel( { ...props } ) {\n\treturn <ToolsPanel label={ __( 'Typography' ) } { ...props } />;\n}\n\nconst DEFAULT_CONTROLS = {\n\tfontFamily: true,\n\tfontSize: true,\n\tfontAppearance: true,\n\tlineHeight: true,\n\tletterSpacing: true,\n\ttextTransform: true,\n\ttextDecoration: true,\n};\n\nexport default function TypographyPanel( {\n\tas: Wrapper = TypographyToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\t// Font Family\n\tconst hasFontFamilyEnabled = useHasFontFamilyControl( settings );\n\tconst fontFamiliesPerOrigin = settings?.typography?.fontFamilies;\n\tconst fontFamilies =\n\t\tfontFamiliesPerOrigin?.custom ??\n\t\tfontFamiliesPerOrigin?.theme ??\n\t\tfontFamiliesPerOrigin?.default;\n\tconst fontFamily = decodeValue( inheritedValue?.typography?.fontFamily );\n\tconst setFontFamily = ( newValue ) => {\n\t\tconst slug = fontFamilies?.find(\n\t\t\t( { fontFamily: f } ) => f === newValue\n\t\t)?.slug;\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tfontFamily: slug\n\t\t\t\t\t? `var:preset|font-family|${ slug }`\n\t\t\t\t\t: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasFontFamily = () => !! value?.typography?.fontFamily;\n\tconst resetFontFamily = () => setFontFamily( undefined );\n\n\t// Font Size\n\tconst hasFontSizeEnabled = useHasFontSizeControl( settings );\n\tconst disableCustomFontSizes = ! settings?.typography?.customFontSize;\n\tconst fontSizesPerOrigin = settings?.typography?.fontSizes ?? {};\n\tconst fontSizes =\n\t\tfontSizesPerOrigin?.custom ??\n\t\tfontSizesPerOrigin?.theme ??\n\t\tfontSizesPerOrigin.default;\n\tconst fontSize = decodeValue( inheritedValue?.typography?.fontSize );\n\tconst setFontSize = ( newValue, metadata ) => {\n\t\tconst actualValue = !! metadata?.slug\n\t\t\t? `var:preset|font-size|${ metadata?.slug }`\n\t\t\t: newValue;\n\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tfontSize: actualValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasFontSize = () => !! value?.typography?.fontSize;\n\tconst resetFontSize = () => setFontSize( undefined );\n\n\t// Appearance\n\tconst hasAppearanceControl = useHasAppearanceControl( settings );\n\tconst appearanceControlLabel = useAppearanceControlLabel( settings );\n\tconst hasFontStyles = settings?.typography?.fontStyle;\n\tconst hasFontWeights = settings?.typography?.fontWeight;\n\tconst fontStyle = decodeValue( inheritedValue?.typography?.fontStyle );\n\tconst fontWeight = decodeValue( inheritedValue?.typography?.fontWeight );\n\tconst setFontAppearance = ( {\n\t\tfontStyle: newFontStyle,\n\t\tfontWeight: newFontWeight,\n\t} ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\tfontWeight: newFontWeight,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasFontAppearance = () =>\n\t\t!! value?.typography?.fontStyle || !! value?.typography?.fontWeight;\n\tconst resetFontAppearance = () => {\n\t\tsetFontAppearance( {} );\n\t};\n\n\t// Line Height\n\tconst hasLineHeightEnabled = useHasLineHeightControl( settings );\n\tconst lineHeight = decodeValue( inheritedValue?.typography?.lineHeight );\n\tconst setLineHeight = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tlineHeight: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasLineHeight = () => !! value?.typography?.lineHeight;\n\tconst resetLineHeight = () => setLineHeight( undefined );\n\n\t// Letter Spacing\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( settings );\n\tconst letterSpacing = decodeValue(\n\t\tinheritedValue?.typography?.letterSpacing\n\t);\n\tconst setLetterSpacing = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\tletterSpacing: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasLetterSpacing = () => !! value?.typography?.letterSpacing;\n\tconst resetLetterSpacing = () => setLetterSpacing( undefined );\n\n\t// Text Transform\n\tconst hasTextTransformControl = useHasTextTransformControl( settings );\n\tconst textTransform = decodeValue(\n\t\tinheritedValue?.typography?.textTransform\n\t);\n\tconst setTextTransform = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\ttextTransform: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasTextTransform = () => !! value?.typography?.textTransform;\n\tconst resetTextTransform = () => setTextTransform( undefined );\n\n\t// Text Decoration\n\tconst hasTextDecorationControl = useHasTextDecorationControl( settings );\n\tconst textDecoration = decodeValue(\n\t\tinheritedValue?.typography?.textDecoration\n\t);\n\tconst setTextDecoration = ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {\n\t\t\t\t...value?.typography,\n\t\t\t\ttextDecoration: newValue,\n\t\t\t},\n\t\t} );\n\t};\n\tconst hasTextDecoration = () => !! value?.typography?.textDecoration;\n\tconst resetTextDecoration = () => setTextDecoration( undefined );\n\n\tconst resetAll = () => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\ttypography: {},\n\t\t} );\n\t};\n\n\treturn (\n\t\t<Wrapper 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={ defaultControls.fontFamily }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyControl\n\t\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasFontSizeEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\thasValue={ hasFontSize }\n\t\t\t\t\tonDeselect={ resetFontSize }\n\t\t\t\t\tisShownByDefault={ defaultControls.fontSize }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<FontSizePicker\n\t\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\twithReset={ false }\n\t\t\t\t\t\twithSlider\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ appearanceControlLabel }\n\t\t\t\t\thasValue={ hasFontAppearance }\n\t\t\t\t\tonDeselect={ resetFontAppearance }\n\t\t\t\t\tisShownByDefault={ defaultControls.fontAppearance }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceControl\n\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ setFontAppearance }\n\t\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\thasValue={ hasLineHeight }\n\t\t\t\t\tonDeselect={ resetLineHeight }\n\t\t\t\t\tisShownByDefault={ defaultControls.lineHeight }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<LineHeightControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\t\t\thasValue={ hasLetterSpacing }\n\t\t\t\t\tonDeselect={ resetLetterSpacing }\n\t\t\t\t\tisShownByDefault={ defaultControls.letterSpacing }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingControl\n\t\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasTextDecorationControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Text decoration' ) }\n\t\t\t\t\thasValue={ hasTextDecoration }\n\t\t\t\t\tonDeselect={ resetTextDecoration }\n\t\t\t\t\tisShownByDefault={ defaultControls.textDecoration }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationControl\n\t\t\t\t\t\tvalue={ textDecoration }\n\t\t\t\t\t\tonChange={ setTextDecoration }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasTextTransformControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\thasValue={ hasTextTransform }\n\t\t\t\t\tonDeselect={ resetTextTransform }\n\t\t\t\t\tisShownByDefault={ defaultControls.textTransform }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<TextTransformControl\n\t\t\t\t\t\tvalue={ textTransform }\n\t\t\t\t\t\tonChange={ setTextTransform }\n\t\t\t\t\t\tshowNone\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"]}
@@ -593,13 +593,17 @@ export const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasF
593
593
  }
594
594
 
595
595
  if (useRootPaddingAlign) {
596
+ /*
597
+ * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508
598
+ * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.
599
+ */
596
600
  ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
597
601
  .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
598
602
  .has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
599
603
  .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
600
604
  .has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
601
- .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); }
602
- .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;`;
605
+ .has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
606
+ .has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
603
607
  }
604
608
 
605
609
  ruleset += '}';