@wordpress/block-editor 9.8.1-next.957ca95e4c.0 → 10.0.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 (456) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +13 -1
  3. package/build/components/alignment-control/ui.js +6 -5
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-actions/index.js +5 -9
  6. package/build/components/block-actions/index.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.js +5 -5
  8. package/build/components/block-alignment-control/ui.js.map +1 -1
  9. package/build/components/block-content-overlay/index.js +2 -4
  10. package/build/components/block-content-overlay/index.js.map +1 -1
  11. package/build/components/block-draggable/draggable-chip.js +2 -1
  12. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  13. package/build/components/block-edit/edit.js +1 -1
  14. package/build/components/block-edit/edit.js.map +1 -1
  15. package/build/components/block-inspector/index.js +125 -17
  16. package/build/components/block-inspector/index.js.map +1 -1
  17. package/build/components/block-list/block.js +40 -9
  18. package/build/components/block-list/block.js.map +1 -1
  19. package/build/components/block-list/index.js +4 -4
  20. package/build/components/block-list/index.js.map +1 -1
  21. package/build/components/block-list/use-block-props/index.js +14 -11
  22. package/build/components/block-list/use-block-props/index.js.map +1 -1
  23. package/build/components/block-list/use-block-props/use-block-class-names.js +3 -2
  24. package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  25. package/build/components/block-list/use-block-props/use-focus-first-element.js +3 -9
  26. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  27. package/build/components/block-list/use-block-props/use-is-hovered.js +1 -2
  28. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  29. package/build/components/block-list/use-in-between-inserter.js +7 -12
  30. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  31. package/build/components/block-list-appender/index.js +20 -21
  32. package/build/components/block-list-appender/index.js.map +1 -1
  33. package/build/components/block-list-appender/index.native.js +1 -7
  34. package/build/components/block-list-appender/index.native.js.map +1 -1
  35. package/build/components/block-lock/use-block-lock.js +3 -1
  36. package/build/components/block-lock/use-block-lock.js.map +1 -1
  37. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +20 -10
  38. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  39. package/build/components/block-mover/button.js +4 -6
  40. package/build/components/block-mover/button.js.map +1 -1
  41. package/build/components/block-mover/index.js +4 -6
  42. package/build/components/block-mover/index.js.map +1 -1
  43. package/build/components/block-mover/index.native.js +24 -8
  44. package/build/components/block-mover/index.native.js.map +1 -1
  45. package/build/components/block-popover/inbetween.js +58 -16
  46. package/build/components/block-popover/inbetween.js.map +1 -1
  47. package/build/components/block-popover/index.js +3 -2
  48. package/build/components/block-popover/index.js.map +1 -1
  49. package/build/components/block-preview/auto.js +4 -2
  50. package/build/components/block-preview/auto.js.map +1 -1
  51. package/build/components/block-settings-menu/block-settings-dropdown.js +3 -1
  52. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  53. package/build/components/block-settings-menu-controls/index.js +3 -1
  54. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  55. package/build/components/block-styles/preview-panel.js +7 -1
  56. package/build/components/block-styles/preview-panel.js.map +1 -1
  57. package/build/components/block-switcher/block-transformations-menu.js +114 -25
  58. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  59. package/build/components/block-toolbar/index.js +9 -8
  60. package/build/components/block-toolbar/index.js.map +1 -1
  61. package/build/components/block-tools/block-contextual-toolbar.js +3 -2
  62. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  63. package/build/components/block-tools/block-selection-button.js +13 -5
  64. package/build/components/block-tools/block-selection-button.js.map +1 -1
  65. package/build/components/block-tools/index.js +33 -15
  66. package/build/components/block-tools/index.js.map +1 -1
  67. package/build/components/block-tools/insertion-point.js +4 -9
  68. package/build/components/block-tools/insertion-point.js.map +1 -1
  69. package/build/components/block-tools/selected-block-popover.js +9 -8
  70. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  71. package/build/components/block-tools/use-block-toolbar-popover-props.js +13 -8
  72. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  73. package/build/components/block-tools/zoom-out-mode-inserters.js +71 -0
  74. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -0
  75. package/build/components/block-vertical-alignment-control/ui.js +5 -2
  76. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  77. package/build/components/colors-gradients/dropdown.js +1 -1
  78. package/build/components/colors-gradients/dropdown.js.map +1 -1
  79. package/build/components/iframe/index.js +31 -4
  80. package/build/components/iframe/index.js.map +1 -1
  81. package/build/components/inner-blocks/default-block-appender.js +1 -7
  82. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  83. package/build/components/inner-blocks/index.js +2 -2
  84. package/build/components/inner-blocks/index.js.map +1 -1
  85. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -5
  86. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  87. package/build/components/inner-blocks/use-nested-settings-update.js +1 -1
  88. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  89. package/build/components/inserter/index.js +3 -6
  90. package/build/components/inserter/index.js.map +1 -1
  91. package/build/components/inserter/library.js +14 -3
  92. package/build/components/inserter/library.js.map +1 -1
  93. package/build/components/inserter/menu.js +21 -8
  94. package/build/components/inserter/menu.js.map +1 -1
  95. package/build/components/inserter/preview-panel.js +1 -1
  96. package/build/components/inserter/preview-panel.js.map +1 -1
  97. package/build/components/inserter/tabs.js +11 -4
  98. package/build/components/inserter/tabs.js.map +1 -1
  99. package/build/components/link-control/link-preview.js +1 -1
  100. package/build/components/link-control/link-preview.js.map +1 -1
  101. package/build/components/link-control/search-input.js +6 -3
  102. package/build/components/link-control/search-input.js.map +1 -1
  103. package/build/components/link-control/search-item.js +36 -5
  104. package/build/components/link-control/search-item.js.map +1 -1
  105. package/build/components/list-view/block.js +23 -11
  106. package/build/components/list-view/block.js.map +1 -1
  107. package/build/components/list-view/branch.js +19 -2
  108. package/build/components/list-view/branch.js.map +1 -1
  109. package/build/components/list-view/index.js +8 -4
  110. package/build/components/list-view/index.js.map +1 -1
  111. package/build/components/list-view/use-block-selection.js +0 -1
  112. package/build/components/list-view/use-block-selection.js.map +1 -1
  113. package/build/components/provider/use-block-sync.js +1 -7
  114. package/build/components/provider/use-block-sync.js.map +1 -1
  115. package/build/components/publish-date-time-picker/index.js +1 -1
  116. package/build/components/publish-date-time-picker/index.js.map +1 -1
  117. package/build/components/rich-text/index.js +27 -19
  118. package/build/components/rich-text/index.js.map +1 -1
  119. package/build/components/rich-text/index.native.js +11 -20
  120. package/build/components/rich-text/index.native.js.map +1 -1
  121. package/build/components/text-decoration-control/index.js +1 -1
  122. package/build/components/text-decoration-control/index.js.map +1 -1
  123. package/build/components/text-transform-control/index.js +1 -1
  124. package/build/components/text-transform-control/index.js.map +1 -1
  125. package/build/components/tool-selector/index.js +6 -11
  126. package/build/components/tool-selector/index.js.map +1 -1
  127. package/build/components/url-popover/index.js +1 -1
  128. package/build/components/url-popover/index.js.map +1 -1
  129. package/build/components/use-block-drop-zone/index.js +7 -4
  130. package/build/components/use-block-drop-zone/index.js.map +1 -1
  131. package/build/components/use-moving-animation/index.js +9 -28
  132. package/build/components/use-moving-animation/index.js.map +1 -1
  133. package/build/components/writing-flow/use-select-all.js +1 -7
  134. package/build/components/writing-flow/use-select-all.js.map +1 -1
  135. package/build/hooks/align.js +14 -2
  136. package/build/hooks/align.js.map +1 -1
  137. package/build/hooks/color-panel.js +2 -1
  138. package/build/hooks/color-panel.js.map +1 -1
  139. package/build/hooks/content-lock-ui.js +145 -0
  140. package/build/hooks/content-lock-ui.js.map +1 -0
  141. package/build/hooks/duotone.js +8 -1
  142. package/build/hooks/duotone.js.map +1 -1
  143. package/build/hooks/index.js +14 -0
  144. package/build/hooks/index.js.map +1 -1
  145. package/build/hooks/layout.js +11 -9
  146. package/build/hooks/layout.js.map +1 -1
  147. package/build/hooks/metadata-name.js +55 -0
  148. package/build/hooks/metadata-name.js.map +1 -0
  149. package/build/hooks/metadata.js +65 -0
  150. package/build/hooks/metadata.js.map +1 -0
  151. package/build/hooks/use-typography-props.js +51 -0
  152. package/build/hooks/use-typography-props.js.map +1 -0
  153. package/build/hooks/utils.js +3 -1
  154. package/build/hooks/utils.js.map +1 -1
  155. package/build/index.js +7 -0
  156. package/build/index.js.map +1 -1
  157. package/build/layouts/constrained.js +59 -20
  158. package/build/layouts/constrained.js.map +1 -1
  159. package/build/store/actions.js +65 -21
  160. package/build/store/actions.js.map +1 -1
  161. package/build/store/reducer.js +39 -18
  162. package/build/store/reducer.js.map +1 -1
  163. package/build/store/selectors.js +95 -9
  164. package/build/store/selectors.js.map +1 -1
  165. package/build/utils/parse-css-unit-to-px.js +1 -1
  166. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  167. package/build-module/components/alignment-control/ui.js +6 -5
  168. package/build-module/components/alignment-control/ui.js.map +1 -1
  169. package/build-module/components/block-actions/index.js +5 -8
  170. package/build-module/components/block-actions/index.js.map +1 -1
  171. package/build-module/components/block-alignment-control/ui.js +5 -5
  172. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  173. package/build-module/components/block-content-overlay/index.js +2 -4
  174. package/build-module/components/block-content-overlay/index.js.map +1 -1
  175. package/build-module/components/block-draggable/draggable-chip.js +2 -1
  176. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  177. package/build-module/components/block-edit/edit.js +1 -1
  178. package/build-module/components/block-edit/edit.js.map +1 -1
  179. package/build-module/components/block-inspector/index.js +127 -19
  180. package/build-module/components/block-inspector/index.js.map +1 -1
  181. package/build-module/components/block-list/block.js +41 -9
  182. package/build-module/components/block-list/block.js.map +1 -1
  183. package/build-module/components/block-list/index.js +4 -4
  184. package/build-module/components/block-list/index.js.map +1 -1
  185. package/build-module/components/block-list/use-block-props/index.js +13 -11
  186. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  187. package/build-module/components/block-list/use-block-props/use-block-class-names.js +3 -2
  188. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  189. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +3 -8
  190. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  191. package/build-module/components/block-list/use-block-props/use-is-hovered.js +1 -2
  192. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  193. package/build-module/components/block-list/use-in-between-inserter.js +7 -12
  194. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  195. package/build-module/components/block-list-appender/index.js +20 -20
  196. package/build-module/components/block-list-appender/index.js.map +1 -1
  197. package/build-module/components/block-list-appender/index.native.js +1 -6
  198. package/build-module/components/block-list-appender/index.native.js.map +1 -1
  199. package/build-module/components/block-lock/use-block-lock.js +3 -1
  200. package/build-module/components/block-lock/use-block-lock.js.map +1 -1
  201. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +20 -9
  202. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  203. package/build-module/components/block-mover/button.js +4 -5
  204. package/build-module/components/block-mover/button.js.map +1 -1
  205. package/build-module/components/block-mover/index.js +4 -5
  206. package/build-module/components/block-mover/index.js.map +1 -1
  207. package/build-module/components/block-mover/index.native.js +24 -7
  208. package/build-module/components/block-mover/index.native.js.map +1 -1
  209. package/build-module/components/block-popover/inbetween.js +59 -17
  210. package/build-module/components/block-popover/inbetween.js.map +1 -1
  211. package/build-module/components/block-popover/index.js +3 -2
  212. package/build-module/components/block-popover/index.js.map +1 -1
  213. package/build-module/components/block-preview/auto.js +4 -2
  214. package/build-module/components/block-preview/auto.js.map +1 -1
  215. package/build-module/components/block-settings-menu/block-settings-dropdown.js +3 -1
  216. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  217. package/build-module/components/block-settings-menu-controls/index.js +3 -1
  218. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  219. package/build-module/components/block-styles/preview-panel.js +6 -1
  220. package/build-module/components/block-styles/preview-panel.js.map +1 -1
  221. package/build-module/components/block-switcher/block-transformations-menu.js +115 -27
  222. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  223. package/build-module/components/block-toolbar/index.js +9 -8
  224. package/build-module/components/block-toolbar/index.js.map +1 -1
  225. package/build-module/components/block-tools/block-contextual-toolbar.js +3 -2
  226. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  227. package/build-module/components/block-tools/block-selection-button.js +12 -5
  228. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  229. package/build-module/components/block-tools/index.js +30 -15
  230. package/build-module/components/block-tools/index.js.map +1 -1
  231. package/build-module/components/block-tools/insertion-point.js +4 -9
  232. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  233. package/build-module/components/block-tools/selected-block-popover.js +9 -8
  234. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  235. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +13 -8
  236. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  237. package/build-module/components/block-tools/zoom-out-mode-inserters.js +59 -0
  238. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -0
  239. package/build-module/components/block-vertical-alignment-control/ui.js +5 -2
  240. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  241. package/build-module/components/colors-gradients/dropdown.js +1 -1
  242. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  243. package/build-module/components/iframe/index.js +32 -5
  244. package/build-module/components/iframe/index.js.map +1 -1
  245. package/build-module/components/inner-blocks/default-block-appender.js +1 -6
  246. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  247. package/build-module/components/inner-blocks/index.js +2 -2
  248. package/build-module/components/inner-blocks/index.js.map +1 -1
  249. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -5
  250. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  251. package/build-module/components/inner-blocks/use-nested-settings-update.js +1 -1
  252. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  253. package/build-module/components/inserter/index.js +3 -6
  254. package/build-module/components/inserter/index.js.map +1 -1
  255. package/build-module/components/inserter/library.js +14 -3
  256. package/build-module/components/inserter/library.js.map +1 -1
  257. package/build-module/components/inserter/menu.js +20 -8
  258. package/build-module/components/inserter/menu.js.map +1 -1
  259. package/build-module/components/inserter/preview-panel.js +1 -1
  260. package/build-module/components/inserter/preview-panel.js.map +1 -1
  261. package/build-module/components/inserter/tabs.js +11 -4
  262. package/build-module/components/inserter/tabs.js.map +1 -1
  263. package/build-module/components/link-control/link-preview.js +1 -1
  264. package/build-module/components/link-control/link-preview.js.map +1 -1
  265. package/build-module/components/link-control/search-input.js +6 -2
  266. package/build-module/components/link-control/search-input.js.map +1 -1
  267. package/build-module/components/link-control/search-item.js +37 -6
  268. package/build-module/components/link-control/search-item.js.map +1 -1
  269. package/build-module/components/list-view/block.js +23 -11
  270. package/build-module/components/list-view/block.js.map +1 -1
  271. package/build-module/components/list-view/branch.js +19 -3
  272. package/build-module/components/list-view/branch.js.map +1 -1
  273. package/build-module/components/list-view/index.js +8 -4
  274. package/build-module/components/list-view/index.js.map +1 -1
  275. package/build-module/components/list-view/use-block-selection.js +0 -1
  276. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  277. package/build-module/components/provider/use-block-sync.js +1 -6
  278. package/build-module/components/provider/use-block-sync.js.map +1 -1
  279. package/build-module/components/publish-date-time-picker/index.js +1 -1
  280. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  281. package/build-module/components/rich-text/index.js +27 -18
  282. package/build-module/components/rich-text/index.js.map +1 -1
  283. package/build-module/components/rich-text/index.native.js +11 -18
  284. package/build-module/components/rich-text/index.native.js.map +1 -1
  285. package/build-module/components/text-decoration-control/index.js +1 -1
  286. package/build-module/components/text-decoration-control/index.js.map +1 -1
  287. package/build-module/components/text-transform-control/index.js +1 -1
  288. package/build-module/components/text-transform-control/index.js.map +1 -1
  289. package/build-module/components/tool-selector/index.js +6 -11
  290. package/build-module/components/tool-selector/index.js.map +1 -1
  291. package/build-module/components/url-popover/index.js +1 -1
  292. package/build-module/components/url-popover/index.js.map +1 -1
  293. package/build-module/components/use-block-drop-zone/index.js +7 -4
  294. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  295. package/build-module/components/use-moving-animation/index.js +9 -28
  296. package/build-module/components/use-moving-animation/index.js.map +1 -1
  297. package/build-module/components/writing-flow/use-select-all.js +1 -6
  298. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  299. package/build-module/hooks/align.js +12 -2
  300. package/build-module/hooks/align.js.map +1 -1
  301. package/build-module/hooks/color-panel.js +2 -1
  302. package/build-module/hooks/color-panel.js.map +1 -1
  303. package/build-module/hooks/content-lock-ui.js +128 -0
  304. package/build-module/hooks/content-lock-ui.js.map +1 -0
  305. package/build-module/hooks/duotone.js +6 -1
  306. package/build-module/hooks/duotone.js.map +1 -1
  307. package/build-module/hooks/index.js +4 -0
  308. package/build-module/hooks/index.js.map +1 -1
  309. package/build-module/hooks/layout.js +11 -9
  310. package/build-module/hooks/layout.js.map +1 -1
  311. package/build-module/hooks/metadata-name.js +45 -0
  312. package/build-module/hooks/metadata-name.js.map +1 -0
  313. package/build-module/hooks/metadata.js +50 -0
  314. package/build-module/hooks/metadata.js.map +1 -0
  315. package/build-module/hooks/use-typography-props.js +38 -0
  316. package/build-module/hooks/use-typography-props.js.map +1 -0
  317. package/build-module/hooks/utils.js +4 -2
  318. package/build-module/hooks/utils.js.map +1 -1
  319. package/build-module/index.js +1 -1
  320. package/build-module/index.js.map +1 -1
  321. package/build-module/layouts/constrained.js +61 -22
  322. package/build-module/layouts/constrained.js.map +1 -1
  323. package/build-module/store/actions.js +58 -20
  324. package/build-module/store/actions.js.map +1 -1
  325. package/build-module/store/reducer.js +37 -18
  326. package/build-module/store/reducer.js.map +1 -1
  327. package/build-module/store/selectors.js +80 -9
  328. package/build-module/store/selectors.js.map +1 -1
  329. package/build-module/utils/parse-css-unit-to-px.js +1 -1
  330. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  331. package/build-style/style-rtl.css +95 -45
  332. package/build-style/style.css +95 -45
  333. package/package.json +28 -28
  334. package/src/components/alignment-control/test/__snapshots__/index.js.snap +137 -108
  335. package/src/components/alignment-control/test/index.js +124 -33
  336. package/src/components/alignment-control/ui.js +8 -3
  337. package/src/components/block-actions/index.js +9 -8
  338. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +108 -65
  339. package/src/components/block-alignment-control/test/index.js +95 -31
  340. package/src/components/block-alignment-control/ui.js +2 -2
  341. package/src/components/block-compare/test/__snapshots__/block-view.js.snap +28 -26
  342. package/src/components/block-compare/test/block-view.js +3 -3
  343. package/src/components/block-content-overlay/index.js +2 -6
  344. package/src/components/block-content-overlay/style.scss +24 -3
  345. package/src/components/block-draggable/draggable-chip.js +4 -1
  346. package/src/components/block-edit/edit.js +5 -1
  347. package/src/components/block-edit/test/edit.js +23 -21
  348. package/src/components/block-icon/test/__snapshots__/index.js.snap +22 -0
  349. package/src/components/block-icon/test/index.js +31 -16
  350. package/src/components/block-inspector/index.js +126 -12
  351. package/src/components/block-inspector/style.scss +7 -1
  352. package/src/components/block-list/block.js +53 -13
  353. package/src/components/block-list/index.js +4 -4
  354. package/src/components/block-list/style.scss +39 -12
  355. package/src/components/block-list/test/block-list-context.native.js +11 -13
  356. package/src/components/block-list/use-block-props/index.js +10 -10
  357. package/src/components/block-list/use-block-props/use-block-class-names.js +4 -1
  358. package/src/components/block-list/use-block-props/use-focus-first-element.js +3 -8
  359. package/src/components/block-list/use-block-props/use-is-hovered.js +2 -2
  360. package/src/components/block-list/use-in-between-inserter.js +11 -13
  361. package/src/components/block-list-appender/index.js +27 -18
  362. package/src/components/block-list-appender/index.native.js +3 -6
  363. package/src/components/block-lock/use-block-lock.js +2 -0
  364. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +15 -9
  365. package/src/components/block-mover/button.js +6 -5
  366. package/src/components/block-mover/index.js +8 -7
  367. package/src/components/block-mover/index.native.js +20 -13
  368. package/src/components/block-popover/inbetween.js +85 -21
  369. package/src/components/block-popover/index.js +3 -2
  370. package/src/components/block-popover/style.scss +3 -4
  371. package/src/components/block-preview/auto.js +4 -2
  372. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
  373. package/src/components/block-settings-menu-controls/README.md +9 -0
  374. package/src/components/block-settings-menu-controls/index.js +13 -2
  375. package/src/components/block-styles/preview-panel.js +3 -0
  376. package/src/components/block-switcher/block-transformations-menu.js +127 -33
  377. package/src/components/block-switcher/style.scss +4 -2
  378. package/src/components/block-title/test/index.js +28 -25
  379. package/src/components/block-toolbar/index.js +27 -17
  380. package/src/components/block-tools/block-contextual-toolbar.js +10 -3
  381. package/src/components/block-tools/block-selection-button.js +35 -16
  382. package/src/components/block-tools/index.js +40 -24
  383. package/src/components/block-tools/insertion-point.js +3 -7
  384. package/src/components/block-tools/selected-block-popover.js +9 -7
  385. package/src/components/block-tools/style.scss +5 -0
  386. package/src/components/block-tools/use-block-toolbar-popover-props.js +19 -6
  387. package/src/components/block-tools/zoom-out-mode-inserters.js +57 -0
  388. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +91 -51
  389. package/src/components/block-vertical-alignment-control/test/index.js +92 -23
  390. package/src/components/block-vertical-alignment-control/ui.js +3 -2
  391. package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -12
  392. package/src/components/colors/test/with-colors.js +37 -12
  393. package/src/components/colors-gradients/dropdown.js +1 -1
  394. package/src/components/contrast-checker/test/index.js +135 -116
  395. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +39 -57
  396. package/src/components/default-block-appender/test/index.js +32 -18
  397. package/src/components/font-sizes/README.MD +9 -0
  398. package/src/components/iframe/index.js +64 -5
  399. package/src/components/inner-blocks/README.md +2 -1
  400. package/src/components/inner-blocks/default-block-appender.js +1 -6
  401. package/src/components/inner-blocks/index.js +3 -2
  402. package/src/components/inner-blocks/use-inner-block-template-sync.js +9 -5
  403. package/src/components/inner-blocks/use-nested-settings-update.js +3 -1
  404. package/src/components/inserter/index.js +2 -8
  405. package/src/components/inserter/library.js +11 -5
  406. package/src/components/inserter/menu.js +42 -29
  407. package/src/components/inserter/preview-panel.js +1 -1
  408. package/src/components/inserter/stories/fixtures.js +44 -0
  409. package/src/components/inserter/stories/index.js +90 -0
  410. package/src/components/inserter/style.scss +21 -27
  411. package/src/components/inserter/tabs.js +8 -4
  412. package/src/components/link-control/link-preview.js +5 -3
  413. package/src/components/link-control/search-input.js +2 -2
  414. package/src/components/link-control/search-item.js +39 -7
  415. package/src/components/list-view/block.js +29 -10
  416. package/src/components/list-view/branch.js +27 -4
  417. package/src/components/list-view/index.js +8 -3
  418. package/src/components/list-view/use-block-selection.js +0 -1
  419. package/src/components/media-placeholder/test/index.js +2 -2
  420. package/src/components/media-replace-flow/README.md +1 -1
  421. package/src/components/provider/use-block-sync.js +3 -6
  422. package/src/components/publish-date-time-picker/index.js +1 -1
  423. package/src/components/rich-text/index.js +24 -35
  424. package/src/components/rich-text/index.native.js +8 -21
  425. package/src/components/text-decoration-control/index.js +1 -1
  426. package/src/components/text-transform-control/index.js +1 -1
  427. package/src/components/tool-selector/index.js +9 -11
  428. package/src/components/url-input/test/button.js +145 -71
  429. package/src/components/url-popover/index.js +1 -1
  430. package/src/components/url-popover/test/__snapshots__/index.js.snap +108 -80
  431. package/src/components/url-popover/test/index.js +14 -12
  432. package/src/components/use-block-drop-zone/index.js +15 -4
  433. package/src/components/use-moving-animation/index.js +9 -24
  434. package/src/components/warning/test/__snapshots__/index.js.snap +11 -14
  435. package/src/components/warning/test/index.js +32 -29
  436. package/src/components/writing-flow/use-select-all.js +4 -6
  437. package/src/hooks/align.js +22 -13
  438. package/src/hooks/color-panel.js +2 -1
  439. package/src/hooks/content-lock-ui.js +161 -0
  440. package/src/hooks/duotone.js +13 -1
  441. package/src/hooks/index.js +4 -0
  442. package/src/hooks/layout.js +25 -19
  443. package/src/hooks/layout.scss +7 -1
  444. package/src/hooks/metadata-name.js +48 -0
  445. package/src/hooks/metadata.js +64 -0
  446. package/src/hooks/test/use-typography-props.js +28 -0
  447. package/src/hooks/use-typography-props.js +41 -0
  448. package/src/hooks/utils.js +2 -11
  449. package/src/index.js +1 -0
  450. package/src/layouts/constrained.js +73 -24
  451. package/src/store/actions.js +45 -4
  452. package/src/store/reducer.js +33 -21
  453. package/src/store/selectors.js +98 -19
  454. package/src/store/test/reducer.js +8 -5
  455. package/src/utils/parse-css-unit-to-px.js +1 -1
  456. package/src/components/colors/test/__snapshots__/with-colors.js.snap +0 -23
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["EMPTY_ARRAY","namesPlugin","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","DuotonePanel","attributes","setAttributes","style","duotone","color","duotonePalette","colorPalette","disableCustomColors","disableCustomDuotone","length","newDuotone","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","scopeSelector","scope","scopes","split","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","withDuotoneStyles","BlockListBlock","duotoneSupport","selectorsGroup","className","element","BlockList","__unstableElementContext"],"mappings":";;;;AAaA;;;;AAVA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AAaA,MAAMA,WAAW,GAAG,EAApB;AAEA,oBAAQ,CAAEC,cAAF,CAAR;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,OAAmD;AAAA,MAA3B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAZ;AAAgBC,IAAAA;AAAhB,GAA2B;;AAClD,MAAKA,MAAM,KAAK,OAAhB,EAA0B;AACzB,WAAO,4BAA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AwBhB,KAAF,IAAa;AAAA;;AAClC,QAAMiB,cAAc,GAAG,6BACtBjB,KAAK,CAACE,IADgB,EAEtB,6BAFsB,CAAvB;AAIA,QAAM9B,MAAM,GAAG4B,KAAH,aAAGA,KAAH,4CAAGA,KAAK,CAAEnB,UAAV,+EAAG,kBAAmBE,KAAtB,oFAAG,sBAA0BE,KAA7B,2DAAG,uBAAiCD,OAAhD;;AAEA,MAAK,CAAEiC,cAAF,IAAoB,CAAE7C,MAA3B,EAAoC;AACnC,WAAO,4BAAC,cAAD,EAAqB4B,KAArB,CAAP;AACA;;AAED,QAAM7B,EAAE,GAAI,cAAc,4BAAe6C,cAAf,CAAiC,EAA3D,CAXkC,CAalC;AACA;AACA;;AACA,QAAME,cAAc,GAAGf,aAAa,CAClC,2BAA2BhC,EAAI,EADG,EAEnC8C,cAFmC,CAApC;AAKA,QAAME,SAAS,GAAG,yBAAYnB,KAAZ,aAAYA,KAAZ,uBAAYA,KAAK,CAAEmB,SAAnB,EAA8BhD,EAA9B,CAAlB;AAEA,QAAMiD,OAAO,GAAG,yBAAYC,mBAAUC,wBAAtB,CAAhB;AAEA,SACC,qDACGF,OAAO,IACR,2BACC,4BAAC,aAAD;AACC,IAAA,QAAQ,EAAGF,cADZ;AAEC,IAAA,EAAE,EAAG/C,EAFN;AAGC,IAAA,MAAM,EAAGC;AAHV,IADD,EAMCgD,OAND,CAFF,EAUC,4BAAC,cAAD,6BAAqBpB,KAArB;AAA6B,IAAA,SAAS,EAAGmB;AAAzC,KAVD,CADD;AAcA,CAxCwB,EAyCzB,mBAzCyB,CAA1B;AA4CA,sBACC,0BADD,EAEC,oCAFD,EAGC1B,oBAHD;AAKA,sBACC,kBADD,EAEC,0CAFD,EAGCK,mBAHD;AAKA,sBACC,uBADD,EAEC,iCAFD,EAGCiB,iBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotone = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotone }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: newDuotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, 'color.__experimentalDuotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasDuotoneSupport && <DuotonePanel { ...props } /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nfunction scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst duotoneSupport = getBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst colors = props?.attributes?.style?.color?.duotone;\n\n\t\tif ( ! duotoneSupport || ! colors ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst id = `wp-duotone-${ useInstanceId( BlockListBlock ) }`;\n\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\t\tconst selectorsGroup = scopeSelector(\n\t\t\t`.editor-styles-wrapper .${ id }`,\n\t\t\tduotoneSupport\n\t\t);\n\n\t\tconst className = classnames( props?.className, id );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ element &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<InlineDuotone\n\t\t\t\t\t\t\tselector={ selectorsGroup }\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["EMPTY_ARRAY","namesPlugin","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","DuotonePanel","attributes","setAttributes","style","duotone","color","duotonePalette","colorPalette","disableCustomColors","disableCustomDuotone","length","newDuotone","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","isContentLocked","select","blockEditorStore","__unstableGetContentLockingParent","clientId","scopeSelector","scope","scopes","split","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","withDuotoneStyles","BlockListBlock","duotoneSupport","selectorsGroup","className","element","BlockList","__unstableElementContext"],"mappings":";;;;AAaA;;;;AAVA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AAKA;;AACA;;AAKA;;AA9BA;AACA;AACA;;AAKA;AACA;AACA;;AAOA;AACA;AACA;AAcA,MAAMA,WAAW,GAAG,EAApB;AAEA,oBAAQ,CAAEC,cAAF,CAAR;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,OAAmD;AAAA,MAA3B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAZ;AAAgBC,IAAAA;AAAhB,GAA2B;;AAClD,MAAKA,MAAM,KAAK,OAAhB,EAA0B;AACzB,WAAO,4BAAC,yCAAD;AAAwB,MAAA,QAAQ,EAAGF;AAAnC,MAAP;AACA;;AAED,SACC,qDACC,4BAAC,gCAAD;AAAe,IAAA,EAAE,EAAGC,EAApB;AAAyB,IAAA,MAAM,EAAGC;AAAlC,IADD,EAEC,4BAAC,oCAAD;AAAmB,IAAA,EAAE,EAAGD,EAAxB;AAA6B,IAAA,QAAQ,EAAGD;AAAxC,IAFD,CADD;AAMA;;AAED,SAASG,qBAAT,QAAoE;AAAA,MAApC;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,GAAoC;AACnE,QAAMC,cAAc,GAAG,CAAE,4BAAYD,cAAZ,CAAzB;AACA,QAAME,WAAW,GAChB,4BAAa,GAAGH,aAAe,SAA/B,KAA6CP,WAD9C;AAEA,QAAMW,YAAY,GACjB,4BAAa,GAAGJ,aAAe,QAA/B,KAA4CP,WAD7C;AAEA,QAAMY,cAAc,GACnB,4BAAa,GAAGL,aAAe,UAA/B,KAA8CP,WAD/C;AAEA,SAAO,sBACN,MAAM,CACL,GAAGU,WADE,EAEL,GAAGC,YAFE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,GAAGf,aAAa,CAClC,2BAA2BrC,EAAI,EADG,EAEnCmD,cAFmC,CAApC;AAKA,QAAME,SAAS,GAAG,yBAAYxB,KAAZ,aAAYA,KAAZ,uBAAYA,KAAK,CAAEwB,SAAnB,EAA8BrD,EAA9B,CAAlB;AAEA,QAAMsD,OAAO,GAAG,yBAAYC,mBAAUC,wBAAtB,CAAhB;AAEA,SACC,qDACGF,OAAO,IACR,2BACC,4BAAC,aAAD;AACC,IAAA,QAAQ,EAAGF,cADZ;AAEC,IAAA,EAAE,EAAGpD,EAFN;AAGC,IAAA,MAAM,EAAGC;AAHV,IADD,EAMCqD,OAND,CAFF,EAUC,4BAAC,cAAD,6BAAqBzB,KAArB;AAA6B,IAAA,SAAS,EAAGwB;AAAzC,KAVD,CADD;AAcA,CAxCwB,EAyCzB,mBAzCyB,CAA1B;AA4CA,sBACC,0BADD,EAEC,oCAFD,EAGC/B,oBAHD;AAKA,sBACC,kBADD,EAEC,0CAFD,EAGCK,mBAHD;AAKA,sBACC,uBADD,EAEC,iCAFD,EAGCsB,iBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\nimport { store as blockEditorStore } from '../store';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotone = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotone }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: newDuotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, 'color.__experimentalDuotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasDuotoneSupport && ! isContentLocked && (\n\t\t\t\t\t<DuotonePanel { ...props } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nfunction scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst duotoneSupport = getBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst colors = props?.attributes?.style?.color?.duotone;\n\n\t\tif ( ! duotoneSupport || ! colors ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst id = `wp-duotone-${ useInstanceId( BlockListBlock ) }`;\n\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\t\tconst selectorsGroup = scopeSelector(\n\t\t\t`.editor-styles-wrapper .${ id }`,\n\t\t\tduotoneSupport\n\t\t);\n\n\t\tconst className = classnames( props?.className, id );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ element &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<InlineDuotone\n\t\t\t\t\t\t\tselector={ selectorsGroup }\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "getSpacingClassesAndStyles", {
27
27
  return _useSpacingProps.getSpacingClassesAndStyles;
28
28
  }
29
29
  });
30
+ Object.defineProperty(exports, "getTypographyClassesAndStyles", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _useTypographyProps.getTypographyClassesAndStyles;
34
+ }
35
+ });
30
36
  Object.defineProperty(exports, "useBorderProps", {
31
37
  enumerable: true,
32
38
  get: function () {
@@ -80,6 +86,12 @@ require("./border");
80
86
 
81
87
  require("./layout");
82
88
 
89
+ require("./content-lock-ui");
90
+
91
+ require("./metadata");
92
+
93
+ require("./metadata-name");
94
+
83
95
  var _dimensions = require("./dimensions");
84
96
 
85
97
  var _useBorderProps = require("./use-border-props");
@@ -88,6 +100,8 @@ var _useColorProps = require("./use-color-props");
88
100
 
89
101
  var _useSpacingProps = require("./use-spacing-props");
90
102
 
103
+ var _useTypographyProps = require("./use-typography-props");
104
+
91
105
  var _gap = require("./gap");
92
106
 
93
107
  var _useCachedTruthy = require("./use-cached-truthy");
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border';\nimport './layout';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
@@ -85,7 +85,7 @@ function useLayoutClasses(layout, layoutDefinitions) {
85
85
  layoutClassnames.push(layoutDefinitions === null || layoutDefinitions === void 0 ? void 0 : (_layoutDefinitions2 = layoutDefinitions[(layout === null || layout === void 0 ? void 0 : layout.type) || 'default']) === null || _layoutDefinitions2 === void 0 ? void 0 : _layoutDefinitions2.className);
86
86
  }
87
87
 
88
- if ((layout !== null && layout !== void 0 && layout.inherit || layout !== null && layout !== void 0 && layout.contentSize) && rootPaddingAlignment) {
88
+ if ((layout !== null && layout !== void 0 && layout.inherit || layout !== null && layout !== void 0 && layout.contentSize || (layout === null || layout === void 0 ? void 0 : layout.type) === 'constrained') && rootPaddingAlignment) {
89
89
  layoutClassnames.push('has-global-padding');
90
90
  }
91
91
 
@@ -154,6 +154,8 @@ function LayoutPanel(_ref) {
154
154
 
155
155
  const layoutType = (0, _layouts.getLayoutType)(type);
156
156
  const constrainedType = (0, _layouts.getLayoutType)('constrained');
157
+ const displayControlsForLegacyLayouts = !usedLayout.type && (contentSize || inherit);
158
+ const hasContentSizeOrLegacySettings = !!inherit || !!contentSize;
157
159
 
158
160
  const onChangeType = newType => setAttributes({
159
161
  layout: {
@@ -168,23 +170,23 @@ function LayoutPanel(_ref) {
168
170
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components2.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
169
171
  title: (0, _i18n.__)('Layout')
170
172
  }, showInheritToggle && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToggleControl, {
171
- label: (0, _i18n.__)('Inner blocks respect content width'),
172
- checked: (layoutType === null || layoutType === void 0 ? void 0 : layoutType.name) === 'constrained' || !!inherit || !!contentSize,
173
+ className: "block-editor-hooks__toggle-control",
174
+ label: (0, _i18n.__)('Inner blocks use content width'),
175
+ checked: (layoutType === null || layoutType === void 0 ? void 0 : layoutType.name) === 'constrained' || hasContentSizeOrLegacySettings,
173
176
  onChange: () => setAttributes({
174
177
  layout: {
175
- type: (layoutType === null || layoutType === void 0 ? void 0 : layoutType.name) === 'constrained' ? 'default' : 'constrained'
178
+ type: (layoutType === null || layoutType === void 0 ? void 0 : layoutType.name) === 'constrained' || hasContentSizeOrLegacySettings ? 'default' : 'constrained'
176
179
  }
177
- })
178
- }), (0, _element.createElement)("p", {
179
- className: "block-editor-hooks__layout-controls-helptext"
180
- }, !!inherit || (layoutType === null || layoutType === void 0 ? void 0 : layoutType.name) === 'constrained' ? (0, _i18n.__)('Nested blocks use theme content width with options for full and wide widths.') : (0, _i18n.__)('Nested blocks will fill the width of this container.'))), !inherit && allowSwitching && (0, _element.createElement)(LayoutTypeSwitcher, {
180
+ }),
181
+ help: (layoutType === null || layoutType === void 0 ? void 0 : layoutType.name) === 'constrained' || hasContentSizeOrLegacySettings ? (0, _i18n.__)('Nested blocks use content width with options for full and wide widths.') : (0, _i18n.__)('Nested blocks will fill the width of this container. Toggle to constrain.')
182
+ })), !inherit && allowSwitching && (0, _element.createElement)(LayoutTypeSwitcher, {
181
183
  type: type,
182
184
  onChange: onChangeType
183
185
  }), layoutType && layoutType.name !== 'default' && (0, _element.createElement)(layoutType.inspectorControls, {
184
186
  layout: usedLayout,
185
187
  onChange: onChangeLayout,
186
188
  layoutBlockSupport: layoutBlockSupport
187
- }), constrainedType && !!contentSize && (0, _element.createElement)(constrainedType.inspectorControls, {
189
+ }), constrainedType && displayControlsForLegacyLayouts && (0, _element.createElement)(constrainedType.inspectorControls, {
188
190
  layout: usedLayout,
189
191
  onChange: onChangeLayout,
190
192
  layoutBlockSupport: layoutBlockSupport
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["layoutBlockSupportKey","useLayoutClasses","layout","layoutDefinitions","rootPaddingAlignment","select","getSettings","blockEditorStore","__experimentalFeatures","useRootPaddingAwareAlignments","layoutClassnames","type","className","push","inherit","contentSize","orientation","justifyContent","flexWrap","LayoutPanel","setAttributes","attributes","name","blockName","defaultThemeLayout","themeSupportsLayout","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","default","defaultBlockLayout","showInheritToggle","usedLayout","layoutType","constrainedType","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","BlockList","__unstableElementContext","wideSize","layoutClasses","definitions","selector","blockGapSupport","hasBlockGapSupport","css","fullLayoutType","getLayoutStyle","style"],"mappings":";;;;;;;;;;AAwBA;;;;AArBA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAMA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAIA;AACA;AACA;;AAkBA;AACA;AACA;AAQA,MAAMA,qBAAqB,GAAG,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,MAA3B,EAAmCC,iBAAnC,EAAuD;AAAA;;AACtD,QAAMC,oBAAoB,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AACrD,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEE,YAAF,CAA9B;AACA,oCAAOD,WAAW,GAAGE,sBAArB,0DAAO,sBACJC,6BADH;AAEA,GAJ4B,EAI1B,EAJ0B,CAA7B;AAKA,QAAMC,gBAAgB,GAAG,EAAzB;;AAEA,MAAKP,iBAAL,aAAKA,iBAAL,qCAAKA,iBAAiB,CAAI,CAAAD,MAAM,SAAN,IAA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,CAAEsC,WAJA;AAKvCO,MAAAA,KAAK,EAAEhD,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEgD,KALoB;AAMvCJ,MAAAA;AANuC,KAApB,CAApB;AAQA,GA9CiC,CAgDlC;;;AACA,QAAMrD,SAAS,GAAG,yBACjBqC,KADiB,aACjBA,KADiB,uBACjBA,KAAK,CAAErC,SADU,EAEjB;AACC,KAAG,gBAAgB4C,EAAI,EAAvB,GAA4BD,wBAAwB,IAAI,CAAC,CAAEW,GAD5D,CACiE;;AADjE,GAFiB,EAKjBL,aALiB,CAAlB;AAQA,SACC,qDACGN,wBAAwB,IACzBE,OADC,IAED,CAAC,CAAES,GAFF,IAGD,2BACC,4BAAC,mBAAD;AACC,IAAA,SAAS,EAAG5C,IADb;AAEC,IAAA,QAAQ,EAAGyC,QAFZ;AAGC,IAAA,GAAG,EAAGG,GAHP;AAIC,IAAA,MAAM,EAAGhC,UAJV;AAKC,IAAA,KAAK,EAAGb,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEgD;AALrB,IADD,EAQCZ,OARD,CAJF,EAcC,4BAAC,cAAD,6BAAqBR,KAArB;AAA6B,IAAA,SAAS,EAAGrC;AAAzC,KAdD,CADD;AAkBA,CA5E8B,CAAzB;;AA+EP,sBACC,0BADD,EAEC,0BAFD,EAGCiC,YAHD;AAKA,sBACC,uBADD,EAEC,uCAFD,EAGCM,gBAHD;AAKA,sBACC,kBADD,EAEC,4CAFD,EAGCJ,qBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockDefaultClassName,\n\tgetBlockSupport,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given blocks layout attributes.\n * This method was primarily added to reintroduce classnames that were removed\n * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather\n * than providing an extensive list of all possible layout classes. The plan is to\n * have the style engine generate a more extensive list of utility classnames which\n * will then replace this method.\n *\n * @param { Object } layout Layout object.\n * @param { Object } layoutDefinitions An object containing layout definitions, stored in theme.json.\n *\n * @return { Array } Array of CSS classname strings.\n */\nfunction useLayoutClasses( layout, layoutDefinitions ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst layoutClassnames = [];\n\n\tif ( layoutDefinitions?.[ layout?.type || 'default' ]?.className ) {\n\t\tlayoutClassnames.push(\n\t\t\tlayoutDefinitions?.[ layout?.type || 'default' ]?.className\n\t\t);\n\t}\n\n\tif ( ( layout?.inherit || layout?.contentSize ) && rootPaddingAlignment ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( layout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( layout.orientation ) }` );\n\t}\n\n\tif ( layout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase( layout.justifyContent ) }`\n\t\t);\n\t}\n\n\tif ( layout?.flexWrap && layout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\n\tconst constrainedType = getLayoutType( 'constrained' );\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Inner blocks respect content width'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\t!! inherit ||\n\t\t\t\t\t\t\t\t\t!! contentSize\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t'constrained'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t\t\t\t{ !! inherit ||\n\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained'\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use theme content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && !! contentSize && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( usedLayout, defaultThemeLayout?.definitions )\n\t\t\t: null;\n\t\tconst selector = `.${ getBlockDefaultClassName(\n\t\t\tname\n\t\t) }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst className = classnames(\n\t\t\tprops?.className,\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["layoutBlockSupportKey","useLayoutClasses","layout","layoutDefinitions","rootPaddingAlignment","select","getSettings","blockEditorStore","__experimentalFeatures","useRootPaddingAwareAlignments","layoutClassnames","type","className","push","inherit","contentSize","orientation","justifyContent","flexWrap","LayoutPanel","setAttributes","attributes","name","blockName","defaultThemeLayout","themeSupportsLayout","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","default","defaultBlockLayout","showInheritToggle","usedLayout","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","BlockList","__unstableElementContext","wideSize","layoutClasses","definitions","selector","blockGapSupport","hasBlockGapSupport","css","fullLayoutType","getLayoutStyle","style"],"mappings":";;;;;;;;;;AAwBA;;;;AArBA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAMA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAIA;AACA;AACA;;AAkBA;AACA;AACA;AAQA,MAAMA,qBAAqB,GAAG,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,MAA3B,EAAmCC,iBAAnC,EAAuD;AAAA;;AACtD,QAAMC,oBAAoB,GAAG,qBAAaC,MAAF,IAAc;AAAA;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AkBA,CA5E8B,CAAzB;;AA+EP,sBACC,0BADD,EAEC,0BAFD,EAGCmC,YAHD;AAKA,sBACC,uBADD,EAEC,uCAFD,EAGCM,gBAHD;AAKA,sBACC,kBADD,EAEC,4CAFD,EAGCJ,qBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockDefaultClassName,\n\tgetBlockSupport,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given blocks layout attributes.\n * This method was primarily added to reintroduce classnames that were removed\n * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather\n * than providing an extensive list of all possible layout classes. The plan is to\n * have the style engine generate a more extensive list of utility classnames which\n * will then replace this method.\n *\n * @param { Object } layout Layout object.\n * @param { Object } layoutDefinitions An object containing layout definitions, stored in theme.json.\n *\n * @return { Array } Array of CSS classname strings.\n */\nfunction useLayoutClasses( layout, layoutDefinitions ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst layoutClassnames = [];\n\n\tif ( layoutDefinitions?.[ layout?.type || 'default' ]?.className ) {\n\t\tlayoutClassnames.push(\n\t\t\tlayoutDefinitions?.[ layout?.type || 'default' ]?.className\n\t\t);\n\t}\n\n\tif (\n\t\t( layout?.inherit ||\n\t\t\tlayout?.contentSize ||\n\t\t\tlayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( layout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( layout.orientation ) }` );\n\t}\n\n\tif ( layout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase( layout.justifyContent ) }`\n\t\t);\n\t}\n\n\tif ( layout?.flexWrap && layout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( usedLayout, defaultThemeLayout?.definitions )\n\t\t\t: null;\n\t\tconst selector = `.${ getBlockDefaultClassName(\n\t\t\tname\n\t\t) }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst className = classnames(\n\t\t\tprops?.className,\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addLabelCallback = addLabelCallback;
7
+
8
+ var _hooks = require("@wordpress/hooks");
9
+
10
+ var _metadata = require("./metadata");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ /**
21
+ * Filters registered block settings, adding an `__experimentalLabel` callback if one does not already exist.
22
+ *
23
+ * @param {Object} settings Original block settings.
24
+ *
25
+ * @return {Object} Filtered block settings.
26
+ */
27
+ function addLabelCallback(settings) {
28
+ // If blocks provide their own label callback, do not override it.
29
+ if (settings.__experimentalLabel) {
30
+ return settings;
31
+ }
32
+
33
+ const supportsBlockNaming = (0, _metadata.hasBlockMetadataSupport)(settings, 'name', false // default value
34
+ ); // Check whether block metadata is supported before using it.
35
+
36
+ if (supportsBlockNaming) {
37
+ settings.__experimentalLabel = (attributes, _ref) => {
38
+ let {
39
+ context
40
+ } = _ref;
41
+ const {
42
+ metadata
43
+ } = attributes; // In the list view, use the block's name attribute as the label.
44
+
45
+ if (context === 'list-view' && metadata !== null && metadata !== void 0 && metadata.name) {
46
+ return metadata.name;
47
+ }
48
+ };
49
+ }
50
+
51
+ return settings;
52
+ }
53
+
54
+ (0, _hooks.addFilter)('blocks.registerBlockType', 'core/metadata/addLabelCallback', addLabelCallback);
55
+ //# sourceMappingURL=metadata-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/metadata-name.js"],"names":["addLabelCallback","settings","__experimentalLabel","supportsBlockNaming","attributes","context","metadata","name"],"mappings":";;;;;;;AAGA;;AAIA;;AAPA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,QAA3B,EAAsC;AAC5C;AACA,MAAKA,QAAQ,CAACC,mBAAd,EAAoC;AACnC,WAAOD,QAAP;AACA;;AAED,QAAME,mBAAmB,GAAG,uCAC3BF,QAD2B,EAE3B,MAF2B,EAG3B,KAH2B,CAGrB;AAHqB,GAA5B,CAN4C,CAY5C;;AACA,MAAKE,mBAAL,EAA2B;AAC1BF,IAAAA,QAAQ,CAACC,mBAAT,GAA+B,CAAEE,UAAF,WAA+B;AAAA,UAAjB;AAAEC,QAAAA;AAAF,OAAiB;AAC7D,YAAM;AAAEC,QAAAA;AAAF,UAAeF,UAArB,CAD6D,CAG7D;;AACA,UAAKC,OAAO,KAAK,WAAZ,IAA2BC,QAA3B,aAA2BA,QAA3B,eAA2BA,QAAQ,CAAEC,IAA1C,EAAiD;AAChD,eAAOD,QAAQ,CAACC,IAAhB;AACA;AACD,KAPD;AAQA;;AAED,SAAON,QAAP;AACA;;AAED,sBACC,0BADD,EAEC,gCAFD,EAGCD,gBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n/**\n * Internal dependencies\n */\nimport { hasBlockMetadataSupport } from './metadata';\n\n/**\n * Filters registered block settings, adding an `__experimentalLabel` callback if one does not already exist.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addLabelCallback( settings ) {\n\t// If blocks provide their own label callback, do not override it.\n\tif ( settings.__experimentalLabel ) {\n\t\treturn settings;\n\t}\n\n\tconst supportsBlockNaming = hasBlockMetadataSupport(\n\t\tsettings,\n\t\t'name',\n\t\tfalse // default value\n\t);\n\n\t// Check whether block metadata is supported before using it.\n\tif ( supportsBlockNaming ) {\n\t\tsettings.__experimentalLabel = ( attributes, { context } ) => {\n\t\t\tconst { metadata } = attributes;\n\n\t\t\t// In the list view, use the block's name attribute as the label.\n\t\t\tif ( context === 'list-view' && metadata?.name ) {\n\t\t\t\treturn metadata.name;\n\t\t\t}\n\t\t};\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/metadata/addLabelCallback',\n\taddLabelCallback\n);\n"]}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addMetaAttribute = addMetaAttribute;
7
+ exports.addSaveProps = addSaveProps;
8
+ exports.hasBlockMetadataSupport = hasBlockMetadataSupport;
9
+
10
+ var _hooks = require("@wordpress/hooks");
11
+
12
+ var _blocks = require("@wordpress/blocks");
13
+
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+ const META_ATTRIBUTE_NAME = 'metadata';
18
+
19
+ function hasBlockMetadataSupport(blockType) {
20
+ let feature = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
21
+ const support = (0, _blocks.getBlockSupport)(blockType, '__experimentalMetadata');
22
+ return !!(true === support || support !== null && support !== void 0 && support[feature]);
23
+ }
24
+ /**
25
+ * Filters registered block settings, extending attributes to include `metadata`.
26
+ *
27
+ * see: https://github.com/WordPress/gutenberg/pull/40393/files#r864632012
28
+ *
29
+ * @param {Object} blockTypeSettings Original block settings.
30
+ * @return {Object} Filtered block settings.
31
+ */
32
+
33
+
34
+ function addMetaAttribute(blockTypeSettings) {
35
+ var _blockTypeSettings$at, _blockTypeSettings$at2;
36
+
37
+ // Allow blocks to specify their own attribute definition with default values if needed.
38
+ if (blockTypeSettings !== null && blockTypeSettings !== void 0 && (_blockTypeSettings$at = blockTypeSettings.attributes) !== null && _blockTypeSettings$at !== void 0 && (_blockTypeSettings$at2 = _blockTypeSettings$at[META_ATTRIBUTE_NAME]) !== null && _blockTypeSettings$at2 !== void 0 && _blockTypeSettings$at2.type) {
39
+ return blockTypeSettings;
40
+ }
41
+
42
+ const supportsBlockNaming = hasBlockMetadataSupport(blockTypeSettings, 'name', false);
43
+
44
+ if (supportsBlockNaming) {
45
+ blockTypeSettings.attributes = { ...blockTypeSettings.attributes,
46
+ [META_ATTRIBUTE_NAME]: {
47
+ type: 'object'
48
+ }
49
+ };
50
+ }
51
+
52
+ return blockTypeSettings;
53
+ }
54
+
55
+ function addSaveProps(extraProps, blockType, attributes) {
56
+ if (hasBlockMetadataSupport(blockType)) {
57
+ extraProps[META_ATTRIBUTE_NAME] = attributes[META_ATTRIBUTE_NAME];
58
+ }
59
+
60
+ return extraProps;
61
+ }
62
+
63
+ (0, _hooks.addFilter)('blocks.registerBlockType', 'core/metadata/addMetaAttribute', addMetaAttribute);
64
+ (0, _hooks.addFilter)('blocks.getSaveContent.extraProps', 'core/metadata/save-props', addSaveProps);
65
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/metadata.js"],"names":["META_ATTRIBUTE_NAME","hasBlockMetadataSupport","blockType","feature","support","addMetaAttribute","blockTypeSettings","attributes","type","supportsBlockNaming","addSaveProps","extraProps"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,mBAAmB,GAAG,UAA5B;;AAEO,SAASC,uBAAT,CAAkCC,SAAlC,EAA4D;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAClE,QAAMC,OAAO,GAAG,6BAAiBF,SAAjB,EAA4B,wBAA5B,CAAhB;AACA,SAAO,CAAC,EAAI,SAASE,OAAT,IAAoBA,OAApB,aAAoBA,OAApB,eAAoBA,OAAO,CAAID,OAAJ,CAA/B,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,gBAAT,CAA2BC,iBAA3B,EAA+C;AAAA;;AACrD;AACA,MAAKA,iBAAL,aAAKA,iBAAL,wCAAKA,iBAAiB,CAAEC,UAAxB,4EAAK,sBAAiCP,mBAAjC,CAAL,mDAAK,uBAAwDQ,IAA7D,EAAoE;AACnE,WAAOF,iBAAP;AACA;;AAED,QAAMG,mBAAmB,GAAGR,uBAAuB,CAClDK,iBADkD,EAElD,MAFkD,EAGlD,KAHkD,CAAnD;;AAMA,MAAKG,mBAAL,EAA2B;AAC1BH,IAAAA,iBAAiB,CAACC,UAAlB,GAA+B,EAC9B,GAAGD,iBAAiB,CAACC,UADS;AAE9B,OAAEP,mBAAF,GAAyB;AACxBQ,QAAAA,IAAI,EAAE;AADkB;AAFK,KAA/B;AAMA;;AAED,SAAOF,iBAAP;AACA;;AAEM,SAASI,YAAT,CAAuBC,UAAvB,EAAmCT,SAAnC,EAA8CK,UAA9C,EAA2D;AACjE,MAAKN,uBAAuB,CAAEC,SAAF,CAA5B,EAA4C;AAC3CS,IAAAA,UAAU,CAAEX,mBAAF,CAAV,GAAoCO,UAAU,CAAEP,mBAAF,CAA9C;AACA;;AAED,SAAOW,UAAP;AACA;;AAED,sBACC,0BADD,EAEC,gCAFD,EAGCN,gBAHD;AAMA,sBACC,kCADD,EAEC,0BAFD,EAGCK,YAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\n\nconst META_ATTRIBUTE_NAME = 'metadata';\n\nexport function hasBlockMetadataSupport( blockType, feature = '' ) {\n\tconst support = getBlockSupport( blockType, '__experimentalMetadata' );\n\treturn !! ( true === support || support?.[ feature ] );\n}\n\n/**\n * Filters registered block settings, extending attributes to include `metadata`.\n *\n * see: https://github.com/WordPress/gutenberg/pull/40393/files#r864632012\n *\n * @param {Object} blockTypeSettings Original block settings.\n * @return {Object} Filtered block settings.\n */\nexport function addMetaAttribute( blockTypeSettings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( blockTypeSettings?.attributes?.[ META_ATTRIBUTE_NAME ]?.type ) {\n\t\treturn blockTypeSettings;\n\t}\n\n\tconst supportsBlockNaming = hasBlockMetadataSupport(\n\t\tblockTypeSettings,\n\t\t'name',\n\t\tfalse\n\t);\n\n\tif ( supportsBlockNaming ) {\n\t\tblockTypeSettings.attributes = {\n\t\t\t...blockTypeSettings.attributes,\n\t\t\t[ META_ATTRIBUTE_NAME ]: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn blockTypeSettings;\n}\n\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockMetadataSupport( blockType ) ) {\n\t\textraProps[ META_ATTRIBUTE_NAME ] = attributes[ META_ATTRIBUTE_NAME ];\n\t}\n\n\treturn extraProps;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/metadata/addMetaAttribute',\n\taddMetaAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/metadata/save-props',\n\taddSaveProps\n);\n"]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getTypographyClassesAndStyles = getTypographyClassesAndStyles;
9
+
10
+ var _lodash = require("lodash");
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _style = require("./style");
15
+
16
+ var _fontSizes = require("../components/font-sizes");
17
+
18
+ /**
19
+ * External dependencies
20
+ */
21
+
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+ // This utility is intended to assist where the serialization of the typography
26
+ // block support is being skipped for a block but the typography related CSS
27
+ // styles still need to be generated so they can be applied to inner elements.
28
+
29
+ /**
30
+ * Provides the CSS class names and inline styles for a block's typography support
31
+ * attributes.
32
+ *
33
+ * @param {Object} attributes Block attributes.
34
+ *
35
+ * @return {Object} Typography block support derived CSS classes & styles.
36
+ */
37
+ function getTypographyClassesAndStyles(attributes) {
38
+ var _attributes$style;
39
+
40
+ const typographyStyles = (attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography) || {};
41
+ const style = (0, _style.getInlineStyles)({
42
+ typography: typographyStyles
43
+ });
44
+ const fontFamilyClassName = !!(attributes !== null && attributes !== void 0 && attributes.fontFamily) ? `has-${(0, _lodash.kebabCase)(attributes.fontFamily)}-font-family` : '';
45
+ const className = (0, _classnames.default)(fontFamilyClassName, (0, _fontSizes.getFontSizeClass)(attributes === null || attributes === void 0 ? void 0 : attributes.fontSize));
46
+ return {
47
+ className,
48
+ style
49
+ };
50
+ }
51
+ //# sourceMappingURL=use-typography-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["getTypographyClassesAndStyles","attributes","typographyStyles","style","typography","fontFamilyClassName","fontFamily","className","fontSize"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,6BAAT,CAAwCC,UAAxC,EAAqD;AAAA;;AAC3D,QAAMC,gBAAgB,GAAG,CAAAD,UAAU,SAAV,IAAAA,UAAU,WAAV,iCAAAA,UAAU,CAAEE,KAAZ,wEAAmBC,UAAnB,KAAiC,EAA1D;AACA,QAAMD,KAAK,GAAG,4BAAiB;AAAEC,IAAAA,UAAU,EAAEF;AAAd,GAAjB,CAAd;AACA,QAAMG,mBAAmB,GAAG,CAAC,EAAEJ,UAAF,aAAEA,UAAF,eAAEA,UAAU,CAAEK,UAAd,CAAD,GACxB,OAAO,uBAAWL,UAAU,CAACK,UAAtB,CAAoC,cADnB,GAEzB,EAFH;AAIA,QAAMC,SAAS,GAAG,yBACjBF,mBADiB,EAEjB,iCAAkBJ,UAAlB,aAAkBA,UAAlB,uBAAkBA,UAAU,CAAEO,QAA9B,CAFiB,CAAlB;AAKA,SAAO;AACND,IAAAA,SADM;AAENJ,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\n\n// This utility is intended to assist where the serialization of the typography\n// block support is being skipped for a block but the typography related CSS\n// styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles( attributes ) {\n\tconst typographyStyles = attributes?.style?.typography || {};\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\n\tconst className = classnames(\n\t\tfontFamilyClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"]}
@@ -76,7 +76,9 @@ function transformStyles(activeSupports, migrationPaths, result, source, index,
76
76
  }
77
77
 
78
78
  let returnBlock = result;
79
- (0, _lodash.forEach)(activeSupports, (isActive, support) => {
79
+ Object.entries(activeSupports).forEach(_ref => {
80
+ let [support, isActive] = _ref;
81
+
80
82
  if (isActive) {
81
83
  migrationPaths[support].forEach(path => {
82
84
  const styleValue = (0, _lodash.get)(referenceBlockAttributes, path);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["identity","x","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","undefined","immutableSet","path","value","clone","transformStyles","activeSupports","migrationPaths","result","source","index","results","isActive","length","innerBlocks","referenceBlockAttributes","attributes","returnBlock","support","forEach","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes"],"mappings":";;;;;;;;;;AAGA;;AAcA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAKC,CAAF,IAASA,CAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AACD,QAAMG,oBAAoB,GAAG,oBAC5B,uBAAWH,MAAX,EAAmBD,gBAAnB,CAD4B,EAE5BF,QAF4B,CAA7B;AAIA,SAAO,qBAASM,oBAAT,IAAkCC,SAAlC,GAA8CD,oBAArD;AACA,CAbM;;;;AAeA,SAASE,YAAT,CAAuBL,MAAvB,EAA+BM,IAA/B,EAAqCC,KAArC,EAA6C;AACnD,SAAO,qBAASP,MAAM,GAAG,mBAAOA,MAAP,CAAH,GAAqB,EAApC,EAAwC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B,EAGvBkB,UAHuB;AAFX,WAAd;AAQA;AACD,OAZD;AAaA;AACD,GAhBD;AAiBA,SAAOH,WAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,uBAAT,CAAkCC,SAAlC,EAA6CC,UAA7C,EAAyDC,OAAzD,EAAmE;AACzE,QAAMN,OAAO,GAAG,6BAAiBI,SAAjB,EAA4BC,UAA5B,CAAhB;AACA,QAAME,iBAAiB,GAAGP,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEQ,+BAAnC;;AAEA,MAAK7B,KAAK,CAACC,OAAN,CAAe2B,iBAAf,CAAL,EAA0C;AACzC,WAAOA,iBAAiB,CAACE,QAAlB,CAA4BH,OAA5B,CAAP;AACA;;AAED,SAAOC,iBAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tpickBy,\n\tisEmpty,\n\tmapValues,\n\tforEach,\n\tget,\n\tsetWith,\n\tclone,\n\tevery,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\n\nconst identity = ( x ) => x;\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = pickBy(\n\t\tmapValues( object, cleanEmptyObject ),\n\t\tidentity\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport function immutableSet( object, path, value ) {\n\treturn setWith( object ? clone( object ) : {}, path, value, clone );\n}\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif ( every( activeSupports, ( isActive ) => ! isActive ) ) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tforEach( activeSupports, ( isActive, support ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: immutableSet(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["identity","x","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","undefined","immutableSet","path","value","clone","transformStyles","activeSupports","migrationPaths","result","source","index","results","isActive","length","innerBlocks","referenceBlockAttributes","attributes","returnBlock","Object","entries","forEach","support","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAKC,CAAF,IAASA,CAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AACD,QAAMG,oBAAoB,GAAG,oBAC5B,uBAAWH,MAAX,EAAmBD,gBAAnB,CAD4B,EAE5BF,QAF4B,CAA7B;AAIA,SAAO,qBAASM,oBAAT,IAAkCC,SAAlC,GAA8CD,oBAArD;AACA,CAbM;;;;AAeA,SAASE,YAAT,CAAuBL,MAAvB,EAA+BM,IAA/B,EAAqCC,KAArC,EAA6C;AACnD,SAAO,qBAASP,MAAM,GAAG,mBAAOA,MAAP,CAAH,GAAqB,EAApC,EAAwCM,IAAxC,EAA8CC,KAA9C,EAAqDC,aAArD,CAAP;AACA;;AAEM,SAASC,eAAT,CACNC,cADM,EAENC,cAFM,EAGNC,MAHM,EAINC,MAJM,EAKNC,KALM,EAMNC,OANM,EAOL;AAAA;;AACD;AACA,MAAK,mBAAOL,cAAP,EAAyBM,QAAF,IAAgB,CAAEA,QAAzC,CAAL,EAA2D;AAC1D,WAAOJ,MAAP;AACA,GAJA,CAKD;AACA;;;AACA,MAAKG,OAAO,CAACE,MAAR,KAAmB,CAAnB,IAAwBL,MAAM,CAACM,WAAP,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,iBAAiB,GAAGN,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEO,+BAAnC;;AAEA,MAAK/B,KAAK,CAACC,OAAN,CAAe6B,iBAAf,CAAL,EAA0C;AACzC,WAAOA,iBAAiB,CAACE,QAAlB,CAA4BH,OAA5B,CAAP;AACA;;AAED,SAAOC,iBAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { pickBy, isEmpty, mapValues, get, setWith, clone, every } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\n\nconst identity = ( x ) => x;\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = pickBy(\n\t\tmapValues( object, cleanEmptyObject ),\n\t\tidentity\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport function immutableSet( object, path, value ) {\n\treturn setWith( object ? clone( object ) : {}, path, value, clone );\n}\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif ( every( activeSupports, ( isActive ) => ! isActive ) ) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: immutableSet(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n"]}
package/build/index.js CHANGED
@@ -7,6 +7,7 @@ var _exportNames = {
7
7
  __experimentalGetBorderClassesAndStyles: true,
8
8
  __experimentalUseBorderProps: true,
9
9
  __experimentalGetColorClassesAndStyles: true,
10
+ getTypographyClassesAndStyles: true,
10
11
  __experimentalUseColorProps: true,
11
12
  __experimentalUseCustomSides: true,
12
13
  __experimentalGetSpacingClassesAndStyles: true,
@@ -64,6 +65,12 @@ Object.defineProperty(exports, "__experimentalUseCustomSides", {
64
65
  return _hooks.useCustomSides;
65
66
  }
66
67
  });
68
+ Object.defineProperty(exports, "getTypographyClassesAndStyles", {
69
+ enumerable: true,
70
+ get: function () {
71
+ return _hooks.getTypographyClassesAndStyles;
72
+ }
73
+ });
67
74
  Object.defineProperty(exports, "store", {
68
75
  enumerable: true,
69
76
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAWA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tgetGapCSSValue as __experimentalGetGapCSSValue,\n\tuseCachedTruthy,\n} from './hooks';\nexport * from './components';\nexport * from './elements';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAYA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tgetTypographyClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tgetGapCSSValue as __experimentalGetGapCSSValue,\n\tuseCachedTruthy,\n} from './hooks';\nexport * from './components';\nexport * from './elements';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\n"]}