@wordpress/block-editor 12.11.1 → 12.12.2-next.f8d8eceb.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 (453) hide show
  1. package/CHANGELOG.md +14 -10
  2. package/README.md +35 -3
  3. package/build/components/block-alignment-control/use-available-alignments.js +30 -28
  4. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  5. package/build/components/block-controls/hook.js +4 -1
  6. package/build/components/block-controls/hook.js.map +1 -1
  7. package/build/components/block-list/block-outline.native.js +1 -1
  8. package/build/components/block-list/block-outline.native.js.map +1 -1
  9. package/build/components/block-list/block.js +2 -0
  10. package/build/components/block-list/block.js.map +1 -1
  11. package/build/components/block-list/block.native.js +4 -4
  12. package/build/components/block-list/block.native.js.map +1 -1
  13. package/build/components/block-list/layout.js +2 -3
  14. package/build/components/block-list/layout.js.map +1 -1
  15. package/build/components/block-preview/index.js +4 -1
  16. package/build/components/block-preview/index.js.map +1 -1
  17. package/build/components/block-styles/index.js +1 -2
  18. package/build/components/block-styles/index.js.map +1 -1
  19. package/build/components/block-switcher/pattern-transformations-menu.js +2 -4
  20. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  21. package/build/components/block-tools/block-contextual-toolbar.js +1 -0
  22. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  23. package/build/components/border-radius-control/index.js +3 -2
  24. package/build/components/border-radius-control/index.js.map +1 -1
  25. package/build/components/color-palette/with-color-context.js +6 -6
  26. package/build/components/color-palette/with-color-context.js.map +1 -1
  27. package/build/components/colors/with-colors.js +2 -8
  28. package/build/components/colors/with-colors.js.map +1 -1
  29. package/build/components/colors-gradients/control.js +6 -7
  30. package/build/components/colors-gradients/control.js.map +1 -1
  31. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -13
  32. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  33. package/build/components/dimensions-tool/index.js +22 -22
  34. package/build/components/dimensions-tool/index.js.map +1 -1
  35. package/build/components/dimensions-tool/scale-tool.js +1 -1
  36. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  37. package/build/components/font-family/index.js +2 -3
  38. package/build/components/font-family/index.js.map +1 -1
  39. package/build/components/font-sizes/font-size-picker.js +3 -5
  40. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  41. package/build/components/font-sizes/with-font-sizes.js +3 -4
  42. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  43. package/build/components/global-styles/filters-panel.js +7 -8
  44. package/build/components/global-styles/filters-panel.js.map +1 -1
  45. package/build/components/global-styles/image-settings-panel.js +2 -2
  46. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  47. package/build/components/global-styles/typography-panel.js +1 -1
  48. package/build/components/global-styles/typography-panel.js.map +1 -1
  49. package/build/components/gradients/use-gradient.js +2 -5
  50. package/build/components/gradients/use-gradient.js.map +1 -1
  51. package/build/components/height-control/index.js +93 -5
  52. package/build/components/height-control/index.js.map +1 -1
  53. package/build/components/iframe/index.js +9 -1
  54. package/build/components/iframe/index.js.map +1 -1
  55. package/build/components/image-editor/aspect-ratio-dropdown.js +0 -6
  56. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  57. package/build/components/index.js +9 -2
  58. package/build/components/index.js.map +1 -1
  59. package/build/components/index.native.js +17 -2
  60. package/build/components/index.native.js.map +1 -1
  61. package/build/components/inner-blocks/index.js +2 -2
  62. package/build/components/inner-blocks/index.js.map +1 -1
  63. package/build/components/letter-spacing-control/index.js +3 -3
  64. package/build/components/letter-spacing-control/index.js.map +1 -1
  65. package/build/components/link-control/link-preview.js +5 -2
  66. package/build/components/link-control/link-preview.js.map +1 -1
  67. package/build/components/link-control/search-item.js +11 -0
  68. package/build/components/link-control/search-item.js.map +1 -1
  69. package/build/components/link-control/search-results.js +2 -1
  70. package/build/components/link-control/search-results.js.map +1 -1
  71. package/build/components/link-control/use-internal-value.js +14 -8
  72. package/build/components/link-control/use-internal-value.js.map +1 -1
  73. package/build/components/link-control/use-search-handler.js +10 -5
  74. package/build/components/link-control/use-search-handler.js.map +1 -1
  75. package/build/components/list-view/index.js +6 -5
  76. package/build/components/list-view/index.js.map +1 -1
  77. package/build/components/media-replace-flow/index.js +2 -4
  78. package/build/components/media-replace-flow/index.js.map +1 -1
  79. package/build/components/provider/use-block-sync.js +2 -2
  80. package/build/components/provider/use-block-sync.js.map +1 -1
  81. package/build/components/rich-text/index.js +1 -1
  82. package/build/components/rich-text/index.js.map +1 -1
  83. package/build/components/rich-text/index.native.js +14 -3
  84. package/build/components/rich-text/index.native.js.map +1 -1
  85. package/build/components/rich-text/use-delete.js +1 -1
  86. package/build/components/rich-text/use-delete.js.map +1 -1
  87. package/build/components/rich-text/use-paste-handler.js +25 -22
  88. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  89. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -3
  90. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  91. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +91 -3
  92. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  93. package/build/components/tool-selector/index.js +1 -2
  94. package/build/components/tool-selector/index.js.map +1 -1
  95. package/build/components/unit-control/index.js +3 -3
  96. package/build/components/unit-control/index.js.map +1 -1
  97. package/build/components/use-block-commands/index.js +96 -47
  98. package/build/components/use-block-commands/index.js.map +1 -1
  99. package/build/components/use-settings/index.js +212 -0
  100. package/build/components/use-settings/index.js.map +1 -0
  101. package/build/components/writing-flow/use-arrow-nav.js +4 -0
  102. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  103. package/build/hooks/align.js +51 -35
  104. package/build/hooks/align.js.map +1 -1
  105. package/build/hooks/anchor.js +37 -32
  106. package/build/hooks/anchor.js.map +1 -1
  107. package/build/hooks/background.js +4 -4
  108. package/build/hooks/background.js.map +1 -1
  109. package/build/hooks/block-rename-ui.js +5 -5
  110. package/build/hooks/block-rename-ui.js.map +1 -1
  111. package/build/hooks/{metadata-name.js → block-renaming.js} +3 -7
  112. package/build/hooks/block-renaming.js.map +1 -0
  113. package/build/hooks/color.js +2 -4
  114. package/build/hooks/color.js.map +1 -1
  115. package/build/hooks/custom-class-name.js +28 -21
  116. package/build/hooks/custom-class-name.js.map +1 -1
  117. package/build/hooks/duotone.js +33 -8
  118. package/build/hooks/duotone.js.map +1 -1
  119. package/build/hooks/font-size.js +4 -4
  120. package/build/hooks/font-size.js.map +1 -1
  121. package/build/hooks/index.js +1 -1
  122. package/build/hooks/index.js.map +1 -1
  123. package/build/hooks/layout.js +16 -17
  124. package/build/hooks/layout.js.map +1 -1
  125. package/build/hooks/line-height.js +3 -3
  126. package/build/hooks/line-height.js.map +1 -1
  127. package/build/hooks/metadata.js +6 -27
  128. package/build/hooks/metadata.js.map +1 -1
  129. package/build/hooks/position.js +2 -3
  130. package/build/hooks/position.js.map +1 -1
  131. package/build/hooks/use-color-props.js +3 -11
  132. package/build/hooks/use-color-props.js.map +1 -1
  133. package/build/hooks/utils.js +2 -43
  134. package/build/hooks/utils.js.map +1 -1
  135. package/build/layouts/constrained.js +3 -3
  136. package/build/layouts/constrained.js.map +1 -1
  137. package/build/layouts/grid.js +25 -3
  138. package/build/layouts/grid.js.map +1 -1
  139. package/build/layouts/utils.js +1 -1
  140. package/build/layouts/utils.js.map +1 -1
  141. package/build/lock-unlock.js +1 -1
  142. package/build/lock-unlock.js.map +1 -1
  143. package/build/store/actions.js +13 -5
  144. package/build/store/actions.js.map +1 -1
  145. package/build/utils/object.js +4 -1
  146. package/build/utils/object.js.map +1 -1
  147. package/build/utils/parse-css-unit-to-px.js +20 -0
  148. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  149. package/build/utils/pasting.js +1 -1
  150. package/build/utils/pasting.js.map +1 -1
  151. package/build/utils/transform-styles/index.js +19 -24
  152. package/build/utils/transform-styles/index.js.map +1 -1
  153. package/build-module/components/block-alignment-control/use-available-alignments.js +30 -28
  154. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  155. package/build-module/components/block-controls/hook.js +4 -1
  156. package/build-module/components/block-controls/hook.js.map +1 -1
  157. package/build-module/components/block-list/block-outline.native.js +1 -1
  158. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  159. package/build-module/components/block-list/block.js +2 -0
  160. package/build-module/components/block-list/block.js.map +1 -1
  161. package/build-module/components/block-list/block.native.js +4 -4
  162. package/build-module/components/block-list/block.native.js.map +1 -1
  163. package/build-module/components/block-list/layout.js +2 -2
  164. package/build-module/components/block-list/layout.js.map +1 -1
  165. package/build-module/components/block-preview/index.js +4 -1
  166. package/build-module/components/block-preview/index.js.map +1 -1
  167. package/build-module/components/block-styles/index.js +1 -2
  168. package/build-module/components/block-styles/index.js.map +1 -1
  169. package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -4
  170. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  171. package/build-module/components/block-tools/block-contextual-toolbar.js +1 -0
  172. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  173. package/build-module/components/border-radius-control/index.js +3 -2
  174. package/build-module/components/border-radius-control/index.js.map +1 -1
  175. package/build-module/components/color-palette/with-color-context.js +6 -5
  176. package/build-module/components/color-palette/with-color-context.js.map +1 -1
  177. package/build-module/components/colors/with-colors.js +2 -7
  178. package/build-module/components/colors/with-colors.js.map +1 -1
  179. package/build-module/components/colors-gradients/control.js +6 -7
  180. package/build-module/components/colors-gradients/control.js.map +1 -1
  181. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -12
  182. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  183. package/build-module/components/dimensions-tool/index.js +22 -22
  184. package/build-module/components/dimensions-tool/index.js.map +1 -1
  185. package/build-module/components/dimensions-tool/scale-tool.js +1 -1
  186. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  187. package/build-module/components/font-family/index.js +2 -2
  188. package/build-module/components/font-family/index.js.map +1 -1
  189. package/build-module/components/font-sizes/font-size-picker.js +3 -4
  190. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  191. package/build-module/components/font-sizes/with-font-sizes.js +3 -3
  192. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  193. package/build-module/components/global-styles/filters-panel.js +7 -8
  194. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  195. package/build-module/components/global-styles/image-settings-panel.js +2 -2
  196. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  197. package/build-module/components/global-styles/typography-panel.js +1 -1
  198. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  199. package/build-module/components/gradients/use-gradient.js +2 -4
  200. package/build-module/components/gradients/use-gradient.js.map +1 -1
  201. package/build-module/components/height-control/index.js +93 -4
  202. package/build-module/components/height-control/index.js.map +1 -1
  203. package/build-module/components/iframe/index.js +9 -1
  204. package/build-module/components/iframe/index.js.map +1 -1
  205. package/build-module/components/image-editor/aspect-ratio-dropdown.js +0 -6
  206. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  207. package/build-module/components/index.js +1 -1
  208. package/build-module/components/index.js.map +1 -1
  209. package/build-module/components/index.native.js +2 -1
  210. package/build-module/components/index.native.js.map +1 -1
  211. package/build-module/components/inner-blocks/index.js +2 -2
  212. package/build-module/components/inner-blocks/index.js.map +1 -1
  213. package/build-module/components/letter-spacing-control/index.js +3 -2
  214. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  215. package/build-module/components/link-control/link-preview.js +6 -3
  216. package/build-module/components/link-control/link-preview.js.map +1 -1
  217. package/build-module/components/link-control/search-item.js +12 -1
  218. package/build-module/components/link-control/search-item.js.map +1 -1
  219. package/build-module/components/link-control/search-results.js +2 -1
  220. package/build-module/components/link-control/search-results.js.map +1 -1
  221. package/build-module/components/link-control/use-internal-value.js +14 -9
  222. package/build-module/components/link-control/use-internal-value.js.map +1 -1
  223. package/build-module/components/link-control/use-search-handler.js +10 -5
  224. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  225. package/build-module/components/list-view/index.js +7 -6
  226. package/build-module/components/list-view/index.js.map +1 -1
  227. package/build-module/components/media-replace-flow/index.js +3 -5
  228. package/build-module/components/media-replace-flow/index.js.map +1 -1
  229. package/build-module/components/provider/use-block-sync.js +2 -2
  230. package/build-module/components/provider/use-block-sync.js.map +1 -1
  231. package/build-module/components/rich-text/index.js +1 -1
  232. package/build-module/components/rich-text/index.js.map +1 -1
  233. package/build-module/components/rich-text/index.native.js +15 -4
  234. package/build-module/components/rich-text/index.native.js.map +1 -1
  235. package/build-module/components/rich-text/use-delete.js +1 -1
  236. package/build-module/components/rich-text/use-delete.js.map +1 -1
  237. package/build-module/components/rich-text/use-paste-handler.js +25 -22
  238. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  239. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -2
  240. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  241. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +91 -2
  242. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  243. package/build-module/components/tool-selector/index.js +1 -2
  244. package/build-module/components/tool-selector/index.js.map +1 -1
  245. package/build-module/components/unit-control/index.js +3 -2
  246. package/build-module/components/unit-control/index.js.map +1 -1
  247. package/build-module/components/use-block-commands/index.js +95 -47
  248. package/build-module/components/use-block-commands/index.js.map +1 -1
  249. package/build-module/components/use-settings/index.js +203 -0
  250. package/build-module/components/use-settings/index.js.map +1 -0
  251. package/build-module/components/writing-flow/use-arrow-nav.js +4 -0
  252. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  253. package/build-module/hooks/align.js +51 -35
  254. package/build-module/hooks/align.js.map +1 -1
  255. package/build-module/hooks/anchor.js +37 -32
  256. package/build-module/hooks/anchor.js.map +1 -1
  257. package/build-module/hooks/background.js +4 -4
  258. package/build-module/hooks/background.js.map +1 -1
  259. package/build-module/hooks/block-rename-ui.js +6 -6
  260. package/build-module/hooks/block-rename-ui.js.map +1 -1
  261. package/build-module/hooks/{metadata-name.js → block-renaming.js} +3 -6
  262. package/build-module/hooks/block-renaming.js.map +1 -0
  263. package/build-module/hooks/color.js +2 -4
  264. package/build-module/hooks/color.js.map +1 -1
  265. package/build-module/hooks/custom-class-name.js +28 -21
  266. package/build-module/hooks/custom-class-name.js.map +1 -1
  267. package/build-module/hooks/duotone.js +34 -9
  268. package/build-module/hooks/duotone.js.map +1 -1
  269. package/build-module/hooks/font-size.js +4 -4
  270. package/build-module/hooks/font-size.js.map +1 -1
  271. package/build-module/hooks/index.js +1 -1
  272. package/build-module/hooks/index.js.map +1 -1
  273. package/build-module/hooks/layout.js +16 -17
  274. package/build-module/hooks/layout.js.map +1 -1
  275. package/build-module/hooks/line-height.js +3 -3
  276. package/build-module/hooks/line-height.js.map +1 -1
  277. package/build-module/hooks/metadata.js +6 -25
  278. package/build-module/hooks/metadata.js.map +1 -1
  279. package/build-module/hooks/position.js +2 -3
  280. package/build-module/hooks/position.js.map +1 -1
  281. package/build-module/hooks/use-color-props.js +3 -11
  282. package/build-module/hooks/use-color-props.js.map +1 -1
  283. package/build-module/hooks/utils.js +3 -44
  284. package/build-module/hooks/utils.js.map +1 -1
  285. package/build-module/layouts/constrained.js +3 -2
  286. package/build-module/layouts/constrained.js.map +1 -1
  287. package/build-module/layouts/grid.js +25 -3
  288. package/build-module/layouts/grid.js.map +1 -1
  289. package/build-module/layouts/utils.js +1 -1
  290. package/build-module/layouts/utils.js.map +1 -1
  291. package/build-module/lock-unlock.js +1 -1
  292. package/build-module/lock-unlock.js.map +1 -1
  293. package/build-module/store/actions.js +14 -6
  294. package/build-module/store/actions.js.map +1 -1
  295. package/build-module/utils/object.js +3 -1
  296. package/build-module/utils/object.js.map +1 -1
  297. package/build-module/utils/parse-css-unit-to-px.js +20 -0
  298. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  299. package/build-module/utils/pasting.js +1 -1
  300. package/build-module/utils/pasting.js.map +1 -1
  301. package/build-module/utils/transform-styles/index.js +20 -24
  302. package/build-module/utils/transform-styles/index.js.map +1 -1
  303. package/build-style/style-rtl.css +24 -12
  304. package/build-style/style.css +24 -12
  305. package/package.json +36 -34
  306. package/src/components/block-alignment-control/use-available-alignments.js +49 -34
  307. package/src/components/block-controls/hook.js +6 -3
  308. package/src/components/block-list/block-outline.native.js +1 -1
  309. package/src/components/block-list/block.js +2 -0
  310. package/src/components/block-list/block.native.js +4 -4
  311. package/src/components/block-list/layout.js +2 -2
  312. package/src/components/block-preview/index.js +7 -1
  313. package/src/components/block-styles/index.js +1 -4
  314. package/src/components/block-styles/style.scss +1 -1
  315. package/src/components/block-switcher/pattern-transformations-menu.js +1 -4
  316. package/src/components/block-switcher/style.scss +6 -0
  317. package/src/components/block-tools/block-contextual-toolbar.js +1 -0
  318. package/src/components/block-tools/style.scss +0 -1
  319. package/src/components/border-radius-control/index.js +3 -2
  320. package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -1
  321. package/src/components/color-palette/with-color-context.js +9 -9
  322. package/src/components/colors/with-colors.js +6 -7
  323. package/src/components/colors-gradients/control.js +10 -7
  324. package/src/components/colors-gradients/style.scss +4 -2
  325. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +29 -15
  326. package/src/components/dimensions-tool/index.js +25 -25
  327. package/src/components/dimensions-tool/scale-tool.js +1 -1
  328. package/src/components/font-family/index.js +2 -2
  329. package/src/components/font-sizes/font-size-picker.js +6 -4
  330. package/src/components/font-sizes/with-font-sizes.js +3 -5
  331. package/src/components/global-styles/filters-panel.js +9 -15
  332. package/src/components/global-styles/image-settings-panel.js +2 -2
  333. package/src/components/global-styles/typography-panel.js +1 -1
  334. package/src/components/gradients/use-gradient.js +10 -4
  335. package/src/components/height-control/index.js +53 -4
  336. package/src/components/iframe/index.js +8 -1
  337. package/src/components/image-editor/aspect-ratio-dropdown.js +0 -8
  338. package/src/components/index.js +1 -1
  339. package/src/components/index.native.js +2 -1
  340. package/src/components/inner-blocks/index.js +2 -2
  341. package/src/components/inserter/style.scss +9 -1
  342. package/src/components/letter-spacing-control/index.js +3 -2
  343. package/src/components/link-control/README.md +43 -0
  344. package/src/components/link-control/link-preview.js +11 -5
  345. package/src/components/link-control/search-item.js +14 -0
  346. package/src/components/link-control/search-results.js +1 -0
  347. package/src/components/link-control/style.scss +3 -3
  348. package/src/components/link-control/test/index.js +19 -0
  349. package/src/components/link-control/use-internal-value.js +14 -10
  350. package/src/components/link-control/use-search-handler.js +22 -15
  351. package/src/components/list-view/index.js +13 -3
  352. package/src/components/media-replace-flow/index.js +9 -14
  353. package/src/components/provider/test/use-block-sync.js +1 -1
  354. package/src/components/provider/use-block-sync.js +2 -2
  355. package/src/components/rich-text/index.js +1 -1
  356. package/src/components/rich-text/index.native.js +19 -3
  357. package/src/components/rich-text/use-delete.js +1 -1
  358. package/src/components/rich-text/use-paste-handler.js +27 -24
  359. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +7 -5
  360. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +25 -2
  361. package/src/components/tool-selector/index.js +1 -1
  362. package/src/components/unit-control/index.js +3 -8
  363. package/src/components/use-block-commands/index.js +93 -47
  364. package/src/components/{use-setting → use-settings}/README.md +9 -10
  365. package/src/components/use-settings/index.js +272 -0
  366. package/src/components/{use-setting → use-settings}/test/index.js +47 -5
  367. package/src/components/writing-flow/use-arrow-nav.js +4 -0
  368. package/src/hooks/align.js +79 -54
  369. package/src/hooks/anchor.js +75 -65
  370. package/src/hooks/background.js +7 -9
  371. package/src/hooks/block-rename-ui.js +5 -14
  372. package/src/hooks/{metadata-name.js → block-renaming.js} +4 -7
  373. package/src/hooks/color.js +7 -4
  374. package/src/hooks/custom-class-name.js +36 -31
  375. package/src/hooks/duotone.js +51 -14
  376. package/src/hooks/font-size.js +4 -4
  377. package/src/hooks/index.js +1 -1
  378. package/src/hooks/layout.js +17 -17
  379. package/src/hooks/line-height.js +3 -3
  380. package/src/hooks/metadata.js +6 -38
  381. package/src/hooks/position.js +5 -3
  382. package/src/hooks/use-color-props.js +21 -14
  383. package/src/hooks/utils.js +90 -43
  384. package/src/layouts/constrained.js +3 -8
  385. package/src/layouts/grid.js +50 -2
  386. package/src/layouts/utils.js +2 -1
  387. package/src/lock-unlock.js +1 -1
  388. package/src/store/actions.js +25 -8
  389. package/src/utils/object.js +4 -1
  390. package/src/utils/parse-css-unit-to-px.js +20 -0
  391. package/src/utils/pasting.js +1 -4
  392. package/src/utils/test/__snapshots__/transform-styles.js.snap +103 -0
  393. package/src/utils/test/pasting.js +12 -19
  394. package/src/utils/test/transform-styles.js +217 -0
  395. package/src/utils/transform-styles/index.js +25 -25
  396. package/build/components/use-setting/index.js +0 -159
  397. package/build/components/use-setting/index.js.map +0 -1
  398. package/build/hooks/metadata-name.js.map +0 -1
  399. package/build/utils/transform-styles/ast/index.js +0 -21
  400. package/build/utils/transform-styles/ast/index.js.map +0 -1
  401. package/build/utils/transform-styles/ast/parse.js +0 -660
  402. package/build/utils/transform-styles/ast/parse.js.map +0 -1
  403. package/build/utils/transform-styles/ast/stringify/compiler.js +0 -52
  404. package/build/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
  405. package/build/utils/transform-styles/ast/stringify/compress.js +0 -178
  406. package/build/utils/transform-styles/ast/stringify/compress.js.map +0 -1
  407. package/build/utils/transform-styles/ast/stringify/identity.js +0 -207
  408. package/build/utils/transform-styles/ast/stringify/identity.js.map +0 -1
  409. package/build/utils/transform-styles/ast/stringify/index.js +0 -36
  410. package/build/utils/transform-styles/ast/stringify/index.js.map +0 -1
  411. package/build/utils/transform-styles/transforms/url-rewrite.js +0 -130
  412. package/build/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
  413. package/build/utils/transform-styles/transforms/wrap.js +0 -59
  414. package/build/utils/transform-styles/transforms/wrap.js.map +0 -1
  415. package/build/utils/transform-styles/traverse.js +0 -37
  416. package/build/utils/transform-styles/traverse.js.map +0 -1
  417. package/build-module/components/use-setting/index.js +0 -152
  418. package/build-module/components/use-setting/index.js.map +0 -1
  419. package/build-module/hooks/metadata-name.js.map +0 -1
  420. package/build-module/utils/transform-styles/ast/index.js +0 -6
  421. package/build-module/utils/transform-styles/ast/index.js.map +0 -1
  422. package/build-module/utils/transform-styles/ast/parse.js +0 -654
  423. package/build-module/utils/transform-styles/ast/parse.js.map +0 -1
  424. package/build-module/utils/transform-styles/ast/stringify/compiler.js +0 -49
  425. package/build-module/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
  426. package/build-module/utils/transform-styles/ast/stringify/compress.js +0 -176
  427. package/build-module/utils/transform-styles/ast/stringify/compress.js.map +0 -1
  428. package/build-module/utils/transform-styles/ast/stringify/identity.js +0 -206
  429. package/build-module/utils/transform-styles/ast/stringify/identity.js.map +0 -1
  430. package/build-module/utils/transform-styles/ast/stringify/index.js +0 -29
  431. package/build-module/utils/transform-styles/ast/stringify/index.js.map +0 -1
  432. package/build-module/utils/transform-styles/transforms/url-rewrite.js +0 -123
  433. package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
  434. package/build-module/utils/transform-styles/transforms/wrap.js +0 -52
  435. package/build-module/utils/transform-styles/transforms/wrap.js.map +0 -1
  436. package/build-module/utils/transform-styles/traverse.js +0 -28
  437. package/build-module/utils/transform-styles/traverse.js.map +0 -1
  438. package/src/components/use-setting/index.js +0 -213
  439. package/src/utils/transform-styles/ast/index.js +0 -5
  440. package/src/utils/transform-styles/ast/parse.js +0 -732
  441. package/src/utils/transform-styles/ast/stringify/compiler.js +0 -50
  442. package/src/utils/transform-styles/ast/stringify/compress.js +0 -238
  443. package/src/utils/transform-styles/ast/stringify/identity.js +0 -286
  444. package/src/utils/transform-styles/ast/stringify/index.js +0 -32
  445. package/src/utils/transform-styles/test/__snapshots__/traverse.js.snap +0 -7
  446. package/src/utils/transform-styles/test/traverse.js +0 -24
  447. package/src/utils/transform-styles/transforms/test/__snapshots__/url-rewrite.js.snap +0 -25
  448. package/src/utils/transform-styles/transforms/test/__snapshots__/wrap.js.snap +0 -64
  449. package/src/utils/transform-styles/transforms/test/url-rewrite.js +0 -39
  450. package/src/utils/transform-styles/transforms/test/wrap.js +0 -95
  451. package/src/utils/transform-styles/transforms/url-rewrite.js +0 -139
  452. package/src/utils/transform-styles/transforms/wrap.js +0 -56
  453. package/src/utils/transform-styles/traverse.js +0 -32
@@ -4,23 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addMetaAttribute = addMetaAttribute;
7
- exports.addSaveProps = addSaveProps;
8
- exports.hasBlockMetadataSupport = hasBlockMetadataSupport;
9
7
  var _hooks = require("@wordpress/hooks");
10
- var _blocks = require("@wordpress/blocks");
11
8
  /**
12
9
  * WordPress dependencies
13
10
  */
14
11
 
15
12
  const META_ATTRIBUTE_NAME = 'metadata';
16
- function hasBlockMetadataSupport(blockType, feature = '') {
17
- // Only core blocks are allowed to use __experimentalMetadata until the fetaure is stablised.
18
- if (!blockType.name.startsWith('core/')) {
19
- return false;
20
- }
21
- const support = (0, _blocks.getBlockSupport)(blockType, '__experimentalMetadata');
22
- return !!(true === support || support?.[feature]);
23
- }
24
13
 
25
14
  /**
26
15
  * Filters registered block settings, extending attributes to include `metadata`.
@@ -35,23 +24,13 @@ function addMetaAttribute(blockTypeSettings) {
35
24
  if (blockTypeSettings?.attributes?.[META_ATTRIBUTE_NAME]?.type) {
36
25
  return blockTypeSettings;
37
26
  }
38
- const supportsBlockNaming = hasBlockMetadataSupport(blockTypeSettings, 'name');
39
- if (supportsBlockNaming) {
40
- blockTypeSettings.attributes = {
41
- ...blockTypeSettings.attributes,
42
- [META_ATTRIBUTE_NAME]: {
43
- type: 'object'
44
- }
45
- };
46
- }
27
+ blockTypeSettings.attributes = {
28
+ ...blockTypeSettings.attributes,
29
+ [META_ATTRIBUTE_NAME]: {
30
+ type: 'object'
31
+ }
32
+ };
47
33
  return blockTypeSettings;
48
34
  }
49
- function addSaveProps(extraProps, blockType, attributes) {
50
- if (hasBlockMetadataSupport(blockType)) {
51
- extraProps[META_ATTRIBUTE_NAME] = attributes[META_ATTRIBUTE_NAME];
52
- }
53
- return extraProps;
54
- }
55
35
  (0, _hooks.addFilter)('blocks.registerBlockType', 'core/metadata/addMetaAttribute', addMetaAttribute);
56
- (0, _hooks.addFilter)('blocks.getSaveContent.extraProps', 'core/metadata/save-props', addSaveProps);
57
36
  //# sourceMappingURL=metadata.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_hooks","require","_blocks","META_ATTRIBUTE_NAME","hasBlockMetadataSupport","blockType","feature","name","startsWith","support","getBlockSupport","addMetaAttribute","blockTypeSettings","attributes","type","supportsBlockNaming","addSaveProps","extraProps","addFilter"],"sources":["@wordpress/block-editor/src/hooks/metadata.js"],"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\t// Only core blocks are allowed to use __experimentalMetadata until the fetaure is stablised.\n\tif ( ! blockType.name.startsWith( 'core/' ) ) {\n\t\treturn false;\n\t}\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);\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"],"mappings":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,mBAAmB,GAAG,UAAU;AAE/B,SAASC,uBAAuBA,CAAEC,SAAS,EAAEC,OAAO,GAAG,EAAE,EAAG;EAClE;EACA,IAAK,CAAED,SAAS,CAACE,IAAI,CAACC,UAAU,CAAE,OAAQ,CAAC,EAAG;IAC7C,OAAO,KAAK;EACb;EACA,MAAMC,OAAO,GAAG,IAAAC,uBAAe,EAAEL,SAAS,EAAE,wBAAyB,CAAC;EACtE,OAAO,CAAC,EAAI,IAAI,KAAKI,OAAO,IAAIA,OAAO,GAAIH,OAAO,CAAE,CAAE;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,gBAAgBA,CAAEC,iBAAiB,EAAG;EACrD;EACA,IAAKA,iBAAiB,EAAEC,UAAU,GAAIV,mBAAmB,CAAE,EAAEW,IAAI,EAAG;IACnE,OAAOF,iBAAiB;EACzB;EAEA,MAAMG,mBAAmB,GAAGX,uBAAuB,CAClDQ,iBAAiB,EACjB,MACD,CAAC;EAED,IAAKG,mBAAmB,EAAG;IAC1BH,iBAAiB,CAACC,UAAU,GAAG;MAC9B,GAAGD,iBAAiB,CAACC,UAAU;MAC/B,CAAEV,mBAAmB,GAAI;QACxBW,IAAI,EAAE;MACP;IACD,CAAC;EACF;EAEA,OAAOF,iBAAiB;AACzB;AAEO,SAASI,YAAYA,CAAEC,UAAU,EAAEZ,SAAS,EAAEQ,UAAU,EAAG;EACjE,IAAKT,uBAAuB,CAAEC,SAAU,CAAC,EAAG;IAC3CY,UAAU,CAAEd,mBAAmB,CAAE,GAAGU,UAAU,CAAEV,mBAAmB,CAAE;EACtE;EAEA,OAAOc,UAAU;AAClB;AAEA,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,gCAAgC,EAChCP,gBACD,CAAC;AAED,IAAAO,gBAAS,EACR,kCAAkC,EAClC,0BAA0B,EAC1BF,YACD,CAAC"}
1
+ {"version":3,"names":["_hooks","require","META_ATTRIBUTE_NAME","addMetaAttribute","blockTypeSettings","attributes","type","addFilter"],"sources":["@wordpress/block-editor/src/hooks/metadata.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nconst META_ATTRIBUTE_NAME = 'metadata';\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\tblockTypeSettings.attributes = {\n\t\t...blockTypeSettings.attributes,\n\t\t[ META_ATTRIBUTE_NAME ]: {\n\t\t\ttype: 'object',\n\t\t},\n\t};\n\n\treturn blockTypeSettings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/metadata/addMetaAttribute',\n\taddMetaAttribute\n);\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAEA,MAAMC,mBAAmB,GAAG,UAAU;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAEC,iBAAiB,EAAG;EACrD;EACA,IAAKA,iBAAiB,EAAEC,UAAU,GAAIH,mBAAmB,CAAE,EAAEI,IAAI,EAAG;IACnE,OAAOF,iBAAiB;EACzB;EAEAA,iBAAiB,CAACC,UAAU,GAAG;IAC9B,GAAGD,iBAAiB,CAACC,UAAU;IAC/B,CAAEH,mBAAmB,GAAI;MACxBI,IAAI,EAAE;IACP;EACD,CAAC;EAED,OAAOF,iBAAiB;AACzB;AAEA,IAAAG,gBAAS,EACR,0BAA0B,EAC1B,gCAAgC,EAChCJ,gBACD,CAAC"}
@@ -24,7 +24,7 @@ var _data = require("@wordpress/data");
24
24
  var _element = require("@wordpress/element");
25
25
  var _hooks = require("@wordpress/hooks");
26
26
  var _blockList = _interopRequireDefault(require("../components/block-list"));
27
- var _useSetting = _interopRequireDefault(require("../components/use-setting"));
27
+ var _useSettings = require("../components/use-settings");
28
28
  var _inspectorControls = _interopRequireDefault(require("../components/inspector-controls"));
29
29
  var _useBlockDisplayInformation = _interopRequireDefault(require("../components/use-block-display-information"));
30
30
  var _utils = require("./utils");
@@ -202,8 +202,7 @@ function resetPosition({
202
202
  function useIsPositionDisabled({
203
203
  name: blockName
204
204
  } = {}) {
205
- const allowFixed = (0, _useSetting.default)('position.fixed');
206
- const allowSticky = (0, _useSetting.default)('position.sticky');
205
+ const [allowFixed, allowSticky] = (0, _useSettings.useSettings)('position.fixed', 'position.sticky');
207
206
  const isDisabled = !allowFixed && !allowSticky;
208
207
  return !hasPositionSupport(blockName) || isDisabled;
209
208
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_blocks","_components","_compose","_data","_element","_hooks","_blockList","_useSetting","_inspectorControls","_useBlockDisplayInformation","_utils","_lockUnlock","_store","CustomSelectControl","unlock","componentsPrivateApis","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","__","className","STICKY_OPTION","_x","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","getBlockSupport","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","cleanEmptyObject","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","useSetting","allowSticky","isDisabled","PositionPanel","clientId","firstParentClientId","useSelect","select","getBlockParents","blockEditorStore","parents","length","blockInformation","useBlockDisplayInformation","stickyHelpText","sprintf","title","options","useMemo","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","Platform","web","_react","createElement","default","group","BaseControl","__nextHasNoMarginBottom","help","__nextUnconstrainedWidth","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","__experimentalShowSelectedHint","onChange","selectedItem","size","native","withInspectorControls","createHigherOrderComponent","BlockEdit","positionSupport","hasBlockSupport","isPositionDisabled","showPositionControls","exports","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","useInstanceId","element","useContext","BlockList","__unstableElementContext","positionSelector","css","classnames","Fragment","createPortal","addFilter"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport useSetting from '../components/use-setting';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst allowFixed = useSetting( 'position.fixed' );\n\tconst allowSticky = useSetting( 'position.sticky' );\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position 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 positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tconst showPositionControls = positionSupport && ! isPositionDisabled;\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\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 position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! isPositionDisabled;\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withPositionStyles'\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twithPositionStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/position/with-inspector-controls',\n\twithInspectorControls\n);\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,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U,EAAEnB,KAAK,EAAEI,QAAQ,EAAEF;EAClC,CAAE,CAAC;EAEH,OACC,IAAA2D,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAsC,QAAA,QACGV,mBAAmB,IACpBG,OAAO,IACP,CAAC,CAAEK,GAAG,IACN,IAAAG,qBAAY,EAAE,IAAAvC,MAAA,CAAAC,aAAA,iBAASmC,GAAY,CAAC,EAAEL,OAAQ,CAAC,EAChD,IAAA/B,MAAA,CAAAC,aAAA,EAACyB,cAAc;IAAA,GAAMrE,KAAK;IAAG3B,SAAS,EAAGA;EAAW,CAAE,CACrD,CAAC;AAEL,CAAC,EACD,oBACD,CAAC;AAAC8F,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEF,IAAAe,gBAAS,EACR,uBAAuB,EACvB,2CAA2C,EAC3Cf,kBACD,CAAC;AACD,IAAAe,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CvB,qBACD,CAAC"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_blocks","_components","_compose","_data","_element","_hooks","_blockList","_useSettings","_inspectorControls","_useBlockDisplayInformation","_utils","_lockUnlock","_store","CustomSelectControl","unlock","componentsPrivateApis","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","__","className","STICKY_OPTION","_x","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","getBlockSupport","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","cleanEmptyObject","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","useSettings","isDisabled","PositionPanel","clientId","firstParentClientId","useSelect","select","getBlockParents","blockEditorStore","parents","length","blockInformation","useBlockDisplayInformation","stickyHelpText","sprintf","title","options","useMemo","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","Platform","web","_react","createElement","default","group","BaseControl","__nextHasNoMarginBottom","help","__nextUnconstrainedWidth","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","__experimentalShowSelectedHint","onChange","selectedItem","size","native","withInspectorControls","createHigherOrderComponent","BlockEdit","positionSupport","hasBlockSupport","isPositionDisabled","showPositionControls","exports","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","useInstanceId","element","useContext","BlockList","__unstableElementContext","positionSelector","css","classnames","Fragment","createPortal","addFilter"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position 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 positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tconst showPositionControls = positionSupport && ! isPositionDisabled;\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\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 position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! isPositionDisabled;\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withPositionStyles'\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twithPositionStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/position/with-inspector-controls',\n\twithInspectorControls\n);\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAMA,IAAAO,MAAA,GAAAP,OAAA;AAKA,IAAAQ,UAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,2BAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAjCA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AASA,MAAM;EAAEe;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAE/D,MA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AC3Cf,kBACD,CAAC;AACD,IAAAe,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CvB,qBACD,CAAC"}
@@ -11,7 +11,7 @@ var _element = require("@wordpress/element");
11
11
  var _style = require("./style");
12
12
  var _colors = require("../components/colors");
13
13
  var _gradients = require("../components/gradients");
14
- var _useSetting = _interopRequireDefault(require("../components/use-setting"));
14
+ var _useSettings = require("../components/use-settings");
15
15
  /**
16
16
  * External dependencies
17
17
  */
@@ -72,7 +72,6 @@ function getColorClassesAndStyles(attributes) {
72
72
  style: styleProp
73
73
  };
74
74
  }
75
- const EMPTY_OBJECT = {};
76
75
 
77
76
  /**
78
77
  * Determines the color related props for a block derived from its color block
@@ -91,16 +90,9 @@ function useColorProps(attributes) {
91
90
  textColor,
92
91
  gradient
93
92
  } = attributes;
94
-
95
- // Some color settings have a special handling for deprecated flags in `useSetting`,
96
- // so we can't unwrap them by doing const { ... } = useSetting('color')
97
- // until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
98
- const userPalette = (0, _useSetting.default)('color.palette.custom');
99
- const themePalette = (0, _useSetting.default)('color.palette.theme');
100
- const defaultPalette = (0, _useSetting.default)('color.palette.default');
101
- const gradientsPerOrigin = (0, _useSetting.default)('color.gradients') || EMPTY_OBJECT;
93
+ const [userPalette, themePalette, defaultPalette, userGradients, themeGradients, defaultGradients] = (0, _useSettings.useSettings)('color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default');
102
94
  const colors = (0, _element.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
103
- const gradients = (0, _element.useMemo)(() => [...(gradientsPerOrigin?.custom || []), ...(gradientsPerOrigin?.theme || []), ...(gradientsPerOrigin?.default || [])], [gradientsPerOrigin]);
95
+ const gradients = (0, _element.useMemo)(() => [...(userGradients || []), ...(themeGradients || []), ...(defaultGradients || [])], [userGradients, themeGradients, defaultGradients]);
104
96
  const colorProps = getColorClassesAndStyles(attributes);
105
97
 
106
98
  // Force inline styles to apply colors when themes do not load their color
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_style","_colors","_gradients","_useSetting","getColorClassesAndStyles","attributes","backgroundColor","textColor","gradient","style","backgroundClass","getColorClassName","textClass","gradientClass","__experimentalGetGradientClass","hasGradient","color","className","classnames","text","background","elements","link","colorStyles","styleProp","getInlineStyles","undefined","EMPTY_OBJECT","useColorProps","userPalette","useSetting","themePalette","defaultPalette","gradientsPerOrigin","colors","useMemo","gradients","custom","theme","default","colorProps","backgroundColorObject","getColorObjectByAttributeValues","getGradientValueBySlug","textColorObject"],"sources":["@wordpress/block-editor/src/hooks/use-color-props.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n} from '../components/gradients';\nimport useSetting from '../components/use-setting';\n\n// The code in this file has largely been lifted from the color block support\n// hook.\n//\n// This utility is intended to assist where the serialization of the colors\n// block support is being skipped for a block but the color related CSS classes\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 color support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Color block support derived CSS classes & styles.\n */\nexport function getColorClassesAndStyles( attributes ) {\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\t// Collect color CSS classes.\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst textClass = getColorClassName( 'color', textColor );\n\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst hasGradient = gradientClass || style?.color?.gradient;\n\n\t// Determine color CSS class name list.\n\tconst className = classnames( textClass, gradientClass, {\n\t\t// Don't apply the background class if there's a gradient.\n\t\t[ backgroundClass ]: ! hasGradient && !! backgroundClass,\n\t\t'has-text-color': textColor || style?.color?.text,\n\t\t'has-background':\n\t\t\tbackgroundColor ||\n\t\t\tstyle?.color?.background ||\n\t\t\tgradient ||\n\t\t\tstyle?.color?.gradient,\n\t\t'has-link-color': style?.elements?.link?.color,\n\t} );\n\n\t// Collect inline styles for colors.\n\tconst colorStyles = style?.color || {};\n\tconst styleProp = getInlineStyles( { color: colorStyles } );\n\n\treturn {\n\t\tclassName: className || undefined,\n\t\tstyle: styleProp,\n\t};\n}\n\nconst EMPTY_OBJECT = {};\n\n/**\n * Determines the color related props for a block derived from its color block\n * support attributes.\n *\n * Inline styles are forced for named colors to ensure these selections are\n * reflected when themes do not load their color stylesheets in the editor.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} ClassName & style props from colors block support.\n */\nexport function useColorProps( attributes ) {\n\tconst { backgroundColor, textColor, gradient } = attributes;\n\n\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\tconst userPalette = useSetting( 'color.palette.custom' );\n\tconst themePalette = useSetting( 'color.palette.theme' );\n\tconst defaultPalette = useSetting( 'color.palette.default' );\n\tconst gradientsPerOrigin = useSetting( 'color.gradients' ) || EMPTY_OBJECT;\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst gradients = useMemo(\n\t\t() => [\n\t\t\t...( gradientsPerOrigin?.custom || [] ),\n\t\t\t...( gradientsPerOrigin?.theme || [] ),\n\t\t\t...( gradientsPerOrigin?.default || [] ),\n\t\t],\n\t\t[ gradientsPerOrigin ]\n\t);\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t// Force inline styles to apply colors when themes do not load their color\n\t// stylesheets in the editor.\n\tif ( backgroundColor ) {\n\t\tconst backgroundColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tbackgroundColor\n\t\t);\n\n\t\tcolorProps.style.backgroundColor = backgroundColorObject.color;\n\t}\n\n\tif ( gradient ) {\n\t\tcolorProps.style.background = getGradientValueBySlug(\n\t\t\tgradients,\n\t\t\tgradient\n\t\t);\n\t}\n\n\tif ( textColor ) {\n\t\tconst textColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\ttextColor\n\t\t);\n\n\t\tcolorProps.style.color = textColorObject.color;\n\t}\n\n\treturn colorProps;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAIA,IAAAI,UAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,wBAAwBA,CAAEC,UAAU,EAAG;EACtD,MAAM;IAAEC,eAAe;IAAEC,SAAS;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAGJ,UAAU;;EAElE;EACA,MAAMK,eAAe,GAAG,IAAAC,yBAAiB,EACxC,kBAAkB,EAClBL,eACD,CAAC;EACD,MAAMM,SAAS,GAAG,IAAAD,yBAAiB,EAAE,OAAO,EAAEJ,SAAU,CAAC;EAEzD,MAAMM,aAAa,GAAG,IAAAC,yCAA8B,EAAEN,QAAS,CAAC;EAChE,MAAMO,WAAW,GAAGF,aAAa,IAAIJ,KAAK,EAAEO,KAAK,EAAER,QAAQ;;EAE3D;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YAAY,IAAI,EAAE,CAAE,EACzB,IAAKC,cAAc,IAAI,EAAE,CAAE,CAC3B,EACD,CAAEH,WAAW,EAAEE,YAAY,EAAEC,cAAc,CAC5C,CAAC;EACD,MAAMI,SAAS,GAAG,IAAAD,gBAAO,EACxB,MAAM,CACL,IAAKF,kBAAkB,EAAEI,MAAM,IAAI,EAAE,CAAE,EACvC,IAAKJ,kBAAkB,EAAEK,KAAK,IAAI,EAAE,CAAE,EACtC,IAAKL,kBAAkB,EAAEM,OAAO,IAAI,EAAE,CAAE,CACxC,EACD,CAAEN,kBAAkB,CACrB,CAAC;EAED,MAAMO,UAAU,GAAGpC,wBAAwB,CAAEC,UAAW,CAAC;;EAEzD;EACA;EACA,IAAKC,eAAe,EAAG;IACtB,MAAMmC,qBAAqB,GAAG,IAAAC,uCAA+B,EAC5DR,MAAM,EACN5B,eACD,CAAC;IAEDkC,UAAU,CAAC/B,KAAK,CAACH,eAAe,GAAGmC,qBAAqB,CAACzB,KAAK;EAC/D;EAEA,IAAKR,QAAQ,EAAG;IACfgC,UAAU,CAAC/B,KAAK,CAACW,UAAU,GAAG,IAAAuB,iCAAsB,EACnDP,SAAS,EACT5B,QACD,CAAC;EACF;EAEA,IAAKD,SAAS,EAAG;IAChB,MAAMqC,eAAe,GAAG,IAAAF,uCAA+B,EACtDR,MAAM,EACN3B,SACD,CAAC;IAEDiC,UAAU,CAAC/B,KAAK,CAACO,KAAK,GAAG4B,eAAe,CAAC5B,KAAK;EAC/C;EAEA,OAAOwB,UAAU;AAClB"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_style","_colors","_gradients","_useSettings","getColorClassesAndStyles","attributes","backgroundColor","textColor","gradient","style","backgroundClass","getColorClassName","textClass","gradientClass","__experimentalGetGradientClass","hasGradient","color","className","classnames","text","background","elements","link","colorStyles","styleProp","getInlineStyles","undefined","useColorProps","userPalette","themePalette","defaultPalette","userGradients","themeGradients","defaultGradients","useSettings","colors","useMemo","gradients","colorProps","backgroundColorObject","getColorObjectByAttributeValues","getGradientValueBySlug","textColorObject"],"sources":["@wordpress/block-editor/src/hooks/use-color-props.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n} from '../components/gradients';\nimport { useSettings } from '../components/use-settings';\n\n// The code in this file has largely been lifted from the color block support\n// hook.\n//\n// This utility is intended to assist where the serialization of the colors\n// block support is being skipped for a block but the color related CSS classes\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 color support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Color block support derived CSS classes & styles.\n */\nexport function getColorClassesAndStyles( attributes ) {\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\t// Collect color CSS classes.\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst textClass = getColorClassName( 'color', textColor );\n\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst hasGradient = gradientClass || style?.color?.gradient;\n\n\t// Determine color CSS class name list.\n\tconst className = classnames( textClass, gradientClass, {\n\t\t// Don't apply the background class if there's a gradient.\n\t\t[ backgroundClass ]: ! hasGradient && !! backgroundClass,\n\t\t'has-text-color': textColor || style?.color?.text,\n\t\t'has-background':\n\t\t\tbackgroundColor ||\n\t\t\tstyle?.color?.background ||\n\t\t\tgradient ||\n\t\t\tstyle?.color?.gradient,\n\t\t'has-link-color': style?.elements?.link?.color,\n\t} );\n\n\t// Collect inline styles for colors.\n\tconst colorStyles = style?.color || {};\n\tconst styleProp = getInlineStyles( { color: colorStyles } );\n\n\treturn {\n\t\tclassName: className || undefined,\n\t\tstyle: styleProp,\n\t};\n}\n\n/**\n * Determines the color related props for a block derived from its color block\n * support attributes.\n *\n * Inline styles are forced for named colors to ensure these selections are\n * reflected when themes do not load their color stylesheets in the editor.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} ClassName & style props from colors block support.\n */\nexport function useColorProps( attributes ) {\n\tconst { backgroundColor, textColor, gradient } = attributes;\n\n\tconst [\n\t\tuserPalette,\n\t\tthemePalette,\n\t\tdefaultPalette,\n\t\tuserGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t] = useSettings(\n\t\t'color.palette.custom',\n\t\t'color.palette.theme',\n\t\t'color.palette.default',\n\t\t'color.gradients.custom',\n\t\t'color.gradients.theme',\n\t\t'color.gradients.default'\n\t);\n\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst gradients = useMemo(\n\t\t() => [\n\t\t\t...( userGradients || [] ),\n\t\t\t...( themeGradients || [] ),\n\t\t\t...( defaultGradients || [] ),\n\t\t],\n\t\t[ userGradients, themeGradients, defaultGradients ]\n\t);\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t// Force inline styles to apply colors when themes do not load their color\n\t// stylesheets in the editor.\n\tif ( backgroundColor ) {\n\t\tconst backgroundColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tbackgroundColor\n\t\t);\n\n\t\tcolorProps.style.backgroundColor = backgroundColorObject.color;\n\t}\n\n\tif ( gradient ) {\n\t\tcolorProps.style.background = getGradientValueBySlug(\n\t\t\tgradients,\n\t\t\tgradient\n\t\t);\n\t}\n\n\tif ( textColor ) {\n\t\tconst textColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\ttextColor\n\t\t);\n\n\t\tcolorProps.style.color = textColorObject.color;\n\t}\n\n\treturn colorProps;\n}\n"],"mappings":";;;;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CAACvB,KAAK;EAC/D;EAEA,IAAKR,QAAQ,EAAG;IACf8B,UAAU,CAAC7B,KAAK,CAACW,UAAU,GAAG,IAAAqB,iCAAsB,EACnDJ,SAAS,EACT7B,QACD,CAAC;EACF;EAEA,IAAKD,SAAS,EAAG;IAChB,MAAMmC,eAAe,GAAG,IAAAF,uCAA+B,EACtDL,MAAM,EACN5B,SACD,CAAC;IAED+B,UAAU,CAAC7B,KAAK,CAACO,KAAK,GAAG0B,eAAe,CAAC1B,KAAK;EAC/C;EAEA,OAAOsB,UAAU;AAClB"}
@@ -106,48 +106,7 @@ function shouldSkipSerialization(blockType, featureSet, feature) {
106
106
  * @return {Object} Settings object.
107
107
  */
108
108
  function useBlockSettings(name, parentLayout) {
109
- const fontFamilies = (0, _components.useSetting)('typography.fontFamilies');
110
- const fontSizes = (0, _components.useSetting)('typography.fontSizes');
111
- const customFontSize = (0, _components.useSetting)('typography.customFontSize');
112
- const fontStyle = (0, _components.useSetting)('typography.fontStyle');
113
- const fontWeight = (0, _components.useSetting)('typography.fontWeight');
114
- const lineHeight = (0, _components.useSetting)('typography.lineHeight');
115
- const textColumns = (0, _components.useSetting)('typography.textColumns');
116
- const textDecoration = (0, _components.useSetting)('typography.textDecoration');
117
- const writingMode = (0, _components.useSetting)('typography.writingMode');
118
- const textTransform = (0, _components.useSetting)('typography.textTransform');
119
- const letterSpacing = (0, _components.useSetting)('typography.letterSpacing');
120
- const padding = (0, _components.useSetting)('spacing.padding');
121
- const margin = (0, _components.useSetting)('spacing.margin');
122
- const blockGap = (0, _components.useSetting)('spacing.blockGap');
123
- const spacingSizes = (0, _components.useSetting)('spacing.spacingSizes');
124
- const units = (0, _components.useSetting)('spacing.units');
125
- const minHeight = (0, _components.useSetting)('dimensions.minHeight');
126
- const layout = (0, _components.useSetting)('layout');
127
- const borderColor = (0, _components.useSetting)('border.color');
128
- const borderRadius = (0, _components.useSetting)('border.radius');
129
- const borderStyle = (0, _components.useSetting)('border.style');
130
- const borderWidth = (0, _components.useSetting)('border.width');
131
- const customColorsEnabled = (0, _components.useSetting)('color.custom');
132
- const customColors = (0, _components.useSetting)('color.palette.custom');
133
- const customDuotone = (0, _components.useSetting)('color.customDuotone');
134
- const themeColors = (0, _components.useSetting)('color.palette.theme');
135
- const defaultColors = (0, _components.useSetting)('color.palette.default');
136
- const defaultPalette = (0, _components.useSetting)('color.defaultPalette');
137
- const defaultDuotone = (0, _components.useSetting)('color.defaultDuotone');
138
- const userDuotonePalette = (0, _components.useSetting)('color.duotone.custom');
139
- const themeDuotonePalette = (0, _components.useSetting)('color.duotone.theme');
140
- const defaultDuotonePalette = (0, _components.useSetting)('color.duotone.default');
141
- const userGradientPalette = (0, _components.useSetting)('color.gradients.custom');
142
- const themeGradientPalette = (0, _components.useSetting)('color.gradients.theme');
143
- const defaultGradientPalette = (0, _components.useSetting)('color.gradients.default');
144
- const defaultGradients = (0, _components.useSetting)('color.defaultGradients');
145
- const areCustomGradientsEnabled = (0, _components.useSetting)('color.customGradient');
146
- const isBackgroundEnabled = (0, _components.useSetting)('color.background');
147
- const isLinkEnabled = (0, _components.useSetting)('color.link');
148
- const isTextEnabled = (0, _components.useSetting)('color.text');
149
- const isHeadingEnabled = (0, _components.useSetting)('color.heading');
150
- const isButtonEnabled = (0, _components.useSetting)('color.button');
109
+ const [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled] = (0, _components.useSettings)('typography.fontFamilies', 'typography.fontSizes', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.spacingSizes', 'spacing.units', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button');
151
110
  const rawSettings = (0, _element.useMemo)(() => {
152
111
  return {
153
112
  color: {
@@ -216,7 +175,7 @@ function useBlockSettings(name, parentLayout) {
216
175
  layout,
217
176
  parentLayout
218
177
  };
219
- }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
178
+ }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled]);
220
179
  return (0, _hooks.useSettingsForBlockElement)(rawSettings, name);
221
180
  }
222
181
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_element","_components","_hooks","_object","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","exports","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","getValueFromObjectPath","setImmutably","shouldSkipSerialization","blockType","featureSet","feature","getBlockSupport","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","useSetting","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","writingMode","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","isHeadingEnabled","isButtonEnabled","rawSettings","useMemo","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","heading","button","text","typography","spacing","border","radius","style","width","dimensions","useSettingsForBlockElement"],"sources":["@wordpress/block-editor/src/hooks/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\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\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\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 (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\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 = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\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: setImmutably(\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\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst writingMode = useSetting( 'typography.writingMode' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst customDuotone = useSetting( 'color.customDuotone' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst defaultDuotone = useSetting( 'color.defaultDuotone' );\n\tconst userDuotonePalette = useSetting( 'color.duotone.custom' );\n\tconst themeDuotonePalette = useSetting( 'color.duotone.theme' );\n\tconst defaultDuotonePalette = useSetting( 'color.duotone.default' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\tconst isHeadingEnabled = useSetting( 'color.heading' );\n\tconst isButtonEnabled = useSetting( 'color.button' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\theading: isHeadingEnabled,\n\t\t\t\tbutton: isButtonEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,gBAAgB,GAAKC,MAAM,IAAM;EAC7C,IACCA,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ,IAC1BC,KAAK,CAACC,OAAO,CAAEF,MAAO,CAAC,EACtB;IACD,OAAOA,MAAM;EACd;EAEA,MAAMG,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAAEL,MAAO,CAAC,CACnDM,GAAG,CAAE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM,CAAED,GAAG,EAAER,gBAAgB,CAAES,KAAM,CAAC,CAAG,CAAC,CAC/DC,MAAM,CAAE,CAAE,GAAID,KAAK,CAAE,KAAMA,KAAK,KAAKE,SAAU,CAAC;EAClD,OAAO,CAAEP,oBAAoB,CAACQ,MAAM,GACjCD,SAAS,GACTN,MAAM,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rBC,mBAAmB,EACnBC,oBAAoB,EACpBC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,EACzBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,CACZ,CAAC;EAEH,OAAO,IAAAyB,iCAA0B,EAAEtB,WAAW,EAAE7C,IAAK,CAAC;AACvD"}
1
+ {"version":3,"names":["_blocks","require","_element","_components","_hooks","_object","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","exports","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","getValueFromObjectPath","setImmutably","shouldSkipSerialization","blockType","featureSet","feature","getBlockSupport","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","writingMode","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","isHeadingEnabled","isButtonEnabled","useSettings","rawSettings","useMemo","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","heading","button","text","typography","spacing","border","radius","style","width","dimensions","useSettingsForBlockElement"],"sources":["@wordpress/block-editor/src/hooks/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\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\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\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 (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\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 = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\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: setImmutably(\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\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\twritingMode,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t] = useSettings(\n\t\t'typography.fontFamilies',\n\t\t'typography.fontSizes',\n\t\t'typography.customFontSize',\n\t\t'typography.fontStyle',\n\t\t'typography.fontWeight',\n\t\t'typography.lineHeight',\n\t\t'typography.textColumns',\n\t\t'typography.textDecoration',\n\t\t'typography.writingMode',\n\t\t'typography.textTransform',\n\t\t'typography.letterSpacing',\n\t\t'spacing.padding',\n\t\t'spacing.margin',\n\t\t'spacing.blockGap',\n\t\t'spacing.spacingSizes',\n\t\t'spacing.units',\n\t\t'dimensions.minHeight',\n\t\t'layout',\n\t\t'border.color',\n\t\t'border.radius',\n\t\t'border.style',\n\t\t'border.width',\n\t\t'color.custom',\n\t\t'color.palette.custom',\n\t\t'color.customDuotone',\n\t\t'color.palette.theme',\n\t\t'color.palette.default',\n\t\t'color.defaultPalette',\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default',\n\t\t'color.gradients.custom',\n\t\t'color.gradients.theme',\n\t\t'color.gradients.default',\n\t\t'color.defaultGradients',\n\t\t'color.customGradient',\n\t\t'color.background',\n\t\t'color.link',\n\t\t'color.text',\n\t\t'color.heading',\n\t\t'color.button'\n\t);\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\theading: isHeadingEnabled,\n\t\t\t\tbutton: isButtonEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,gBAAgB,GAAKC,MAAM,IAAM;EAC7C,IACCA,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ,IAC1BC,KAAK,CAACC,OAAO,CAAEF,MAAO,CAAC,EACtB;IACD,OAAOA,MAAM;EACd;EAEA,MAAMG,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAAEL,MAAO,CAAC,CACnDM,GAAG,CAAE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM,CAAED,GAAG,EAAER,gBAAgB,CAAES,KAAM,CAAC,CAAG,CAA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AAyB,EACzBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,CACd,CAAC;EAEH,OAAO,IAAAwB,iCAA0B,EAAEtB,WAAW,EAAE7C,IAAK,CAAC;AACvD"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -10,7 +9,7 @@ var _components = require("@wordpress/components");
10
9
  var _i18n = require("@wordpress/i18n");
11
10
  var _icons = require("@wordpress/icons");
12
11
  var _styleEngine = require("@wordpress/style-engine");
13
- var _useSetting = _interopRequireDefault(require("../components/use-setting"));
12
+ var _useSettings = require("../components/use-settings");
14
13
  var _utils = require("./utils");
15
14
  var _gap = require("../hooks/gap");
16
15
  var _utils2 = require("../hooks/utils");
@@ -56,8 +55,9 @@ var _default = {
56
55
  icon: _icons.justifyRight,
57
56
  label: (0, _i18n.__)('Justify items right')
58
57
  }];
58
+ const [availableUnits] = (0, _useSettings.useSettings)('spacing.units');
59
59
  const units = (0, _components.__experimentalUseCustomUnits)({
60
- availableUnits: (0, _useSetting.default)('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
60
+ availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw']
61
61
  });
62
62
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
63
63
  className: "block-editor-hooks__layout-controls"
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_icons","_styleEngine","_useSetting","_interopRequireDefault","_utils","_gap","_utils2","_definitions","_default","name","label","__","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","layoutBlockSupport","wideSize","contentSize","justifyContent","allowJustification","onJustificationChange","value","justificationOptions","icon","justifyLeft","justifyCenter","justifyRight","units","useCustomUnits","availableUnits","useSetting","_react","createElement","Fragment","className","__experimentalUnitControl","labelPosition","__unstableInputWidth","nextWidth","parseFloat","Icon","positionCenter","stretchWide","__experimentalToggleGroupControl","__nextHasNoMarginBottom","map","__experimentalToggleGroupControlOptionIcon","key","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","LAYOUT_DEFINITIONS","blockGapStyleValue","getGapCSSValue","spacing","blockGap","blockGapValue","shouldSkipSerialization","top","marginLeft","marginRight","output","appendSelectors","padding","paddingValues","getCSSRules","forEach","rule","getBlockGapCSS","getOrientation","getAlignments","alignmentInfo","getAlignmentsInfo","alignments","undefined","includes","unshift","alignment","info","wide","none","exports","default"],"sources":["@wordpress/block-editor/src/layouts/constrained.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tpositionCenter,\n\tstretchWide,\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n} from '@wordpress/icons';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nexport default {\n\tname: 'constrained',\n\tlabel: __( 'Constrained' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { wideSize, contentSize, justifyContent = 'center' } = layout;\n\t\tconst { allowJustification = true } = layoutBlockSupport;\n\t\tconst onJustificationChange = ( value ) => {\n\t\t\tonChange( {\n\t\t\t\t...layout,\n\t\t\t\tjustifyContent: value,\n\t\t\t} );\n\t\t};\n\t\tconst justificationOptions = [\n\t\t\t{\n\t\t\t\tvalue: 'left',\n\t\t\t\ticon: justifyLeft,\n\t\t\t\tlabel: __( 'Justify items left' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'center',\n\t\t\t\ticon: justifyCenter,\n\t\t\t\tlabel: __( 'Justify items center' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'right',\n\t\t\t\ticon: justifyRight,\n\t\t\t\tlabel: __( 'Justify items right' ),\n\t\t\t},\n\t\t];\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t\t'%',\n\t\t\t\t'px',\n\t\t\t\t'em',\n\t\t\t\t'rem',\n\t\t\t\t'vw',\n\t\t\t],\n\t\t} );\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t{ allowJustification && (\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ justificationOptions.map(\n\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\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) }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst { contentSize, wideSize, justifyContent } = layout;\n\t\tconst blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );\n\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tlet blockGapValue = '';\n\t\tif ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) {\n\t\t\t// If an object is provided only use the 'top' value for this kind of gap.\n\t\t\tif ( blockGapStyleValue?.top ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue?.top );\n\t\t\t} else if ( typeof blockGapStyleValue === 'string' ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue );\n\t\t\t}\n\t\t}\n\n\t\tconst marginLeft =\n\t\t\tjustifyContent === 'left' ? '0 !important' : 'auto !important';\n\t\tconst marginRight =\n\t\t\tjustifyContent === 'right' ? '0 !important' : 'auto !important';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: ${ marginLeft };\n\t\t\t\t\t\tmargin-right: ${ marginRight };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\tif ( justifyContent === 'left' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-left: ${ marginLeft }; }`;\n\t\t} else if ( justifyContent === 'right' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-right: ${ marginRight }; }`;\n\t\t}\n\n\t\t// If there is custom padding, add negative margins for alignfull blocks.\n\t\tif ( style?.spacing?.padding ) {\n\t\t\t// The style object might be storing a preset so we need to make sure we get a usable value.\n\t\t\tconst paddingValues = getCSSRules( style );\n\t\t\tpaddingValues.forEach( ( rule ) => {\n\t\t\t\tif ( rule.key === 'paddingRight' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-right: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t} else if ( rule.key === 'paddingLeft' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-left: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'constrained',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAQA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AA3BA;AACA;AACA;AAkBA;AACA;AACA;AAFA,IAAAU,QAAA,GASe;EACdC,IAAI,EAAE,aAAa;EACnBC,KAAK,EAAE,IAAAC,QAAE,EAAE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AQ,CAAC,CACjB;IAED,IAAKS,WAAW,EAAG;MAClB6D,UAAU,CAACG,OAAO,CAAE;QAAEzE,IAAI,EAAE;MAAO,CAAE,CAAC;IACvC;IAEA,IAAKQ,QAAQ,EAAG;MACf8D,UAAU,CAACG,OAAO,CAAE;QAAEzE,IAAI,EAAE,MAAM;QAAE2E,IAAI,EAAEP,aAAa,CAACQ;MAAK,CAAE,CAAC;IACjE;IAEAN,UAAU,CAACG,OAAO,CAAE;MAAEzE,IAAI,EAAE,MAAM;MAAE2E,IAAI,EAAEP,aAAa,CAACS;IAAK,CAAE,CAAC;IAEhE,OAAOP,UAAU;EAClB;AACD,CAAC;AAAAQ,OAAA,CAAAC,OAAA,GAAAhF,QAAA"}
1
+ {"version":3,"names":["_components","require","_i18n","_icons","_styleEngine","_useSettings","_utils","_gap","_utils2","_definitions","_default","name","label","__","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","layoutBlockSupport","wideSize","contentSize","justifyContent","allowJustification","onJustificationChange","value","justificationOptions","icon","justifyLeft","justifyCenter","justifyRight","availableUnits","useSettings","units","useCustomUnits","_react","createElement","Fragment","className","__experimentalUnitControl","labelPosition","__unstableInputWidth","nextWidth","parseFloat","Icon","positionCenter","stretchWide","__experimentalToggleGroupControl","__nextHasNoMarginBottom","map","__experimentalToggleGroupControlOptionIcon","key","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","LAYOUT_DEFINITIONS","blockGapStyleValue","getGapCSSValue","spacing","blockGap","blockGapValue","shouldSkipSerialization","top","marginLeft","marginRight","output","appendSelectors","padding","paddingValues","getCSSRules","forEach","rule","getBlockGapCSS","getOrientation","getAlignments","alignmentInfo","getAlignmentsInfo","alignments","undefined","includes","unshift","alignment","info","wide","none","exports","default"],"sources":["@wordpress/block-editor/src/layouts/constrained.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tpositionCenter,\n\tstretchWide,\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n} from '@wordpress/icons';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nexport default {\n\tname: 'constrained',\n\tlabel: __( 'Constrained' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { wideSize, contentSize, justifyContent = 'center' } = layout;\n\t\tconst { allowJustification = true } = layoutBlockSupport;\n\t\tconst onJustificationChange = ( value ) => {\n\t\t\tonChange( {\n\t\t\t\t...layout,\n\t\t\t\tjustifyContent: value,\n\t\t\t} );\n\t\t};\n\t\tconst justificationOptions = [\n\t\t\t{\n\t\t\t\tvalue: 'left',\n\t\t\t\ticon: justifyLeft,\n\t\t\t\tlabel: __( 'Justify items left' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'center',\n\t\t\t\ticon: justifyCenter,\n\t\t\t\tlabel: __( 'Justify items center' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'right',\n\t\t\t\ticon: justifyRight,\n\t\t\t\tlabel: __( 'Justify items right' ),\n\t\t\t},\n\t\t];\n\t\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],\n\t\t} );\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t{ allowJustification && (\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ justificationOptions.map(\n\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\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) }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst { contentSize, wideSize, justifyContent } = layout;\n\t\tconst blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );\n\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tlet blockGapValue = '';\n\t\tif ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) {\n\t\t\t// If an object is provided only use the 'top' value for this kind of gap.\n\t\t\tif ( blockGapStyleValue?.top ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue?.top );\n\t\t\t} else if ( typeof blockGapStyleValue === 'string' ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue );\n\t\t\t}\n\t\t}\n\n\t\tconst marginLeft =\n\t\t\tjustifyContent === 'left' ? '0 !important' : 'auto !important';\n\t\tconst marginRight =\n\t\t\tjustifyContent === 'right' ? '0 !important' : 'auto !important';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: ${ marginLeft };\n\t\t\t\t\t\tmargin-right: ${ marginRight };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\tif ( justifyContent === 'left' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-left: ${ marginLeft }; }`;\n\t\t} else if ( justifyContent === 'right' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-right: ${ marginRight }; }`;\n\t\t}\n\n\t\t// If there is custom padding, add negative margins for alignfull blocks.\n\t\tif ( style?.spacing?.padding ) {\n\t\t\t// The style object might be storing a preset so we need to make sure we get a usable value.\n\t\t\tconst paddingValues = getCSSRules( style );\n\t\t\tpaddingValues.forEach( ( rule ) => {\n\t\t\t\tif ( rule.key === 'paddingRight' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-right: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t} else if ( rule.key === 'paddingLeft' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-left: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'constrained',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAQA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AA3BA;AACA;AACA;AAkBA;AACA;AACA;AAFA,IAAAS,QAAA,GASe;EACdC,IAAI,EAAE,aAAa;EACnBC,KAAK,EAAE,IAAAC,QAAE,EAAE,aAAc,CAAC;EAC1BC,iBAAiB,EAAE,SAASC,8BAA8BA,CAAE;IAC3DC,MAAM;IACNC,QAAQ;IACRC,kBAAkB,GAAG,CAAC;EACvB,CAAC,EAAG;IACH,MAAM;MAAEC,QAAQ;MAAEC,WAAW;MAAEC,cAAc,GAAG;IAAS,CAAC,GAAGL,MAAM;IACnE,MAAM;MAAEM,kBAAkB,GAAG;IAAK,CAAC,GAAGJ,kBAAkB;IACxD,MAAMK,qBAAqB,GAAKC,KAAK,IAAM;MAC1CP,QAAQ,CAAE;QACT,GAAGD,MAAM;QACTK,cAAc,EAAEG;MACjB,CAAE,CAAC;IACJ,CAAC;IACD,MAAMC,oBAAoB,GAAG,CAC5B;MACCD,KAAK,EAAE,MAAM;MACbE,IAAI,EAAEC,kBAAW;MACjBf,KAAK,EAAE,IAAAC,QAAE,EAAE,oBAAqB;IAC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VALUES = {
25
25
  vw: 100,
26
26
  vh: 100,
27
27
  em: 38,
28
- rem: 38
28
+ rem: 38,
29
+ svw: 100,
30
+ lvw: 100,
31
+ dvw: 100,
32
+ svh: 100,
33
+ lvh: 100,
34
+ dvh: 100,
35
+ vi: 100,
36
+ svi: 100,
37
+ lvi: 100,
38
+ dvi: 100,
39
+ vb: 100,
40
+ svb: 100,
41
+ lvb: 100,
42
+ dvb: 100,
43
+ vmin: 100,
44
+ svmin: 100,
45
+ lvmin: 100,
46
+ dvmin: 100,
47
+ vmax: 100,
48
+ svmax: 100,
49
+ lvmax: 100,
50
+ dvmax: 100
29
51
  };
30
52
  var _default = {
31
53
  name: 'grid',
@@ -114,8 +136,8 @@ function GridLayoutMinimumWidthControl({
114
136
  } else if (['em', 'rem'].includes(unit) && newUnit === 'px') {
115
137
  // Convert to pixel value assuming a root size of 16px.
116
138
  newValue = Math.round(quantity * 16) + newUnit;
117
- } else if (['vh', 'vw', '%'].includes(newUnit) && quantity > 100) {
118
- // When converting to `vh`, `vw`, or `%` units, cap the new value at 100.
139
+ } else if (['vh', 'vw', '%', 'svw', 'lvw', 'dvw', 'svh', 'lvh', 'dvh', 'vi', 'svi', 'lvi', 'dvi', 'vb', 'svb', 'lvb', 'dvb', 'vmin', 'svmin', 'lvmin', 'dvmin', 'vmax', 'svmax', 'lvmax', 'dvmax'].includes(newUnit) && quantity > 100) {
140
+ // When converting to `%` or viewport-relative units, cap the new value at 100.
119
141
  newValue = 100 + newUnit;
120
142
  }
121
143
  onChange({