@wordpress/block-editor 12.9.0 → 12.10.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 (463) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +33 -3
  3. package/build/components/block-canvas/index.js +107 -0
  4. package/build/components/block-canvas/index.js.map +1 -0
  5. package/build/components/block-inspector/index.js +4 -1
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-patterns-list/index.js +19 -4
  8. package/build/components/block-patterns-list/index.js.map +1 -1
  9. package/build/components/block-patterns-paging/index.js +66 -0
  10. package/build/components/block-patterns-paging/index.js.map +1 -0
  11. package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
  12. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  13. package/build/components/block-settings-menu-controls/index.js +4 -7
  14. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  15. package/build/components/block-styles/index.js +1 -0
  16. package/build/components/block-styles/index.js.map +1 -1
  17. package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  18. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  19. package/build/components/block-tools/block-contextual-toolbar.js +18 -7
  20. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  21. package/build/components/block-tools/block-selection-button.js +5 -1
  22. package/build/components/block-tools/block-selection-button.js.map +1 -1
  23. package/build/components/border-radius-control/input-controls.js +1 -1
  24. package/build/components/border-radius-control/input-controls.js.map +1 -1
  25. package/build/components/border-radius-control/linked-button.js +2 -4
  26. package/build/components/border-radius-control/linked-button.js.map +1 -1
  27. package/build/components/colors/with-colors.js.map +1 -1
  28. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  29. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  30. package/build/components/default-block-appender/index.native.js +20 -1
  31. package/build/components/default-block-appender/index.native.js.map +1 -1
  32. package/build/components/duotone/utils.js +68 -0
  33. package/build/components/duotone/utils.js.map +1 -1
  34. package/build/components/editor-styles/index.js +28 -9
  35. package/build/components/editor-styles/index.js.map +1 -1
  36. package/build/components/global-styles/hooks.js +2 -101
  37. package/build/components/global-styles/hooks.js.map +1 -1
  38. package/build/components/global-styles/image-settings-panel.js +61 -0
  39. package/build/components/global-styles/image-settings-panel.js.map +1 -0
  40. package/build/components/global-styles/index.js +11 -17
  41. package/build/components/global-styles/index.js.map +1 -1
  42. package/build/components/global-styles/use-global-styles-output.js +19 -15
  43. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  44. package/build/components/global-styles/utils.js +1 -1
  45. package/build/components/global-styles/utils.js.map +1 -1
  46. package/build/components/iframe/index.js +67 -33
  47. package/build/components/iframe/index.js.map +1 -1
  48. package/build/components/image-editor/use-save-image.js +2 -5
  49. package/build/components/image-editor/use-save-image.js.map +1 -1
  50. package/build/components/image-editor/use-transform-image.js +9 -9
  51. package/build/components/image-editor/use-transform-image.js.map +1 -1
  52. package/build/components/index.js +8 -12
  53. package/build/components/index.js.map +1 -1
  54. package/build/components/index.native.js +6 -5
  55. package/build/components/index.native.js.map +1 -1
  56. package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
  57. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  58. package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
  59. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  60. package/build/components/inserter/block-patterns-explorer/patterns-list.js +57 -23
  61. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  62. package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
  63. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  64. package/build/components/inserter/block-patterns-source-filter.js +54 -0
  65. package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
  66. package/build/components/inserter/block-patterns-sync-filter.js +46 -0
  67. package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
  68. package/build/components/inserter/block-patterns-tab.js +91 -45
  69. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  70. package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
  71. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  72. package/build/components/inserter/hooks/use-patterns-state.js +21 -10
  73. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  74. package/build/components/inserter/menu.js +13 -11
  75. package/build/components/inserter/menu.js.map +1 -1
  76. package/build/components/inserter/search-results.js +4 -3
  77. package/build/components/inserter/search-results.js.map +1 -1
  78. package/build/components/inserter/tabs.js +1 -12
  79. package/build/components/inserter/tabs.js.map +1 -1
  80. package/build/components/inspector-controls/block-support-slot-container.js +12 -1
  81. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  82. package/build/components/inspector-controls/fill.js +24 -13
  83. package/build/components/inspector-controls/fill.js.map +1 -1
  84. package/build/components/inspector-controls/groups.js +5 -3
  85. package/build/components/inspector-controls/groups.js.map +1 -1
  86. package/build/components/inspector-controls/slot.js +13 -0
  87. package/build/components/inspector-controls/slot.js.map +1 -1
  88. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  89. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  90. package/build/components/link-control/index.js +13 -2
  91. package/build/components/link-control/index.js.map +1 -1
  92. package/build/components/link-control/settings.js +2 -1
  93. package/build/components/link-control/settings.js.map +1 -1
  94. package/build/components/list-view/block-select-button.js +1 -3
  95. package/build/components/list-view/block-select-button.js.map +1 -1
  96. package/build/components/list-view/block.js +13 -1
  97. package/build/components/list-view/block.js.map +1 -1
  98. package/build/components/list-view/use-block-selection.js +29 -24
  99. package/build/components/list-view/use-block-selection.js.map +1 -1
  100. package/build/components/media-placeholder/index.js +2 -2
  101. package/build/components/media-placeholder/index.js.map +1 -1
  102. package/build/components/media-placeholder/index.native.js +11 -11
  103. package/build/components/media-placeholder/index.native.js.map +1 -1
  104. package/build/components/media-replace-flow/index.js +2 -3
  105. package/build/components/media-replace-flow/index.js.map +1 -1
  106. package/build/components/media-upload/constants.js +30 -0
  107. package/build/components/media-upload/constants.js.map +1 -0
  108. package/build/components/media-upload/index.native.js +63 -53
  109. package/build/components/media-upload/index.native.js.map +1 -1
  110. package/build/components/preview-options/index.js +1 -1
  111. package/build/components/preview-options/index.js.map +1 -1
  112. package/build/components/rich-text/index.js +34 -35
  113. package/build/components/rich-text/index.js.map +1 -1
  114. package/build/components/rich-text/index.native.js +14 -32
  115. package/build/components/rich-text/index.native.js.map +1 -1
  116. package/build/components/rich-text/multiline.js +95 -0
  117. package/build/components/rich-text/multiline.js.map +1 -0
  118. package/build/components/rich-text/split-value.js +10 -16
  119. package/build/components/rich-text/split-value.js.map +1 -1
  120. package/build/components/rich-text/use-enter.js +31 -40
  121. package/build/components/rich-text/use-enter.js.map +1 -1
  122. package/build/components/rich-text/use-paste-handler.js +18 -33
  123. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  124. package/build/components/spacing-sizes-control/utils.js +1 -1
  125. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  126. package/build/components/use-block-commands/index.js +30 -18
  127. package/build/components/use-block-commands/index.js.map +1 -1
  128. package/build/components/use-block-display-information/index.js +5 -2
  129. package/build/components/use-block-display-information/index.js.map +1 -1
  130. package/build/hooks/background.js +258 -0
  131. package/build/hooks/background.js.map +1 -0
  132. package/build/hooks/block-hooks.js +188 -0
  133. package/build/hooks/block-hooks.js.map +1 -0
  134. package/build/hooks/block-rename-ui.js +160 -0
  135. package/build/hooks/block-rename-ui.js.map +1 -0
  136. package/build/hooks/duotone.js +29 -42
  137. package/build/hooks/duotone.js.map +1 -1
  138. package/build/hooks/index.js +2 -2
  139. package/build/hooks/index.js.map +1 -1
  140. package/build/hooks/layout.js +31 -14
  141. package/build/hooks/layout.js.map +1 -1
  142. package/build/hooks/position.js +4 -2
  143. package/build/hooks/position.js.map +1 -1
  144. package/build/hooks/style.js +74 -25
  145. package/build/hooks/style.js.map +1 -1
  146. package/build/hooks/utils.js +4 -0
  147. package/build/hooks/utils.js.map +1 -1
  148. package/build/private-apis.js +2 -0
  149. package/build/private-apis.js.map +1 -1
  150. package/build/store/actions.js +33 -10
  151. package/build/store/actions.js.map +1 -1
  152. package/build/store/private-actions.js +42 -8
  153. package/build/store/private-actions.js.map +1 -1
  154. package/build/store/private-selectors.js +23 -0
  155. package/build/store/private-selectors.js.map +1 -1
  156. package/build/store/reducer.js +43 -1
  157. package/build/store/reducer.js.map +1 -1
  158. package/build/store/selectors.js +84 -23
  159. package/build/store/selectors.js.map +1 -1
  160. package/build/store/utils.js +0 -4
  161. package/build/store/utils.js.map +1 -1
  162. package/build-module/components/block-canvas/index.js +97 -0
  163. package/build-module/components/block-canvas/index.js.map +1 -0
  164. package/build-module/components/block-inspector/index.js +4 -1
  165. package/build-module/components/block-inspector/index.js.map +1 -1
  166. package/build-module/components/block-patterns-list/index.js +20 -5
  167. package/build-module/components/block-patterns-list/index.js.map +1 -1
  168. package/build-module/components/block-patterns-paging/index.js +59 -0
  169. package/build-module/components/block-patterns-paging/index.js.map +1 -0
  170. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
  171. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  172. package/build-module/components/block-settings-menu-controls/index.js +4 -7
  173. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  174. package/build-module/components/block-styles/index.js +1 -0
  175. package/build-module/components/block-styles/index.js.map +1 -1
  176. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  177. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  178. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
  179. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  180. package/build-module/components/block-tools/block-selection-button.js +5 -1
  181. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  182. package/build-module/components/border-radius-control/input-controls.js +1 -1
  183. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  184. package/build-module/components/border-radius-control/linked-button.js +2 -4
  185. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  186. package/build-module/components/colors/with-colors.js.map +1 -1
  187. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  188. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  189. package/build-module/components/default-block-appender/index.native.js +20 -1
  190. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  191. package/build-module/components/duotone/utils.js +65 -0
  192. package/build-module/components/duotone/utils.js.map +1 -1
  193. package/build-module/components/editor-styles/index.js +28 -9
  194. package/build-module/components/editor-styles/index.js.map +1 -1
  195. package/build-module/components/global-styles/hooks.js +3 -100
  196. package/build-module/components/global-styles/hooks.js.map +1 -1
  197. package/build-module/components/global-styles/image-settings-panel.js +53 -0
  198. package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
  199. package/build-module/components/global-styles/index.js +2 -2
  200. package/build-module/components/global-styles/index.js.map +1 -1
  201. package/build-module/components/global-styles/use-global-styles-output.js +18 -16
  202. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  203. package/build-module/components/global-styles/utils.js +1 -1
  204. package/build-module/components/global-styles/utils.js.map +1 -1
  205. package/build-module/components/iframe/index.js +66 -33
  206. package/build-module/components/iframe/index.js.map +1 -1
  207. package/build-module/components/image-editor/use-save-image.js +2 -5
  208. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  209. package/build-module/components/image-editor/use-transform-image.js +9 -9
  210. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  211. package/build-module/components/index.js +1 -1
  212. package/build-module/components/index.js.map +1 -1
  213. package/build-module/components/index.native.js +2 -1
  214. package/build-module/components/index.native.js.map +1 -1
  215. package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
  216. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  217. package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
  218. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  219. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
  220. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  221. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
  222. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  223. package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
  224. package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
  225. package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
  226. package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
  227. package/build-module/components/inserter/block-patterns-tab.js +87 -46
  228. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  229. package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
  230. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  231. package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
  232. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  233. package/build-module/components/inserter/menu.js +13 -11
  234. package/build-module/components/inserter/menu.js.map +1 -1
  235. package/build-module/components/inserter/search-results.js +4 -3
  236. package/build-module/components/inserter/search-results.js.map +1 -1
  237. package/build-module/components/inserter/tabs.js +1 -12
  238. package/build-module/components/inserter/tabs.js.map +1 -1
  239. package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
  240. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  241. package/build-module/components/inspector-controls/fill.js +25 -14
  242. package/build-module/components/inspector-controls/fill.js.map +1 -1
  243. package/build-module/components/inspector-controls/groups.js +5 -3
  244. package/build-module/components/inspector-controls/groups.js.map +1 -1
  245. package/build-module/components/inspector-controls/slot.js +15 -1
  246. package/build-module/components/inspector-controls/slot.js.map +1 -1
  247. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  248. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  249. package/build-module/components/link-control/index.js +13 -2
  250. package/build-module/components/link-control/index.js.map +1 -1
  251. package/build-module/components/link-control/settings.js +2 -1
  252. package/build-module/components/link-control/settings.js.map +1 -1
  253. package/build-module/components/list-view/block-select-button.js +1 -3
  254. package/build-module/components/list-view/block-select-button.js.map +1 -1
  255. package/build-module/components/list-view/block.js +13 -1
  256. package/build-module/components/list-view/block.js.map +1 -1
  257. package/build-module/components/list-view/use-block-selection.js +30 -25
  258. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  259. package/build-module/components/media-placeholder/index.js +2 -2
  260. package/build-module/components/media-placeholder/index.js.map +1 -1
  261. package/build-module/components/media-placeholder/index.native.js +7 -7
  262. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  263. package/build-module/components/media-replace-flow/index.js +2 -3
  264. package/build-module/components/media-replace-flow/index.js.map +1 -1
  265. package/build-module/components/media-upload/constants.js +14 -0
  266. package/build-module/components/media-upload/constants.js.map +1 -0
  267. package/build-module/components/media-upload/index.native.js +53 -34
  268. package/build-module/components/media-upload/index.native.js.map +1 -1
  269. package/build-module/components/preview-options/index.js +1 -1
  270. package/build-module/components/preview-options/index.js.map +1 -1
  271. package/build-module/components/rich-text/index.js +35 -37
  272. package/build-module/components/rich-text/index.js.map +1 -1
  273. package/build-module/components/rich-text/index.native.js +15 -33
  274. package/build-module/components/rich-text/index.native.js.map +1 -1
  275. package/build-module/components/rich-text/multiline.js +87 -0
  276. package/build-module/components/rich-text/multiline.js.map +1 -0
  277. package/build-module/components/rich-text/split-value.js +10 -16
  278. package/build-module/components/rich-text/split-value.js.map +1 -1
  279. package/build-module/components/rich-text/use-enter.js +33 -42
  280. package/build-module/components/rich-text/use-enter.js.map +1 -1
  281. package/build-module/components/rich-text/use-paste-handler.js +19 -34
  282. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  283. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  284. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  285. package/build-module/components/use-block-commands/index.js +28 -16
  286. package/build-module/components/use-block-commands/index.js.map +1 -1
  287. package/build-module/components/use-block-display-information/index.js +5 -2
  288. package/build-module/components/use-block-display-information/index.js.map +1 -1
  289. package/build-module/hooks/background.js +244 -0
  290. package/build-module/hooks/background.js.map +1 -0
  291. package/build-module/hooks/block-hooks.js +181 -0
  292. package/build-module/hooks/block-hooks.js.map +1 -0
  293. package/build-module/hooks/block-rename-ui.js +153 -0
  294. package/build-module/hooks/block-rename-ui.js.map +1 -0
  295. package/build-module/hooks/duotone.js +26 -39
  296. package/build-module/hooks/duotone.js.map +1 -1
  297. package/build-module/hooks/index.js +2 -2
  298. package/build-module/hooks/index.js.map +1 -1
  299. package/build-module/hooks/layout.js +33 -16
  300. package/build-module/hooks/layout.js.map +1 -1
  301. package/build-module/hooks/position.js +4 -2
  302. package/build-module/hooks/position.js.map +1 -1
  303. package/build-module/hooks/style.js +73 -24
  304. package/build-module/hooks/style.js.map +1 -1
  305. package/build-module/hooks/utils.js +4 -0
  306. package/build-module/hooks/utils.js.map +1 -1
  307. package/build-module/private-apis.js +2 -0
  308. package/build-module/private-apis.js.map +1 -1
  309. package/build-module/store/actions.js +33 -10
  310. package/build-module/store/actions.js.map +1 -1
  311. package/build-module/store/private-actions.js +39 -8
  312. package/build-module/store/private-actions.js.map +1 -1
  313. package/build-module/store/private-selectors.js +21 -0
  314. package/build-module/store/private-selectors.js.map +1 -1
  315. package/build-module/store/reducer.js +41 -1
  316. package/build-module/store/reducer.js.map +1 -1
  317. package/build-module/store/selectors.js +78 -22
  318. package/build-module/store/selectors.js.map +1 -1
  319. package/build-module/store/utils.js +0 -4
  320. package/build-module/store/utils.js.map +1 -1
  321. package/build-style/content-rtl.css +0 -1
  322. package/build-style/content.css +0 -1
  323. package/build-style/style-rtl.css +174 -131
  324. package/build-style/style.css +174 -131
  325. package/package.json +32 -32
  326. package/src/components/block-canvas/index.js +108 -0
  327. package/src/components/block-inspector/index.js +5 -1
  328. package/src/components/block-list/content.scss +0 -1
  329. package/src/components/block-patterns-list/index.js +32 -7
  330. package/src/components/block-patterns-list/style.scss +26 -9
  331. package/src/components/block-patterns-paging/index.js +92 -0
  332. package/src/components/block-patterns-paging/style.scss +42 -0
  333. package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
  334. package/src/components/block-settings-menu-controls/index.js +4 -9
  335. package/src/components/block-styles/index.js +1 -0
  336. package/src/components/block-styles/style.scss +3 -3
  337. package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
  338. package/src/components/block-tools/block-contextual-toolbar.js +16 -5
  339. package/src/components/block-tools/block-selection-button.js +9 -1
  340. package/src/components/block-tools/style.scss +0 -98
  341. package/src/components/border-radius-control/input-controls.js +1 -1
  342. package/src/components/border-radius-control/linked-button.js +8 -11
  343. package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
  344. package/src/components/colors/with-colors.js +3 -2
  345. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
  346. package/src/components/default-block-appender/index.native.js +26 -3
  347. package/src/components/duotone/utils.js +65 -0
  348. package/src/components/editor-styles/index.js +32 -23
  349. package/src/components/global-styles/hooks.js +4 -112
  350. package/src/components/global-styles/image-settings-panel.js +71 -0
  351. package/src/components/global-styles/index.js +4 -3
  352. package/src/components/global-styles/use-global-styles-output.js +25 -16
  353. package/src/components/global-styles/utils.js +1 -2
  354. package/src/components/iframe/index.js +72 -33
  355. package/src/components/image-editor/use-save-image.js +2 -9
  356. package/src/components/image-editor/use-transform-image.js +9 -9
  357. package/src/components/index.js +1 -1
  358. package/src/components/index.native.js +2 -2
  359. package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
  360. package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
  361. package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
  362. package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
  363. package/src/components/inserter/block-patterns-source-filter.js +40 -0
  364. package/src/components/inserter/block-patterns-sync-filter.js +35 -0
  365. package/src/components/inserter/block-patterns-tab.js +168 -57
  366. package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
  367. package/src/components/inserter/hooks/use-patterns-state.js +27 -16
  368. package/src/components/inserter/menu.js +15 -17
  369. package/src/components/inserter/search-results.js +6 -4
  370. package/src/components/inserter/style.scss +23 -2
  371. package/src/components/inserter/tabs.js +2 -12
  372. package/src/components/inserter/test/index.native.js +8 -12
  373. package/src/components/inspector-controls/block-support-slot-container.js +19 -3
  374. package/src/components/inspector-controls/fill.js +28 -14
  375. package/src/components/inspector-controls/groups.js +6 -2
  376. package/src/components/inspector-controls/slot.js +28 -3
  377. package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
  378. package/src/components/link-control/index.js +14 -0
  379. package/src/components/link-control/settings.js +1 -0
  380. package/src/components/link-control/style.scss +28 -7
  381. package/src/components/link-control/test/index.js +88 -6
  382. package/src/components/list-view/block-select-button.js +1 -3
  383. package/src/components/list-view/block.js +19 -1
  384. package/src/components/list-view/style.scss +1 -2
  385. package/src/components/list-view/use-block-selection.js +38 -32
  386. package/src/components/media-placeholder/README.md +2 -2
  387. package/src/components/media-placeholder/index.js +2 -2
  388. package/src/components/media-placeholder/index.native.js +11 -12
  389. package/src/components/media-replace-flow/index.js +2 -2
  390. package/src/components/media-replace-flow/test/index.js +5 -23
  391. package/src/components/media-upload/README.md +3 -2
  392. package/src/components/media-upload/constants.js +15 -0
  393. package/src/components/media-upload/index.native.js +66 -40
  394. package/src/components/media-upload/style.native.scss +4 -0
  395. package/src/components/media-upload/test/index.native.js +2 -2
  396. package/src/components/preview-options/README.md +7 -0
  397. package/src/components/preview-options/index.js +1 -1
  398. package/src/components/rich-text/index.js +48 -44
  399. package/src/components/rich-text/index.native.js +14 -42
  400. package/src/components/rich-text/multiline.js +121 -0
  401. package/src/components/rich-text/split-value.js +10 -35
  402. package/src/components/rich-text/use-enter.js +32 -42
  403. package/src/components/rich-text/use-paste-handler.js +16 -40
  404. package/src/components/spacing-sizes-control/style.scss +5 -7
  405. package/src/components/spacing-sizes-control/utils.js +1 -2
  406. package/src/components/use-block-commands/index.js +28 -20
  407. package/src/components/use-block-display-information/index.js +3 -0
  408. package/src/hooks/background.js +288 -0
  409. package/src/hooks/background.scss +57 -0
  410. package/src/hooks/block-hooks.js +257 -0
  411. package/src/hooks/block-hooks.scss +16 -0
  412. package/src/hooks/block-rename-ui.js +230 -0
  413. package/src/hooks/block-rename-ui.scss +3 -0
  414. package/src/hooks/duotone.js +42 -43
  415. package/src/hooks/index.js +2 -2
  416. package/src/hooks/layout.js +31 -33
  417. package/src/hooks/position.js +4 -3
  418. package/src/hooks/style.js +96 -37
  419. package/src/hooks/test/align.native.js +4 -3
  420. package/src/hooks/utils.js +4 -0
  421. package/src/private-apis.js +2 -0
  422. package/src/store/actions.js +52 -10
  423. package/src/store/private-actions.js +37 -6
  424. package/src/store/private-selectors.js +21 -0
  425. package/src/store/reducer.js +38 -0
  426. package/src/store/selectors.js +107 -26
  427. package/src/store/test/actions.js +19 -8
  428. package/src/store/test/private-actions.js +17 -0
  429. package/src/store/test/reducer.js +25 -0
  430. package/src/store/test/selectors.js +130 -123
  431. package/src/store/utils.js +3 -10
  432. package/src/style.scss +4 -0
  433. package/build/components/duotone/components.js +0 -135
  434. package/build/components/duotone/components.js.map +0 -1
  435. package/build/components/duotone/index.js +0 -38
  436. package/build/components/duotone/index.js.map +0 -1
  437. package/build/components/global-styles/behaviors-panel.js +0 -64
  438. package/build/components/global-styles/behaviors-panel.js.map +0 -1
  439. package/build/components/inserter/reusable-blocks-tab.js +0 -85
  440. package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
  441. package/build/hooks/auto-inserting-blocks.js +0 -174
  442. package/build/hooks/auto-inserting-blocks.js.map +0 -1
  443. package/build/hooks/behaviors.js +0 -173
  444. package/build/hooks/behaviors.js.map +0 -1
  445. package/build-module/components/duotone/components.js +0 -126
  446. package/build-module/components/duotone/components.js.map +0 -1
  447. package/build-module/components/duotone/index.js +0 -3
  448. package/build-module/components/duotone/index.js.map +0 -1
  449. package/build-module/components/global-styles/behaviors-panel.js +0 -57
  450. package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
  451. package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
  452. package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
  453. package/build-module/hooks/auto-inserting-blocks.js +0 -167
  454. package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
  455. package/build-module/hooks/behaviors.js +0 -166
  456. package/build-module/hooks/behaviors.js.map +0 -1
  457. package/src/components/duotone/components.js +0 -133
  458. package/src/components/duotone/index.js +0 -7
  459. package/src/components/global-styles/behaviors-panel.js +0 -71
  460. package/src/components/inserter/reusable-blocks-tab.js +0 -84
  461. package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
  462. package/src/hooks/auto-inserting-blocks.js +0 -232
  463. package/src/hooks/behaviors.js +0 -206
@@ -1,166 +0,0 @@
1
- import { createElement, Fragment } from "@wordpress/element";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { addFilter } from '@wordpress/hooks';
6
- import { SelectControl } from '@wordpress/components';
7
- import { __ } from '@wordpress/i18n';
8
- import { hasBlockSupport } from '@wordpress/blocks';
9
- import { createHigherOrderComponent } from '@wordpress/compose';
10
- import { useSelect } from '@wordpress/data';
11
- import { useMemo } from '@wordpress/element';
12
-
13
- /**
14
- * Internal dependencies
15
- */
16
- import { store as blockEditorStore } from '../store';
17
- import { InspectorControls } from '../components';
18
- function BehaviorsControl({
19
- blockName,
20
- blockBehaviors,
21
- onChangeBehavior,
22
- onChangeAnimation,
23
- disabled = false
24
- }) {
25
- const {
26
- settings
27
- } = useSelect(select => {
28
- const {
29
- getSettings
30
- } = select(blockEditorStore);
31
- return {
32
- settings: getSettings()?.__experimentalFeatures?.blocks?.[blockName]?.behaviors || {}
33
- };
34
- }, [blockName]);
35
- const defaultBehaviors = {
36
- default: {
37
- value: 'default',
38
- label: __('Default')
39
- },
40
- noBehaviors: {
41
- value: '',
42
- label: __('No behaviors')
43
- }
44
- };
45
- const behaviorsOptions = Object.entries(settings).filter(([behaviorName, behaviorValue]) => hasBlockSupport(blockName, `behaviors.${behaviorName}`) && behaviorValue) // Filter out behaviors that are disabled.
46
- .map(([behaviorName]) => ({
47
- value: behaviorName,
48
- // Capitalize the first letter of the behavior name.
49
- label: `${behaviorName.charAt(0).toUpperCase()}${behaviorName.slice(1).toLowerCase()}`
50
- }));
51
- const options = [...Object.values(defaultBehaviors), ...behaviorsOptions];
52
- const {
53
- behaviors,
54
- behaviorsValue
55
- } = useMemo(() => {
56
- const mergedBehaviors = {
57
- ...(blockBehaviors || {})
58
- };
59
- let value = '';
60
- if (blockBehaviors === undefined) {
61
- value = 'default';
62
- }
63
- if (blockBehaviors?.lightbox.enabled) {
64
- value = 'lightbox';
65
- }
66
- return {
67
- behaviors: mergedBehaviors,
68
- behaviorsValue: value
69
- };
70
- }, [blockBehaviors]);
71
-
72
- // If every behavior is disabled, do not show the behaviors inspector control.
73
- if (behaviorsOptions.length === 0) {
74
- return null;
75
- }
76
- const helpText = disabled ? __('The lightbox behavior is disabled for linked images.') : '';
77
- return createElement(InspectorControls, {
78
- group: "advanced"
79
- }, createElement("div", null, createElement(SelectControl, {
80
- label: __('Behaviors')
81
- // At the moment we are only supporting one behavior (Lightbox)
82
- ,
83
- value: behaviorsValue,
84
- options: options,
85
- onChange: onChangeBehavior,
86
- hideCancelButton: true,
87
- help: helpText,
88
- size: "__unstable-large",
89
- disabled: disabled
90
- }), behaviorsValue === 'lightbox' && createElement(SelectControl, {
91
- label: __('Animation')
92
- // At the moment we are only supporting one behavior (Lightbox)
93
- ,
94
- value: behaviors?.lightbox.animation ? behaviors?.lightbox.animation : '',
95
- options: [{
96
- value: 'zoom',
97
- label: __('Zoom')
98
- }, {
99
- value: 'fade',
100
- label: __('Fade')
101
- }],
102
- onChange: onChangeAnimation,
103
- hideCancelButton: false,
104
- size: "__unstable-large",
105
- disabled: disabled
106
- })));
107
- }
108
-
109
- /**
110
- * Override the default edit UI to include a new block inspector control for
111
- * assigning behaviors to blocks if behaviors are enabled in the theme.json.
112
- *
113
- * Currently, only the `core/image` block is supported.
114
- *
115
- * @param {WPComponent} BlockEdit Original component.
116
- *
117
- * @return {WPComponent} Wrapped component.
118
- */
119
- export const withBehaviors = createHigherOrderComponent(BlockEdit => {
120
- return props => {
121
- const blockEdit = createElement(BlockEdit, {
122
- key: "edit",
123
- ...props
124
- });
125
- // Only add behaviors to blocks with support.
126
- if (!hasBlockSupport(props.name, 'behaviors')) {
127
- return blockEdit;
128
- }
129
- const blockHasLink = typeof props.attributes?.linkDestination !== 'undefined' && props.attributes?.linkDestination !== 'none';
130
- return createElement(Fragment, null, blockEdit, createElement(BehaviorsControl, {
131
- blockName: props.name,
132
- blockBehaviors: props.attributes.behaviors,
133
- onChangeBehavior: nextValue => {
134
- if (nextValue === 'default') {
135
- props.setAttributes({
136
- behaviors: undefined
137
- });
138
- } else {
139
- // If the user selects something, it means that they want to
140
- // change the default value (true) so we save it in the attributes.
141
- props.setAttributes({
142
- behaviors: {
143
- lightbox: {
144
- enabled: nextValue === 'lightbox',
145
- animation: nextValue === 'lightbox' ? 'zoom' : ''
146
- }
147
- }
148
- });
149
- }
150
- },
151
- onChangeAnimation: nextValue => {
152
- props.setAttributes({
153
- behaviors: {
154
- lightbox: {
155
- enabled: props.attributes.behaviors.lightbox.enabled,
156
- animation: nextValue
157
- }
158
- }
159
- });
160
- },
161
- disabled: blockHasLink
162
- }));
163
- };
164
- }, 'withBehaviors');
165
- addFilter('editor.BlockEdit', 'core/behaviors/with-inspector-control', withBehaviors);
166
- //# sourceMappingURL=behaviors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["addFilter","SelectControl","__","hasBlockSupport","createHigherOrderComponent","useSelect","useMemo","store","blockEditorStore","InspectorControls","BehaviorsControl","blockName","blockBehaviors","onChangeBehavior","onChangeAnimation","disabled","settings","select","getSettings","__experimentalFeatures","blocks","behaviors","defaultBehaviors","default","value","label","noBehaviors","behaviorsOptions","Object","entries","filter","behaviorName","behaviorValue","map","charAt","toUpperCase","slice","toLowerCase","options","values","behaviorsValue","mergedBehaviors","undefined","lightbox","enabled","length","helpText","createElement","group","onChange","hideCancelButton","help","size","animation","withBehaviors","BlockEdit","props","blockEdit","key","name","blockHasLink","attributes","linkDestination","Fragment","nextValue","setAttributes"],"sources":["@wordpress/block-editor/src/hooks/behaviors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\n\nfunction BehaviorsControl( {\n\tblockName,\n\tblockBehaviors,\n\tonChangeBehavior,\n\tonChangeAnimation,\n\tdisabled = false,\n} ) {\n\tconst { settings } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tsettings:\n\t\t\t\t\tgetSettings()?.__experimentalFeatures?.blocks?.[ blockName ]\n\t\t\t\t\t\t?.behaviors || {},\n\t\t\t};\n\t\t},\n\t\t[ blockName ]\n\t);\n\n\tconst defaultBehaviors = {\n\t\tdefault: {\n\t\t\tvalue: 'default',\n\t\t\tlabel: __( 'Default' ),\n\t\t},\n\t\tnoBehaviors: {\n\t\t\tvalue: '',\n\t\t\tlabel: __( 'No behaviors' ),\n\t\t},\n\t};\n\tconst behaviorsOptions = Object.entries( settings )\n\t\t.filter(\n\t\t\t( [ behaviorName, behaviorValue ] ) =>\n\t\t\t\thasBlockSupport( blockName, `behaviors.${ behaviorName }` ) &&\n\t\t\t\tbehaviorValue\n\t\t) // Filter out behaviors that are disabled.\n\t\t.map( ( [ behaviorName ] ) => ( {\n\t\t\tvalue: behaviorName,\n\t\t\t// Capitalize the first letter of the behavior name.\n\t\t\tlabel: `${ behaviorName.charAt( 0 ).toUpperCase() }${ behaviorName\n\t\t\t\t.slice( 1 )\n\t\t\t\t.toLowerCase() }`,\n\t\t} ) );\n\tconst options = [\n\t\t...Object.values( defaultBehaviors ),\n\t\t...behaviorsOptions,\n\t];\n\n\tconst { behaviors, behaviorsValue } = useMemo( () => {\n\t\tconst mergedBehaviors = {\n\t\t\t...( blockBehaviors || {} ),\n\t\t};\n\n\t\tlet value = '';\n\t\tif ( blockBehaviors === undefined ) {\n\t\t\tvalue = 'default';\n\t\t}\n\t\tif ( blockBehaviors?.lightbox.enabled ) {\n\t\t\tvalue = 'lightbox';\n\t\t}\n\t\treturn {\n\t\t\tbehaviors: mergedBehaviors,\n\t\t\tbehaviorsValue: value,\n\t\t};\n\t}, [ blockBehaviors ] );\n\n\t// If every behavior is disabled, do not show the behaviors inspector control.\n\tif ( behaviorsOptions.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst helpText = disabled\n\t\t? __( 'The lightbox behavior is disabled for linked images.' )\n\t\t: '';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<div>\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Behaviors' ) }\n\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\tvalue={ behaviorsValue }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ onChangeBehavior }\n\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t\thelp={ helpText }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t/>\n\t\t\t\t{ behaviorsValue === 'lightbox' && (\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Animation' ) }\n\t\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tbehaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t? behaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'zoom',\n\t\t\t\t\t\t\t\tlabel: __( 'Zoom' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'fade',\n\t\t\t\t\t\t\t\tlabel: __( 'Fade' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ onChangeAnimation }\n\t\t\t\t\t\thideCancelButton={ false }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning behaviors to blocks if behaviors are enabled in the theme.json.\n *\n * Currently, only the `core/image` block is supported.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withBehaviors = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\t// Only add behaviors to blocks with support.\n\t\tif ( ! hasBlockSupport( props.name, 'behaviors' ) ) {\n\t\t\treturn blockEdit;\n\t\t}\n\t\tconst blockHasLink =\n\t\t\ttypeof props.attributes?.linkDestination !== 'undefined' &&\n\t\t\tprops.attributes?.linkDestination !== 'none';\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockEdit }\n\t\t\t\t<BehaviorsControl\n\t\t\t\t\tblockName={ props.name }\n\t\t\t\t\tblockBehaviors={ props.attributes.behaviors }\n\t\t\t\t\tonChangeBehavior={ ( nextValue ) => {\n\t\t\t\t\t\tif ( nextValue === 'default' ) {\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If the user selects something, it means that they want to\n\t\t\t\t\t\t\t// change the default value (true) so we save it in the attributes.\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\t\tenabled: nextValue === 'lightbox',\n\t\t\t\t\t\t\t\t\t\tanimation:\n\t\t\t\t\t\t\t\t\t\t\tnextValue === 'lightbox'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'zoom'\n\t\t\t\t\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonChangeAnimation={ ( nextValue ) => {\n\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\tenabled:\n\t\t\t\t\t\t\t\t\t\tprops.attributes.behaviors.lightbox\n\t\t\t\t\t\t\t\t\t\t\t.enabled,\n\t\t\t\t\t\t\t\t\tanimation: nextValue,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdisabled={ blockHasLink }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n}, 'withBehaviors' );\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/behaviors/with-inspector-control',\n\twithBehaviors\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ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ACS,aAAa,CAAE;YACpB5C,SAAS,EAAE;cACVsB,QAAQ,EAAE;gBACTC,OAAO,EAAEoB,SAAS,KAAK,UAAU;gBACjCX,SAAS,EACRW,SAAS,KAAK,UAAU,GACrB,MAAM,GACN;cACL;YACD;UACD,CAAE,CAAC;QACJ;MACD,CAAG;MACHlD,iBAAiB,EAAKkD,SAAS,IAAM;QACpCR,KAAK,CAACS,aAAa,CAAE;UACpB5C,SAAS,EAAE;YACVsB,QAAQ,EAAE;cACTC,OAAO,EACNY,KAAK,CAACK,UAAU,CAACxC,SAAS,CAACsB,QAAQ,CACjCC,OAAO;cACVS,SAAS,EAAEW;YACZ;UACD;QACD,CAAE,CAAC;MACJ,CAAG;MACHjD,QAAQ,EAAG6C;IAAc,CACzB,CACA,CAAC;EAEL,CAAC;AACF,CAAC,EAAE,eAAgB,CAAC;AAEpB5D,SAAS,CACR,kBAAkB,EAClB,uCAAuC,EACvCsD,aACD,CAAC"}
@@ -1,133 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { SVG } from '@wordpress/components';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import { __unstableGetValuesFromColors as getValuesFromColors } from './index';
10
-
11
- /**
12
- * SVG and stylesheet needed for rendering the duotone filter.
13
- *
14
- * @param {Object} props Duotone props.
15
- * @param {string} props.selector Selector to apply the filter to.
16
- * @param {string} props.id Unique id for this duotone filter.
17
- *
18
- * @return {WPElement} Duotone element.
19
- */
20
- export function DuotoneStylesheet( { selector, id } ) {
21
- const css = `
22
- ${ selector } {
23
- filter: url( #${ id } );
24
- }
25
- `;
26
- return <style>{ css }</style>;
27
- }
28
-
29
- /**
30
- * Stylesheet for disabling a global styles duotone filter.
31
- *
32
- * @param {Object} props Duotone props.
33
- * @param {string} props.selector Selector to disable the filter for.
34
- *
35
- * @return {WPElement} Filter none style element.
36
- */
37
- export function DuotoneUnsetStylesheet( { selector } ) {
38
- const css = `
39
- ${ selector } {
40
- filter: none;
41
- }
42
- `;
43
- return <style>{ css }</style>;
44
- }
45
-
46
- /**
47
- * The SVG part of the duotone filter.
48
- *
49
- * @param {Object} props Duotone props.
50
- * @param {string} props.id Unique id for this duotone filter.
51
- * @param {string[]} props.colors Color strings from dark to light.
52
- *
53
- * @return {WPElement} Duotone SVG.
54
- */
55
- export function DuotoneFilter( { id, colors } ) {
56
- const values = getValuesFromColors( colors );
57
- return (
58
- <SVG
59
- xmlnsXlink="http://www.w3.org/1999/xlink"
60
- viewBox="0 0 0 0"
61
- width="0"
62
- height="0"
63
- focusable="false"
64
- role="none"
65
- style={ {
66
- visibility: 'hidden',
67
- position: 'absolute',
68
- left: '-9999px',
69
- overflow: 'hidden',
70
- } }
71
- >
72
- <defs>
73
- <filter id={ id }>
74
- <feColorMatrix
75
- // Use sRGB instead of linearRGB so transparency looks correct.
76
- colorInterpolationFilters="sRGB"
77
- type="matrix"
78
- // Use perceptual brightness to convert to grayscale.
79
- values="
80
- .299 .587 .114 0 0
81
- .299 .587 .114 0 0
82
- .299 .587 .114 0 0
83
- .299 .587 .114 0 0
84
- "
85
- />
86
- <feComponentTransfer
87
- // Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
88
- colorInterpolationFilters="sRGB"
89
- >
90
- <feFuncR
91
- type="table"
92
- tableValues={ values.r.join( ' ' ) }
93
- />
94
- <feFuncG
95
- type="table"
96
- tableValues={ values.g.join( ' ' ) }
97
- />
98
- <feFuncB
99
- type="table"
100
- tableValues={ values.b.join( ' ' ) }
101
- />
102
- <feFuncA
103
- type="table"
104
- tableValues={ values.a.join( ' ' ) }
105
- />
106
- </feComponentTransfer>
107
- <feComposite
108
- // Re-mask the image with the original transparency since the feColorMatrix above loses that information.
109
- in2="SourceGraphic"
110
- operator="in"
111
- />
112
- </filter>
113
- </defs>
114
- </SVG>
115
- );
116
- }
117
-
118
- /**
119
- * SVG from a duotone preset
120
- *
121
- * @param {Object} props Duotone props.
122
- * @param {Object} props.preset Duotone preset settings.
123
- *
124
- * @return {WPElement} Duotone element.
125
- */
126
- export function PresetDuotoneFilter( { preset } ) {
127
- return (
128
- <DuotoneFilter
129
- id={ `wp-duotone-${ preset.slug }` }
130
- colors={ preset.colors }
131
- />
132
- );
133
- }
@@ -1,7 +0,0 @@
1
- export { getValuesFromColors as __unstableGetValuesFromColors } from './utils';
2
- export {
3
- DuotoneFilter as __unstableDuotoneFilter,
4
- PresetDuotoneFilter as __unstablePresetDuotoneFilter,
5
- DuotoneStylesheet as __unstableDuotoneStylesheet,
6
- DuotoneUnsetStylesheet as __unstableDuotoneUnsetStylesheet,
7
- } from './components';
@@ -1,71 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { SelectControl } from '@wordpress/components';
5
- import { __ } from '@wordpress/i18n';
6
-
7
- export default function ( { onChange, value, behaviors } ) {
8
- const defaultBehaviors = {
9
- default: {
10
- value: 'default',
11
- label: __( 'Default' ),
12
- },
13
- noBehaviors: {
14
- value: '',
15
- label: __( 'No behaviors' ),
16
- },
17
- };
18
-
19
- const behaviorsOptions = Object.entries( behaviors ).map(
20
- ( [ behaviorName ] ) => ( {
21
- value: behaviorName,
22
- // Capitalize the first letter of the behavior name.
23
- label: `${ behaviorName.charAt( 0 ).toUpperCase() }${ behaviorName
24
- .slice( 1 )
25
- .toLowerCase() }`,
26
- } )
27
- );
28
-
29
- const options = [
30
- ...Object.values( defaultBehaviors ),
31
- ...behaviorsOptions,
32
- ];
33
-
34
- const animations = [
35
- {
36
- value: 'zoom',
37
- label: __( 'Zoom' ),
38
- },
39
- {
40
- value: 'fade',
41
- label: __( 'Fade' ),
42
- },
43
- ];
44
- return (
45
- <div style={ { marginTop: '2rem' } }>
46
- <SelectControl
47
- label={ __( 'Behaviors' ) }
48
- // At the moment we are only supporting one behavior (Lightbox)
49
- value={ value }
50
- options={ options }
51
- onChange={ onChange }
52
- hideCancelButton={ true }
53
- size="__unstable-large"
54
- />
55
- { value === 'lightbox' && (
56
- <SelectControl
57
- label={ __( 'Animation' ) }
58
- value={
59
- behaviors?.lightbox.animation
60
- ? behaviors?.lightbox.animation
61
- : ''
62
- }
63
- options={ animations }
64
- onChange={ onChange }
65
- hideCancelButton={ false }
66
- size="__unstable-large"
67
- />
68
- ) }
69
- </div>
70
- );
71
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useMemo } from '@wordpress/element';
5
- import { __ } from '@wordpress/i18n';
6
- import { addQueryArgs } from '@wordpress/url';
7
- import { Button } from '@wordpress/components';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import BlockTypesList from '../block-types-list';
13
- import InserterPanel from './panel';
14
- import InserterNoResults from './no-results';
15
- import useBlockTypesState from './hooks/use-block-types-state';
16
- import ReusableBlocksRenameHint from './reusable-block-rename-hint';
17
-
18
- function ReusableBlocksList( { onHover, onInsert, rootClientId } ) {
19
- const [ items, , , onSelectItem ] = useBlockTypesState(
20
- rootClientId,
21
- onInsert
22
- );
23
-
24
- const filteredItems = useMemo( () => {
25
- return items.filter(
26
- ( { category, syncStatus } ) =>
27
- category === 'reusable' && syncStatus !== 'unsynced'
28
- );
29
- }, [ items ] );
30
-
31
- if ( filteredItems.length === 0 ) {
32
- return <InserterNoResults />;
33
- }
34
-
35
- return (
36
- <InserterPanel title={ __( 'Synced patterns' ) }>
37
- <BlockTypesList
38
- items={ filteredItems }
39
- onSelect={ onSelectItem }
40
- onHover={ onHover }
41
- label={ __( 'Synced patterns' ) }
42
- />
43
- </InserterPanel>
44
- );
45
- }
46
-
47
- // The unwrapped component is only exported for use by unit tests.
48
- /**
49
- * List of reusable blocks shown in the "Reusable" tab of the inserter.
50
- *
51
- * @param {Object} props Component props.
52
- * @param {?string} props.rootClientId Client id of block to insert into.
53
- * @param {Function} props.onInsert Callback to run when item is inserted.
54
- * @param {Function} props.onHover Callback to run when item is hovered.
55
- *
56
- * @return {WPComponent} The component.
57
- */
58
- export function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {
59
- return (
60
- <>
61
- <div className="block-editor-inserter__hint">
62
- <ReusableBlocksRenameHint />
63
- </div>
64
- <ReusableBlocksList
65
- onHover={ onHover }
66
- onInsert={ onInsert }
67
- rootClientId={ rootClientId }
68
- />
69
- <div className="block-editor-inserter__manage-reusable-blocks-container">
70
- <Button
71
- className="block-editor-inserter__manage-reusable-blocks"
72
- variant="secondary"
73
- href={ addQueryArgs( 'edit.php', {
74
- post_type: 'wp_block',
75
- } ) }
76
- >
77
- { __( 'Manage my patterns' ) }
78
- </Button>
79
- </div>
80
- </>
81
- );
82
- }
83
-
84
- export default ReusableBlocksTab;
@@ -1,73 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { render, screen } from '@testing-library/react';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { registerBlockType, unregisterBlockType } from '@wordpress/blocks';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import { ReusableBlocksTab } from '../reusable-blocks-tab';
15
- import items, { categories, collections } from './fixtures';
16
- import useBlockTypesState from '../hooks/use-block-types-state';
17
-
18
- jest.mock( '../hooks/use-block-types-state', () => {
19
- // This allows us to tweak the returned value on each test.
20
- const mock = jest.fn();
21
- return mock;
22
- } );
23
-
24
- describe( 'InserterMenu', () => {
25
- beforeAll( () => {
26
- registerBlockType( 'core/block', {
27
- save: () => {},
28
- title: 'reusable block',
29
- edit: () => {},
30
- } );
31
- } );
32
-
33
- afterAll( () => {
34
- unregisterBlockType( 'core/block' );
35
- } );
36
-
37
- beforeEach( () => {
38
- useBlockTypesState.mockImplementation( () => [
39
- items,
40
- categories,
41
- collections,
42
- ] );
43
- } );
44
-
45
- it( 'should show nothing if there are no items', () => {
46
- const noItems = [];
47
- useBlockTypesState.mockImplementation( () => [
48
- noItems,
49
- categories,
50
- collections,
51
- ] );
52
-
53
- render( <ReusableBlocksTab filterValue="random" /> );
54
-
55
- expect( screen.queryByRole( 'option' ) ).not.toBeInTheDocument();
56
- } );
57
-
58
- it( 'should list reusable blocks', () => {
59
- render( <ReusableBlocksTab /> );
60
-
61
- expect(
62
- screen.getByRole( 'option', { name: 'My reusable block' } )
63
- ).toBeVisible();
64
- } );
65
-
66
- it( 'should trim whitespace of search terms', () => {
67
- render( <ReusableBlocksTab filterValue=" my reusable" /> );
68
-
69
- expect(
70
- screen.getByRole( 'option', { name: 'My reusable block' } )
71
- ).toBeVisible();
72
- } );
73
- } );