@wordpress/block-editor 14.0.0 → 14.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 (290) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +9 -14
  3. package/build/autocompleters/block.js +1 -1
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-list/use-block-props/index.js +2 -2
  6. package/build/components/block-list/use-block-props/index.js.map +1 -1
  7. package/build/components/block-list/use-in-between-inserter.js +11 -4
  8. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  9. package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
  10. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  11. package/build/components/block-tools/insertion-point.js +14 -3
  12. package/build/components/block-tools/insertion-point.js.map +1 -1
  13. package/build/components/block-tools/use-show-block-tools.js +2 -1
  14. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  15. package/build/components/block-tools/zoom-out-mode-inserters.js +8 -4
  16. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  17. package/build/components/border-radius-control/index.js +1 -0
  18. package/build/components/border-radius-control/index.js.map +1 -1
  19. package/build/components/convert-to-group-buttons/index.js +1 -1
  20. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  21. package/build/components/date-format-picker/index.js +2 -0
  22. package/build/components/date-format-picker/index.js.map +1 -1
  23. package/build/components/font-appearance-control/index.js +3 -0
  24. package/build/components/font-appearance-control/index.js.map +1 -1
  25. package/build/components/font-family/index.js +3 -0
  26. package/build/components/font-family/index.js.map +1 -1
  27. package/build/components/global-styles/background-panel.js +114 -42
  28. package/build/components/global-styles/background-panel.js.map +1 -1
  29. package/build/components/global-styles/get-global-styles-changes.js +3 -1
  30. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  31. package/build/components/global-styles/hooks.js +0 -7
  32. package/build/components/global-styles/hooks.js.map +1 -1
  33. package/build/components/global-styles/index.js +0 -6
  34. package/build/components/global-styles/index.js.map +1 -1
  35. package/build/components/global-styles/use-global-styles-output.js +3 -3
  36. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  37. package/build/components/global-styles/utils.js +8 -24
  38. package/build/components/global-styles/utils.js.map +1 -1
  39. package/build/components/grid/grid-visualizer.js +20 -5
  40. package/build/components/grid/grid-visualizer.js.map +1 -1
  41. package/build/components/height-control/index.js +1 -0
  42. package/build/components/height-control/index.js.map +1 -1
  43. package/build/components/iframe/index.js +4 -2
  44. package/build/components/iframe/index.js.map +1 -1
  45. package/build/components/image-editor/zoom-dropdown.js +11 -7
  46. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  47. package/build/components/inner-blocks/button-block-appender.js +8 -8
  48. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  49. package/build/components/inner-blocks/default-block-appender.js +7 -25
  50. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  51. package/build/components/inner-blocks/index.js +9 -11
  52. package/build/components/inner-blocks/index.js.map +1 -1
  53. package/build/components/inserter/library.js +4 -2
  54. package/build/components/inserter/library.js.map +1 -1
  55. package/build/components/inserter/menu.js +30 -12
  56. package/build/components/inserter/menu.js.map +1 -1
  57. package/build/components/inserter/quick-inserter.js +4 -0
  58. package/build/components/inserter/quick-inserter.js.map +1 -1
  59. package/build/components/line-height-control/index.js +3 -0
  60. package/build/components/line-height-control/index.js.map +1 -1
  61. package/build/components/media-placeholder/index.js +9 -4
  62. package/build/components/media-placeholder/index.js.map +1 -1
  63. package/build/components/media-upload/index.native.js +4 -1
  64. package/build/components/media-upload/index.native.js.map +1 -1
  65. package/build/components/multi-selection-inspector/index.js +12 -12
  66. package/build/components/multi-selection-inspector/index.js.map +1 -1
  67. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  68. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  69. package/build/components/text-alignment-control/index.js +13 -8
  70. package/build/components/text-alignment-control/index.js.map +1 -1
  71. package/build/components/text-decoration-control/index.js +13 -8
  72. package/build/components/text-decoration-control/index.js.map +1 -1
  73. package/build/components/text-transform-control/index.js +13 -8
  74. package/build/components/text-transform-control/index.js.map +1 -1
  75. package/build/components/url-popover/image-url-input-ui.js +2 -0
  76. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  77. package/build/components/use-block-drop-zone/index.js +14 -2
  78. package/build/components/use-block-drop-zone/index.js.map +1 -1
  79. package/build/components/writing-mode-control/index.js +13 -8
  80. package/build/components/writing-mode-control/index.js.map +1 -1
  81. package/build/hooks/background.js +19 -23
  82. package/build/hooks/background.js.map +1 -1
  83. package/build/hooks/block-bindings.js +37 -79
  84. package/build/hooks/block-bindings.js.map +1 -1
  85. package/build/layouts/constrained.js +1 -0
  86. package/build/layouts/constrained.js.map +1 -1
  87. package/build/layouts/flex.js +2 -0
  88. package/build/layouts/flex.js.map +1 -1
  89. package/build/layouts/grid.js +3 -0
  90. package/build/layouts/grid.js.map +1 -1
  91. package/build/private-apis.js +3 -1
  92. package/build/private-apis.js.map +1 -1
  93. package/build/store/private-selectors.js +30 -0
  94. package/build/store/private-selectors.js.map +1 -1
  95. package/build/store/reducer.js +10 -1
  96. package/build/store/reducer.js.map +1 -1
  97. package/build/utils/block-bindings.js +112 -0
  98. package/build/utils/block-bindings.js.map +1 -0
  99. package/build-module/autocompleters/block.js +1 -1
  100. package/build-module/autocompleters/block.js.map +1 -1
  101. package/build-module/components/block-list/use-block-props/index.js +2 -2
  102. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  103. package/build-module/components/block-list/use-in-between-inserter.js +11 -4
  104. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  105. package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
  106. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  107. package/build-module/components/block-tools/insertion-point.js +14 -3
  108. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  109. package/build-module/components/block-tools/use-show-block-tools.js +2 -1
  110. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  111. package/build-module/components/block-tools/zoom-out-mode-inserters.js +8 -4
  112. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  113. package/build-module/components/border-radius-control/index.js +1 -0
  114. package/build-module/components/border-radius-control/index.js.map +1 -1
  115. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  116. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  117. package/build-module/components/date-format-picker/index.js +2 -0
  118. package/build-module/components/date-format-picker/index.js.map +1 -1
  119. package/build-module/components/font-appearance-control/index.js +3 -0
  120. package/build-module/components/font-appearance-control/index.js.map +1 -1
  121. package/build-module/components/font-family/index.js +3 -0
  122. package/build-module/components/font-family/index.js.map +1 -1
  123. package/build-module/components/global-styles/background-panel.js +117 -45
  124. package/build-module/components/global-styles/background-panel.js.map +1 -1
  125. package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
  126. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  127. package/build-module/components/global-styles/hooks.js +0 -6
  128. package/build-module/components/global-styles/hooks.js.map +1 -1
  129. package/build-module/components/global-styles/index.js +1 -1
  130. package/build-module/components/global-styles/index.js.map +1 -1
  131. package/build-module/components/global-styles/use-global-styles-output.js +5 -5
  132. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  133. package/build-module/components/global-styles/utils.js +8 -23
  134. package/build-module/components/global-styles/utils.js.map +1 -1
  135. package/build-module/components/grid/grid-visualizer.js +20 -5
  136. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  137. package/build-module/components/height-control/index.js +1 -0
  138. package/build-module/components/height-control/index.js.map +1 -1
  139. package/build-module/components/iframe/index.js +4 -2
  140. package/build-module/components/iframe/index.js.map +1 -1
  141. package/build-module/components/image-editor/zoom-dropdown.js +12 -8
  142. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  143. package/build-module/components/inner-blocks/button-block-appender.js +7 -6
  144. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  145. package/build-module/components/inner-blocks/default-block-appender.js +6 -23
  146. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  147. package/build-module/components/inner-blocks/index.js +9 -11
  148. package/build-module/components/inner-blocks/index.js.map +1 -1
  149. package/build-module/components/inserter/library.js +4 -2
  150. package/build-module/components/inserter/library.js.map +1 -1
  151. package/build-module/components/inserter/menu.js +30 -12
  152. package/build-module/components/inserter/menu.js.map +1 -1
  153. package/build-module/components/inserter/quick-inserter.js +5 -1
  154. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  155. package/build-module/components/line-height-control/index.js +3 -0
  156. package/build-module/components/line-height-control/index.js.map +1 -1
  157. package/build-module/components/media-placeholder/index.js +9 -4
  158. package/build-module/components/media-placeholder/index.js.map +1 -1
  159. package/build-module/components/media-upload/index.native.js +4 -1
  160. package/build-module/components/media-upload/index.native.js.map +1 -1
  161. package/build-module/components/multi-selection-inspector/index.js +12 -12
  162. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  163. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  164. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  165. package/build-module/components/text-alignment-control/index.js +13 -8
  166. package/build-module/components/text-alignment-control/index.js.map +1 -1
  167. package/build-module/components/text-decoration-control/index.js +13 -8
  168. package/build-module/components/text-decoration-control/index.js.map +1 -1
  169. package/build-module/components/text-transform-control/index.js +13 -8
  170. package/build-module/components/text-transform-control/index.js.map +1 -1
  171. package/build-module/components/url-popover/image-url-input-ui.js +2 -0
  172. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  173. package/build-module/components/use-block-drop-zone/index.js +14 -2
  174. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  175. package/build-module/components/writing-mode-control/index.js +13 -8
  176. package/build-module/components/writing-mode-control/index.js.map +1 -1
  177. package/build-module/hooks/background.js +19 -23
  178. package/build-module/hooks/background.js.map +1 -1
  179. package/build-module/hooks/block-bindings.js +38 -80
  180. package/build-module/hooks/block-bindings.js.map +1 -1
  181. package/build-module/layouts/constrained.js +1 -0
  182. package/build-module/layouts/constrained.js.map +1 -1
  183. package/build-module/layouts/flex.js +2 -0
  184. package/build-module/layouts/flex.js.map +1 -1
  185. package/build-module/layouts/grid.js +3 -0
  186. package/build-module/layouts/grid.js.map +1 -1
  187. package/build-module/private-apis.js +3 -1
  188. package/build-module/private-apis.js.map +1 -1
  189. package/build-module/store/private-selectors.js +27 -0
  190. package/build-module/store/private-selectors.js.map +1 -1
  191. package/build-module/store/reducer.js +9 -1
  192. package/build-module/store/reducer.js.map +1 -1
  193. package/build-module/utils/block-bindings.js +105 -0
  194. package/build-module/utils/block-bindings.js.map +1 -0
  195. package/build-style/content-rtl.css +7 -14
  196. package/build-style/content.css +7 -14
  197. package/build-style/default-editor-styles-rtl.css +2 -2
  198. package/build-style/default-editor-styles.css +2 -2
  199. package/build-style/style-rtl.css +36 -38
  200. package/build-style/style.css +36 -38
  201. package/package.json +32 -32
  202. package/src/autocompleters/block.js +2 -1
  203. package/src/components/block-list/content.scss +5 -13
  204. package/src/components/block-list/use-block-props/index.js +2 -2
  205. package/src/components/block-list/use-in-between-inserter.js +17 -5
  206. package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
  207. package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
  208. package/src/components/block-tools/insertion-point.js +11 -0
  209. package/src/components/block-tools/style.scss +1 -1
  210. package/src/components/block-tools/use-show-block-tools.js +4 -1
  211. package/src/components/block-tools/zoom-out-mode-inserters.js +7 -1
  212. package/src/components/block-variation-transforms/style.scss +1 -1
  213. package/src/components/border-radius-control/index.js +1 -0
  214. package/src/components/border-radius-control/style.scss +0 -10
  215. package/src/components/convert-to-group-buttons/index.js +1 -1
  216. package/src/components/date-format-picker/index.js +2 -0
  217. package/src/components/font-appearance-control/index.js +3 -0
  218. package/src/components/font-family/README.md +11 -2
  219. package/src/components/font-family/index.js +3 -0
  220. package/src/components/global-styles/background-panel.js +132 -53
  221. package/src/components/global-styles/get-global-styles-changes.js +4 -1
  222. package/src/components/global-styles/hooks.js +0 -5
  223. package/src/components/global-styles/index.js +0 -1
  224. package/src/components/global-styles/style.scss +13 -2
  225. package/src/components/global-styles/test/use-global-styles-output.js +20 -4
  226. package/src/components/global-styles/use-global-styles-output.js +5 -6
  227. package/src/components/global-styles/utils.js +7 -29
  228. package/src/components/grid/grid-visualizer.js +22 -7
  229. package/src/components/height-control/index.js +1 -0
  230. package/src/components/iframe/index.js +4 -2
  231. package/src/components/image-editor/zoom-dropdown.js +17 -9
  232. package/src/components/inner-blocks/button-block-appender.js +5 -7
  233. package/src/components/inner-blocks/default-block-appender.js +4 -23
  234. package/src/components/inner-blocks/index.js +10 -9
  235. package/src/components/inserter/library.js +2 -0
  236. package/src/components/inserter/menu.js +32 -27
  237. package/src/components/inserter/quick-inserter.js +4 -1
  238. package/src/components/inserter/style.scss +1 -1
  239. package/src/components/inserter-list-item/style.scss +1 -0
  240. package/src/components/line-height-control/README.md +7 -0
  241. package/src/components/line-height-control/index.js +3 -0
  242. package/src/components/link-control/style.scss +1 -1
  243. package/src/components/media-placeholder/index.js +12 -7
  244. package/src/components/media-upload/README.md +2 -0
  245. package/src/components/media-upload/index.native.js +2 -0
  246. package/src/components/multi-selection-inspector/index.js +8 -9
  247. package/src/components/responsive-block-control/README.md +1 -0
  248. package/src/components/responsive-block-control/test/index.js +1 -0
  249. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -4
  250. package/src/components/spacing-sizes-control/style.scss +16 -16
  251. package/src/components/text-alignment-control/index.js +20 -8
  252. package/src/components/text-decoration-control/index.js +20 -8
  253. package/src/components/text-decoration-control/stories/index.story.js +0 -4
  254. package/src/components/text-transform-control/index.js +20 -8
  255. package/src/components/text-transform-control/stories/index.story.js +0 -4
  256. package/src/components/url-input/style.scss +2 -2
  257. package/src/components/url-popover/image-url-input-ui.js +2 -0
  258. package/src/components/use-block-drop-zone/index.js +21 -3
  259. package/src/components/writing-mode-control/index.js +20 -8
  260. package/src/hooks/background.js +21 -27
  261. package/src/hooks/block-bindings.js +27 -84
  262. package/src/hooks/block-bindings.scss +1 -1
  263. package/src/hooks/test/background.js +60 -0
  264. package/src/layouts/constrained.js +1 -0
  265. package/src/layouts/flex.js +2 -0
  266. package/src/layouts/grid.js +3 -0
  267. package/src/private-apis.js +2 -0
  268. package/src/store/private-selectors.js +36 -0
  269. package/src/store/reducer.js +7 -0
  270. package/src/store/test/private-selectors.js +89 -0
  271. package/src/style.scss +0 -1
  272. package/src/utils/block-bindings.js +98 -0
  273. package/src/utils/test/transform-styles.js +49 -0
  274. package/build/components/global-styles/theme-file-uri-utils.js +0 -21
  275. package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
  276. package/build/components/inner-blocks/with-client-id.js +0 -28
  277. package/build/components/inner-blocks/with-client-id.js.map +0 -1
  278. package/build/components/segmented-text-control/index.js +0 -63
  279. package/build/components/segmented-text-control/index.js.map +0 -1
  280. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -15
  281. package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
  282. package/build-module/components/inner-blocks/with-client-id.js +0 -21
  283. package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
  284. package/build-module/components/segmented-text-control/index.js +0 -58
  285. package/build-module/components/segmented-text-control/index.js.map +0 -1
  286. package/src/components/global-styles/test/theme-file-uri-utils.js +0 -41
  287. package/src/components/global-styles/theme-file-uri-utils.js +0 -18
  288. package/src/components/inner-blocks/with-client-id.js +0 -19
  289. package/src/components/segmented-text-control/index.js +0 -63
  290. package/src/components/segmented-text-control/style.scss +0 -15
@@ -125,6 +125,7 @@ export default {
125
125
  ) }
126
126
  { allowJustification && (
127
127
  <ToggleGroupControl
128
+ __next40pxDefaultSize
128
129
  __nextHasNoMarginBottom
129
130
  label={ __( 'Justification' ) }
130
131
  value={ justifyContent }
@@ -325,6 +325,7 @@ function FlexLayoutJustifyContentControl( {
325
325
 
326
326
  return (
327
327
  <ToggleGroupControl
328
+ __next40pxDefaultSize
328
329
  __nextHasNoMarginBottom
329
330
  label={ __( 'Justification' ) }
330
331
  value={ justifyContent }
@@ -370,6 +371,7 @@ function OrientationControl( { layout, onChange } ) {
370
371
  } = layout;
371
372
  return (
372
373
  <ToggleGroupControl
374
+ __next40pxDefaultSize
373
375
  __nextHasNoMarginBottom
374
376
  className="block-editor-hooks__flex-layout-orientation-controls"
375
377
  label={ __( 'Orientation' ) }
@@ -264,6 +264,7 @@ function GridLayoutMinimumWidthControl( { layout, onChange } ) {
264
264
  </FlexItem>
265
265
  <FlexItem isBlock>
266
266
  <RangeControl
267
+ __next40pxDefaultSize
267
268
  __nextHasNoMarginBottom
268
269
  onChange={ handleSliderChange }
269
270
  value={ quantity || 0 }
@@ -368,6 +369,7 @@ function GridLayoutColumnsAndRowsControl( {
368
369
  />
369
370
  ) : (
370
371
  <RangeControl
372
+ __next40pxDefaultSize
371
373
  __nextHasNoMarginBottom
372
374
  value={ columnCount ?? 0 }
373
375
  onChange={ ( value ) =>
@@ -449,6 +451,7 @@ function GridLayoutTypeControl( { layout, onChange } ) {
449
451
 
450
452
  return (
451
453
  <ToggleGroupControl
454
+ __next40pxDefaultSize
452
455
  __nextHasNoMarginBottom
453
456
  label={ __( 'Grid item position' ) }
454
457
  value={ gridPlacement }
@@ -47,6 +47,7 @@ import { PrivatePublishDateTimePicker } from './components/publish-date-time-pic
47
47
  import useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';
48
48
  import useBlockDisplayTitle from './components/block-title/use-block-display-title';
49
49
  import TabbedSidebar from './components/tabbed-sidebar';
50
+ import { useBlockBindingsUtils } from './utils/block-bindings';
50
51
 
51
52
  /**
52
53
  * Private @wordpress/block-editor APIs.
@@ -92,4 +93,5 @@ lock( privateApis, {
92
93
  useBlockDisplayTitle,
93
94
  __unstableBlockStyleVariationOverridesWithConfig,
94
95
  setBackgroundStyleDefaults,
96
+ useBlockBindingsUtils,
95
97
  } );
@@ -511,3 +511,39 @@ export function getTemporarilyEditingAsBlocks( state ) {
511
511
  export function getTemporarilyEditingFocusModeToRevert( state ) {
512
512
  return state.temporarilyEditingFocusModeRevert;
513
513
  }
514
+
515
+ export function getInserterSearchInputRef( state ) {
516
+ return state.inserterSearchInputRef;
517
+ }
518
+
519
+ /**
520
+ * Returns the style attributes of multiple blocks.
521
+ *
522
+ * @param {Object} state Global application state.
523
+ * @param {string[]} clientIds An array of block client IDs.
524
+ *
525
+ * @return {Object} An object where keys are client IDs and values are the corresponding block styles or undefined.
526
+ */
527
+ export const getBlockStyles = createSelector(
528
+ ( state, clientIds ) =>
529
+ clientIds.reduce( ( styles, clientId ) => {
530
+ styles[ clientId ] = state.blocks.attributes.get( clientId )?.style;
531
+ return styles;
532
+ }, {} ),
533
+ ( state, clientIds ) => [
534
+ ...clientIds.map(
535
+ ( clientId ) => state.blocks.attributes.get( clientId )?.style
536
+ ),
537
+ ]
538
+ );
539
+
540
+ /**
541
+ * Returns whether zoom out mode is enabled.
542
+ *
543
+ * @param {Object} state Editor state.
544
+ *
545
+ * @return {boolean} Is zoom out mode enabled.
546
+ */
547
+ export function isZoomOutMode( state ) {
548
+ return state.editorMode === 'zoom-out';
549
+ }
@@ -1624,6 +1624,8 @@ export function insertionPoint( state = null, action ) {
1624
1624
  }
1625
1625
 
1626
1626
  case 'HIDE_INSERTION_POINT':
1627
+ case 'CLEAR_SELECTED_BLOCK':
1628
+ case 'SELECT_BLOCK':
1627
1629
  return null;
1628
1630
  }
1629
1631
 
@@ -2085,6 +2087,10 @@ export function hoveredBlockClientId( state = false, action ) {
2085
2087
  return state;
2086
2088
  }
2087
2089
 
2090
+ export function inserterSearchInputRef( state = { current: null } ) {
2091
+ return state;
2092
+ }
2093
+
2088
2094
  const combinedReducers = combineReducers( {
2089
2095
  blocks,
2090
2096
  isDragging,
@@ -2118,6 +2124,7 @@ const combinedReducers = combineReducers( {
2118
2124
  openedBlockSettingsMenu,
2119
2125
  registeredInserterMediaCategories,
2120
2126
  hoveredBlockClientId,
2127
+ inserterSearchInputRef,
2121
2128
  } );
2122
2129
 
2123
2130
  function withAutomaticChangeReset( reducer ) {
@@ -9,6 +9,7 @@ import {
9
9
  getEnabledBlockParents,
10
10
  getExpandedBlock,
11
11
  isDragging,
12
+ getBlockStyles,
12
13
  } from '../private-selectors';
13
14
  import { getBlockEditingMode } from '../selectors';
14
15
 
@@ -509,4 +510,92 @@ describe( 'private selectors', () => {
509
510
  );
510
511
  } );
511
512
  } );
513
+
514
+ describe( 'getBlockStyles', () => {
515
+ it( 'should return an empty object when no client IDs are provided', () => {
516
+ const state = {
517
+ blocks: {
518
+ attributes: new Map(),
519
+ },
520
+ };
521
+ const result = getBlockStyles( state, [] );
522
+ expect( result ).toEqual( {} );
523
+ } );
524
+
525
+ it( 'should return styles for a single block', () => {
526
+ const state = {
527
+ blocks: {
528
+ attributes: new Map( [
529
+ [ 'block-1', { style: { color: 'red' } } ],
530
+ ] ),
531
+ },
532
+ };
533
+ const result = getBlockStyles( state, [ 'block-1' ] );
534
+ expect( result ).toEqual( {
535
+ 'block-1': { color: 'red' },
536
+ } );
537
+ } );
538
+
539
+ it( 'should return styles for multiple blocks', () => {
540
+ const state = {
541
+ blocks: {
542
+ attributes: new Map( [
543
+ [ 'block-1', { style: { color: 'red' } } ],
544
+ [ 'block-2', { style: { fontSize: '16px' } } ],
545
+ [ 'block-3', { style: { margin: '10px' } } ],
546
+ ] ),
547
+ },
548
+ };
549
+ const result = getBlockStyles( state, [
550
+ 'block-1',
551
+ 'block-2',
552
+ 'block-3',
553
+ ] );
554
+ expect( result ).toEqual( {
555
+ 'block-1': { color: 'red' },
556
+ 'block-2': { fontSize: '16px' },
557
+ 'block-3': { margin: '10px' },
558
+ } );
559
+ } );
560
+
561
+ it( 'should return undefined for blocks without styles', () => {
562
+ const state = {
563
+ blocks: {
564
+ attributes: new Map( [
565
+ [ 'block-1', { style: { color: 'red' } } ],
566
+ [ 'block-2', {} ],
567
+ [ 'block-3', { style: { margin: '10px' } } ],
568
+ ] ),
569
+ },
570
+ };
571
+ const result = getBlockStyles( state, [
572
+ 'block-1',
573
+ 'block-2',
574
+ 'block-3',
575
+ ] );
576
+ expect( result ).toEqual( {
577
+ 'block-1': { color: 'red' },
578
+ 'block-2': undefined,
579
+ 'block-3': { margin: '10px' },
580
+ } );
581
+ } );
582
+
583
+ it( 'should return undefined for non-existent blocks', () => {
584
+ const state = {
585
+ blocks: {
586
+ attributes: new Map( [
587
+ [ 'block-1', { style: { color: 'red' } } ],
588
+ ] ),
589
+ },
590
+ };
591
+ const result = getBlockStyles( state, [
592
+ 'block-1',
593
+ 'non-existent-block',
594
+ ] );
595
+ expect( result ).toEqual( {
596
+ 'block-1': { color: 'red' },
597
+ 'non-existent-block': undefined,
598
+ } );
599
+ } );
600
+ } );
512
601
  } );
package/src/style.scss CHANGED
@@ -40,7 +40,6 @@
40
40
  @import "./components/multi-selection-inspector/style.scss";
41
41
  @import "./components/responsive-block-control/style.scss";
42
42
  @import "./components/rich-text/style.scss";
43
- @import "./components/segmented-text-control/style.scss";
44
43
  @import "./components/skip-to-selected-block/style.scss";
45
44
  @import "./components/tabbed-sidebar/style.scss";
46
45
  @import "./components/tool-selector/style.scss";
@@ -0,0 +1,98 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useDispatch, useSelect } from '@wordpress/data';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { store as blockEditorStore } from '../store';
10
+ import { useBlockEditContext } from '../components/block-edit';
11
+
12
+ export function useBlockBindingsUtils() {
13
+ const { clientId } = useBlockEditContext();
14
+ const { updateBlockAttributes } = useDispatch( blockEditorStore );
15
+ const { getBlockAttributes } = useSelect( blockEditorStore );
16
+
17
+ /**
18
+ * Updates the value of the bindings connected to block attributes.
19
+ * It removes the binding when the new value is `undefined`.
20
+ *
21
+ * @param {Object} bindings Bindings including the attributes to update and the new object.
22
+ * @param {string} bindings.source The source name to connect to.
23
+ * @param {Object} [bindings.args] Object containing the arguments needed by the source.
24
+ *
25
+ * @example
26
+ * ```js
27
+ * import { useBlockBindingsUtils } from '@wordpress/block-editor'
28
+ *
29
+ * const { updateBlockBindings } = useBlockBindingsUtils();
30
+ * updateBlockBindings( {
31
+ * url: {
32
+ * source: 'core/post-meta',
33
+ * args: {
34
+ * key: 'url_custom_field',
35
+ * },
36
+ * },
37
+ * alt: {
38
+ * source: 'core/post-meta',
39
+ * args: {
40
+ * key: 'text_custom_field',
41
+ * },
42
+ * }
43
+ * } );
44
+ * ```
45
+ */
46
+ const updateBlockBindings = ( bindings ) => {
47
+ const { metadata } = getBlockAttributes( clientId );
48
+ const newBindings = { ...metadata?.bindings };
49
+ Object.entries( bindings ).forEach( ( [ attribute, binding ] ) => {
50
+ if ( ! binding && newBindings[ attribute ] ) {
51
+ delete newBindings[ attribute ];
52
+ return;
53
+ }
54
+ newBindings[ attribute ] = binding;
55
+ } );
56
+
57
+ const newMetadata = {
58
+ ...metadata,
59
+ bindings: newBindings,
60
+ };
61
+
62
+ if ( Object.keys( newMetadata.bindings ).length === 0 ) {
63
+ delete newMetadata.bindings;
64
+ }
65
+
66
+ updateBlockAttributes( clientId, {
67
+ metadata:
68
+ Object.keys( newMetadata ).length === 0
69
+ ? undefined
70
+ : newMetadata,
71
+ } );
72
+ };
73
+
74
+ /**
75
+ * Removes the bindings property of the `metadata` attribute.
76
+ *
77
+ * @example
78
+ * ```js
79
+ * import { useBlockBindingsUtils } from '@wordpress/block-editor'
80
+ *
81
+ * const { removeAllBlockBindings } = useBlockBindingsUtils();
82
+ * removeAllBlockBindings();
83
+ * ```
84
+ */
85
+ const removeAllBlockBindings = () => {
86
+ const { metadata } = getBlockAttributes( clientId );
87
+ const newMetadata = { ...metadata };
88
+ delete newMetadata.bindings;
89
+ updateBlockAttributes( clientId, {
90
+ metadata:
91
+ Object.keys( newMetadata ).length === 0
92
+ ? undefined
93
+ : newMetadata,
94
+ } );
95
+ };
96
+
97
+ return { updateBlockBindings, removeAllBlockBindings };
98
+ }
@@ -125,6 +125,21 @@ describe( 'transformStyles', () => {
125
125
  expect( output ).toMatchSnapshot();
126
126
  } );
127
127
 
128
+ it( `should not try to replace 'body' in the middle of a classname`, () => {
129
+ const prefix = '.my-namespace';
130
+ const input = `.has-body-text { color: red; }`;
131
+ const output = transformStyles(
132
+ [
133
+ {
134
+ css: input,
135
+ },
136
+ ],
137
+ prefix
138
+ );
139
+
140
+ expect( output ).toEqual( [ `${ prefix } ${ input }` ] );
141
+ } );
142
+
128
143
  it( 'should ignore keyframes', () => {
129
144
  const input = `
130
145
  @keyframes edit-post__fade-in-animation {
@@ -210,6 +225,40 @@ describe( 'transformStyles', () => {
210
225
 
211
226
  expect( output ).toMatchSnapshot();
212
227
  } );
228
+
229
+ it( 'should not try to wrap items within `:where` selectors', () => {
230
+ const input = `:where(.wp-element-button:active, .wp-block-button__link:active) { color: blue; }`;
231
+ const prefix = '.my-namespace';
232
+ const expected = [ `${ prefix } ${ input }` ];
233
+
234
+ const output = transformStyles(
235
+ [
236
+ {
237
+ css: input,
238
+ },
239
+ ],
240
+ prefix
241
+ );
242
+
243
+ expect( output ).toEqual( expected );
244
+ } );
245
+
246
+ it( 'should not try to prefix pseudo elements on `:where` selectors', () => {
247
+ const input = `:where(.wp-element-button, .wp-block-button__link)::before { color: blue; }`;
248
+ const prefix = '.my-namespace';
249
+ const expected = [ `${ prefix } ${ input }` ];
250
+
251
+ const output = transformStyles(
252
+ [
253
+ {
254
+ css: input,
255
+ },
256
+ ],
257
+ prefix
258
+ );
259
+
260
+ expect( output ).toEqual( expected );
261
+ } );
213
262
  } );
214
263
 
215
264
  it( 'should not break with data urls', () => {
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getResolvedThemeFilePath = getResolvedThemeFilePath;
7
- /**
8
- * Looks up a theme file URI based on a relative path.
9
- *
10
- * @param {string} file A relative path.
11
- * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.
12
- * @return {string?} A resolved theme file URI, if one is found in the themeFileURIs collection.
13
- */
14
- function getResolvedThemeFilePath(file, themeFileURIs = []) {
15
- const uri = themeFileURIs.find(themeFileUri => themeFileUri.name === file);
16
- if (!uri?.href) {
17
- return file;
18
- }
19
- return uri?.href;
20
- }
21
- //# sourceMappingURL=theme-file-uri-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getResolvedThemeFilePath","file","themeFileURIs","uri","find","themeFileUri","name","href"],"sources":["@wordpress/block-editor/src/components/global-styles/theme-file-uri-utils.js"],"sourcesContent":["/**\n * Looks up a theme file URI based on a relative path.\n *\n * @param {string} file A relative path.\n * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.\n * @return {string?} A resolved theme file URI, if one is found in the themeFileURIs collection.\n */\nexport function getResolvedThemeFilePath( file, themeFileURIs = [] ) {\n\tconst uri = themeFileURIs.find(\n\t\t( themeFileUri ) => themeFileUri.name === file\n\t);\n\n\tif ( ! uri?.href ) {\n\t\treturn file;\n\t}\n\n\treturn uri?.href;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,CAAEC,IAAI,EAAEC,aAAa,GAAG,EAAE,EAAG;EACpE,MAAMC,GAAG,GAAGD,aAAa,CAACE,IAAI,CAC3BC,YAAY,IAAMA,YAAY,CAACC,IAAI,KAAKL,IAC3C,CAAC;EAED,IAAK,CAAEE,GAAG,EAAEI,IAAI,EAAG;IAClB,OAAON,IAAI;EACZ;EAEA,OAAOE,GAAG,EAAEI,IAAI;AACjB","ignoreList":[]}
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _compose = require("@wordpress/compose");
8
- var _context = require("../block-edit/context");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Internal dependencies
16
- */
17
-
18
- const withClientId = (0, _compose.createHigherOrderComponent)(WrappedComponent => props => {
19
- const {
20
- clientId
21
- } = (0, _context.useBlockEditContext)();
22
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
23
- ...props,
24
- clientId: clientId
25
- });
26
- }, 'withClientId');
27
- var _default = exports.default = withClientId;
28
- //# sourceMappingURL=with-client-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_compose","require","_context","_jsxRuntime","withClientId","createHigherOrderComponent","WrappedComponent","props","clientId","useBlockEditContext","jsx","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/inner-blocks/with-client-id.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\n\nconst withClientId = createHigherOrderComponent(\n\t( WrappedComponent ) => ( props ) => {\n\t\tconst { clientId } = useBlockEditContext();\n\t\treturn <WrappedComponent { ...props } clientId={ clientId } />;\n\t},\n\t'withClientId'\n);\n\nexport default withClientId;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAA4D,IAAAE,WAAA,GAAAF,OAAA;AAR5D;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMG,YAAY,GAAG,IAAAC,mCAA0B,EAC5CC,gBAAgB,IAAQC,KAAK,IAAM;EACpC,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,4BAAmB,EAAC,CAAC;EAC1C,oBAAO,IAAAN,WAAA,CAAAO,GAAA,EAACJ,gBAAgB;IAAA,GAAMC,KAAK;IAAGC,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC/D,CAAC,EACD,cACD,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaT,YAAY","ignoreList":[]}
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = SegmentedTextControl;
8
- var _clsx = _interopRequireDefault(require("clsx"));
9
- var _components = require("@wordpress/components");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * External dependencies
13
- */
14
-
15
- /**
16
- * WordPress dependencies
17
- */
18
-
19
- /**
20
- * @typedef {Object} Option
21
- * @property {string} label The label of the option.
22
- * @property {string} value The value of the option.
23
- * @property {string} icon The icon of the option.
24
- */
25
-
26
- /**
27
- * Control to facilitate selecting a text style from a set of options.
28
- *
29
- * @param {Object} props Component props.
30
- * @param {string} props.label A label for the option.
31
- * @param {string} props.value Currently selected value.
32
- * @param {Function} props.onChange Callback to handle onChange.
33
- * @param {Option[]} props.options Array of options to display.
34
- * @param {string} props.className Additional class name to apply.
35
- *
36
- * @return {Element} Element to render.
37
- */function SegmentedTextControl({
38
- label,
39
- value,
40
- options,
41
- onChange,
42
- className
43
- }) {
44
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("fieldset", {
45
- className: (0, _clsx.default)('block-editor-segmented-text-control', className),
46
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.BaseControl.VisualLabel, {
47
- as: "legend",
48
- children: label
49
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
50
- className: "block-editor-segmented-text-control__buttons",
51
- children: options.map(option => {
52
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
53
- size: "compact",
54
- icon: option.icon,
55
- label: option.label,
56
- isPressed: option.value === value,
57
- onClick: () => onChange(option.value)
58
- }, option.value);
59
- })
60
- })]
61
- });
62
- }
63
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_jsxRuntime","SegmentedTextControl","label","value","options","onChange","className","jsxs","clsx","children","jsx","BaseControl","VisualLabel","as","map","option","Button","size","icon","isPressed","onClick"],"sources":["@wordpress/block-editor/src/components/segmented-text-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\n\n/**\n * @typedef {Object} Option\n * @property {string} label The label of the option.\n * @property {string} value The value of the option.\n * @property {string} icon The icon of the option.\n */\n\n/**\n * Control to facilitate selecting a text style from a set of options.\n *\n * @param {Object} props Component props.\n * @param {string} props.label A label for the option.\n * @param {string} props.value Currently selected value.\n * @param {Function} props.onChange Callback to handle onChange.\n * @param {Option[]} props.options Array of options to display.\n * @param {string} props.className Additional class name to apply.\n *\n * @return {Element} Element to render.\n */\nexport default function SegmentedTextControl( {\n\tlabel,\n\tvalue,\n\toptions,\n\tonChange,\n\tclassName,\n} ) {\n\treturn (\n\t\t<fieldset\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-segmented-text-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ label }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"block-editor-segmented-text-control__buttons\">\n\t\t\t\t{ options.map( ( option ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\ticon={ option.icon }\n\t\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t\t\tisPressed={ option.value === value }\n\t\t\t\t\t\t\tonClick={ () => onChange( option.value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAA4D,IAAAE,WAAA,GAAAF,OAAA;AAR5D;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASG,oBAAoBA,CAAE;EAC7CC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,oBACC,IAAAN,WAAA,CAAAO,IAAA;IACCD,SAAS,EAAG,IAAAE,aAAI,EACf,qCAAqC,EACrCF,SACD,CAAG;IAAAG,QAAA,gBAEH,IAAAT,WAAA,CAAAU,GAAA,EAACX,WAAA,CAAAY,WAAW,CAACC,WAAW;MAACC,EAAE,EAAC,QAAQ;MAAAJ,QAAA,EACjCP;IAAK,CACiB,CAAC,eAC1B,IAAAF,WAAA,CAAAU,GAAA;MAAKJ,SAAS,EAAC,8CAA8C;MAAAG,QAAA,EAC1DL,OAAO,CAACU,GAAG,CAAIC,MAAM,IAAM;QAC5B,oBACC,IAAAf,WAAA,CAAAU,GAAA,EAACX,WAAA,CAAAiB,MAAM;UACNC,IAAI,EAAC,SAAS;UAEdC,IAAI,EAAGH,MAAM,CAACG,IAAM;UACpBhB,KAAK,EAAGa,MAAM,CAACb,KAAO;UACtBiB,SAAS,EAAGJ,MAAM,CAACZ,KAAK,KAAKA,KAAO;UACpCiB,OAAO,EAAGA,CAAA,KAAMf,QAAQ,CAAEU,MAAM,CAACZ,KAAM;QAAG,GAJpCY,MAAM,CAACZ,KAKb,CAAC;MAEJ,CAAE;IAAC,CACC,CAAC;EAAA,CACG,CAAC;AAEb","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- /**
2
- * Looks up a theme file URI based on a relative path.
3
- *
4
- * @param {string} file A relative path.
5
- * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.
6
- * @return {string?} A resolved theme file URI, if one is found in the themeFileURIs collection.
7
- */
8
- export function getResolvedThemeFilePath(file, themeFileURIs = []) {
9
- const uri = themeFileURIs.find(themeFileUri => themeFileUri.name === file);
10
- if (!uri?.href) {
11
- return file;
12
- }
13
- return uri?.href;
14
- }
15
- //# sourceMappingURL=theme-file-uri-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getResolvedThemeFilePath","file","themeFileURIs","uri","find","themeFileUri","name","href"],"sources":["@wordpress/block-editor/src/components/global-styles/theme-file-uri-utils.js"],"sourcesContent":["/**\n * Looks up a theme file URI based on a relative path.\n *\n * @param {string} file A relative path.\n * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.\n * @return {string?} A resolved theme file URI, if one is found in the themeFileURIs collection.\n */\nexport function getResolvedThemeFilePath( file, themeFileURIs = [] ) {\n\tconst uri = themeFileURIs.find(\n\t\t( themeFileUri ) => themeFileUri.name === file\n\t);\n\n\tif ( ! uri?.href ) {\n\t\treturn file;\n\t}\n\n\treturn uri?.href;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,wBAAwBA,CAAEC,IAAI,EAAEC,aAAa,GAAG,EAAE,EAAG;EACpE,MAAMC,GAAG,GAAGD,aAAa,CAACE,IAAI,CAC3BC,YAAY,IAAMA,YAAY,CAACC,IAAI,KAAKL,IAC3C,CAAC;EAED,IAAK,CAAEE,GAAG,EAAEI,IAAI,EAAG;IAClB,OAAON,IAAI;EACZ;EAEA,OAAOE,GAAG,EAAEI,IAAI;AACjB","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createHigherOrderComponent } from '@wordpress/compose';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import { useBlockEditContext } from '../block-edit/context';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- const withClientId = createHigherOrderComponent(WrappedComponent => props => {
12
- const {
13
- clientId
14
- } = useBlockEditContext();
15
- return /*#__PURE__*/_jsx(WrappedComponent, {
16
- ...props,
17
- clientId: clientId
18
- });
19
- }, 'withClientId');
20
- export default withClientId;
21
- //# sourceMappingURL=with-client-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createHigherOrderComponent","useBlockEditContext","jsx","_jsx","withClientId","WrappedComponent","props","clientId"],"sources":["@wordpress/block-editor/src/components/inner-blocks/with-client-id.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\n\nconst withClientId = createHigherOrderComponent(\n\t( WrappedComponent ) => ( props ) => {\n\t\tconst { clientId } = useBlockEditContext();\n\t\treturn <WrappedComponent { ...props } clientId={ clientId } />;\n\t},\n\t'withClientId'\n);\n\nexport default withClientId;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAA0B,QAAQ,oBAAoB;;AAE/D;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5D,MAAMC,YAAY,GAAGJ,0BAA0B,CAC5CK,gBAAgB,IAAQC,KAAK,IAAM;EACpC,MAAM;IAAEC;EAAS,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EAC1C,oBAAOE,IAAA,CAACE,gBAAgB;IAAA,GAAMC,KAAK;IAAGC,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC/D,CAAC,EACD,cACD,CAAC;AAED,eAAeH,YAAY","ignoreList":[]}
@@ -1,58 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { BaseControl, Button } from '@wordpress/components';
10
-
11
- /**
12
- * @typedef {Object} Option
13
- * @property {string} label The label of the option.
14
- * @property {string} value The value of the option.
15
- * @property {string} icon The icon of the option.
16
- */
17
-
18
- /**
19
- * Control to facilitate selecting a text style from a set of options.
20
- *
21
- * @param {Object} props Component props.
22
- * @param {string} props.label A label for the option.
23
- * @param {string} props.value Currently selected value.
24
- * @param {Function} props.onChange Callback to handle onChange.
25
- * @param {Option[]} props.options Array of options to display.
26
- * @param {string} props.className Additional class name to apply.
27
- *
28
- * @return {Element} Element to render.
29
- */
30
- import { jsx as _jsx } from "react/jsx-runtime";
31
- import { jsxs as _jsxs } from "react/jsx-runtime";
32
- export default function SegmentedTextControl({
33
- label,
34
- value,
35
- options,
36
- onChange,
37
- className
38
- }) {
39
- return /*#__PURE__*/_jsxs("fieldset", {
40
- className: clsx('block-editor-segmented-text-control', className),
41
- children: [/*#__PURE__*/_jsx(BaseControl.VisualLabel, {
42
- as: "legend",
43
- children: label
44
- }), /*#__PURE__*/_jsx("div", {
45
- className: "block-editor-segmented-text-control__buttons",
46
- children: options.map(option => {
47
- return /*#__PURE__*/_jsx(Button, {
48
- size: "compact",
49
- icon: option.icon,
50
- label: option.label,
51
- isPressed: option.value === value,
52
- onClick: () => onChange(option.value)
53
- }, option.value);
54
- })
55
- })]
56
- });
57
- }
58
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["clsx","BaseControl","Button","jsx","_jsx","jsxs","_jsxs","SegmentedTextControl","label","value","options","onChange","className","children","VisualLabel","as","map","option","size","icon","isPressed","onClick"],"sources":["@wordpress/block-editor/src/components/segmented-text-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\n\n/**\n * @typedef {Object} Option\n * @property {string} label The label of the option.\n * @property {string} value The value of the option.\n * @property {string} icon The icon of the option.\n */\n\n/**\n * Control to facilitate selecting a text style from a set of options.\n *\n * @param {Object} props Component props.\n * @param {string} props.label A label for the option.\n * @param {string} props.value Currently selected value.\n * @param {Function} props.onChange Callback to handle onChange.\n * @param {Option[]} props.options Array of options to display.\n * @param {string} props.className Additional class name to apply.\n *\n * @return {Element} Element to render.\n */\nexport default function SegmentedTextControl( {\n\tlabel,\n\tvalue,\n\toptions,\n\tonChange,\n\tclassName,\n} ) {\n\treturn (\n\t\t<fieldset\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-segmented-text-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ label }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"block-editor-segmented-text-control__buttons\">\n\t\t\t\t{ options.map( ( option ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\ticon={ option.icon }\n\t\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t\t\tisPressed={ option.value === value }\n\t\t\t\t\t\t\tonClick={ () => onChange( option.value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;;AAE3D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAYA,eAAe,SAASC,oBAAoBA,CAAE;EAC7CC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,oBACCN,KAAA;IACCM,SAAS,EAAGZ,IAAI,CACf,qCAAqC,EACrCY,SACD,CAAG;IAAAC,QAAA,gBAEHT,IAAA,CAACH,WAAW,CAACa,WAAW;MAACC,EAAE,EAAC,QAAQ;MAAAF,QAAA,EACjCL;IAAK,CACiB,CAAC,eAC1BJ,IAAA;MAAKQ,SAAS,EAAC,8CAA8C;MAAAC,QAAA,EAC1DH,OAAO,CAACM,GAAG,CAAIC,MAAM,IAAM;QAC5B,oBACCb,IAAA,CAACF,MAAM;UACNgB,IAAI,EAAC,SAAS;UAEdC,IAAI,EAAGF,MAAM,CAACE,IAAM;UACpBX,KAAK,EAAGS,MAAM,CAACT,KAAO;UACtBY,SAAS,EAAGH,MAAM,CAACR,KAAK,KAAKA,KAAO;UACpCY,OAAO,EAAGA,CAAA,KAAMV,QAAQ,CAAEM,MAAM,CAACR,KAAM;QAAG,GAJpCQ,MAAM,CAACR,KAKb,CAAC;MAEJ,CAAE;IAAC,CACC,CAAC;EAAA,CACG,CAAC;AAEb","ignoreList":[]}