@wordpress/block-editor 11.5.0 → 11.6.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 (198) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-list/block-invalid-warning.js +63 -80
  3. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  4. package/build/components/block-settings-menu-controls/index.js +1 -1
  5. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  6. package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
  7. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  8. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
  9. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  10. package/build/components/global-styles/border-panel.js +306 -0
  11. package/build/components/global-styles/border-panel.js.map +1 -0
  12. package/build/components/global-styles/hooks.js +57 -3
  13. package/build/components/global-styles/hooks.js.map +1 -1
  14. package/build/components/global-styles/index.js +20 -0
  15. package/build/components/global-styles/index.js.map +1 -1
  16. package/build/components/global-styles/typography-panel.js +62 -15
  17. package/build/components/global-styles/typography-panel.js.map +1 -1
  18. package/build/components/global-styles/use-global-styles-output.js +20 -13
  19. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  20. package/build/components/inserter/index.js +29 -17
  21. package/build/components/inserter/index.js.map +1 -1
  22. package/build/components/inserter/menu.js +1 -1
  23. package/build/components/inserter/menu.js.map +1 -1
  24. package/build/components/inserter/quick-inserter.js +4 -2
  25. package/build/components/inserter/quick-inserter.js.map +1 -1
  26. package/build/components/inserter/search-results.js +10 -3
  27. package/build/components/inserter/search-results.js.map +1 -1
  28. package/build/components/inserter/tabs.js +1 -1
  29. package/build/components/inserter/tabs.js.map +1 -1
  30. package/build/components/link-control/index.js +1 -1
  31. package/build/components/link-control/index.js.map +1 -1
  32. package/build/components/link-control/search-item.js +5 -2
  33. package/build/components/link-control/search-item.js.map +1 -1
  34. package/build/components/list-view/use-block-selection.js +1 -2
  35. package/build/components/list-view/use-block-selection.js.map +1 -1
  36. package/build/components/off-canvas-editor/appender.js +28 -3
  37. package/build/components/off-canvas-editor/appender.js.map +1 -1
  38. package/build/components/off-canvas-editor/branch.js +5 -3
  39. package/build/components/off-canvas-editor/branch.js.map +1 -1
  40. package/build/components/off-canvas-editor/index.js +9 -7
  41. package/build/components/off-canvas-editor/index.js.map +1 -1
  42. package/build/components/off-canvas-editor/link-ui.js +0 -1
  43. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  44. package/build/components/provider/use-block-sync.js +17 -3
  45. package/build/components/provider/use-block-sync.js.map +1 -1
  46. package/build/components/rich-text/format-toolbar-container.js +0 -3
  47. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  48. package/build/hooks/border.js +91 -240
  49. package/build/hooks/border.js.map +1 -1
  50. package/build/hooks/custom-class-name.js +4 -4
  51. package/build/hooks/custom-class-name.js.map +1 -1
  52. package/build/hooks/custom-class-name.native.js +3 -4
  53. package/build/hooks/custom-class-name.native.js.map +1 -1
  54. package/build/hooks/layout.js +19 -22
  55. package/build/hooks/layout.js.map +1 -1
  56. package/build/hooks/supports.js +7 -1
  57. package/build/hooks/supports.js.map +1 -1
  58. package/build/hooks/typography.js +2 -1
  59. package/build/hooks/typography.js.map +1 -1
  60. package/build/hooks/utils.js +27 -1
  61. package/build/hooks/utils.js.map +1 -1
  62. package/build/layouts/constrained.js +6 -2
  63. package/build/layouts/constrained.js.map +1 -1
  64. package/build/private-apis.js +4 -1
  65. package/build/private-apis.js.map +1 -1
  66. package/build/store/actions.js +10 -8
  67. package/build/store/actions.js.map +1 -1
  68. package/build/store/selectors.js +19 -3
  69. package/build/store/selectors.js.map +1 -1
  70. package/build/utils/parse-css-unit-to-px.js +15 -9
  71. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  72. package/build-module/components/block-list/block-invalid-warning.js +66 -78
  73. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  74. package/build-module/components/block-settings-menu-controls/index.js +1 -1
  75. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  76. package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
  77. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  78. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
  79. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  80. package/build-module/components/global-styles/border-panel.js +291 -0
  81. package/build-module/components/global-styles/border-panel.js.map +1 -0
  82. package/build-module/components/global-styles/hooks.js +54 -3
  83. package/build-module/components/global-styles/hooks.js.map +1 -1
  84. package/build-module/components/global-styles/index.js +2 -1
  85. package/build-module/components/global-styles/index.js.map +1 -1
  86. package/build-module/components/global-styles/typography-panel.js +62 -16
  87. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  88. package/build-module/components/global-styles/use-global-styles-output.js +20 -13
  89. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  90. package/build-module/components/inserter/index.js +28 -16
  91. package/build-module/components/inserter/index.js.map +1 -1
  92. package/build-module/components/inserter/menu.js +1 -1
  93. package/build-module/components/inserter/menu.js.map +1 -1
  94. package/build-module/components/inserter/quick-inserter.js +4 -2
  95. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  96. package/build-module/components/inserter/search-results.js +10 -3
  97. package/build-module/components/inserter/search-results.js.map +1 -1
  98. package/build-module/components/inserter/tabs.js +1 -1
  99. package/build-module/components/inserter/tabs.js.map +1 -1
  100. package/build-module/components/link-control/index.js +1 -1
  101. package/build-module/components/link-control/index.js.map +1 -1
  102. package/build-module/components/link-control/search-item.js +4 -2
  103. package/build-module/components/link-control/search-item.js.map +1 -1
  104. package/build-module/components/list-view/use-block-selection.js +1 -2
  105. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  106. package/build-module/components/off-canvas-editor/appender.js +28 -4
  107. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  108. package/build-module/components/off-canvas-editor/branch.js +5 -3
  109. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  110. package/build-module/components/off-canvas-editor/index.js +9 -7
  111. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  112. package/build-module/components/off-canvas-editor/link-ui.js +0 -1
  113. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  114. package/build-module/components/provider/use-block-sync.js +17 -3
  115. package/build-module/components/provider/use-block-sync.js.map +1 -1
  116. package/build-module/components/rich-text/format-toolbar-container.js +0 -3
  117. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  118. package/build-module/hooks/border.js +93 -240
  119. package/build-module/hooks/border.js.map +1 -1
  120. package/build-module/hooks/custom-class-name.js +4 -4
  121. package/build-module/hooks/custom-class-name.js.map +1 -1
  122. package/build-module/hooks/custom-class-name.native.js +3 -4
  123. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  124. package/build-module/hooks/layout.js +19 -22
  125. package/build-module/hooks/layout.js.map +1 -1
  126. package/build-module/hooks/supports.js +7 -1
  127. package/build-module/hooks/supports.js.map +1 -1
  128. package/build-module/hooks/typography.js +2 -1
  129. package/build-module/hooks/typography.js.map +1 -1
  130. package/build-module/hooks/utils.js +27 -1
  131. package/build-module/hooks/utils.js.map +1 -1
  132. package/build-module/layouts/constrained.js +6 -2
  133. package/build-module/layouts/constrained.js.map +1 -1
  134. package/build-module/private-apis.js +3 -1
  135. package/build-module/private-apis.js.map +1 -1
  136. package/build-module/store/actions.js +10 -8
  137. package/build-module/store/actions.js.map +1 -1
  138. package/build-module/store/selectors.js +17 -3
  139. package/build-module/store/selectors.js.map +1 -1
  140. package/build-module/utils/parse-css-unit-to-px.js +15 -9
  141. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  142. package/build-style/style-rtl.css +6 -6
  143. package/build-style/style.css +6 -6
  144. package/package.json +31 -31
  145. package/src/components/block-inspector/style.scss +3 -0
  146. package/src/components/block-list/block-invalid-warning.js +72 -64
  147. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +20 -2
  148. package/src/components/block-preview/test/index.js +0 -2
  149. package/src/components/block-settings-menu-controls/index.js +2 -1
  150. package/src/components/block-styles/style.scss +2 -2
  151. package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
  152. package/src/components/color-palette/test/__snapshots__/control.js.snap +16 -14
  153. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
  154. package/src/components/global-styles/border-panel.js +285 -0
  155. package/src/components/global-styles/hooks.js +74 -1
  156. package/src/components/global-styles/index.js +2 -0
  157. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  158. package/src/components/global-styles/typography-panel.js +48 -1
  159. package/src/components/global-styles/use-global-styles-output.js +13 -13
  160. package/src/components/inserter/index.js +30 -11
  161. package/src/components/inserter/menu.js +0 -1
  162. package/src/components/inserter/quick-inserter.js +2 -0
  163. package/src/components/inserter/search-results.js +7 -1
  164. package/src/components/inserter/style.scss +3 -0
  165. package/src/components/inserter/tabs.js +1 -9
  166. package/src/components/link-control/index.js +1 -1
  167. package/src/components/link-control/search-item.js +3 -1
  168. package/src/components/link-control/style.scss +0 -4
  169. package/src/components/link-control/test/index.js +0 -2
  170. package/src/components/list-view/use-block-selection.js +0 -2
  171. package/src/components/off-canvas-editor/appender.js +31 -5
  172. package/src/components/off-canvas-editor/branch.js +3 -1
  173. package/src/components/off-canvas-editor/index.js +7 -7
  174. package/src/components/off-canvas-editor/link-ui.js +0 -1
  175. package/src/components/provider/use-block-sync.js +21 -4
  176. package/src/components/rich-text/format-toolbar-container.js +1 -7
  177. package/src/components/url-popover/test/index.js +0 -2
  178. package/src/hooks/border.js +94 -225
  179. package/src/hooks/custom-class-name.js +4 -4
  180. package/src/hooks/custom-class-name.native.js +3 -4
  181. package/src/hooks/layout.js +19 -16
  182. package/src/hooks/supports.js +6 -0
  183. package/src/hooks/test/style.js +2 -1
  184. package/src/hooks/test/use-typography-props.js +2 -0
  185. package/src/hooks/typography.js +2 -0
  186. package/src/hooks/utils.js +36 -0
  187. package/src/layouts/constrained.js +23 -17
  188. package/src/private-apis.js +2 -0
  189. package/src/store/actions.js +10 -8
  190. package/src/store/selectors.js +20 -3
  191. package/src/utils/parse-css-unit-to-px.js +14 -9
  192. package/src/utils/test/parse-css-unit-to-px.js +1 -2
  193. package/tsconfig.tsbuildinfo +1 -1
  194. package/build/hooks/border-radius.js +0 -100
  195. package/build/hooks/border-radius.js.map +0 -1
  196. package/build-module/hooks/border-radius.js +0 -84
  197. package/build-module/hooks/border-radius.js.map +0 -1
  198. package/src/hooks/border-radius.js +0 -70
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = BorderPanel;
9
+ exports.useHasBorderPanel = useHasBorderPanel;
10
+
11
+ var _element = require("@wordpress/element");
12
+
13
+ var _components = require("@wordpress/components");
14
+
15
+ var _i18n = require("@wordpress/i18n");
16
+
17
+ var _borderRadiusControl = _interopRequireDefault(require("../border-radius-control"));
18
+
19
+ var _hooks = require("./hooks");
20
+
21
+ var _utils = require("./utils");
22
+
23
+ /**
24
+ * WordPress dependencies
25
+ */
26
+
27
+ /**
28
+ * Internal dependencies
29
+ */
30
+ function useHasBorderPanel(settings) {
31
+ const controls = [useHasBorderColorControl(settings), useHasBorderRadiusControl(settings), useHasBorderStyleControl(settings), useHasBorderWidthControl(settings)];
32
+ return controls.some(Boolean);
33
+ }
34
+
35
+ function useHasBorderColorControl(settings) {
36
+ var _settings$border;
37
+
38
+ return settings === null || settings === void 0 ? void 0 : (_settings$border = settings.border) === null || _settings$border === void 0 ? void 0 : _settings$border.color;
39
+ }
40
+
41
+ function useHasBorderRadiusControl(settings) {
42
+ var _settings$border2;
43
+
44
+ return settings === null || settings === void 0 ? void 0 : (_settings$border2 = settings.border) === null || _settings$border2 === void 0 ? void 0 : _settings$border2.radius;
45
+ }
46
+
47
+ function useHasBorderStyleControl(settings) {
48
+ var _settings$border3;
49
+
50
+ return settings === null || settings === void 0 ? void 0 : (_settings$border3 = settings.border) === null || _settings$border3 === void 0 ? void 0 : _settings$border3.style;
51
+ }
52
+
53
+ function useHasBorderWidthControl(settings) {
54
+ var _settings$border4;
55
+
56
+ return settings === null || settings === void 0 ? void 0 : (_settings$border4 = settings.border) === null || _settings$border4 === void 0 ? void 0 : _settings$border4.width;
57
+ }
58
+
59
+ function applyFallbackStyle(border) {
60
+ if (!border) {
61
+ return border;
62
+ }
63
+
64
+ if (!border.style && (border.color || border.width)) {
65
+ return { ...border,
66
+ style: 'solid'
67
+ };
68
+ }
69
+
70
+ return border;
71
+ }
72
+
73
+ function applyAllFallbackStyles(border) {
74
+ if (!border) {
75
+ return border;
76
+ }
77
+
78
+ if ((0, _components.__experimentalHasSplitBorders)(border)) {
79
+ return {
80
+ top: applyFallbackStyle(border.top),
81
+ right: applyFallbackStyle(border.right),
82
+ bottom: applyFallbackStyle(border.bottom),
83
+ left: applyFallbackStyle(border.left)
84
+ };
85
+ }
86
+
87
+ return applyFallbackStyle(border);
88
+ }
89
+
90
+ function BorderToolsPanel(_ref) {
91
+ let {
92
+ resetAllFilter,
93
+ onChange,
94
+ value,
95
+ panelId,
96
+ children
97
+ } = _ref;
98
+
99
+ const resetAll = () => {
100
+ const updatedValue = resetAllFilter(value);
101
+ onChange(updatedValue);
102
+ };
103
+
104
+ return (0, _element.createElement)(_components.__experimentalToolsPanel, {
105
+ label: (0, _i18n.__)('Border'),
106
+ resetAll: resetAll,
107
+ panelId: panelId
108
+ }, children);
109
+ }
110
+
111
+ const DEFAULT_CONTROLS = {
112
+ radius: true,
113
+ color: true,
114
+ width: true
115
+ };
116
+
117
+ function BorderPanel(_ref2) {
118
+ let {
119
+ as: Wrapper = BorderToolsPanel,
120
+ value,
121
+ onChange,
122
+ inheritedValue = value,
123
+ settings,
124
+ panelId,
125
+ defaultControls = DEFAULT_CONTROLS
126
+ } = _ref2;
127
+ const colors = (0, _hooks.useColorsPerOrigin)(settings);
128
+
129
+ const decodeValue = rawValue => (0, _utils.getValueFromVariable)({
130
+ settings
131
+ }, '', rawValue);
132
+
133
+ const encodeColorValue = colorValue => {
134
+ const allColors = colors.flatMap(_ref3 => {
135
+ let {
136
+ colors: originColors
137
+ } = _ref3;
138
+ return originColors;
139
+ });
140
+ const colorObject = allColors.find(_ref4 => {
141
+ let {
142
+ color
143
+ } = _ref4;
144
+ return color === colorValue;
145
+ });
146
+ return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue;
147
+ };
148
+
149
+ const decodeColorValue = (0, _element.useCallback)(colorValue => {
150
+ const allColors = colors.flatMap(_ref5 => {
151
+ let {
152
+ colors: originColors
153
+ } = _ref5;
154
+ return originColors;
155
+ });
156
+ const colorObject = allColors.find(_ref6 => {
157
+ let {
158
+ slug
159
+ } = _ref6;
160
+ return colorValue === 'var:preset|color|' + slug;
161
+ });
162
+ return colorObject ? colorObject.color : colorValue;
163
+ }, [colors]);
164
+ const border = (0, _element.useMemo)(() => {
165
+ var _inheritedValue$borde, _inheritedValue$borde2;
166
+
167
+ if ((0, _components.__experimentalHasSplitBorders)(inheritedValue === null || inheritedValue === void 0 ? void 0 : inheritedValue.border)) {
168
+ const borderValue = { ...(inheritedValue === null || inheritedValue === void 0 ? void 0 : inheritedValue.border)
169
+ };
170
+ ['top', 'right', 'bottom', 'left'].forEach(side => {
171
+ var _borderValue$side;
172
+
173
+ borderValue[side] = { ...borderValue[side],
174
+ color: decodeColorValue((_borderValue$side = borderValue[side]) === null || _borderValue$side === void 0 ? void 0 : _borderValue$side.color)
175
+ };
176
+ });
177
+ return borderValue;
178
+ }
179
+
180
+ return { ...(inheritedValue === null || inheritedValue === void 0 ? void 0 : inheritedValue.border),
181
+ color: inheritedValue !== null && inheritedValue !== void 0 && (_inheritedValue$borde = inheritedValue.border) !== null && _inheritedValue$borde !== void 0 && _inheritedValue$borde.color ? decodeColorValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$borde2 = inheritedValue.border) === null || _inheritedValue$borde2 === void 0 ? void 0 : _inheritedValue$borde2.color) : undefined
182
+ };
183
+ }, [inheritedValue === null || inheritedValue === void 0 ? void 0 : inheritedValue.border, decodeColorValue]);
184
+
185
+ const setBorder = newBorder => onChange({ ...value,
186
+ border: newBorder
187
+ });
188
+
189
+ const showBorderColor = useHasBorderColorControl(settings);
190
+ const showBorderStyle = useHasBorderStyleControl(settings);
191
+ const showBorderWidth = useHasBorderWidthControl(settings); // Border radius.
192
+
193
+ const showBorderRadius = useHasBorderRadiusControl(settings);
194
+ const borderRadiusValues = decodeValue(border === null || border === void 0 ? void 0 : border.radius);
195
+
196
+ const setBorderRadius = newBorderRadius => setBorder({ ...border,
197
+ radius: newBorderRadius
198
+ });
199
+
200
+ const hasBorderRadius = () => {
201
+ var _value$border;
202
+
203
+ const borderValues = value === null || value === void 0 ? void 0 : (_value$border = value.border) === null || _value$border === void 0 ? void 0 : _value$border.radius;
204
+
205
+ if (typeof borderValues === 'object') {
206
+ return Object.entries(borderValues).some(Boolean);
207
+ }
208
+
209
+ return !!borderValues;
210
+ };
211
+
212
+ const resetBorder = () => {
213
+ if (hasBorderRadius()) {
214
+ var _value$border2;
215
+
216
+ return setBorder({
217
+ radius: value === null || value === void 0 ? void 0 : (_value$border2 = value.border) === null || _value$border2 === void 0 ? void 0 : _value$border2.radius
218
+ });
219
+ }
220
+
221
+ setBorder(undefined);
222
+ };
223
+
224
+ const onBorderChange = newBorder => {
225
+ // Ensure we have a visible border style when a border width or
226
+ // color is being selected.
227
+ const newBorderWithStyle = applyAllFallbackStyles(newBorder); // As we can't conditionally generate styles based on if other
228
+ // style properties have been set we need to force split border
229
+ // definitions for user set border styles. Border radius is derived
230
+ // from the same property i.e. `border.radius` if it is a string
231
+ // that is used. The longhand border radii styles are only generated
232
+ // if that property is an object.
233
+ //
234
+ // For borders (color, style, and width) those are all properties on
235
+ // the `border` style property. This means if the theme.json defined
236
+ // split borders and the user condenses them into a flat border or
237
+ // vice-versa we'd get both sets of styles which would conflict.
238
+
239
+ const updatedBorder = !(0, _components.__experimentalHasSplitBorders)(newBorderWithStyle) ? {
240
+ top: newBorderWithStyle,
241
+ right: newBorderWithStyle,
242
+ bottom: newBorderWithStyle,
243
+ left: newBorderWithStyle
244
+ } : {
245
+ color: null,
246
+ style: null,
247
+ width: null,
248
+ ...newBorderWithStyle
249
+ };
250
+ ['top', 'right', 'bottom', 'left'].forEach(side => {
251
+ var _updatedBorder$side;
252
+
253
+ updatedBorder[side] = { ...updatedBorder[side],
254
+ color: encodeColorValue((_updatedBorder$side = updatedBorder[side]) === null || _updatedBorder$side === void 0 ? void 0 : _updatedBorder$side.color)
255
+ };
256
+ }); // As radius is maintained separately to color, style, and width
257
+ // maintain its value. Undefined values here will be cleaned when
258
+ // global styles are saved.
259
+
260
+ setBorder({
261
+ radius: border === null || border === void 0 ? void 0 : border.radius,
262
+ ...updatedBorder
263
+ });
264
+ };
265
+
266
+ const resetAllFilter = (0, _element.useCallback)(previousValue => {
267
+ return { ...previousValue,
268
+ border: undefined
269
+ };
270
+ }, []);
271
+ const showBorderByDefault = (defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.color) || (defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.width);
272
+ return (0, _element.createElement)(Wrapper, {
273
+ resetAllFilter: resetAllFilter,
274
+ value: value,
275
+ onChange: onChange,
276
+ panelId: panelId
277
+ }, (showBorderWidth || showBorderColor) && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
278
+ hasValue: () => (0, _components.__experimentalIsDefinedBorder)(value === null || value === void 0 ? void 0 : value.border),
279
+ label: (0, _i18n.__)('Border'),
280
+ onDeselect: () => resetBorder(),
281
+ isShownByDefault: showBorderByDefault,
282
+ panelId: panelId
283
+ }, (0, _element.createElement)(_components.__experimentalBorderBoxControl, {
284
+ colors: colors,
285
+ enableAlpha: true,
286
+ enableStyle: showBorderStyle,
287
+ onChange: onBorderChange,
288
+ popoverOffset: 40,
289
+ popoverPlacement: "left-start",
290
+ value: border,
291
+ __experimentalIsRenderedInSidebar: true,
292
+ size: '__unstable-large'
293
+ })), showBorderRadius && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
294
+ hasValue: hasBorderRadius,
295
+ label: (0, _i18n.__)('Radius'),
296
+ onDeselect: () => setBorderRadius(undefined),
297
+ isShownByDefault: defaultControls.radius,
298
+ panelId: panelId
299
+ }, (0, _element.createElement)(_borderRadiusControl.default, {
300
+ values: borderRadiusValues,
301
+ onChange: newValue => {
302
+ setBorderRadius(newValue || undefined);
303
+ }
304
+ })));
305
+ }
306
+ //# sourceMappingURL=border-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/border-panel.js"],"names":["useHasBorderPanel","settings","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","border","color","radius","style","width","applyFallbackStyle","applyAllFallbackStyles","top","right","bottom","left","BorderToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","DEFAULT_CONTROLS","BorderPanel","as","Wrapper","inheritedValue","defaultControls","colors","decodeValue","rawValue","encodeColorValue","colorValue","allColors","flatMap","originColors","colorObject","find","slug","decodeColorValue","borderValue","forEach","side","undefined","setBorder","newBorder","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","newBorderRadius","hasBorderRadius","borderValues","Object","entries","resetBorder","onBorderChange","newBorderWithStyle","updatedBorder","previousValue","showBorderByDefault","newValue"],"mappings":";;;;;;;;;;AAUA;;AAPA;;AAQA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAWA;AACA;AACA;AAKO,SAASA,iBAAT,CAA4BC,QAA5B,EAAuC;AAC7C,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,QAAF,CADR,EAEhBG,yBAAyB,CAAEH,QAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,QAAF,C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,QAAQ,EAAGW,cAJZ;AAKC,IAAA,aAAa,EAAG,EALjB;AAMC,IAAA,gBAAgB,EAAC,YANlB;AAOC,IAAA,KAAK,EAAGvD,MAPT;AAQC,IAAA,iCAAiC,EAAG,IARrC;AASC,IAAA,IAAI,EAAG;AATR,IAPD,CAPF,EA2BG8C,gBAAgB,IACjB,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGI,eADZ;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,MAAMF,eAAe,CAAER,SAAF,CAHnC;AAIC,IAAA,gBAAgB,EAAGhB,eAAe,CAACtB,MAJpC;AAKC,IAAA,OAAO,EAAGa;AALX,KAOC,4BAAC,4BAAD;AACC,IAAA,MAAM,EAAGgC,kBADV;AAEC,IAAA,QAAQ,EAAKa,QAAF,IAAgB;AAC1BZ,MAAAA,eAAe,CAAEY,QAAQ,IAAIpB,SAAd,CAAf;AACA;AAJF,IAPD,CA5BF,CADD;AA8CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { getValueFromVariable } from './utils';\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( settings ),\n\t\tuseHasBorderRadiusControl( settings ),\n\t\tuseHasBorderStyleControl( settings ),\n\t\tuseHasBorderWidthControl( settings ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( settings ) {\n\treturn settings?.border?.color;\n}\n\nfunction useHasBorderRadiusControl( settings ) {\n\treturn settings?.border?.radius;\n}\n\nfunction useHasBorderStyleControl( settings ) {\n\treturn settings?.border?.style;\n}\n\nfunction useHasBorderWidthControl( settings ) {\n\treturn settings?.border?.width;\n}\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( ! border.style && ( border.color || border.width ) ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Border' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tradius: true,\n\tcolor: true,\n\twidth: true,\n};\n\nexport default function BorderPanel( {\n\tas: Wrapper = BorderToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\tconst decodeColorValue = useCallback(\n\t\t( colorValue ) => {\n\t\t\tconst allColors = colors.flatMap(\n\t\t\t\t( { colors: originColors } ) => originColors\n\t\t\t);\n\t\t\tconst colorObject = allColors.find(\n\t\t\t\t( { slug } ) => colorValue === 'var:preset|color|' + slug\n\t\t\t);\n\t\t\treturn colorObject ? colorObject.color : colorValue;\n\t\t},\n\t\t[ colors ]\n\t);\n\tconst border = useMemo( () => {\n\t\tif ( hasSplitBorders( inheritedValue?.border ) ) {\n\t\t\tconst borderValue = { ...inheritedValue?.border };\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tborderValue[ side ] = {\n\t\t\t\t\t...borderValue[ side ],\n\t\t\t\t\tcolor: decodeColorValue( borderValue[ side ]?.color ),\n\t\t\t\t};\n\t\t\t} );\n\t\t\treturn borderValue;\n\t\t}\n\t\treturn {\n\t\t\t...inheritedValue?.border,\n\t\t\tcolor: inheritedValue?.border?.color\n\t\t\t\t? decodeColorValue( inheritedValue?.border?.color )\n\t\t\t\t: undefined,\n\t\t};\n\t}, [ inheritedValue?.border, decodeColorValue ] );\n\tconst setBorder = ( newBorder ) =>\n\t\tonChange( { ...value, border: newBorder } );\n\tconst showBorderColor = useHasBorderColorControl( settings );\n\tconst showBorderStyle = useHasBorderStyleControl( settings );\n\tconst showBorderWidth = useHasBorderWidthControl( settings );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst borderRadiusValues = decodeValue( border?.radius );\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...border, radius: newBorderRadius } );\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = value?.border?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: value?.border?.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Ensure we have a visible border style when a border width or\n\t\t// color is being selected.\n\t\tconst newBorderWithStyle = applyAllFallbackStyles( newBorder );\n\n\t\t// As we can't conditionally generate styles based on if other\n\t\t// style properties have been set we need to force split border\n\t\t// definitions for user set border styles. Border radius is derived\n\t\t// from the same property i.e. `border.radius` if it is a string\n\t\t// that is used. The longhand border radii styles are only generated\n\t\t// if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst updatedBorder = ! hasSplitBorders( newBorderWithStyle )\n\t\t\t? {\n\t\t\t\t\ttop: newBorderWithStyle,\n\t\t\t\t\tright: newBorderWithStyle,\n\t\t\t\t\tbottom: newBorderWithStyle,\n\t\t\t\t\tleft: newBorderWithStyle,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...newBorderWithStyle,\n\t\t\t };\n\n\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\tupdatedBorder[ side ] = {\n\t\t\t\t...updatedBorder[ side ],\n\t\t\t\tcolor: encodeColorValue( updatedBorder[ side ]?.color ),\n\t\t\t};\n\t\t} );\n\n\t\t// As radius is maintained separately to color, style, and width\n\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t};\n\t}, [] );\n\n\tconst showBorderByDefault =\n\t\tdefaultControls?.color || defaultControls?.width;\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\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{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ defaultControls.radius }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetBorderRadius( newValue || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"]}
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.useColorsPerOrigin = useColorsPerOrigin;
8
9
  exports.useGlobalSetting = useGlobalSetting;
9
10
  exports.useGlobalStyle = useGlobalStyle;
10
11
  exports.useGlobalStylesReset = void 0;
@@ -20,6 +21,8 @@ var _data = require("@wordpress/data");
20
21
 
21
22
  var _blocks = require("@wordpress/blocks");
22
23
 
24
+ var _i18n = require("@wordpress/i18n");
25
+
23
26
  var _utils = require("./utils");
24
27
 
25
28
  var _context = require("./context");
@@ -41,7 +44,7 @@ const EMPTY_CONFIG = {
41
44
  settings: {},
42
45
  styles: {}
43
46
  };
44
- const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textDecoration', 'typography.textTransform'];
47
+ const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform'];
45
48
 
46
49
  const useGlobalStylesReset = () => {
47
50
  const {
@@ -130,7 +133,7 @@ function useGlobalStyle(path, blockName) {
130
133
 
131
134
  switch (source) {
132
135
  case 'all':
133
- rawResult = // The stlyes.css path is allowed to be empty, so don't revert to base if undefined.
136
+ rawResult = // The styles.css path is allowed to be empty, so don't revert to base if undefined.
134
137
  finalPath === 'styles.css' ? (0, _lodash.get)(userConfig, finalPath) : (0, _lodash.get)(mergedConfig, finalPath);
135
138
  result = shouldDecodeEncode ? (0, _utils.getValueFromVariable)(mergedConfig, blockName, rawResult) : rawResult;
136
139
  break;
@@ -197,7 +200,16 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
197
200
  [key]: false
198
201
  };
199
202
  }
200
- });
203
+ }); // The column-count style is named text column to reduce confusion with
204
+ // the columns block and manage expectations from the support.
205
+ // See: https://github.com/WordPress/gutenberg/pull/33587
206
+
207
+ if (!supportedStyles.includes('columnCount')) {
208
+ updatedSettings.typography = { ...updatedSettings.typography,
209
+ textColumns: false
210
+ };
211
+ }
212
+
201
213
  ['contentSize', 'wideSize'].forEach(key => {
202
214
  if (!supportedStyles.includes(key)) {
203
215
  updatedSettings.layout = { ...updatedSettings.layout,
@@ -233,7 +245,49 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
233
245
  };
234
246
  }
235
247
 
248
+ ['radius', 'color', 'style', 'width'].forEach(key => {
249
+ if (!supportedStyles.includes('border' + key.charAt(0).toUpperCase() + key.slice(1))) {
250
+ updatedSettings.border = { ...updatedSettings.border,
251
+ [key]: false
252
+ };
253
+ }
254
+ });
236
255
  return updatedSettings;
237
256
  }, [parentSettings, supportedStyles, supports]);
238
257
  }
258
+
259
+ function useColorsPerOrigin(settings) {
260
+ var _settings$color, _settings$color$palet, _settings$color2, _settings$color2$pale, _settings$color3, _settings$color3$pale, _settings$color4;
261
+
262
+ const customColors = settings === null || settings === void 0 ? void 0 : (_settings$color = settings.color) === null || _settings$color === void 0 ? void 0 : (_settings$color$palet = _settings$color.palette) === null || _settings$color$palet === void 0 ? void 0 : _settings$color$palet.custom;
263
+ const themeColors = settings === null || settings === void 0 ? void 0 : (_settings$color2 = settings.color) === null || _settings$color2 === void 0 ? void 0 : (_settings$color2$pale = _settings$color2.palette) === null || _settings$color2$pale === void 0 ? void 0 : _settings$color2$pale.theme;
264
+ const defaultColors = settings === null || settings === void 0 ? void 0 : (_settings$color3 = settings.color) === null || _settings$color3 === void 0 ? void 0 : (_settings$color3$pale = _settings$color3.palette) === null || _settings$color3$pale === void 0 ? void 0 : _settings$color3$pale.default;
265
+ const shouldDisplayDefaultColors = settings === null || settings === void 0 ? void 0 : (_settings$color4 = settings.color) === null || _settings$color4 === void 0 ? void 0 : _settings$color4.defaultPalette;
266
+ return (0, _element.useMemo)(() => {
267
+ const result = [];
268
+
269
+ if (themeColors && themeColors.length) {
270
+ result.push({
271
+ name: (0, _i18n._x)('Theme', 'Indicates this palette comes from the theme.'),
272
+ colors: themeColors
273
+ });
274
+ }
275
+
276
+ if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
277
+ result.push({
278
+ name: (0, _i18n._x)('Default', 'Indicates this palette comes from WordPress.'),
279
+ colors: defaultColors
280
+ });
281
+ }
282
+
283
+ if (customColors && customColors.length) {
284
+ result.push({
285
+ name: (0, _i18n._x)('Custom', 'Indicates this palette is created by the user.'),
286
+ colors: customColors
287
+ });
288
+ }
289
+
290
+ return result;
291
+ }, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]);
292
+ }
239
293
  //# sourceMappingURL=hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"names":["EMPTY_CONFIG","settings","styles","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","GlobalStylesContext","canReset","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","configToUse","result","forEach","setting","value","setSetting","newValue","currentConfig","newUserConfig","JSON","parse","stringify","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","rawResult","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","select","blocksStore","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","fontFamilies","key","layout","spacing","sides","Array","isArray","length","dimensions","minHeight"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAEC,EAAAA,QAAQ,EAAE,EAAZ;AAAgBC,EAAAA,MAAM,EAAE;AAAxB,CAArB;AAEA,MAAMC,cAAc,GAAG,CACtB,iBADsB,EAEtB,+BAFsB,EAGtB,cAHsB,EAItB,eAJsB,EAKtB,cALsB,EAMtB,cANsB,EAOtB,gBAPsB,EAQtB,uBARsB,EAStB,kBATsB,EAUtB,cAVsB,EAWtB,qBAXsB,EAYtB,sBAZsB,EAatB,sBAbsB,EActB,wBAdsB,EAetB,sBAfsB,EAgBtB,eAhBsB,EAiBtB,iBAjBsB,EAkBtB,YAlBsB,EAmBtB,eAnBsB,EAoBtB,YApBsB,EAqBtB,QArBsB,EAsBtB,sBAtBsB,EAuBtB,oBAvBsB,EAwBtB,oBAxBsB,EAyB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K,CAAEG,MAAZ,EAAqB;AAAA;;AACpBZ,QAAAA,eAAe,CAACQ,OAAhB,GAA0B,EACzB,GAAGR,eAAe,CAACQ,OADM;AAEzB,WAAEF,GAAF,GAAS,EACR,6BAAGN,eAAe,CAACQ,OAAnB,0DAAG,sBAA2BF,GAA3B,CAAH,CADQ;AAERG,YAAAA;AAFQ;AAFgB,SAA1B;AAOA;AACD,KApBD;;AAsBA,QAAK,CAAEf,eAAe,CAACO,QAAhB,CAA0B,WAA1B,CAAP,EAAiD;AAChDD,MAAAA,eAAe,CAACa,UAAhB,GAA6B,EAC5B,GAAGb,eAAe,CAACa,UADS;AAE5BC,QAAAA,SAAS,EAAE;AAFiB,OAA7B;AAIA;;AAED,WAAOd,eAAP;AACA,GAzEM,EAyEJ,CAAER,cAAF,EAAkBE,eAAlB,EAAmCC,QAAnC,CAzEI,CAAP;AA0EA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_CONFIG = { settings: {}, styles: {} };\n\nconst VALID_SETTINGS = [\n\t'appearanceTools',\n\t'useRootPaddingAwareAlignments',\n\t'border.color',\n\t'border.radius',\n\t'border.style',\n\t'border.width',\n\t'shadow.presets',\n\t'shadow.defaultPresets',\n\t'color.background',\n\t'color.custom',\n\t'color.customDuotone',\n\t'color.customGradient',\n\t'color.defaultDuotone',\n\t'color.defaultGradients',\n\t'color.defaultPalette',\n\t'color.duotone',\n\t'color.gradients',\n\t'color.link',\n\t'color.palette',\n\t'color.text',\n\t'custom',\n\t'dimensions.minHeight',\n\t'layout.contentSize',\n\t'layout.definitions',\n\t'layout.wideSize',\n\t'position.fixed',\n\t'position.sticky',\n\t'spacing.customSpacingSize',\n\t'spacing.spacingSizes',\n\t'spacing.spacingScale',\n\t'spacing.blockGap',\n\t'spacing.margin',\n\t'spacing.padding',\n\t'spacing.units',\n\t'typography.fluid',\n\t'typography.customFontSize',\n\t'typography.dropCap',\n\t'typography.fontFamilies',\n\t'typography.fontSizes',\n\t'typography.fontStyle',\n\t'typography.fontWeight',\n\t'typography.letterSpacing',\n\t'typography.lineHeight',\n\t'typography.textDecoration',\n\t'typography.textTransform',\n];\n\nexport const useGlobalStylesReset = () => {\n\tconst { user: config, setUserConfig } = useContext( GlobalStylesContext );\n\tconst canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );\n\treturn [\n\t\tcanReset,\n\t\tuseCallback(\n\t\t\t() => setUserConfig( () => EMPTY_CONFIG ),\n\t\t\t[ setUserConfig ]\n\t\t),\n\t];\n};\n\nexport function useGlobalSetting( propertyPath, blockName, source = 'all' ) {\n\tconst { setUserConfig, ...configs } = useContext( GlobalStylesContext );\n\n\tconst appendedBlockPath = blockName ? '.blocks.' + blockName : '';\n\tconst appendedPropertyPath = propertyPath ? '.' + propertyPath : '';\n\tconst contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;\n\tconst globalPath = `settings${ appendedPropertyPath }`;\n\tconst sourceKey = source === 'all' ? 'merged' : source;\n\n\tconst settingValue = useMemo( () => {\n\t\tconst configToUse = configs[ sourceKey ];\n\t\tif ( ! configToUse ) {\n\t\t\tthrow 'Unsupported source';\n\t\t}\n\n\t\tif ( propertyPath ) {\n\t\t\treturn (\n\t\t\t\tget( configToUse, contextualPath ) ??\n\t\t\t\tget( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tconst result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tget(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ?? get( configToUse, `settings.${ setting }` );\n\t\t\tif ( value ) {\n\t\t\t\tset( result, setting, value );\n\t\t\t}\n\t\t} );\n\t\treturn result;\n\t}, [\n\t\tconfigs,\n\t\tsourceKey,\n\t\tpropertyPath,\n\t\tcontextualPath,\n\t\tglobalPath,\n\t\tappendedBlockPath,\n\t] );\n\n\tconst setSetting = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset( newUserConfig, contextualPath, newValue );\n\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\treturn [ settingValue, setSetting ];\n}\n\nexport function useGlobalStyle(\n\tpath,\n\tblockName,\n\tsource = 'all',\n\t{ shouldDecodeEncode = true } = {}\n) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst appendedPath = path ? '.' + path : '';\n\tconst finalPath = ! blockName\n\t\t? `styles${ appendedPath }`\n\t\t: `styles.blocks.${ blockName }${ appendedPath }`;\n\n\tconst setStyle = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset(\n\t\t\t\tnewUserConfig,\n\t\t\t\tfinalPath,\n\t\t\t\tshouldDecodeEncode\n\t\t\t\t\t? getPresetVariableFromValue(\n\t\t\t\t\t\t\tmergedConfig.settings,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tnewValue\n\t\t\t\t\t )\n\t\t\t\t\t: newValue\n\t\t\t);\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult =\n\t\t\t\t// The stlyes.css path is allowed to be empty, so don't revert to base if undefined.\n\t\t\t\tfinalPath === 'styles.css'\n\t\t\t\t\t? get( userConfig, finalPath )\n\t\t\t\t\t: get( mergedConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\trawResult = get( userConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\trawResult = get( baseConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( baseConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\treturn [ result, setStyle ];\n}\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\tif ( sides?.length ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tif ( ! supportedStyles.includes( 'minHeight' ) ) {\n\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\tminHeight: false,\n\t\t\t};\n\t\t}\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"names":["EMPTY_CONFIG","settings","styles","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","GlobalStylesContext","canReset","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","configToUse","result","forEach","setting","value","setSetting","newValue","currentConfig","newUserConfig","JSON","parse","stringify","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","rawResult","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","select","blocksStore","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","fontFamilies","key","textColumns","layout","spacing","sides","Array","isArray","length","dimensions","minHeight","charAt","toUpperCase","slice","border","useColorsPerOrigin","customColors","color","palette","custom","themeColors","theme","defaultColors","default","shouldDisplayDefaultColors","defaultPalette","push","name","colors"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAEC,EAAAA,QAAQ,EAAE,EAAZ;AAAgBC,EAAAA,MAAM,EAAE;AAAxB,CAArB;AAEA,MAAMC,cAAc,GAAG,CACtB,iBADsB,EAEtB,+BAFsB,EAGtB,cAHsB,EAItB,eAJsB,EAKtB,cALsB,EAMtB,cANsB,EAOtB,gBAPsB,EAQtB,uBARsB,EAStB,kBATsB,EAUtB,cAVsB,EAWtB,qBAXsB,EAYtB,sBAZsB,EAatB,sBAbsB,EActB,wBAdsB,EAetB,sBAfsB,EAgBtB,eAhBsB,EAiBtB,iBAjBsB,EAkBtB,YAlBsB,EAmBtB,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GAlCM,EAkCJ,CACFqD,YADE,EAEFI,WAFE,EAGFE,aAHE,EAIFE,0BAJE,CAlCI,CAAP;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_CONFIG = { settings: {}, styles: {} };\n\nconst VALID_SETTINGS = [\n\t'appearanceTools',\n\t'useRootPaddingAwareAlignments',\n\t'border.color',\n\t'border.radius',\n\t'border.style',\n\t'border.width',\n\t'shadow.presets',\n\t'shadow.defaultPresets',\n\t'color.background',\n\t'color.custom',\n\t'color.customDuotone',\n\t'color.customGradient',\n\t'color.defaultDuotone',\n\t'color.defaultGradients',\n\t'color.defaultPalette',\n\t'color.duotone',\n\t'color.gradients',\n\t'color.link',\n\t'color.palette',\n\t'color.text',\n\t'custom',\n\t'dimensions.minHeight',\n\t'layout.contentSize',\n\t'layout.definitions',\n\t'layout.wideSize',\n\t'position.fixed',\n\t'position.sticky',\n\t'spacing.customSpacingSize',\n\t'spacing.spacingSizes',\n\t'spacing.spacingScale',\n\t'spacing.blockGap',\n\t'spacing.margin',\n\t'spacing.padding',\n\t'spacing.units',\n\t'typography.fluid',\n\t'typography.customFontSize',\n\t'typography.dropCap',\n\t'typography.fontFamilies',\n\t'typography.fontSizes',\n\t'typography.fontStyle',\n\t'typography.fontWeight',\n\t'typography.letterSpacing',\n\t'typography.lineHeight',\n\t'typography.textColumns',\n\t'typography.textDecoration',\n\t'typography.textTransform',\n];\n\nexport const useGlobalStylesReset = () => {\n\tconst { user: config, setUserConfig } = useContext( GlobalStylesContext );\n\tconst canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );\n\treturn [\n\t\tcanReset,\n\t\tuseCallback(\n\t\t\t() => setUserConfig( () => EMPTY_CONFIG ),\n\t\t\t[ setUserConfig ]\n\t\t),\n\t];\n};\n\nexport function useGlobalSetting( propertyPath, blockName, source = 'all' ) {\n\tconst { setUserConfig, ...configs } = useContext( GlobalStylesContext );\n\n\tconst appendedBlockPath = blockName ? '.blocks.' + blockName : '';\n\tconst appendedPropertyPath = propertyPath ? '.' + propertyPath : '';\n\tconst contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;\n\tconst globalPath = `settings${ appendedPropertyPath }`;\n\tconst sourceKey = source === 'all' ? 'merged' : source;\n\n\tconst settingValue = useMemo( () => {\n\t\tconst configToUse = configs[ sourceKey ];\n\t\tif ( ! configToUse ) {\n\t\t\tthrow 'Unsupported source';\n\t\t}\n\n\t\tif ( propertyPath ) {\n\t\t\treturn (\n\t\t\t\tget( configToUse, contextualPath ) ??\n\t\t\t\tget( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tconst result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tget(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ?? get( configToUse, `settings.${ setting }` );\n\t\t\tif ( value ) {\n\t\t\t\tset( result, setting, value );\n\t\t\t}\n\t\t} );\n\t\treturn result;\n\t}, [\n\t\tconfigs,\n\t\tsourceKey,\n\t\tpropertyPath,\n\t\tcontextualPath,\n\t\tglobalPath,\n\t\tappendedBlockPath,\n\t] );\n\n\tconst setSetting = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset( newUserConfig, contextualPath, newValue );\n\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\treturn [ settingValue, setSetting ];\n}\n\nexport function useGlobalStyle(\n\tpath,\n\tblockName,\n\tsource = 'all',\n\t{ shouldDecodeEncode = true } = {}\n) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst appendedPath = path ? '.' + path : '';\n\tconst finalPath = ! blockName\n\t\t? `styles${ appendedPath }`\n\t\t: `styles.blocks.${ blockName }${ appendedPath }`;\n\n\tconst setStyle = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset(\n\t\t\t\tnewUserConfig,\n\t\t\t\tfinalPath,\n\t\t\t\tshouldDecodeEncode\n\t\t\t\t\t? getPresetVariableFromValue(\n\t\t\t\t\t\t\tmergedConfig.settings,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tnewValue\n\t\t\t\t\t )\n\t\t\t\t\t: newValue\n\t\t\t);\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult =\n\t\t\t\t// The styles.css path is allowed to be empty, so don't revert to base if undefined.\n\t\t\t\tfinalPath === 'styles.css'\n\t\t\t\t\t? get( userConfig, finalPath )\n\t\t\t\t\t: get( mergedConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\trawResult = get( userConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\trawResult = get( baseConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( baseConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\treturn [ result, setStyle ];\n}\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t// The column-count style is named text column to reduce confusion with\n\t\t// the columns block and manage expectations from the support.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/33587\n\t\tif ( ! supportedStyles.includes( 'columnCount' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextColumns: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\tif ( sides?.length ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tif ( ! supportedStyles.includes( 'minHeight' ) ) {\n\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\tminHeight: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {\n\t\t\tif (\n\t\t\t\t! supportedStyles.includes(\n\t\t\t\t\t'border' + key.charAt( 0 ).toUpperCase() + key.slice( 1 )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tupdatedSettings.border = {\n\t\t\t\t\t...updatedSettings.border,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n\nexport function useColorsPerOrigin( settings ) {\n\tconst customColors = settings?.color?.palette?.custom;\n\tconst themeColors = settings?.color?.palette?.theme;\n\tconst defaultColors = settings?.color?.palette?.default;\n\tconst shouldDisplayDefaultColors = settings?.color?.defaultPalette;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n}\n"]}
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "BorderPanel", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _borderPanel.default;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "DimensionsPanel", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -21,6 +27,12 @@ Object.defineProperty(exports, "TypographyPanel", {
21
27
  return _typographyPanel.default;
22
28
  }
23
29
  });
30
+ Object.defineProperty(exports, "useColorsPerOrigin", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _hooks.useColorsPerOrigin;
34
+ }
35
+ });
24
36
  Object.defineProperty(exports, "useGlobalSetting", {
25
37
  enumerable: true,
26
38
  get: function () {
@@ -45,6 +57,12 @@ Object.defineProperty(exports, "useGlobalStylesReset", {
45
57
  return _hooks.useGlobalStylesReset;
46
58
  }
47
59
  });
60
+ Object.defineProperty(exports, "useHasBorderPanel", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _borderPanel.useHasBorderPanel;
64
+ }
65
+ });
48
66
  Object.defineProperty(exports, "useHasDimensionsPanel", {
49
67
  enumerable: true,
50
68
  get: function () {
@@ -74,6 +92,8 @@ var _typographyPanel = _interopRequireWildcard(require("./typography-panel"));
74
92
 
75
93
  var _dimensionsPanel = _interopRequireWildcard(require("./dimensions-panel"));
76
94
 
95
+ var _borderPanel = _interopRequireWildcard(require("./border-panel"));
96
+
77
97
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
78
98
 
79
99
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AACA;;AACA;;AAIA","sourcesContent":["export {\n\tuseGlobalStylesReset,\n\tuseGlobalSetting,\n\tuseGlobalStyle,\n\tuseSettingsForBlockElement,\n} from './hooks';\nexport { useGlobalStylesOutput } from './use-global-styles-output';\nexport { GlobalStylesContext } from './context';\nexport {\n\tdefault as TypographyPanel,\n\tuseHasTypographyPanel,\n} from './typography-panel';\nexport {\n\tdefault as DimensionsPanel,\n\tuseHasDimensionsPanel,\n} from './dimensions-panel';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;AAIA;;AAIA","sourcesContent":["export {\n\tuseGlobalStylesReset,\n\tuseGlobalSetting,\n\tuseGlobalStyle,\n\tuseSettingsForBlockElement,\n\tuseColorsPerOrigin,\n} from './hooks';\nexport { useGlobalStylesOutput } from './use-global-styles-output';\nexport { GlobalStylesContext } from './context';\nexport {\n\tdefault as TypographyPanel,\n\tuseHasTypographyPanel,\n} from './typography-panel';\nexport {\n\tdefault as DimensionsPanel,\n\tuseHasDimensionsPanel,\n} from './dimensions-panel';\nexport { default as BorderPanel, useHasBorderPanel } from './border-panel';\n"]}