@wordpress/block-editor 9.7.0 → 9.7.1-next.d6164808d3.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 (279) hide show
  1. package/build/components/block-alignment-control/use-available-alignments.js +1 -1
  2. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  3. package/build/components/block-edit-visually-button/index.js +46 -0
  4. package/build/components/block-edit-visually-button/index.js.map +1 -0
  5. package/build/components/block-popover/inbetween.js +4 -2
  6. package/build/components/block-popover/inbetween.js.map +1 -1
  7. package/build/components/block-settings-menu/index.js +2 -6
  8. package/build/components/block-settings-menu/index.js.map +1 -1
  9. package/build/components/block-switcher/index.js +10 -16
  10. package/build/components/block-switcher/index.js.map +1 -1
  11. package/build/components/block-toolbar/index.js +5 -1
  12. package/build/components/block-toolbar/index.js.map +1 -1
  13. package/build/components/border-radius-control/all-input-control.js +31 -3
  14. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  15. package/build/components/border-radius-control/index.js +20 -6
  16. package/build/components/border-radius-control/index.js.map +1 -1
  17. package/build/components/border-radius-control/input-controls.js +21 -6
  18. package/build/components/border-radius-control/input-controls.js.map +1 -1
  19. package/build/components/border-radius-control/utils.js +13 -16
  20. package/build/components/border-radius-control/utils.js.map +1 -1
  21. package/build/components/colors/with-colors.js +17 -4
  22. package/build/components/colors/with-colors.js.map +1 -1
  23. package/build/components/copy-handler/index.js +6 -0
  24. package/build/components/copy-handler/index.js.map +1 -1
  25. package/build/components/date-format-picker/index.js +2 -7
  26. package/build/components/date-format-picker/index.js.map +1 -1
  27. package/build/components/duotone/components.js +5 -5
  28. package/build/components/duotone/components.js.map +1 -1
  29. package/build/components/font-family/index.js +1 -1
  30. package/build/components/font-family/index.js.map +1 -1
  31. package/build/components/font-sizes/with-font-sizes.js +17 -4
  32. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  33. package/build/components/index.js +9 -0
  34. package/build/components/index.js.map +1 -1
  35. package/build/components/inserter/search-items.js +22 -4
  36. package/build/components/inserter/search-items.js.map +1 -1
  37. package/build/components/link-control/link-preview.js +0 -1
  38. package/build/components/link-control/link-preview.js.map +1 -1
  39. package/build/components/list-view/block-select-button.js +5 -2
  40. package/build/components/list-view/block-select-button.js.map +1 -1
  41. package/build/components/list-view/use-block-selection.js +1 -7
  42. package/build/components/list-view/use-block-selection.js.map +1 -1
  43. package/build/components/rich-text/use-enter.js +0 -4
  44. package/build/components/rich-text/use-enter.js.map +1 -1
  45. package/build/components/rich-text/use-format-types.js +8 -11
  46. package/build/components/rich-text/use-format-types.js.map +1 -1
  47. package/build/components/spacing-sizes-control/all-input-control.js +53 -0
  48. package/build/components/spacing-sizes-control/all-input-control.js.map +1 -0
  49. package/build/components/spacing-sizes-control/axial-input-controls.js +69 -0
  50. package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
  51. package/build/components/spacing-sizes-control/index.js +100 -0
  52. package/build/components/spacing-sizes-control/index.js.map +1 -0
  53. package/build/components/spacing-sizes-control/input-controls.js +52 -0
  54. package/build/components/spacing-sizes-control/input-controls.js.map +1 -0
  55. package/build/components/spacing-sizes-control/linked-button.js +38 -0
  56. package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
  57. package/build/components/spacing-sizes-control/spacing-input-control.js +208 -0
  58. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
  59. package/build/components/spacing-sizes-control/utils.js +202 -0
  60. package/build/components/spacing-sizes-control/utils.js.map +1 -0
  61. package/build/components/url-input/index.js +1 -1
  62. package/build/components/url-input/index.js.map +1 -1
  63. package/build/components/writing-flow/use-multi-selection.js +4 -2
  64. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  65. package/build/components/writing-flow/use-selection-observer.js +10 -2
  66. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  67. package/build/hooks/border-radius.js +2 -7
  68. package/build/hooks/border-radius.js.map +1 -1
  69. package/build/hooks/border.js +2 -2
  70. package/build/hooks/border.js.map +1 -1
  71. package/build/hooks/color.js +4 -1
  72. package/build/hooks/color.js.map +1 -1
  73. package/build/hooks/dimensions.js +15 -0
  74. package/build/hooks/dimensions.js.map +1 -1
  75. package/build/hooks/duotone.js +4 -4
  76. package/build/hooks/duotone.js.map +1 -1
  77. package/build/hooks/gap.js +6 -4
  78. package/build/hooks/gap.js.map +1 -1
  79. package/build/hooks/generated-class-name.js +1 -7
  80. package/build/hooks/generated-class-name.js.map +1 -1
  81. package/build/hooks/layout.js +20 -12
  82. package/build/hooks/layout.js.map +1 -1
  83. package/build/hooks/margin.js +28 -12
  84. package/build/hooks/margin.js.map +1 -1
  85. package/build/hooks/padding.js +19 -8
  86. package/build/hooks/padding.js.map +1 -1
  87. package/build/hooks/style.js +4 -50
  88. package/build/hooks/style.js.map +1 -1
  89. package/build/layouts/constrained.js +215 -0
  90. package/build/layouts/constrained.js.map +1 -0
  91. package/build/layouts/flex.js +1 -1
  92. package/build/layouts/flex.js.map +1 -1
  93. package/build/layouts/flow.js +7 -169
  94. package/build/layouts/flow.js.map +1 -1
  95. package/build/layouts/index.js +3 -1
  96. package/build/layouts/index.js.map +1 -1
  97. package/build/layouts/utils.js +43 -0
  98. package/build/layouts/utils.js.map +1 -1
  99. package/build/store/actions.js +25 -3
  100. package/build/store/actions.js.map +1 -1
  101. package/build/store/selectors.js +4 -6
  102. package/build/store/selectors.js.map +1 -1
  103. package/build-module/components/block-alignment-control/use-available-alignments.js +1 -1
  104. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  105. package/build-module/components/block-edit-visually-button/index.js +35 -0
  106. package/build-module/components/block-edit-visually-button/index.js.map +1 -0
  107. package/build-module/components/block-popover/inbetween.js +4 -2
  108. package/build-module/components/block-popover/inbetween.js.map +1 -1
  109. package/build-module/components/block-settings-menu/index.js +3 -6
  110. package/build-module/components/block-settings-menu/index.js.map +1 -1
  111. package/build-module/components/block-switcher/index.js +10 -16
  112. package/build-module/components/block-switcher/index.js.map +1 -1
  113. package/build-module/components/block-toolbar/index.js +4 -1
  114. package/build-module/components/block-toolbar/index.js.map +1 -1
  115. package/build-module/components/border-radius-control/all-input-control.js +32 -4
  116. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  117. package/build-module/components/border-radius-control/index.js +20 -6
  118. package/build-module/components/border-radius-control/index.js.map +1 -1
  119. package/build-module/components/border-radius-control/input-controls.js +22 -7
  120. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  121. package/build-module/components/border-radius-control/utils.js +13 -16
  122. package/build-module/components/border-radius-control/utils.js.map +1 -1
  123. package/build-module/components/colors/with-colors.js +16 -3
  124. package/build-module/components/colors/with-colors.js.map +1 -1
  125. package/build-module/components/copy-handler/index.js +7 -1
  126. package/build-module/components/copy-handler/index.js.map +1 -1
  127. package/build-module/components/date-format-picker/index.js +2 -6
  128. package/build-module/components/date-format-picker/index.js.map +1 -1
  129. package/build-module/components/duotone/components.js +5 -5
  130. package/build-module/components/duotone/components.js.map +1 -1
  131. package/build-module/components/font-family/index.js +1 -1
  132. package/build-module/components/font-family/index.js.map +1 -1
  133. package/build-module/components/font-sizes/with-font-sizes.js +16 -3
  134. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  135. package/build-module/components/index.js +1 -0
  136. package/build-module/components/index.js.map +1 -1
  137. package/build-module/components/inserter/search-items.js +19 -5
  138. package/build-module/components/inserter/search-items.js.map +1 -1
  139. package/build-module/components/link-control/link-preview.js +0 -1
  140. package/build-module/components/link-control/link-preview.js.map +1 -1
  141. package/build-module/components/list-view/block-select-button.js +5 -2
  142. package/build-module/components/list-view/block-select-button.js.map +1 -1
  143. package/build-module/components/list-view/use-block-selection.js +1 -6
  144. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  145. package/build-module/components/rich-text/use-enter.js +0 -4
  146. package/build-module/components/rich-text/use-enter.js.map +1 -1
  147. package/build-module/components/rich-text/use-format-types.js +8 -10
  148. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  149. package/build-module/components/spacing-sizes-control/all-input-control.js +41 -0
  150. package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -0
  151. package/build-module/components/spacing-sizes-control/axial-input-controls.js +57 -0
  152. package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
  153. package/build-module/components/spacing-sizes-control/index.js +83 -0
  154. package/build-module/components/spacing-sizes-control/index.js.map +1 -0
  155. package/build-module/components/spacing-sizes-control/input-controls.js +41 -0
  156. package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -0
  157. package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
  158. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
  159. package/build-module/components/spacing-sizes-control/spacing-input-control.js +192 -0
  160. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
  161. package/build-module/components/spacing-sizes-control/utils.js +174 -0
  162. package/build-module/components/spacing-sizes-control/utils.js.map +1 -0
  163. package/build-module/components/url-input/index.js +1 -1
  164. package/build-module/components/url-input/index.js.map +1 -1
  165. package/build-module/components/writing-flow/use-multi-selection.js +4 -2
  166. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  167. package/build-module/components/writing-flow/use-selection-observer.js +10 -2
  168. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  169. package/build-module/hooks/border-radius.js +2 -7
  170. package/build-module/hooks/border-radius.js.map +1 -1
  171. package/build-module/hooks/border.js +2 -2
  172. package/build-module/hooks/border.js.map +1 -1
  173. package/build-module/hooks/color.js +4 -1
  174. package/build-module/hooks/color.js.map +1 -1
  175. package/build-module/hooks/dimensions.js +13 -0
  176. package/build-module/hooks/dimensions.js.map +1 -1
  177. package/build-module/hooks/duotone.js +4 -4
  178. package/build-module/hooks/duotone.js.map +1 -1
  179. package/build-module/hooks/gap.js +3 -2
  180. package/build-module/hooks/gap.js.map +1 -1
  181. package/build-module/hooks/generated-class-name.js +1 -6
  182. package/build-module/hooks/generated-class-name.js.map +1 -1
  183. package/build-module/hooks/layout.js +20 -12
  184. package/build-module/hooks/layout.js.map +1 -1
  185. package/build-module/hooks/margin.js +26 -12
  186. package/build-module/hooks/margin.js.map +1 -1
  187. package/build-module/hooks/padding.js +17 -8
  188. package/build-module/hooks/padding.js.map +1 -1
  189. package/build-module/hooks/style.js +7 -53
  190. package/build-module/hooks/style.js.map +1 -1
  191. package/build-module/layouts/constrained.js +197 -0
  192. package/build-module/layouts/constrained.js.map +1 -0
  193. package/build-module/layouts/flex.js +1 -1
  194. package/build-module/layouts/flex.js.map +1 -1
  195. package/build-module/layouts/flow.js +8 -163
  196. package/build-module/layouts/flow.js.map +1 -1
  197. package/build-module/layouts/index.js +2 -1
  198. package/build-module/layouts/index.js.map +1 -1
  199. package/build-module/layouts/utils.js +40 -0
  200. package/build-module/layouts/utils.js.map +1 -1
  201. package/build-module/store/actions.js +25 -3
  202. package/build-module/store/actions.js.map +1 -1
  203. package/build-module/store/selectors.js +5 -7
  204. package/build-module/store/selectors.js.map +1 -1
  205. package/build-style/style-rtl.css +115 -20
  206. package/build-style/style.css +115 -20
  207. package/package.json +30 -28
  208. package/src/components/block-alignment-control/use-available-alignments.js +1 -1
  209. package/src/components/block-edit-visually-button/index.js +39 -0
  210. package/src/components/block-popover/inbetween.js +4 -1
  211. package/src/components/block-settings-menu/index.js +11 -15
  212. package/src/components/block-switcher/index.js +9 -13
  213. package/src/components/block-switcher/test/index.js +1 -0
  214. package/src/components/block-toolbar/index.js +2 -0
  215. package/src/components/border-radius-control/all-input-control.js +41 -4
  216. package/src/components/border-radius-control/index.js +25 -5
  217. package/src/components/border-radius-control/input-controls.js +40 -13
  218. package/src/components/border-radius-control/test/utils.js +22 -60
  219. package/src/components/border-radius-control/utils.js +12 -16
  220. package/src/components/colors/with-colors.js +11 -1
  221. package/src/components/copy-handler/index.js +18 -0
  222. package/src/components/date-format-picker/index.js +12 -14
  223. package/src/components/date-format-picker/style.scss +0 -4
  224. package/src/components/duotone/components.js +5 -5
  225. package/src/components/duotone-control/style.scss +0 -4
  226. package/src/components/font-appearance-control/style.scss +0 -2
  227. package/src/components/font-family/index.js +1 -1
  228. package/src/components/font-sizes/with-font-sizes.js +11 -1
  229. package/src/components/index.js +1 -0
  230. package/src/components/inserter/search-items.js +17 -5
  231. package/src/components/link-control/link-preview.js +0 -1
  232. package/src/components/link-control/test/index.js +540 -893
  233. package/src/components/list-view/block-select-button.js +7 -2
  234. package/src/components/list-view/style.scss +11 -4
  235. package/src/components/list-view/use-block-selection.js +2 -8
  236. package/src/components/media-replace-flow/style.scss +1 -0
  237. package/src/components/rich-text/use-enter.js +0 -3
  238. package/src/components/rich-text/use-format-types.js +6 -6
  239. package/src/components/spacing-sizes-control/all-input-control.js +40 -0
  240. package/src/components/spacing-sizes-control/axial-input-controls.js +62 -0
  241. package/src/components/spacing-sizes-control/index.js +91 -0
  242. package/src/components/spacing-sizes-control/input-controls.js +46 -0
  243. package/src/components/spacing-sizes-control/linked-button.js +25 -0
  244. package/src/components/spacing-sizes-control/spacing-input-control.js +280 -0
  245. package/src/components/spacing-sizes-control/style.scss +122 -0
  246. package/src/components/spacing-sizes-control/test/utils.js +156 -0
  247. package/src/components/spacing-sizes-control/utils.js +195 -0
  248. package/src/components/url-input/index.js +1 -1
  249. package/src/components/url-input/style.scss +2 -2
  250. package/src/components/url-popover/style.scss +0 -3
  251. package/src/components/writing-flow/use-multi-selection.js +4 -1
  252. package/src/components/writing-flow/use-selection-observer.js +10 -2
  253. package/src/hooks/border-radius.js +2 -6
  254. package/src/hooks/border.js +2 -2
  255. package/src/hooks/color.js +13 -3
  256. package/src/hooks/dimensions.js +15 -0
  257. package/src/hooks/duotone.js +4 -4
  258. package/src/hooks/gap.js +7 -2
  259. package/src/hooks/generated-class-name.js +6 -9
  260. package/src/hooks/layout.js +45 -14
  261. package/src/hooks/margin.js +49 -17
  262. package/src/hooks/padding.js +41 -14
  263. package/src/hooks/style.js +5 -56
  264. package/src/hooks/test/gap.js +22 -0
  265. package/src/hooks/typography.scss +0 -1
  266. package/src/layouts/constrained.js +217 -0
  267. package/src/layouts/flex.js +1 -1
  268. package/src/layouts/flow.js +6 -173
  269. package/src/layouts/index.js +2 -1
  270. package/src/layouts/test/constrained.js +21 -0
  271. package/src/layouts/utils.js +34 -0
  272. package/src/store/actions.js +32 -4
  273. package/src/store/selectors.js +5 -4
  274. package/src/style.scss +1 -0
  275. package/build/components/block-settings-menu/block-edit-visually-button.js +0 -70
  276. package/build/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
  277. package/build-module/components/block-settings-menu/block-edit-visually-button.js +0 -56
  278. package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
  279. package/src/components/block-settings-menu/block-edit-visually-button.js +0 -52
@@ -1,24 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _element = require("@wordpress/element");
11
-
12
- var _components = require("@wordpress/components");
13
-
14
8
  var _i18n = require("@wordpress/i18n");
15
9
 
16
- var _icons = require("@wordpress/icons");
17
-
18
- var _styleEngine = require("@wordpress/style-engine");
19
-
20
- var _useSetting = _interopRequireDefault(require("../components/use-setting"));
21
-
22
10
  var _utils = require("./utils");
23
11
 
24
12
  var _gap = require("../hooks/gap");
@@ -35,123 +23,27 @@ var _utils2 = require("../hooks/utils");
35
23
  var _default = {
36
24
  name: 'default',
37
25
  label: (0, _i18n.__)('Flow'),
38
- inspectorControls: function DefaultLayoutInspectorControls(_ref) {
39
- let {
40
- layout,
41
- onChange
42
- } = _ref;
43
- const {
44
- wideSize,
45
- contentSize
46
- } = layout;
47
- const units = (0, _components.__experimentalUseCustomUnits)({
48
- availableUnits: (0, _useSetting.default)('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
49
- });
50
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
51
- className: "block-editor-hooks__layout-controls"
52
- }, (0, _element.createElement)("div", {
53
- className: "block-editor-hooks__layout-controls-unit"
54
- }, (0, _element.createElement)(_components.__experimentalUnitControl, {
55
- label: (0, _i18n.__)('Content'),
56
- labelPosition: "top",
57
- __unstableInputWidth: "80px",
58
- value: contentSize || wideSize || '',
59
- onChange: nextWidth => {
60
- nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth;
61
- onChange({ ...layout,
62
- contentSize: nextWidth
63
- });
64
- },
65
- units: units
66
- }), (0, _element.createElement)(_icons.Icon, {
67
- icon: _icons.positionCenter
68
- })), (0, _element.createElement)("div", {
69
- className: "block-editor-hooks__layout-controls-unit"
70
- }, (0, _element.createElement)(_components.__experimentalUnitControl, {
71
- label: (0, _i18n.__)('Wide'),
72
- labelPosition: "top",
73
- __unstableInputWidth: "80px",
74
- value: wideSize || contentSize || '',
75
- onChange: nextWidth => {
76
- nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth;
77
- onChange({ ...layout,
78
- wideSize: nextWidth
79
- });
80
- },
81
- units: units
82
- }), (0, _element.createElement)(_icons.Icon, {
83
- icon: _icons.stretchWide
84
- }))), (0, _element.createElement)("div", {
85
- className: "block-editor-hooks__layout-controls-reset"
86
- }, (0, _element.createElement)(_components.Button, {
87
- variant: "secondary",
88
- isSmall: true,
89
- disabled: !contentSize && !wideSize,
90
- onClick: () => onChange({
91
- contentSize: undefined,
92
- wideSize: undefined,
93
- inherit: false
94
- })
95
- }, (0, _i18n.__)('Reset'))), (0, _element.createElement)("p", {
96
- className: "block-editor-hooks__layout-controls-helptext"
97
- }, (0, _i18n.__)('Customize the width for all elements that are assigned to the center or wide columns.')));
26
+ inspectorControls: function DefaultLayoutInspectorControls() {
27
+ return null;
98
28
  },
99
29
  toolBarControls: function DefaultLayoutToolbarControls() {
100
30
  return null;
101
31
  },
102
- getLayoutStyle: function getLayoutStyle(_ref2) {
103
- var _style$spacing, _style$spacing2;
32
+ getLayoutStyle: function getLayoutStyle(_ref) {
33
+ var _style$spacing;
104
34
 
105
35
  let {
106
36
  selector,
107
- layout = {},
108
37
  style,
109
38
  blockName,
110
39
  hasBlockGapSupport,
111
40
  layoutDefinitions
112
- } = _ref2;
113
- const {
114
- contentSize,
115
- wideSize
116
- } = layout;
41
+ } = _ref;
117
42
  const blockGapStyleValue = (0, _gap.getGapBoxControlValueFromStyle)(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap); // If a block's block.json skips serialization for spacing or
118
43
  // spacing.blockGap, don't apply the user-defined value to the styles.
119
44
 
120
45
  const blockGapValue = blockGapStyleValue !== null && blockGapStyleValue !== void 0 && blockGapStyleValue.top && !(0, _utils2.shouldSkipSerialization)(blockName, 'spacing', 'blockGap') ? blockGapStyleValue === null || blockGapStyleValue === void 0 ? void 0 : blockGapStyleValue.top : '';
121
- let output = !!contentSize || !!wideSize ? `
122
- ${(0, _utils.appendSelectors)(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} {
123
- max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
124
- margin-left: auto !important;
125
- margin-right: auto !important;
126
- }
127
- ${(0, _utils.appendSelectors)(selector, '> .alignwide')} {
128
- max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize};
129
- }
130
- ${(0, _utils.appendSelectors)(selector, '> .alignfull')} {
131
- max-width: none;
132
- }
133
- ` : ''; // If there is custom padding, add negative margins for alignfull blocks.
134
-
135
- if (style !== null && style !== void 0 && (_style$spacing2 = style.spacing) !== null && _style$spacing2 !== void 0 && _style$spacing2.padding) {
136
- // The style object might be storing a preset so we need to make sure we get a usable value.
137
- const paddingValues = (0, _styleEngine.getCSSRules)(style);
138
- paddingValues.forEach(rule => {
139
- if (rule.key === 'paddingRight') {
140
- output += `
141
- ${(0, _utils.appendSelectors)(selector, '> .alignfull')} {
142
- margin-right: calc(${rule.value} * -1);
143
- }
144
- `;
145
- } else if (rule.key === 'paddingLeft') {
146
- output += `
147
- ${(0, _utils.appendSelectors)(selector, '> .alignfull')} {
148
- margin-left: calc(${rule.value} * -1);
149
- }
150
- `;
151
- }
152
- });
153
- } // Output blockGap styles based on rules contained in layout definitions in theme.json.
154
-
46
+ let output = ''; // Output blockGap styles based on rules contained in layout definitions in theme.json.
155
47
 
156
48
  if (hasBlockGapSupport && blockGapValue) {
157
49
  output += (0, _utils.getBlockGapCSS)(selector, layoutDefinitions, 'default', blockGapValue);
@@ -165,7 +57,7 @@ var _default = {
165
57
  },
166
58
 
167
59
  getAlignments(layout) {
168
- const alignmentInfo = getAlignmentsInfo(layout);
60
+ const alignmentInfo = (0, _utils.getAlignmentsInfo)(layout);
169
61
 
170
62
  if (layout.alignments !== undefined) {
171
63
  if (!layout.alignments.includes('none')) {
@@ -178,10 +70,6 @@ var _default = {
178
70
  }));
179
71
  }
180
72
 
181
- const {
182
- contentSize,
183
- wideSize
184
- } = layout;
185
73
  const alignments = [{
186
74
  name: 'left'
187
75
  }, {
@@ -189,20 +77,6 @@ var _default = {
189
77
  }, {
190
78
  name: 'right'
191
79
  }];
192
-
193
- if (contentSize) {
194
- alignments.unshift({
195
- name: 'full'
196
- });
197
- }
198
-
199
- if (wideSize) {
200
- alignments.unshift({
201
- name: 'wide',
202
- info: alignmentInfo.wide
203
- });
204
- }
205
-
206
80
  alignments.unshift({
207
81
  name: 'none',
208
82
  info: alignmentInfo.none
@@ -211,41 +85,5 @@ var _default = {
211
85
  }
212
86
 
213
87
  };
214
- /**
215
- * Helper method to assign contextual info to clarify
216
- * alignment settings.
217
- *
218
- * Besides checking if `contentSize` and `wideSize` have a
219
- * value, we now show this information only if their values
220
- * are not a `css var`. This needs to change when parsing
221
- * css variables land.
222
- *
223
- * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752
224
- *
225
- * @param {Object} layout The layout object.
226
- * @return {Object} An object with contextual info per alignment.
227
- */
228
-
229
88
  exports.default = _default;
230
-
231
- function getAlignmentsInfo(layout) {
232
- const {
233
- contentSize,
234
- wideSize
235
- } = layout;
236
- const alignmentInfo = {};
237
- const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;
238
-
239
- if (sizeRegex.test(contentSize)) {
240
- // translators: %s: container size (i.e. 600px etc)
241
- alignmentInfo.none = (0, _i18n.sprintf)((0, _i18n.__)('Max %s wide'), contentSize);
242
- }
243
-
244
- if (sizeRegex.test(wideSize)) {
245
- // translators: %s: container size (i.e. 600px etc)
246
- alignmentInfo.wide = (0, _i18n.sprintf)((0, _i18n.__)('Max %s wide'), wideSize);
247
- }
248
-
249
- return alignmentInfo;
250
- }
251
89
  //# sourceMappingURL=flow.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","wideSize","contentSize","units","availableUnits","nextWidth","parseFloat","positionCenter","stretchWide","undefined","inherit","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","padding","paddingValues","forEach","rule","key","value","getOrientation","getAlignments","alignmentInfo","getAlignmentsInfo","alignments","includes","unshift","map","alignment","info","wide","none","sizeRegex","test"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;eAMe;AACdA,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAE,cAAI,MAAJ,CAFO;AAGdC,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,OAGf;AAAA,QAHwD;AAC3DC,MAAAA,MAD2D;AAE3DC,MAAAA;AAF2D,KAGxD;AACH,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,QAA4BH,MAAlC;AACA,UAAMI,KAAK,GAAG,8CAAgB;AAC7BC,MAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAChD,GADgD,EAEhD,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M;AAAEG,IAAAA,WAAF;AAAeD,IAAAA;AAAf,MAA4BF,MAAlC;AACA,QAAMkC,aAAa,GAAG,EAAtB;AACA,QAAMU,SAAS,GAAG,iCAAlB;;AACA,MAAKA,SAAS,CAACC,IAAV,CAAgB1C,WAAhB,CAAL,EAAqC;AACpC;AACA+B,IAAAA,aAAa,CAACS,IAAd,GAAqB,mBAAS,cAAI,aAAJ,CAAT,EAA8BxC,WAA9B,CAArB;AACA;;AACD,MAAKyC,SAAS,CAACC,IAAV,CAAgB3C,QAAhB,CAAL,EAAkC;AACjC;AACAgC,IAAAA,aAAa,CAACQ,IAAd,GAAqB,mBAAS,cAAI,aAAJ,CAAT,EAA8BxC,QAA9B,CAArB;AACA;;AACD,SAAOgC,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapBoxControlValueFromStyle } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t} ) {\n\t\tconst { wideSize, contentSize } = layout;\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t\t'%',\n\t\t\t\t'px',\n\t\t\t\t'em',\n\t\t\t\t'rem',\n\t\t\t\t'vw',\n\t\t\t],\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls-reset\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tdisabled={ ! contentSize && ! wideSize }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcontentSize: undefined,\n\t\t\t\t\t\t\t\twideSize: undefined,\n\t\t\t\t\t\t\t\tinherit: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst { contentSize, wideSize } = layout;\n\t\tconst blockGapStyleValue = getGapBoxControlValueFromStyle(\n\t\t\tstyle?.spacing?.blockGap\n\t\t);\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tblockGapStyleValue?.top &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? blockGapStyleValue?.top\n\t\t\t\t: '';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\t// If there is custom padding, add negative margins for alignfull blocks.\n\t\tif ( style?.spacing?.padding ) {\n\t\t\t// The style object might be storing a preset so we need to make sure we get a usable value.\n\t\t\tconst paddingValues = getCSSRules( style );\n\t\t\tpaddingValues.forEach( ( rule ) => {\n\t\t\t\tif ( rule.key === 'paddingRight' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-right: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t} else if ( rule.key === 'paddingLeft' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-left: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'default',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n\n/**\n * Helper method to assign contextual info to clarify\n * alignment settings.\n *\n * Besides checking if `contentSize` and `wideSize` have a\n * value, we now show this information only if their values\n * are not a `css var`. This needs to change when parsing\n * css variables land.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752\n *\n * @param {Object} layout The layout object.\n * @return {Object} An object with contextual info per alignment.\n */\nfunction getAlignmentsInfo( layout ) {\n\tconst { contentSize, wideSize } = layout;\n\tconst alignmentInfo = {};\n\tconst sizeRegex = /^(?!0)\\d+(px|em|rem|vw|vh|%)?$/i;\n\tif ( sizeRegex.test( contentSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );\n\t}\n\tif ( sizeRegex.test( wideSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.wide = sprintf( __( 'Max %s wide' ), wideSize );\n\t}\n\treturn alignmentInfo;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["name","label","inspectorControls","DefaultLayoutInspectorControls","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","getOrientation","getAlignments","layout","alignmentInfo","alignments","undefined","includes","unshift","map","alignment","info","none"],"mappings":";;;;;;;AAGA;;AAMA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;eAMe;AACdA,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAE,cAAI,MAAJ,CAFO;AAGdC,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,GAA0C;AAC5D,WAAO,IAAP;AACA,GALa;AAMdC,EAAAA,eAAe,EAAE,SAASC,4BAAT,GAAwC;AACxD,WAAO,IAAP;AACA,GARa;AASdC,EAAAA,cAAc,EAAE,SAASA,cAAT,OAMZ;AAAA;;AAAA,QANqC;AACxCC,MAAAA,QADwC;AAExCC,MAAAA,KAFwC;AAGxCC,MAAAA,SAHwC;AAIxCC,MAAAA,kBAJwC;AAKxCC,MAAAA;AALwC,KAMrC;AACH,UAAMC,kBAAkB,GAAG,yCAC1BJ,KAD0B,aAC1BA,KAD0B,yCAC1BA,KAAK,CAAEK,OADmB,mDAC1B,eAAgBC,QADU,CAA3B,CADG,CAIH;AACA;;AACA,UAAMC,aAAa,GAClBH,kBAAkB,SAAlB,IAAAA,kBAAkB,WAAlB,IAAAA,kBAAkB,CAAEI,GAApB,IACA,CAAE,qCAAyBP,SAAzB,EAAoC,SAApC,EAA+C,UAA/C,CADF,GAEGG,kBAFH,aAEGA,kBAFH,uBAEGA,kBAAkB,CAAEI,GAFvB,GAGG,EAJJ;AAMA,QAAIC,MAAM,GAAG,EAAb,CAZG,CAcH;;AACA,QAAKP,kBAAkB,IAAIK,aAA3B,EAA2C;AAC1CE,MAAAA,MAAM,IAAI,2BACTV,QADS,EAETI,iBAFS,EAGT,SAHS,EAITI,aAJS,CAAV;AAMA;;AACD,WAAOE,MAAP;AACA,GAvCa;;AAwCdC,EAAAA,cAAc,GAAG;AAChB,WAAO,UAAP;AACA,GA1Ca;;AA2CdC,EAAAA,aAAa,CAAEC,MAAF,EAAW;AACvB,UAAMC,aAAa,GAAG,8BAAmBD,MAAnB,CAAtB;;AACA,QAAKA,MAAM,CAACE,UAAP,KAAsBC,SAA3B,EAAuC;AACtC,UAAK,CAAEH,MAAM,CAACE,UAAP,CAAkBE,QAAlB,CAA4B,MAA5B,CAAP,EAA8C;AAC7CJ,QAAAA,MAAM,CAACE,UAAP,CAAkBG,OAAlB,CAA2B,MAA3B;AACA;;AACD,aAAOL,MAAM,CAACE,UAAP,CAAkBI,GAAlB,CAAyBC,SAAF,KAAmB;AAChD3B,QAAAA,IAAI,EAAE2B,SAD0C;AAEhDC,QAAAA,IAAI,EAAEP,aAAa,CAAEM,SAAF;AAF6B,OAAnB,CAAvB,CAAP;AAIA;;AAED,UAAML,UAAU,GAAG,CAClB;AAAEtB,MAAAA,IAAI,EAAE;AAAR,KADkB,EAElB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAFkB,EAGlB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAHkB,CAAnB;AAMAsB,IAAAA,UAAU,CAACG,OAAX,CAAoB;AAAEzB,MAAAA,IAAI,EAAE,MAAR;AAAgB4B,MAAAA,IAAI,EAAEP,aAAa,CAACQ;AAApC,KAApB;AAEA,WAAOP,UAAP;AACA;;AAhEa,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nimport { getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapBoxControlValueFromStyle } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls() {\n\t\treturn null;\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst blockGapStyleValue = getGapBoxControlValueFromStyle(\n\t\t\tstyle?.spacing?.blockGap\n\t\t);\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tblockGapStyleValue?.top &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? blockGapStyleValue?.top\n\t\t\t\t: '';\n\n\t\tlet output = '';\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'default',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n"]}
@@ -12,10 +12,12 @@ var _flex = _interopRequireDefault(require("./flex"));
12
12
 
13
13
  var _flow = _interopRequireDefault(require("./flow"));
14
14
 
15
+ var _constrained = _interopRequireDefault(require("./constrained"));
16
+
15
17
  /**
16
18
  * Internal dependencies
17
19
  */
18
- const layoutTypes = [_flow.default, _flex.default];
20
+ const layoutTypes = [_flow.default, _flex.default, _constrained.default];
19
21
  /**
20
22
  * Retrieves a layout type by name.
21
23
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/index.js"],"names":["layoutTypes","flow","flex","getLayoutType","name","find","layoutType","getLayoutTypes"],"mappings":";;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,WAAW,GAAG,CAAEC,aAAF,EAAQC,aAAR,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,aAAT,GAA2C;AAAA,MAAnBC,IAAmB,uEAAZ,SAAY;AACjD,SAAOJ,WAAW,CAACK,IAAZ,CAAoBC,UAAF,IAAkBA,UAAU,CAACF,IAAX,KAAoBA,IAAxD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASG,cAAT,GAA0B;AAChC,SAAOP,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport flex from './flex';\nimport flow from './flow';\n\nconst layoutTypes = [ flow, flex ];\n\n/**\n * Retrieves a layout type by name.\n *\n * @param {string} name - The name of the layout type.\n * @return {Object} Layout type.\n */\nexport function getLayoutType( name = 'default' ) {\n\treturn layoutTypes.find( ( layoutType ) => layoutType.name === name );\n}\n\n/**\n * Retrieves the available layout types.\n *\n * @return {Array} Layout types.\n */\nexport function getLayoutTypes() {\n\treturn layoutTypes;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/index.js"],"names":["layoutTypes","flow","flex","constrained","getLayoutType","name","find","layoutType","getLayoutTypes"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,MAAMA,WAAW,GAAG,CAAEC,aAAF,EAAQC,aAAR,EAAcC,oBAAd,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,aAAT,GAA2C;AAAA,MAAnBC,IAAmB,uEAAZ,SAAY;AACjD,SAAOL,WAAW,CAACM,IAAZ,CAAoBC,UAAF,IAAkBA,UAAU,CAACF,IAAX,KAAoBA,IAAxD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASG,cAAT,GAA0B;AAChC,SAAOR,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport flex from './flex';\nimport flow from './flow';\nimport constrained from './constrained';\n\nconst layoutTypes = [ flow, flex, constrained ];\n\n/**\n * Retrieves a layout type by name.\n *\n * @param {string} name - The name of the layout type.\n * @return {Object} Layout type.\n */\nexport function getLayoutType( name = 'default' ) {\n\treturn layoutTypes.find( ( layoutType ) => layoutType.name === name );\n}\n\n/**\n * Retrieves the available layout types.\n *\n * @return {Array} Layout types.\n */\nexport function getLayoutTypes() {\n\treturn layoutTypes;\n}\n"]}
@@ -4,8 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.appendSelectors = appendSelectors;
7
+ exports.getAlignmentsInfo = getAlignmentsInfo;
7
8
  exports.getBlockGapCSS = getBlockGapCSS;
8
9
 
10
+ var _i18n = require("@wordpress/i18n");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
9
16
  /**
10
17
  * Utility to generate the proper CSS selector for layout styles.
11
18
  *
@@ -54,4 +61,40 @@ function getBlockGapCSS(selector, layoutDefinitions, layoutType, blockGapValue)
54
61
 
55
62
  return output;
56
63
  }
64
+ /**
65
+ * Helper method to assign contextual info to clarify
66
+ * alignment settings.
67
+ *
68
+ * Besides checking if `contentSize` and `wideSize` have a
69
+ * value, we now show this information only if their values
70
+ * are not a `css var`. This needs to change when parsing
71
+ * css variables land.
72
+ *
73
+ * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752
74
+ *
75
+ * @param {Object} layout The layout object.
76
+ * @return {Object} An object with contextual info per alignment.
77
+ */
78
+
79
+
80
+ function getAlignmentsInfo(layout) {
81
+ const {
82
+ contentSize,
83
+ wideSize
84
+ } = layout;
85
+ const alignmentInfo = {};
86
+ const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;
87
+
88
+ if (sizeRegex.test(contentSize)) {
89
+ // translators: %s: container size (i.e. 600px etc)
90
+ alignmentInfo.none = (0, _i18n.sprintf)((0, _i18n.__)('Max %s wide'), contentSize);
91
+ }
92
+
93
+ if (sizeRegex.test(wideSize)) {
94
+ // translators: %s: container size (i.e. 600px etc)
95
+ alignmentInfo.wide = (0, _i18n.sprintf)((0, _i18n.__)('Max %s wide'), wideSize);
96
+ }
97
+
98
+ return alignmentInfo;
99
+ }
57
100
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/utils.js"],"names":["appendSelectors","selectors","append","split","map","subselector","join","getBlockGapCSS","selector","layoutDefinitions","layoutType","blockGapValue","output","spacingStyles","length","forEach","gapStyle","trim","Object","entries","rules","cssProperty","value"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAT,CAA0BC,SAA1B,EAAmD;AAAA,MAAdC,MAAc,uEAAL,EAAK;AACzD;AACA;AACA;AACA;AACA;AAEA,SAAOD,SAAS,CACdE,KADK,CACE,GADF,EAELC,GAFK,CAGHC,WAAF,IACE,0BAA0BA,WAAa,GACvCH,MAAM,GAAI,IAAIA,MAAQ,EAAhB,GAAoB,EAC1B,EANG,EAQLI,IARK,CAQC,GARD,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,cAAT,CACNC,QADM,EAENC,iBAFM,EAGNC,UAHM,EAINC,aAJM,EAKL;AAAA;;AACD,MAAIC,MAAM,GAAG,EAAb;;AACA,MACCH,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,6BAAAA,iBAAiB,CAAIC,UAAJ,CAAjB,kGAAmCG,aAAnC,0EAAkDC,MAAlD,IACAH,aAFD,EAGE;AACDF,IAAAA,iBAAiB,CAAEC,UAAF,CAAjB,CAAgCG,aAAhC,CAA8CE,OAA9C,CAAyDC,QAAF,IAAgB;AACtEJ,MAAAA,MAAM,IAAK,GAAGZ,eAAe,CAC5BQ,QAD4B,EAE5BQ,QAAQ,CAACR,QAAT,CAAkBS,IAAlB,EAF4B,CAG1B,KAHH;AAIAL,MAAAA,MAAM,IAAIM,MAAM,CAACC,OAAP,CAAgBH,QAAQ,CAACI,KAAzB,EACRhB,GADQ,CAER;AAAA,YAAE,CAAEiB,WAAF,EAAeC,KAAf,CAAF;AAAA,eACE,GAAGD,WAAa,KAAKC,KAAK,GAAGA,KAAH,GAAWX,aAAe,EADtD;AAAA,OAFQ,EAKRL,IALQ,CAKF,IALE,CAAV;AAMAM,MAAAA,MAAM,IAAI,KAAV;AACA,KAZD;AAaA;;AACD,SAAOA,MAAP;AACA","sourcesContent":["/**\n * Utility to generate the proper CSS selector for layout styles.\n *\n * @param {string} selectors CSS selector, also supports multiple comma-separated selectors.\n * @param {string} append The string to append.\n *\n * @return {string} - CSS selector.\n */\nexport function appendSelectors( selectors, append = '' ) {\n\t// Ideally we shouldn't need the `.editor-styles-wrapper` increased specificity here\n\t// The problem though is that we have a `.editor-styles-wrapper p { margin: reset; }` style\n\t// it's used to reset the default margin added by wp-admin to paragraphs\n\t// so we need this to be higher speficity otherwise, it won't be applied to paragraphs inside containers\n\t// When the post editor is fully iframed, this extra classname could be removed.\n\n\treturn selectors\n\t\t.split( ',' )\n\t\t.map(\n\t\t\t( subselector ) =>\n\t\t\t\t`.editor-styles-wrapper ${ subselector }${\n\t\t\t\t\tappend ? ` ${ append }` : ''\n\t\t\t\t}`\n\t\t)\n\t\t.join( ',' );\n}\n\n/**\n * Get generated blockGap CSS rules based on layout definitions provided in theme.json\n * Falsy values in the layout definition's spacingStyles rules will be swapped out\n * with the provided `blockGapValue`.\n *\n * @param {string} selector The CSS selector to target for the generated rules.\n * @param {Object} layoutDefinitions Layout definitions object from theme.json.\n * @param {string} layoutType The layout type (e.g. `default` or `flex`).\n * @param {string} blockGapValue The current blockGap value to be applied.\n * @return {string} The generated CSS rules.\n */\nexport function getBlockGapCSS(\n\tselector,\n\tlayoutDefinitions,\n\tlayoutType,\n\tblockGapValue\n) {\n\tlet output = '';\n\tif (\n\t\tlayoutDefinitions?.[ layoutType ]?.spacingStyles?.length &&\n\t\tblockGapValue\n\t) {\n\t\tlayoutDefinitions[ layoutType ].spacingStyles.forEach( ( gapStyle ) => {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\tgapStyle.selector.trim()\n\t\t\t) } { `;\n\t\t\toutput += Object.entries( gapStyle.rules )\n\t\t\t\t.map(\n\t\t\t\t\t( [ cssProperty, value ] ) =>\n\t\t\t\t\t\t`${ cssProperty }: ${ value ? value : blockGapValue }`\n\t\t\t\t)\n\t\t\t\t.join( '; ' );\n\t\t\toutput += '; }';\n\t\t} );\n\t}\n\treturn output;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/utils.js"],"names":["appendSelectors","selectors","append","split","map","subselector","join","getBlockGapCSS","selector","layoutDefinitions","layoutType","blockGapValue","output","spacingStyles","length","forEach","gapStyle","trim","Object","entries","rules","cssProperty","value","getAlignmentsInfo","layout","contentSize","wideSize","alignmentInfo","sizeRegex","test","none","wide"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAT,CAA0BC,SAA1B,EAAmD;AAAA,MAAdC,MAAc,uEAAL,EAAK;AACzD;AACA;AACA;AACA;AACA;AAEA,SAAOD,SAAS,CACdE,KADK,CACE,GADF,EAELC,GAFK,CAGHC,WAAF,IACE,0BAA0BA,WAAa,GACvCH,MAAM,GAAI,IAAIA,MAAQ,EAAhB,GAAoB,EAC1B,EANG,EAQLI,IARK,CAQC,GARD,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,cAAT,CACNC,QADM,EAENC,iBAF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AAAA,aAAa,CAACI,IAAd,GAAqB,mBAAS,cAAI,aAAJ,CAAT,EAA8BL,QAA9B,CAArB;AACA;;AACD,SAAOC,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Utility to generate the proper CSS selector for layout styles.\n *\n * @param {string} selectors CSS selector, also supports multiple comma-separated selectors.\n * @param {string} append The string to append.\n *\n * @return {string} - CSS selector.\n */\nexport function appendSelectors( selectors, append = '' ) {\n\t// Ideally we shouldn't need the `.editor-styles-wrapper` increased specificity here\n\t// The problem though is that we have a `.editor-styles-wrapper p { margin: reset; }` style\n\t// it's used to reset the default margin added by wp-admin to paragraphs\n\t// so we need this to be higher speficity otherwise, it won't be applied to paragraphs inside containers\n\t// When the post editor is fully iframed, this extra classname could be removed.\n\n\treturn selectors\n\t\t.split( ',' )\n\t\t.map(\n\t\t\t( subselector ) =>\n\t\t\t\t`.editor-styles-wrapper ${ subselector }${\n\t\t\t\t\tappend ? ` ${ append }` : ''\n\t\t\t\t}`\n\t\t)\n\t\t.join( ',' );\n}\n\n/**\n * Get generated blockGap CSS rules based on layout definitions provided in theme.json\n * Falsy values in the layout definition's spacingStyles rules will be swapped out\n * with the provided `blockGapValue`.\n *\n * @param {string} selector The CSS selector to target for the generated rules.\n * @param {Object} layoutDefinitions Layout definitions object from theme.json.\n * @param {string} layoutType The layout type (e.g. `default` or `flex`).\n * @param {string} blockGapValue The current blockGap value to be applied.\n * @return {string} The generated CSS rules.\n */\nexport function getBlockGapCSS(\n\tselector,\n\tlayoutDefinitions,\n\tlayoutType,\n\tblockGapValue\n) {\n\tlet output = '';\n\tif (\n\t\tlayoutDefinitions?.[ layoutType ]?.spacingStyles?.length &&\n\t\tblockGapValue\n\t) {\n\t\tlayoutDefinitions[ layoutType ].spacingStyles.forEach( ( gapStyle ) => {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\tgapStyle.selector.trim()\n\t\t\t) } { `;\n\t\t\toutput += Object.entries( gapStyle.rules )\n\t\t\t\t.map(\n\t\t\t\t\t( [ cssProperty, value ] ) =>\n\t\t\t\t\t\t`${ cssProperty }: ${ value ? value : blockGapValue }`\n\t\t\t\t)\n\t\t\t\t.join( '; ' );\n\t\t\toutput += '; }';\n\t\t} );\n\t}\n\treturn output;\n}\n\n/**\n * Helper method to assign contextual info to clarify\n * alignment settings.\n *\n * Besides checking if `contentSize` and `wideSize` have a\n * value, we now show this information only if their values\n * are not a `css var`. This needs to change when parsing\n * css variables land.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752\n *\n * @param {Object} layout The layout object.\n * @return {Object} An object with contextual info per alignment.\n */\nexport function getAlignmentsInfo( layout ) {\n\tconst { contentSize, wideSize } = layout;\n\tconst alignmentInfo = {};\n\tconst sizeRegex = /^(?!0)\\d+(px|em|rem|vw|vh|%)?$/i;\n\tif ( sizeRegex.test( contentSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );\n\t}\n\tif ( sizeRegex.test( wideSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.wide = sprintf( __( 'Max %s wide' ), wideSize );\n\t}\n\treturn alignmentInfo;\n}\n"]}
@@ -1014,6 +1014,7 @@ exports.__unstableExpandSelection = __unstableExpandSelection;
1014
1014
 
1015
1015
  const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref15 => {
1016
1016
  let {
1017
+ registry,
1017
1018
  select,
1018
1019
  dispatch
1019
1020
  } = _ref15;
@@ -1024,14 +1025,35 @@ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref15 => {
1024
1025
  });
1025
1026
  const [clientIdA, clientIdB] = blocks;
1026
1027
  const blockA = select.getBlock(clientIdA);
1027
- const blockAType = (0, _blocks.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable.
1028
+ const blockAType = (0, _blocks.getBlockType)(blockA.name);
1029
+ if (!blockAType) return;
1030
+ const blockB = select.getBlock(clientIdB);
1028
1031
 
1029
1032
  if (blockAType && !blockAType.merge) {
1030
- dispatch.selectBlock(blockA.clientId);
1033
+ // If there's no merge function defined, attempt merging inner
1034
+ // blocks.
1035
+ const blocksWithTheSameType = (0, _blocks.switchToBlockType)(blockB, blockAType.name); // Only focus the previous block if it's not mergeable.
1036
+
1037
+ if ((blocksWithTheSameType === null || blocksWithTheSameType === void 0 ? void 0 : blocksWithTheSameType.length) !== 1) {
1038
+ dispatch.selectBlock(blockA.clientId);
1039
+ return;
1040
+ }
1041
+
1042
+ const [blockWithSameType] = blocksWithTheSameType;
1043
+
1044
+ if (blockWithSameType.innerBlocks.length < 1) {
1045
+ dispatch.selectBlock(blockA.clientId);
1046
+ return;
1047
+ }
1048
+
1049
+ registry.batch(() => {
1050
+ dispatch.insertBlocks(blockWithSameType.innerBlocks, undefined, clientIdA);
1051
+ dispatch.removeBlock(clientIdB);
1052
+ dispatch.selectBlock(blockWithSameType.innerBlocks[0].clientId);
1053
+ });
1031
1054
  return;
1032
1055
  }
1033
1056
 
1034
- const blockB = select.getBlock(clientIdB);
1035
1057
  const blockBType = (0, _blocks.getBlockType)(blockB.name);
1036
1058
  const {
1037
1059
  clientId,