@wordpress/block-editor 12.0.0 → 12.1.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 (311) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -1
  3. package/build/components/block-controls/slot.js +12 -4
  4. package/build/components/block-controls/slot.js.map +1 -1
  5. package/build/components/block-controls/slot.native.js +10 -1
  6. package/build/components/block-controls/slot.native.js.map +1 -1
  7. package/build/components/block-draggable/index.js +11 -7
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
  10. package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  11. package/build/components/block-list/block-invalid-warning.native.js +15 -7
  12. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  13. package/build/components/block-list/block-list-item-cell.native.js +15 -2
  14. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  15. package/build/components/block-list/block-list-item.native.js +158 -195
  16. package/build/components/block-list/block-list-item.native.js.map +1 -1
  17. package/build/components/block-list/block-outline.native.js +57 -0
  18. package/build/components/block-list/block-outline.native.js.map +1 -0
  19. package/build/components/block-list/block.native.js +343 -299
  20. package/build/components/block-list/block.native.js.map +1 -1
  21. package/build/components/block-list/index.native.js +202 -298
  22. package/build/components/block-list/index.native.js.map +1 -1
  23. package/build/components/block-list/insertion-point.native.js +4 -2
  24. package/build/components/block-list/insertion-point.native.js.map +1 -1
  25. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  26. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  27. package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
  28. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  29. package/build/components/block-settings-menu-controls/index.js +15 -4
  30. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  31. package/build/components/block-tools/block-contextual-toolbar.js +17 -62
  32. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  33. package/build/components/block-tools/selected-block-popover.js +3 -8
  34. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  35. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  36. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  37. package/build/components/global-styles/advanced-panel.js +86 -0
  38. package/build/components/global-styles/advanced-panel.js.map +1 -0
  39. package/build/components/global-styles/color-panel.js +4 -1
  40. package/build/components/global-styles/color-panel.js.map +1 -1
  41. package/build/components/global-styles/dimensions-panel.js +6 -6
  42. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  43. package/build/components/global-styles/hooks.js +1 -2
  44. package/build/components/global-styles/hooks.js.map +1 -1
  45. package/build/components/global-styles/index.js +24 -0
  46. package/build/components/global-styles/index.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/global-styles/use-global-styles-output.js +27 -4
  50. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  51. package/build/components/global-styles/utils.js +30 -0
  52. package/build/components/global-styles/utils.js.map +1 -1
  53. package/build/components/image-editor/use-save-image.js +24 -8
  54. package/build/components/image-editor/use-save-image.js.map +1 -1
  55. package/build/components/inserter-draggable-blocks/index.js +5 -0
  56. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  57. package/build/components/inspector-controls/fill.js +1 -1
  58. package/build/components/inspector-controls/fill.js.map +1 -1
  59. package/build/components/inspector-controls/fill.native.js +1 -1
  60. package/build/components/inspector-controls/fill.native.js.map +1 -1
  61. package/build/components/inspector-controls/slot.js +3 -6
  62. package/build/components/inspector-controls/slot.js.map +1 -1
  63. package/build/components/inspector-controls/slot.native.js +1 -1
  64. package/build/components/inspector-controls/slot.native.js.map +1 -1
  65. package/build/components/line-height-control/index.js +7 -2
  66. package/build/components/line-height-control/index.js.map +1 -1
  67. package/build/components/link-control/use-internal-input-value.js +9 -8
  68. package/build/components/link-control/use-internal-input-value.js.map +1 -1
  69. package/build/components/list-view/block-contents.js +7 -2
  70. package/build/components/list-view/block-contents.js.map +1 -1
  71. package/build/components/list-view/block-select-button.js +2 -1
  72. package/build/components/list-view/block-select-button.js.map +1 -1
  73. package/build/components/list-view/block.js +4 -4
  74. package/build/components/list-view/block.js.map +1 -1
  75. package/build/components/list-view/index.js +32 -18
  76. package/build/components/list-view/index.js.map +1 -1
  77. package/build/components/list-view/use-list-view-drop-zone.js +163 -11
  78. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  79. package/build/components/media-placeholder/index.js +68 -7
  80. package/build/components/media-placeholder/index.js.map +1 -1
  81. package/build/components/multi-selection-inspector/index.js +2 -2
  82. package/build/components/multi-selection-inspector/index.js.map +1 -1
  83. package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
  84. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  85. package/build/components/preview-options/index.js +6 -1
  86. package/build/components/preview-options/index.js.map +1 -1
  87. package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
  88. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  89. package/build/components/url-input/index.js +1 -2
  90. package/build/components/url-input/index.js.map +1 -1
  91. package/build/hooks/align.js +1 -1
  92. package/build/hooks/align.js.map +1 -1
  93. package/build/hooks/border.js +1 -1
  94. package/build/hooks/border.js.map +1 -1
  95. package/build/hooks/color.js +1 -1
  96. package/build/hooks/color.js.map +1 -1
  97. package/build/hooks/content-lock-ui.js +8 -12
  98. package/build/hooks/content-lock-ui.js.map +1 -1
  99. package/build/hooks/duotone.js +1 -1
  100. package/build/hooks/duotone.js.map +1 -1
  101. package/build/hooks/index.native.js +8 -0
  102. package/build/hooks/index.native.js.map +1 -1
  103. package/build/hooks/layout.js +2 -2
  104. package/build/hooks/layout.js.map +1 -1
  105. package/build/hooks/position.js +1 -1
  106. package/build/hooks/position.js.map +1 -1
  107. package/build/hooks/style.js +1 -1
  108. package/build/hooks/style.js.map +1 -1
  109. package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
  110. package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  111. package/build/hooks/use-typography-props.js +14 -10
  112. package/build/hooks/use-typography-props.js.map +1 -1
  113. package/build/index.native.js +31 -0
  114. package/build/index.native.js.map +1 -0
  115. package/build/utils/use-should-contextual-toolbar-show.js +16 -12
  116. package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
  117. package/build-module/components/block-controls/slot.js +11 -4
  118. package/build-module/components/block-controls/slot.js.map +1 -1
  119. package/build-module/components/block-controls/slot.native.js +9 -1
  120. package/build-module/components/block-controls/slot.native.js.map +1 -1
  121. package/build-module/components/block-draggable/index.js +10 -6
  122. package/build-module/components/block-draggable/index.js.map +1 -1
  123. package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
  124. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  125. package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
  126. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  127. package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
  128. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  129. package/build-module/components/block-list/block-list-item.native.js +160 -190
  130. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  131. package/build-module/components/block-list/block-outline.native.js +44 -0
  132. package/build-module/components/block-list/block-outline.native.js.map +1 -0
  133. package/build-module/components/block-list/block.native.js +341 -298
  134. package/build-module/components/block-list/block.native.js.map +1 -1
  135. package/build-module/components/block-list/index.native.js +203 -293
  136. package/build-module/components/block-list/index.native.js.map +1 -1
  137. package/build-module/components/block-list/insertion-point.native.js +4 -2
  138. package/build-module/components/block-list/insertion-point.native.js.map +1 -1
  139. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  140. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  141. package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
  142. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  143. package/build-module/components/block-settings-menu-controls/index.js +13 -5
  144. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  145. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -62
  146. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  147. package/build-module/components/block-tools/selected-block-popover.js +3 -7
  148. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  149. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  150. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  151. package/build-module/components/global-styles/advanced-panel.js +74 -0
  152. package/build-module/components/global-styles/advanced-panel.js.map +1 -0
  153. package/build-module/components/global-styles/color-panel.js +5 -2
  154. package/build-module/components/global-styles/color-panel.js.map +1 -1
  155. package/build-module/components/global-styles/dimensions-panel.js +6 -6
  156. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  157. package/build-module/components/global-styles/hooks.js +1 -2
  158. package/build-module/components/global-styles/hooks.js.map +1 -1
  159. package/build-module/components/global-styles/index.js +3 -1
  160. package/build-module/components/global-styles/index.js.map +1 -1
  161. package/build-module/components/global-styles/typography-panel.js +1 -1
  162. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  163. package/build-module/components/global-styles/use-global-styles-output.js +25 -4
  164. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  165. package/build-module/components/global-styles/utils.js +25 -0
  166. package/build-module/components/global-styles/utils.js.map +1 -1
  167. package/build-module/components/image-editor/use-save-image.js +24 -8
  168. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  169. package/build-module/components/inserter-draggable-blocks/index.js +4 -0
  170. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  171. package/build-module/components/inspector-controls/fill.js +1 -1
  172. package/build-module/components/inspector-controls/fill.js.map +1 -1
  173. package/build-module/components/inspector-controls/fill.native.js +1 -1
  174. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  175. package/build-module/components/inspector-controls/slot.js +4 -7
  176. package/build-module/components/inspector-controls/slot.js.map +1 -1
  177. package/build-module/components/inspector-controls/slot.native.js +1 -1
  178. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  179. package/build-module/components/line-height-control/index.js +7 -2
  180. package/build-module/components/line-height-control/index.js.map +1 -1
  181. package/build-module/components/link-control/use-internal-input-value.js +9 -8
  182. package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
  183. package/build-module/components/list-view/block-contents.js +7 -3
  184. package/build-module/components/list-view/block-contents.js.map +1 -1
  185. package/build-module/components/list-view/block-select-button.js +2 -1
  186. package/build-module/components/list-view/block-select-button.js.map +1 -1
  187. package/build-module/components/list-view/block.js +4 -4
  188. package/build-module/components/list-view/block.js.map +1 -1
  189. package/build-module/components/list-view/index.js +32 -18
  190. package/build-module/components/list-view/index.js.map +1 -1
  191. package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
  192. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  193. package/build-module/components/media-placeholder/index.js +66 -7
  194. package/build-module/components/media-placeholder/index.js.map +1 -1
  195. package/build-module/components/multi-selection-inspector/index.js +2 -2
  196. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  197. package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
  198. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  199. package/build-module/components/preview-options/index.js +7 -2
  200. package/build-module/components/preview-options/index.js.map +1 -1
  201. package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
  202. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  203. package/build-module/components/url-input/index.js +1 -2
  204. package/build-module/components/url-input/index.js.map +1 -1
  205. package/build-module/hooks/align.js +1 -1
  206. package/build-module/hooks/align.js.map +1 -1
  207. package/build-module/hooks/border.js +1 -1
  208. package/build-module/hooks/border.js.map +1 -1
  209. package/build-module/hooks/color.js +1 -1
  210. package/build-module/hooks/color.js.map +1 -1
  211. package/build-module/hooks/content-lock-ui.js +8 -11
  212. package/build-module/hooks/content-lock-ui.js.map +1 -1
  213. package/build-module/hooks/duotone.js +1 -1
  214. package/build-module/hooks/duotone.js.map +1 -1
  215. package/build-module/hooks/index.native.js +1 -0
  216. package/build-module/hooks/index.native.js.map +1 -1
  217. package/build-module/hooks/layout.js +2 -2
  218. package/build-module/hooks/layout.js.map +1 -1
  219. package/build-module/hooks/position.js +1 -1
  220. package/build-module/hooks/position.js.map +1 -1
  221. package/build-module/hooks/style.js +1 -1
  222. package/build-module/hooks/style.js.map +1 -1
  223. package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
  224. package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  225. package/build-module/hooks/use-typography-props.js +14 -10
  226. package/build-module/hooks/use-typography-props.js.map +1 -1
  227. package/build-module/index.native.js +6 -0
  228. package/build-module/index.native.js.map +1 -0
  229. package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
  230. package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
  231. package/build-style/content-rtl.css +0 -1
  232. package/build-style/content.css +0 -1
  233. package/build-style/style-rtl.css +37 -13
  234. package/build-style/style.css +37 -13
  235. package/package.json +31 -31
  236. package/src/components/block-breadcrumb/style.scss +2 -1
  237. package/src/components/block-controls/slot.js +8 -4
  238. package/src/components/block-controls/slot.native.js +6 -1
  239. package/src/components/block-draggable/index.js +10 -6
  240. package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
  241. package/src/components/block-list/block-invalid-warning.native.js +17 -9
  242. package/src/components/block-list/block-list-item-cell.native.js +10 -1
  243. package/src/components/block-list/block-list-item.native.js +180 -208
  244. package/src/components/block-list/block-outline.native.js +58 -0
  245. package/src/components/block-list/block.native.js +564 -523
  246. package/src/components/block-list/content.scss +0 -1
  247. package/src/components/block-list/index.native.js +229 -298
  248. package/src/components/block-list/insertion-point.native.js +2 -2
  249. package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
  250. package/src/components/block-list/test/index.native.js +205 -0
  251. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
  252. package/src/components/block-pattern-setup/style.scss +1 -4
  253. package/src/components/block-patterns-list/style.scss +1 -4
  254. package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
  255. package/src/components/block-settings-menu-controls/index.js +24 -4
  256. package/src/components/block-styles/style.scss +4 -4
  257. package/src/components/block-tools/block-contextual-toolbar.js +28 -62
  258. package/src/components/block-tools/selected-block-popover.js +3 -5
  259. package/src/components/block-tools/style.scss +8 -0
  260. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
  261. package/src/components/global-styles/advanced-panel.js +82 -0
  262. package/src/components/global-styles/color-panel.js +6 -1
  263. package/src/components/global-styles/dimensions-panel.js +6 -6
  264. package/src/components/global-styles/hooks.js +1 -5
  265. package/src/components/global-styles/index.js +6 -1
  266. package/src/components/global-styles/style.scss +14 -0
  267. package/src/components/global-styles/test/utils.js +57 -1
  268. package/src/components/global-styles/typography-panel.js +1 -1
  269. package/src/components/global-styles/use-global-styles-output.js +21 -3
  270. package/src/components/global-styles/utils.js +27 -0
  271. package/src/components/image-editor/use-save-image.js +20 -9
  272. package/src/components/inserter-draggable-blocks/index.js +4 -0
  273. package/src/components/inspector-controls/fill.js +1 -1
  274. package/src/components/inspector-controls/fill.native.js +1 -1
  275. package/src/components/inspector-controls/slot.js +4 -9
  276. package/src/components/inspector-controls/slot.native.js +1 -1
  277. package/src/components/line-height-control/index.js +7 -2
  278. package/src/components/line-height-control/stories/index.js +1 -1
  279. package/src/components/link-control/test/index.js +42 -0
  280. package/src/components/link-control/use-internal-input-value.js +8 -7
  281. package/src/components/list-view/block-contents.js +26 -20
  282. package/src/components/list-view/block-select-button.js +5 -1
  283. package/src/components/list-view/block.js +5 -2
  284. package/src/components/list-view/index.js +26 -14
  285. package/src/components/list-view/style.scss +5 -2
  286. package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
  287. package/src/components/list-view/use-list-view-drop-zone.js +194 -11
  288. package/src/components/media-placeholder/index.js +74 -1
  289. package/src/components/multi-selection-inspector/index.js +2 -2
  290. package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
  291. package/src/components/preview-options/index.js +9 -2
  292. package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
  293. package/src/components/url-input/index.js +1 -2
  294. package/src/hooks/align.js +2 -1
  295. package/src/hooks/border.js +2 -1
  296. package/src/hooks/color.js +2 -1
  297. package/src/hooks/content-lock-ui.js +3 -15
  298. package/src/hooks/duotone.js +1 -0
  299. package/src/hooks/index.native.js +1 -0
  300. package/src/hooks/layout.js +4 -2
  301. package/src/hooks/position.js +2 -1
  302. package/src/hooks/style.js +2 -1
  303. package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
  304. package/src/hooks/test/use-typography-props.js +47 -2
  305. package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
  306. package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
  307. package/src/hooks/use-typography-props.js +10 -11
  308. package/src/index.native.js +6 -0
  309. package/src/utils/use-should-contextual-toolbar-show.js +19 -9
  310. package/tsconfig.json +1 -0
  311. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/position.js"],"names":["classnames","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","createHigherOrderComponent","useInstanceId","useSelect","useContext","useMemo","createPortal","Platform","addFilter","BlockList","useSetting","InspectorControls","cleanEmptyObject","unlock","store","blockEditorStore","CustomSelectControl","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanel","clientId","hasParents","select","getBlockParents","parents","length","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","selectedItem","native","withInspectorControls","BlockEdit","positionSupport","showPositionControls","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","element","__unstableElementContext","positionSelector","css"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SACCC,WADD,EAECC,WAAW,IAAIC,qBAFhB,QAGO,uBAHP;AAIA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,UADD,EAECC,OAFD,EAGCC,YAHD,EAICC,QAJD,QAKO,oBALP;AAMA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,MAAT,QAAuB,gBAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAA0BH,MAAM,CAAEb,qBAAF,CAAtC;AAEA,MAAMiB,oBAAoB,GAAG,UAA7B;AAEA,MAAMC,gBAAgB,GACrB,gEADD;AAGA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,GAAG,EAAE,SADiB;AAEtBC,EAAAA,KAAK,EAAE,EAFe;AAGtBC,EAAAA,IAAI,EAAE7B,EAAE,CAAE,SAAF,CAHc;AAItB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2CAFQ,EAGR8E,kBAHQ,CAAT;AAKA9E,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR0E,qBAHQ,CAAT","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 { 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 {WPElement} 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 { hasParents } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn {\n\t\t\t\thasParents: parents.length,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Only display sticky option if the block has no parents (is at the root of the document),\n\t\t// or if the block already has a sticky position value set.\n\t\tif (\n\t\t\t( allowSticky && ! hasParents ) ||\n\t\t\tvalue === STICKY_OPTION.value\n\t\t) {\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, hasParents, 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 className=\"block-editor-hooks__position-selection\">\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__next36pxDefaultSize\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 showPositionControls =\n\t\t\tpositionSupport && ! useIsPositionDisabled( props );\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 allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! useIsPositionDisabled( props );\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);\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"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/position.js"],"names":["classnames","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","createHigherOrderComponent","useInstanceId","useSelect","useContext","useMemo","createPortal","Platform","addFilter","BlockList","useSetting","InspectorControls","cleanEmptyObject","unlock","store","blockEditorStore","CustomSelectControl","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanel","clientId","hasParents","select","getBlockParents","parents","length","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","selectedItem","native","withInspectorControls","BlockEdit","positionSupport","showPositionControls","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","element","__unstableElementContext","positionSelector","css"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SACCC,WADD,EAECC,WAAW,IAAIC,qBAFhB,QAGO,uBAHP;AAIA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,UADD,EAECC,OAFD,EAGCC,YAHD,EAICC,QAJD,QAKO,oBALP;AAMA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,MAAT,QAAuB,gBAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA,MAAM;AA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AL6C,GAApB,CAA5B;AAQA,SACC,8BACGwD,mBAAmB,IACpBE,OADC,IAED,CAAC,CAAEG,GAFF,IAGDxF,YAAY,CAAE,6BAASwF,GAAT,CAAF,EAA0BH,OAA1B,CAJd,EAKC,cAAC,cAAD,eAAqB3C,KAArB;AAA6B,IAAA,SAAS,EAAGzB;AAAzC,KALD,CADD;AASA,CA5C0D,EA6C3D,oBA7C2D,CAArD;AAgDPf,SAAS,CACR,uBADQ,EAER,2CAFQ,EAGR8E,kBAHQ,CAAT;AAKA9E,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR0E,qBAHQ,CAAT","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 { 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 {WPElement} 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 { hasParents } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn {\n\t\t\t\thasParents: parents.length,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Only display sticky option if the block has no parents (is at the root of the document),\n\t\t// or if the block already has a sticky position value set.\n\t\tif (\n\t\t\t( allowSticky && ! hasParents ) ||\n\t\t\tvalue === STICKY_OPTION.value\n\t\t) {\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, hasParents, 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 className=\"block-editor-hooks__position-selection\">\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__next36pxDefaultSize\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 showPositionControls =\n\t\t\tpositionSupport && ! useIsPositionDisabled( props );\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 allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! useIsPositionDisabled( props );\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"]}
@@ -371,7 +371,7 @@ const withElementsStyles = createHigherOrderComponent(BlockListBlock => props =>
371
371
  }), element), createElement(BlockListBlock, _extends({}, props, {
372
372
  className: (_props$attributes$sty7 = props.attributes.style) !== null && _props$attributes$sty7 !== void 0 && _props$attributes$sty7.elements ? classnames(props.className, blockElementsContainerIdentifier) : props.className
373
373
  })));
374
- });
374
+ }, 'withElementsStyles');
375
375
  addFilter('blocks.registerBlockType', 'core/style/addAttribute', addAttribute);
376
376
  addFilter('blocks.getSaveContent.extraProps', 'core/style/addSaveProps', addSaveProps);
377
377
  addFilter('blocks.registerBlockType', 'core/style/addEditProps', addEditProps);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["classnames","useContext","useMemo","createPortal","addFilter","getBlockSupport","hasBlockSupport","__EXPERIMENTAL_ELEMENTS","ELEMENTS","createHigherOrderComponent","useInstanceId","getCSSRules","compileCSS","BlockList","BORDER_SUPPORT_KEY","BorderPanel","COLOR_SUPPORT_KEY","ColorEdit","TypographyPanel","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","DimensionsPanel","useDisplayBlockControls","shouldSkipSerialization","styleSupportKeys","hasStyleSupport","blockType","some","key","getInlineStyles","styles","output","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","skipPaths","entries","indicator","skipSerialization","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","skipLinkColorSerialization","name","elements","link","undefined","selector","elementCssRules","elementStyles","cssRule","push","join","element","__unstableElementContext","__html","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,eADD,EAECC,eAFD,EAGCC,uBAAuB,IAAIC,QAH5B,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,yBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SAASC,kBAAT,EAA6BC,WAA7B,QAAgD,UAAhD;AACA,SAASC,iBAAT,EAA4BC,SAA5B,QAA6C,SAA7C;AACA,SACCC,eADD,EAECC,sBAFD,EAGCC,uBAHD,QAIO,cAJP;AAKA,SACCC,sBADD,EAECC,mBAFD,EAGCC,eAHD,QAIO,cAJP;AAKA,OAAOC,uBAAP,MAAoC,0CAApC;AACA,SAASC,uBAAT,QAAwC,SAAxC;AAEA,MAAMC,gBAAgB,GAAG,CACxB,GAAGN,uBADqB,EAExBN,kBAFwB,EAGxBE,iBAHwB,EAIxBK,sBAJwB,EAKxBC,mBALwB,CAAzB;;AAQA,MAAMK,eAAe,GAAKC,SAAF,IACvBF,gBAAgB,CAACG,IAAjB,CAAyBC,GAAF,IAAWxB,eAAe,CAAEsB,SAAF,EAAaE,GAAb,CAAjD,CADD;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,eAAT,GAAwC;AAAA,MAAdC,MAAc,uEAAL,EAAK;AAC9C,QAAMC,MAAM,GAAG,EAAf,CAD8C,CAE9C;AACA;;AACAtB,EAAAA,WAAW,CAAEqB,MAAF,CAAX,CAAsBE,OAAtB,CAAiCC,IAAF,I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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAoBR,KAApB,EAA2BS,KAA3B,EAA8D;AAAA,MAA5BC,iBAA4B,uEAAR,KAAQ;;AACpE,MAAK,CAAEV,KAAP,EAAe;AACd,WAAOA,KAAP;AACA;;AAED,MAAIW,QAAQ,GAAGX,KAAf;;AACA,MAAK,CAAEU,iBAAP,EAA2B;AAC1BC,IAAAA,QAAQ,GAAGC,IAAI,CAACC,KAAL,CAAYD,IAAI,CAACE,SAAL,CAAgBd,KAAhB,CAAZ,CAAX;AACA;;AAED,MAAK,CAAEe,KAAK,CAACC,OAAN,CAAeP,KAAf,CAAP,EAAgC;AAC/BA,IAAAA,KAAK,GAAG,CAAEA,KAAF,CAAR;AACA;;AAEDA,EAAAA,KAAK,CAACf,OAAN,CAAiBuB,IAAF,IAAY;AAC1B,QAAK,CAAEF,KAAK,CAACC,OAAN,CAAeC,IAAf,CAAP,EAA+B;AAC9BA,MAAAA,IAAI,GAAGA,IAAI,CAACC,KAAL,CAAY,GAAZ,CAAP;AACA;;AAED,QAAKD,IAAI,CAACE,MAAL,GAAc,CAAnB,EAAuB;AACtB,YAAM,CAAEC,YAAF,EAAgB,GAAGC,QAAnB,IAAgCJ,IAAtC;AACAT,MAAAA,SAAS,CAAEG,QAAQ,CAAES,YAAF,CAAV,EAA4B,CA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O,GAAGzF,UAAU,CAAEY,SAAS,CAAC8E,wBAAZ,CAA1B;AAEA,SACC,8BACG3D,MAAM,IACP0D,OADC,IAEDvF,YAAY,CACX;AACC,IAAA,uBAAuB,EAAG;AACzByF,MAAAA,MAAM,EAAE5D;AADiB;AAD3B,IADW,EAMX0D,OANW,CAHd,EAYC,cAAC,cAAD,eACM3B,KADN;AAEC,IAAA,SAAS,EACR,0BAAAA,KAAK,CAACxB,UAAN,CAAiBC,KAAjB,0EAAwByC,QAAxB,GACGjF,UAAU,CACV+D,KAAK,CAAC8B,SADI,EAEVf,gCAFU,CADb,GAKGf,KAAK,CAAC8B;AARX,KAZD,CADD;AA0BA,CA5EmD,CAArD;AA+EAzF,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRiC,YAHQ,CAAT;AAMAjC,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGR0D,YAHQ,CAAT;AAMA1D,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRkE,YAHQ,CAAT;AAMAlE,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRqE,iBAHQ,CAAT;AAMArE,SAAS,CACR,uBADQ,EAER,kCAFQ,EAGRwE,kBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\tconst skipLinkColorSerialization = shouldSkipSerialization(\n\t\t\tprops.name,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t'link'\n\t\t);\n\n\t\tconst styles = useMemo( () => {\n\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t// styles to override element styles because of higher specificity.\n\t\t\tconst elements = [\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link?.[ ':hover' ]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }:hover`,\n\t\t\t\t},\n\t\t\t];\n\t\t\tconst elementCssRules = [];\n\t\t\tfor ( const { styles: elementStyles, selector } of elements ) {\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst cssRule = compileCSS( elementStyles, {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t} );\n\t\t\t\t\telementCssRules.push( cssRule );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn elementCssRules.length > 0\n\t\t\t\t? elementCssRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [\n\t\t\tprops.attributes.style?.elements,\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tskipLinkColorSerialization,\n\t\t] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["classnames","useContext","useMemo","createPortal","addFilter","getBlockSupport","hasBlockSupport","__EXPERIMENTAL_ELEMENTS","ELEMENTS","createHigherOrderComponent","useInstanceId","getCSSRules","compileCSS","BlockList","BORDER_SUPPORT_KEY","BorderPanel","COLOR_SUPPORT_KEY","ColorEdit","TypographyPanel","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","DimensionsPanel","useDisplayBlockControls","shouldSkipSerialization","styleSupportKeys","hasStyleSupport","blockType","some","key","getInlineStyles","styles","output","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","skipPaths","entries","indicator","skipSerialization","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","skipLinkColorSerialization","name","elements","link","undefined","selector","elementCssRules","elementStyles","cssRule","push","join","element","__unstableElementContext","__html","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,OAArB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CAHd,EAYC,cAAC,cAAD,eACM3B,KADN;AAEC,IAAA,SAAS,EACR,0BAAAA,KAAK,CAACxB,UAAN,CAAiBC,KAAjB,0EAAwByC,QAAxB,GACGjF,UAAU,CACV+D,KAAK,CAAC8B,SADI,EAEVf,gCAFU,CADb,GAKGf,KAAK,CAAC8B;AARX,KAZD,CADD;AA0BA,CA5EmD,EA6EpD,oBA7EoD,CAArD;AAgFAzF,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRiC,YAHQ,CAAT;AAMAjC,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGR0D,YAHQ,CAAT;AAMA1D,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRkE,YAHQ,CAAT;AAMAlE,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRqE,iBAHQ,CAAT;AAMArE,SAAS,CACR,uBADQ,EAER,kCAFQ,EAGRwE,kBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\tconst skipLinkColorSerialization = shouldSkipSerialization(\n\t\t\tprops.name,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t'link'\n\t\t);\n\n\t\tconst styles = useMemo( () => {\n\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t// styles to override element styles because of higher specificity.\n\t\t\tconst elements = [\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link?.[ ':hover' ]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }:hover`,\n\t\t\t\t},\n\t\t\t];\n\t\t\tconst elementCssRules = [];\n\t\t\tfor ( const { styles: elementStyles, selector } of elements ) {\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst cssRule = compileCSS( elementStyles, {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t} );\n\t\t\t\t\telementCssRules.push( cssRule );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn elementCssRules.length > 0\n\t\t\t\t? elementCssRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [\n\t\t\tprops.attributes.style?.elements,\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tskipLinkColorSerialization,\n\t\t] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withElementsStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
@@ -0,0 +1,242 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { useWindowDimensions } from 'react-native';
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+
9
+ import { useMemo } from '@wordpress/element';
10
+ import { ALIGNMENT_BREAKPOINTS, WIDE_ALIGNMENTS, alignmentHelpers } from '@wordpress/components';
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ import styles from './use-editor-wrapper-styles.scss';
16
+ const ALIGNMENT_MAX_WIDTH = {
17
+ full: '100%',
18
+ wide: 1054,
19
+ wideMedium: 770,
20
+ wideLandscape: 662
21
+ };
22
+ const BLOCK_DEFAULT_MARGIN = 16;
23
+ /**
24
+ * Get the styles for the wide width alignment.
25
+ *
26
+ * @param {Object} [options] The options for the helper.
27
+ * @param {string} options.align The alignment value.
28
+ * @param {boolean} options.isLandscape Whether the screen is in landscape mode.
29
+ * @param {number} options.width The width of the screen.
30
+ * @return {Object} An object containing the styles for the wide width alignment.
31
+ */
32
+
33
+ function getWideWidthStyles() {
34
+ let {
35
+ align,
36
+ isLandscape,
37
+ width
38
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39
+
40
+ if (align !== WIDE_ALIGNMENTS.alignments.wide) {
41
+ return {};
42
+ }
43
+
44
+ if (isLandscape && width < ALIGNMENT_BREAKPOINTS.large) {
45
+ return {
46
+ maxWidth: ALIGNMENT_MAX_WIDTH.wideLandscape
47
+ };
48
+ }
49
+
50
+ if (width <= ALIGNMENT_BREAKPOINTS.small) {
51
+ return {
52
+ maxWidth: width
53
+ };
54
+ }
55
+
56
+ if (width >= ALIGNMENT_BREAKPOINTS.medium && width < ALIGNMENT_BREAKPOINTS.wide) {
57
+ return {
58
+ maxWidth: ALIGNMENT_MAX_WIDTH.wideMedium
59
+ };
60
+ }
61
+
62
+ return {
63
+ maxWidth: ALIGNMENT_MAX_WIDTH.wide
64
+ };
65
+ }
66
+ /**
67
+ * Get the styles for the full width alignment.
68
+ *
69
+ * @param {Object} [options] The options for the helper.
70
+ * @param {string} options.align The alignment value.
71
+ * @param {string} options.blockName The name of the block.
72
+ * @param {boolean} options.hasParents Whether the block has parents.
73
+ * @param {string} options.parentBlockName The name of the parent block.
74
+ * @return {Object} An object containing the styles for the full width alignment.
75
+ */
76
+
77
+
78
+ function getFullWidthStyles() {
79
+ let {
80
+ align,
81
+ blockName,
82
+ hasParents,
83
+ parentBlockName
84
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
85
+ const {
86
+ isContainerRelated,
87
+ isFullWidth
88
+ } = alignmentHelpers;
89
+ const fullWidthStyles = isFullWidth(align) ? {
90
+ maxWidth: ALIGNMENT_MAX_WIDTH.full
91
+ } : {};
92
+
93
+ if (!align && hasParents && !isContainerRelated(parentBlockName) && isContainerRelated(blockName)) {
94
+ fullWidthStyles.paddingHorizontal = BLOCK_DEFAULT_MARGIN;
95
+ }
96
+
97
+ return fullWidthStyles;
98
+ }
99
+ /**
100
+ * Get the block margin based on various conditions.
101
+ *
102
+ * @param {Object} [options] The options for the helper.
103
+ * @param {string} options.align The alignment value.
104
+ * @param {string} options.blockName The name of the block.
105
+ * @param {number} options.blockWidth The width of the block.
106
+ * @param {boolean} options.hasParents Whether the block has parents.
107
+ * @param {number} options.marginHorizontal Default horizontal margin.
108
+ * @param {string} options.parentBlockAlignment The alignment of the parent block.
109
+ * @param {string} options.parentBlockName The name of the parent block.
110
+ * @param {number} options.parentWidth The width of the parent block.
111
+ * @param {number} options.width The width of the screen.
112
+ * @return {number} The calculated block margin.
113
+ */
114
+
115
+
116
+ function getBlockMargin() {
117
+ let {
118
+ align,
119
+ blockName,
120
+ blockWidth,
121
+ hasParents,
122
+ marginHorizontal,
123
+ parentBlockAlignment,
124
+ parentBlockName,
125
+ parentWidth,
126
+ width
127
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
128
+ const {
129
+ isContainerRelated,
130
+ isWider,
131
+ isWideWidth,
132
+ isFullWidth
133
+ } = alignmentHelpers;
134
+
135
+ if (isFullWidth(align)) {
136
+ if (!hasParents) {
137
+ return 0;
138
+ }
139
+
140
+ return marginHorizontal;
141
+ }
142
+
143
+ if (isWideWidth(align)) {
144
+ return marginHorizontal;
145
+ }
146
+
147
+ if (isFullWidth(parentBlockAlignment) && !isWider(blockWidth, 'medium')) {
148
+ if (isContainerRelated(blockName) || isWider(width, 'mobile')) {
149
+ return marginHorizontal;
150
+ }
151
+
152
+ return marginHorizontal * 2;
153
+ }
154
+
155
+ if (isContainerRelated(parentBlockName) && !isContainerRelated(blockName)) {
156
+ const isScreenWidthEqual = parentWidth === width;
157
+
158
+ if (isScreenWidthEqual || isWider(width, 'mobile')) {
159
+ return marginHorizontal;
160
+ }
161
+ }
162
+
163
+ return marginHorizontal;
164
+ }
165
+ /**
166
+ * Custom hook to get the styles and margin for the editor wrapper.
167
+ *
168
+ * @param {Object} [props] The props for the hook.
169
+ * @param {string} props.align The alignment value.
170
+ * @param {string} props.blockName The name of the block.
171
+ * @param {number} props.blockWidth The width of the block.
172
+ * @param {string} props.contentResizeMode The content resize mode.
173
+ * @param {boolean} props.hasParents Whether the block has parents.
174
+ * @param {number} props.marginHorizontal Default horizontal margin.
175
+ * @param {string} props.parentBlockAlignment The alignment of the parent block.
176
+ * @param {string} props.parentBlockName The name of the parent block.
177
+ * @param {number} props.parentWidth The width of the parent block.
178
+ * @param {boolean} [props.reversed=false] Whether the flex direction should be reversed.
179
+ * @return {[Array, number]} An array containing the wrapper styles and block margin.
180
+ */
181
+
182
+
183
+ export function useEditorWrapperStyles() {
184
+ let {
185
+ align,
186
+ blockName,
187
+ blockWidth,
188
+ contentResizeMode,
189
+ hasParents,
190
+ marginHorizontal,
191
+ parentBlockAlignment,
192
+ parentBlockName,
193
+ parentWidth,
194
+ reversed = false
195
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
196
+ const {
197
+ width,
198
+ height
199
+ } = useWindowDimensions();
200
+ const isLandscape = width >= height;
201
+ const blockMargin = useMemo(() => getBlockMargin({
202
+ align,
203
+ blockName,
204
+ blockWidth,
205
+ hasParents,
206
+ marginHorizontal,
207
+ parentBlockAlignment,
208
+ parentBlockName,
209
+ parentWidth,
210
+ width
211
+ }), [align, blockName, blockWidth, hasParents, marginHorizontal, parentBlockAlignment, parentBlockName, parentWidth, width]);
212
+ const wrapperStyles = useMemo(() => {
213
+ let canvasStyles;
214
+
215
+ if (contentResizeMode === 'stretch') {
216
+ // For these cases, no width constraints should be added.
217
+ canvasStyles = {
218
+ flex: 1
219
+ };
220
+ } else if (reversed) {
221
+ canvasStyles = styles['use-editor-wrapper-styles--reversed'];
222
+ } else {
223
+ canvasStyles = styles['use-editor-wrapper-styles'];
224
+ }
225
+
226
+ const alignmentStyles = { ...getWideWidthStyles({
227
+ align,
228
+ isLandscape,
229
+ width
230
+ }),
231
+ ...getFullWidthStyles({
232
+ align,
233
+ blockName,
234
+ hasParents,
235
+ parentBlockName
236
+ })
237
+ };
238
+ return [canvasStyles, alignmentStyles];
239
+ }, [align, blockName, hasParents, parentBlockName, isLandscape, width, contentResizeMode, reversed]);
240
+ return [wrapperStyles, blockMargin];
241
+ }
242
+ //# sourceMappingURL=use-editor-wrapper-styles.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-editor-wrapper-styles.native.js"],"names":["useWindowDimensions","useMemo","ALIGNMENT_BREAKPOINTS","WIDE_ALIGNMENTS","alignmentHelpers","styles","ALIGNMENT_MAX_WIDTH","full","wide","wideMedium","wideLandscape","BLOCK_DEFAULT_MARGIN","getWideWidthStyles","align","isLandscape","width","alignments","large","maxWidth","small","medium","getFullWidthStyles","blockName","hasParents","parentBlockName","isContainerRelated","isFullWidth","fullWidthStyles","paddingHorizontal","getBlockMargin","blockWidth","marginHorizontal","parentBlockAlignment","parentWidth","isWider","isWideWidth","isScreenWidthEqual","useEditorWrapperStyles","contentResizeMode","reversed","height","blockMargin","wrapperStyles","canvasStyles","flex","alignmentStyles"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,qBADD,EAECC,eAFD,EAGCC,gBAHD,QAIO,uBAJP;AAMA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,kCAAnB;AAEA,MAAMC,mBAAmB,GAAG;AAC3BC,EAAAA,IAAI,EAAE,MADqB;AAE3BC,EAAAA,IAAI,EAAE,IAFqB;AAG3BC,EAAAA,UAAU,EAAE,GAHe;AAI3BC,EAAAA,aAAa,EAAE;AAJY,CAA5B;AAOA,MAAMC,oBAAoB,GAAG,EAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,GAAkE;AAAA,MAArC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA;AAAtB,GAAqC,uEAAL,EAAK;;AACjE,MAAKF,KAAK,KAAKV,eAAe,CAACa,UAAhB,CAA2BR,IAA1C,EAAiD;AAChD,WAAO,EAAP;AACA;;AAED,MAAKM,WAAW,IAAIC,KAAK,GAAGb,qBAAqB,CAACe,KAAlD,EAA0D;AACzD,WAAO;AAAEC,MAAAA,QAAQ,EAAEZ,mBAAmB,CAACI;AAAhC,KAAP;AACA;;AAED,MAAKK,KAAK,IAAIb,qBAAqB,CAACiB,KAApC,EAA4C;AAC3C,WAAO;AAAED,MAAAA,QAAQ,EAAEH;AAAZ,KAAP;AACA;;AAED,MACCA,KAAK,IAAIb,qBAAqB,CAACkB,MAA/B,IACAL,KAAK,GAAGb,qBAAqB,CAACM,IAF/B,EAGE;AACD,WAAO;AAAEU,MAAAA,QAAQ,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 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tALIGNMENT_BREAKPOINTS,\n\tWIDE_ALIGNMENTS,\n\talignmentHelpers,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './use-editor-wrapper-styles.scss';\n\nconst ALIGNMENT_MAX_WIDTH = {\n\tfull: '100%',\n\twide: 1054,\n\twideMedium: 770,\n\twideLandscape: 662,\n};\n\nconst BLOCK_DEFAULT_MARGIN = 16;\n\n/**\n * Get the styles for the wide width alignment.\n *\n * @param {Object} [options] The options for the helper.\n * @param {string} options.align The alignment value.\n * @param {boolean} options.isLandscape Whether the screen is in landscape mode.\n * @param {number} options.width The width of the screen.\n * @return {Object} An object containing the styles for the wide width alignment.\n */\nfunction getWideWidthStyles( { align, isLandscape, width } = {} ) {\n\tif ( align !== WIDE_ALIGNMENTS.alignments.wide ) {\n\t\treturn {};\n\t}\n\n\tif ( isLandscape && width < ALIGNMENT_BREAKPOINTS.large ) {\n\t\treturn { maxWidth: ALIGNMENT_MAX_WIDTH.wideLandscape };\n\t}\n\n\tif ( width <= ALIGNMENT_BREAKPOINTS.small ) {\n\t\treturn { maxWidth: width };\n\t}\n\n\tif (\n\t\twidth >= ALIGNMENT_BREAKPOINTS.medium &&\n\t\twidth < ALIGNMENT_BREAKPOINTS.wide\n\t) {\n\t\treturn { maxWidth: ALIGNMENT_MAX_WIDTH.wideMedium };\n\t}\n\n\treturn { maxWidth: ALIGNMENT_MAX_WIDTH.wide };\n}\n\n/**\n * Get the styles for the full width alignment.\n *\n * @param {Object} [options] The options for the helper.\n * @param {string} options.align The alignment value.\n * @param {string} options.blockName The name of the block.\n * @param {boolean} options.hasParents Whether the block has parents.\n * @param {string} options.parentBlockName The name of the parent block.\n * @return {Object} An object containing the styles for the full width alignment.\n */\nfunction getFullWidthStyles( {\n\talign,\n\tblockName,\n\thasParents,\n\tparentBlockName,\n} = {} ) {\n\tconst { isContainerRelated, isFullWidth } = alignmentHelpers;\n\tconst fullWidthStyles = isFullWidth( align )\n\t\t? { maxWidth: ALIGNMENT_MAX_WIDTH.full }\n\t\t: {};\n\n\tif (\n\t\t! align &&\n\t\thasParents &&\n\t\t! isContainerRelated( parentBlockName ) &&\n\t\tisContainerRelated( blockName )\n\t) {\n\t\tfullWidthStyles.paddingHorizontal = BLOCK_DEFAULT_MARGIN;\n\t}\n\n\treturn fullWidthStyles;\n}\n\n/**\n * Get the block margin based on various conditions.\n *\n * @param {Object} [options] The options for the helper.\n * @param {string} options.align The alignment value.\n * @param {string} options.blockName The name of the block.\n * @param {number} options.blockWidth The width of the block.\n * @param {boolean} options.hasParents Whether the block has parents.\n * @param {number} options.marginHorizontal Default horizontal margin.\n * @param {string} options.parentBlockAlignment The alignment of the parent block.\n * @param {string} options.parentBlockName The name of the parent block.\n * @param {number} options.parentWidth The width of the parent block.\n * @param {number} options.width The width of the screen.\n * @return {number} The calculated block margin.\n */\nfunction getBlockMargin( {\n\talign,\n\tblockName,\n\tblockWidth,\n\thasParents,\n\tmarginHorizontal,\n\tparentBlockAlignment,\n\tparentBlockName,\n\tparentWidth,\n\twidth,\n} = {} ) {\n\tconst { isContainerRelated, isWider, isWideWidth, isFullWidth } =\n\t\talignmentHelpers;\n\n\tif ( isFullWidth( align ) ) {\n\t\tif ( ! hasParents ) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn marginHorizontal;\n\t}\n\n\tif ( isWideWidth( align ) ) {\n\t\treturn marginHorizontal;\n\t}\n\n\tif (\n\t\tisFullWidth( parentBlockAlignment ) &&\n\t\t! isWider( blockWidth, 'medium' )\n\t) {\n\t\tif ( isContainerRelated( blockName ) || isWider( width, 'mobile' ) ) {\n\t\t\treturn marginHorizontal;\n\t\t}\n\t\treturn marginHorizontal * 2;\n\t}\n\n\tif (\n\t\tisContainerRelated( parentBlockName ) &&\n\t\t! isContainerRelated( blockName )\n\t) {\n\t\tconst isScreenWidthEqual = parentWidth === width;\n\t\tif ( isScreenWidthEqual || isWider( width, 'mobile' ) ) {\n\t\t\treturn marginHorizontal;\n\t\t}\n\t}\n\n\treturn marginHorizontal;\n}\n\n/**\n * Custom hook to get the styles and margin for the editor wrapper.\n *\n * @param {Object} [props] The props for the hook.\n * @param {string} props.align The alignment value.\n * @param {string} props.blockName The name of the block.\n * @param {number} props.blockWidth The width of the block.\n * @param {string} props.contentResizeMode The content resize mode.\n * @param {boolean} props.hasParents Whether the block has parents.\n * @param {number} props.marginHorizontal Default horizontal margin.\n * @param {string} props.parentBlockAlignment The alignment of the parent block.\n * @param {string} props.parentBlockName The name of the parent block.\n * @param {number} props.parentWidth The width of the parent block.\n * @param {boolean} [props.reversed=false] Whether the flex direction should be reversed.\n * @return {[Array, number]} An array containing the wrapper styles and block margin.\n */\nexport function useEditorWrapperStyles( {\n\talign,\n\tblockName,\n\tblockWidth,\n\tcontentResizeMode,\n\thasParents,\n\tmarginHorizontal,\n\tparentBlockAlignment,\n\tparentBlockName,\n\tparentWidth,\n\treversed = false,\n} = {} ) {\n\tconst { width, height } = useWindowDimensions();\n\tconst isLandscape = width >= height;\n\n\tconst blockMargin = useMemo(\n\t\t() =>\n\t\t\tgetBlockMargin( {\n\t\t\t\talign,\n\t\t\t\tblockName,\n\t\t\t\tblockWidth,\n\t\t\t\thasParents,\n\t\t\t\tmarginHorizontal,\n\t\t\t\tparentBlockAlignment,\n\t\t\t\tparentBlockName,\n\t\t\t\tparentWidth,\n\t\t\t\twidth,\n\t\t\t} ),\n\t\t[\n\t\t\talign,\n\t\t\tblockName,\n\t\t\tblockWidth,\n\t\t\thasParents,\n\t\t\tmarginHorizontal,\n\t\t\tparentBlockAlignment,\n\t\t\tparentBlockName,\n\t\t\tparentWidth,\n\t\t\twidth,\n\t\t]\n\t);\n\n\tconst wrapperStyles = useMemo( () => {\n\t\tlet canvasStyles;\n\n\t\tif ( contentResizeMode === 'stretch' ) {\n\t\t\t// For these cases, no width constraints should be added.\n\t\t\tcanvasStyles = { flex: 1 };\n\t\t} else if ( reversed ) {\n\t\t\tcanvasStyles = styles[ 'use-editor-wrapper-styles--reversed' ];\n\t\t} else {\n\t\t\tcanvasStyles = styles[ 'use-editor-wrapper-styles' ];\n\t\t}\n\n\t\tconst alignmentStyles = {\n\t\t\t...getWideWidthStyles( { align, isLandscape, width } ),\n\t\t\t...getFullWidthStyles( {\n\t\t\t\talign,\n\t\t\t\tblockName,\n\t\t\t\thasParents,\n\t\t\t\tparentBlockName,\n\t\t\t} ),\n\t\t};\n\n\t\treturn [ canvasStyles, alignmentStyles ];\n\t}, [\n\t\talign,\n\t\tblockName,\n\t\thasParents,\n\t\tparentBlockName,\n\t\tisLandscape,\n\t\twidth,\n\t\tcontentResizeMode,\n\t\treversed,\n\t] );\n\n\treturn [ wrapperStyles, blockMargin ];\n}\n"]}
@@ -9,32 +9,36 @@ import classnames from 'classnames';
9
9
 
10
10
  import { getInlineStyles } from './style';
11
11
  import { getFontSizeClass } from '../components/font-sizes';
12
- import { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils'; // This utility is intended to assist where the serialization of the typography
13
- // block support is being skipped for a block but the typography related CSS
14
- // styles still need to be generated so they can be applied to inner elements.
12
+ import { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';
13
+ /*
14
+ * This utility is intended to assist where the serialization of the typography
15
+ * block support is being skipped for a block but the typography related CSS
16
+ * styles still need to be generated so they can be applied to inner elements.
17
+ */
15
18
 
16
19
  /**
17
20
  * Provides the CSS class names and inline styles for a block's typography support
18
21
  * attributes.
19
22
  *
20
- * @param {Object} attributes Block attributes.
21
- * @param {Object|boolean} fluidTypographySettings If boolean, whether the function should try to convert font sizes to fluid values,
22
- * otherwise an object containing theme fluid typography settings.
23
+ * @param {Object} attributes Block attributes.
24
+ * @param {Object|boolean} settings Merged theme.json settings
23
25
  *
24
26
  * @return {Object} Typography block support derived CSS classes & styles.
25
27
  */
26
28
 
27
- export function getTypographyClassesAndStyles(attributes, fluidTypographySettings) {
28
- var _attributes$style;
29
+ export function getTypographyClassesAndStyles(attributes, settings) {
30
+ var _attributes$style, _settings$typography;
29
31
 
30
32
  let typographyStyles = (attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography) || {};
33
+ const fluidTypographySettings = settings === null || settings === void 0 ? void 0 : (_settings$typography = settings.typography) === null || _settings$typography === void 0 ? void 0 : _settings$typography.fluid;
31
34
 
32
35
  if (!!fluidTypographySettings && (true === fluidTypographySettings || Object.keys(fluidTypographySettings).length !== 0)) {
33
- var _attributes$style2, _attributes$style2$ty, _attributes$style3, _attributes$style3$ty;
36
+ var _attributes$style2, _attributes$style2$ty, _settings$layout, _attributes$style3, _attributes$style3$ty;
34
37
 
35
38
  const newFontSize = getComputedFluidTypographyValue({
36
39
  fontSize: attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize,
37
- minimumFontSizeLimit: fluidTypographySettings === null || fluidTypographySettings === void 0 ? void 0 : fluidTypographySettings.minFontSize
40
+ minimumFontSizeLimit: fluidTypographySettings === null || fluidTypographySettings === void 0 ? void 0 : fluidTypographySettings.minFontSize,
41
+ maximumViewPortWidth: settings === null || settings === void 0 ? void 0 : (_settings$layout = settings.layout) === null || _settings$layout === void 0 ? void 0 : _settings$layout.wideSize
38
42
  }) || (attributes === null || attributes === void 0 ? void 0 : (_attributes$style3 = attributes.style) === null || _attributes$style3 === void 0 ? void 0 : (_attributes$style3$ty = _attributes$style3.typography) === null || _attributes$style3$ty === void 0 ? void 0 : _attributes$style3$ty.fontSize);
39
43
  typographyStyles = { ...typographyStyles,
40
44
  fontSize: newFontSize
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["kebabCase","classnames","getInlineStyles","getFontSizeClass","getComputedFluidTypographyValue","getTypographyClassesAndStyles","attributes","fluidTypographySettings","typographyStyles","style","typography","Object","keys","length","newFontSize","fontSize","minimumFontSizeLimit","minFontSize","fontFamilyClassName","fontFamily","className"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AACA,SAASC,gBAAT,QAAiC,0BAAjC;AACA,SAASC,+BAAT,QAAgD,sCAAhD,C,CAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,6BAAT,CACNC,UADM,EAENC,uBAFM,EAGL;AAAA;;AACD,MAAIC,gBAAgB,GAAG,CAAAF,UAAU,SAAV,IAAAA,UAAU,WAAV,iCAAAA,UAAU,CAAEG,KAAZ,wEAAmBC,UAAnB,KAAiC,EAAxD;;AAEA,MACC,CAAC,CAAEH,uBAAH,KACE,SAASA,uBAAT,IACDI,MAAM,CAACC,IAAP,CAAaL,uBAAb,EAAuCM,MAAvC,KAAkD,CAFnD,CADD,EAIE;AAAA;;AACD,UAAMC,WAAW,GAChBV,+BAA+B,CAAE;AAChCW,MAAAA,QAAQ,EAAET,UAAF,aAAEA,UAAF,6CAAEA,UAAU,CAAEG,KAAd,gFAAE,mBAAmBC,UAArB,0DAAE,sBAA+BK,QADT;AAEhCC,MAAAA,oBAAoB,EAAET,uBAAF,aAAEA,uBAAF,uBAAEA,uBAAuB,CAAEU;AAFf,KAAF,CAA/B,KAGOX,UAHP,aAGOA,UAHP,6CAGOA,UAAU,CAAEG,KAHnB,gFAGO,mBAAmBC,UAH1B,0DAGO,sBAA+BK,QAHtC,CADD;AAKAP,IAAAA,gBAAgB,GAAG,EAClB,GAAGA,gBADe;AAElBO,MAAAA,QAAQ,EAAED;AAFQ,KAAnB;AAIA;;AAED,QAAML,KAAK,GAAGP,eAAe,CAAE;AAAEQ,IAAAA,UAAU,EAAEF;AAAd,GAAF,CAA7B;AACA,QAAMU,mBAAmB,GAAG,CAAC,EAAEZ,UAAF,aAAEA,UAAF,eAAEA,UAAU,CAAEa,UAAd,CAAD,GACxB,OAAOnB,SAAS,CAAEM,UAAU,CAACa,UAAb,CAA2B,cADnB,GAEzB,EAFH;AAIA,QAAMC,SAAS,GAAGnB,UAAU,CAC3BiB,mBAD2B,EAE3Bf,gBAAgB,CAAEG,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAES,QAAd,CAFW,CAA5B;AAKA,SAAO;AACNK,IAAAA,SADM;AAENX,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\nimport { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';\n\n// This utility is intended to assist where the serialization of the typography\n// block support is being skipped for a block but the typography related CSS\n// styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {Object|boolean} fluidTypographySettings If boolean, whether the function should try to convert font sizes to fluid values,\n * otherwise an object containing theme fluid typography settings.\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles(\n\tattributes,\n\tfluidTypographySettings\n) {\n\tlet typographyStyles = attributes?.style?.typography || {};\n\n\tif (\n\t\t!! fluidTypographySettings &&\n\t\t( true === fluidTypographySettings ||\n\t\t\tObject.keys( fluidTypographySettings ).length !== 0 )\n\t) {\n\t\tconst newFontSize =\n\t\t\tgetComputedFluidTypographyValue( {\n\t\t\t\tfontSize: attributes?.style?.typography?.fontSize,\n\t\t\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\t\t} ) || attributes?.style?.typography?.fontSize;\n\t\ttypographyStyles = {\n\t\t\t...typographyStyles,\n\t\t\tfontSize: newFontSize,\n\t\t};\n\t}\n\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\n\tconst className = classnames(\n\t\tfontFamilyClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["kebabCase","classnames","getInlineStyles","getFontSizeClass","getComputedFluidTypographyValue","getTypographyClassesAndStyles","attributes","settings","typographyStyles","style","typography","fluidTypographySettings","fluid","Object","keys","length","newFontSize","fontSize","minimumFontSizeLimit","minFontSize","maximumViewPortWidth","layout","wideSize","fontFamilyClassName","fontFamily","className"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AACA,SAASC,gBAAT,QAAiC,0BAAjC;AACA,SAASC,+BAAT,QAAgD,sCAAhD;AAEA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,6BAAT,CAAwCC,UAAxC,EAAoDC,QAApD,EAA+D;AAAA;;AACrE,MAAIC,gBAAgB,GAAG,CAAAF,UAAU,SAAV,IAAAA,UAAU,WAAV,iCAAAA,UAAU,CAAEG,KAAZ,wEAAmBC,UAAnB,KAAiC,EAAxD;AACA,QAAMC,uBAAuB,GAAGJ,QAAH,aAAGA,QAAH,+CAAGA,QAAQ,CAAEG,UAAb,yDAAG,qBAAsBE,KAAtD;;AAEA,MACC,CAAC,CAAED,uBAAH,KACE,SAASA,uBAAT,IACDE,MAAM,CAACC,IAAP,CAAaH,uBAAb,EAAuCI,MAAvC,KAAkD,CAFnD,CADD,EAIE;AAAA;;AACD,UAAMC,WAAW,GAChBZ,+BAA+B,CAAE;AAChCa,MAAAA,QAAQ,EAAEX,UAAF,aAAEA,UAAF,6CAAEA,UAAU,CAAEG,KAAd,gFAAE,mBAAmBC,UAArB,0DAAE,sBAA+BO,QADT;AAEhCC,MAAAA,oBAAoB,EAAEP,uBAAF,aAAEA,uBAAF,uBAAEA,uBAAuB,CAAEQ,WAFf;AAGhCC,MAAAA,oBAAoB,EAAEb,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAEc,MAAZ,qDAAE,iBAAkBC;AAHR,KAAF,CAA/B,KAIOhB,UAJP,aAIOA,UAJP,6CAIOA,UAAU,CAAEG,KAJnB,gFAIO,mBAAmBC,UAJ1B,0DAIO,sBAA+BO,QAJtC,CADD;AAMAT,IAAAA,gBAAgB,GAAG,EAClB,GAAGA,gBADe;AAElBS,MAAAA,QAAQ,EAAED;AAFQ,KAAnB;AAIA;;AAED,QAAMP,KAAK,GAAGP,eAAe,CAAE;AAAEQ,IAAAA,UAAU,EAAEF;AAAd,GAAF,CAA7B;AACA,QAAMe,mBAAmB,GAAG,CAAC,EAAEjB,UAAF,aAAEA,UAAF,eAAEA,UAAU,CAAEkB,UAAd,CAAD,GACxB,OAAOxB,SAAS,CAAEM,UAAU,CAACkB,UAAb,CAA2B,cADnB,GAEzB,EAFH;AAIA,QAAMC,SAAS,GAAGxB,UAAU,CAC3BsB,mBAD2B,EAE3BpB,gBAAgB,CAAEG,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEW,QAAd,CAFW,CAA5B;AAKA,SAAO;AACNQ,IAAAA,SADM;AAENhB,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\nimport { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';\n\n/*\n * This utility is intended to assist where the serialization of the typography\n * block support is being skipped for a block but the typography related CSS\n * styles still need to be generated so they can be applied to inner elements.\n */\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {Object|boolean} settings Merged theme.json settings\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles( attributes, settings ) {\n\tlet typographyStyles = attributes?.style?.typography || {};\n\tconst fluidTypographySettings = settings?.typography?.fluid;\n\n\tif (\n\t\t!! fluidTypographySettings &&\n\t\t( true === fluidTypographySettings ||\n\t\t\tObject.keys( fluidTypographySettings ).length !== 0 )\n\t) {\n\t\tconst newFontSize =\n\t\t\tgetComputedFluidTypographyValue( {\n\t\t\t\tfontSize: attributes?.style?.typography?.fontSize,\n\t\t\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\t\t\tmaximumViewPortWidth: settings?.layout?.wideSize,\n\t\t\t} ) || attributes?.style?.typography?.fontSize;\n\t\ttypographyStyles = {\n\t\t\t...typographyStyles,\n\t\t\tfontSize: newFontSize,\n\t\t};\n\t}\n\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\n\tconst className = classnames(\n\t\tfontFamilyClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ export * from './index.js';
5
+ export { useEditorWrapperStyles } from './hooks';
6
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/index.native.js"],"names":["useEditorWrapperStyles"],"mappings":"AAAA;AACA;AACA;AACA,cAAc,YAAd;AAEA,SAASA,sBAAT,QAAuC,SAAvC","sourcesContent":["/**\n * Internal dependencies\n */\nexport * from './index.js';\n\nexport { useEditorWrapperStyles } from './hooks';\n"]}