@wordpress/block-editor 12.17.0 → 12.18.1

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 (421) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +32 -0
  3. package/build/components/block-draggable/index.js +11 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-edit/context.js +3 -1
  6. package/build/components/block-edit/context.js.map +1 -1
  7. package/build/components/block-edit/index.js +4 -2
  8. package/build/components/block-edit/index.js.map +1 -1
  9. package/build/components/block-editing-mode/index.js +6 -3
  10. package/build/components/block-editing-mode/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +5 -2
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/block.js +4 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +9 -5
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-list/index.js +30 -4
  18. package/build/components/block-list/index.js.map +1 -1
  19. package/build/components/block-list/private-block-context.js +1 -1
  20. package/build/components/block-list/private-block-context.js.map +1 -1
  21. package/build/components/block-list/use-in-between-inserter.js +1 -1
  22. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  23. package/build/components/block-lock/toolbar.js +8 -2
  24. package/build/components/block-lock/toolbar.js.map +1 -1
  25. package/build/components/block-popover/inbetween.js +15 -3
  26. package/build/components/block-popover/inbetween.js.map +1 -1
  27. package/build/components/block-preview/auto.js +1 -1
  28. package/build/components/block-preview/auto.js.map +1 -1
  29. package/build/components/block-removal-warning-modal/index.js +3 -2
  30. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -4
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/block-switcher/block-transformations-menu.js +12 -1
  34. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  35. package/build/components/block-switcher/index.js +119 -90
  36. package/build/components/block-switcher/index.js.map +1 -1
  37. package/build/components/block-tools/insertion-point.js +10 -3
  38. package/build/components/block-tools/insertion-point.js.map +1 -1
  39. package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  40. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  41. package/build/components/font-sizes/fluid-utils.js +7 -1
  42. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  43. package/build/components/global-styles/border-panel.js +5 -14
  44. package/build/components/global-styles/border-panel.js.map +1 -1
  45. package/build/components/global-styles/dimensions-panel.js +30 -5
  46. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  47. package/build/components/global-styles/effects-panel.js +7 -1
  48. package/build/components/global-styles/effects-panel.js.map +1 -1
  49. package/build/components/global-styles/hooks.js +11 -8
  50. package/build/components/global-styles/hooks.js.map +1 -1
  51. package/build/components/global-styles/typography-panel.js +31 -14
  52. package/build/components/global-styles/typography-panel.js.map +1 -1
  53. package/build/components/global-styles/use-global-styles-output.js +6 -0
  54. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  55. package/build/components/iframe/get-compatibility-styles.js +99 -0
  56. package/build/components/iframe/get-compatibility-styles.js.map +1 -0
  57. package/build/components/iframe/index.js +2 -3
  58. package/build/components/iframe/index.js.map +1 -1
  59. package/build/components/index.js +16 -2
  60. package/build/components/index.js.map +1 -1
  61. package/build/components/index.native.js +16 -2
  62. package/build/components/index.native.js.map +1 -1
  63. package/build/components/inspector-controls/groups.js +2 -0
  64. package/build/components/inspector-controls/groups.js.map +1 -1
  65. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  66. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  67. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  68. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  69. package/build/components/link-control/link-preview.js +30 -26
  70. package/build/components/link-control/link-preview.js.map +1 -1
  71. package/build/components/link-control/search-input.js +1 -9
  72. package/build/components/link-control/search-input.js.map +1 -1
  73. package/build/components/list-view/block-contents.js +3 -1
  74. package/build/components/list-view/block-contents.js.map +1 -1
  75. package/build/components/list-view/block.js +10 -1
  76. package/build/components/list-view/block.js.map +1 -1
  77. package/build/components/list-view/branch.js +29 -8
  78. package/build/components/list-view/branch.js.map +1 -1
  79. package/build/components/list-view/drop-indicator.js +100 -32
  80. package/build/components/list-view/drop-indicator.js.map +1 -1
  81. package/build/components/list-view/index.js +52 -4
  82. package/build/components/list-view/index.js.map +1 -1
  83. package/build/components/list-view/leaf.js +2 -2
  84. package/build/components/list-view/leaf.js.map +1 -1
  85. package/build/components/list-view/use-list-view-block-indexes.js +30 -0
  86. package/build/components/list-view/use-list-view-block-indexes.js.map +1 -0
  87. package/build/components/list-view/use-list-view-drop-zone.js +56 -5
  88. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  89. package/build/components/list-view/utils.js +92 -0
  90. package/build/components/list-view/utils.js.map +1 -1
  91. package/build/components/provider/index.js +1 -1
  92. package/build/components/provider/index.js.map +1 -1
  93. package/build/components/recursion-provider/index.js +21 -0
  94. package/build/components/recursion-provider/index.js.map +1 -1
  95. package/build/components/rich-text/index.js +30 -6
  96. package/build/components/rich-text/index.js.map +1 -1
  97. package/build/components/rich-text/native/index.native.js +9 -9
  98. package/build/components/rich-text/native/index.native.js.map +1 -1
  99. package/build/components/use-block-drop-zone/index.js +30 -7
  100. package/build/components/use-block-drop-zone/index.js.map +1 -1
  101. package/build/components/use-on-block-drop/index.js +50 -8
  102. package/build/components/use-on-block-drop/index.js.map +1 -1
  103. package/build/hooks/block-hooks.js +5 -14
  104. package/build/hooks/block-hooks.js.map +1 -1
  105. package/build/hooks/content-lock-ui.js +17 -42
  106. package/build/hooks/content-lock-ui.js.map +1 -1
  107. package/build/hooks/dimensions.js +71 -1
  108. package/build/hooks/dimensions.js.map +1 -1
  109. package/build/hooks/effects.js +66 -0
  110. package/build/hooks/effects.js.map +1 -0
  111. package/build/hooks/index.js +17 -4
  112. package/build/hooks/index.js.map +1 -1
  113. package/build/hooks/index.native.js +13 -0
  114. package/build/hooks/index.native.js.map +1 -1
  115. package/build/hooks/style.js +9 -2
  116. package/build/hooks/style.js.map +1 -1
  117. package/build/hooks/supports.js +2 -1
  118. package/build/hooks/supports.js.map +1 -1
  119. package/build/hooks/typography.native.js +2 -2
  120. package/build/hooks/typography.native.js.map +1 -1
  121. package/build/hooks/use-bindings-attributes.js +115 -0
  122. package/build/hooks/use-bindings-attributes.js.map +1 -0
  123. package/build/hooks/use-shadow-props.js +46 -0
  124. package/build/hooks/use-shadow-props.js.map +1 -0
  125. package/build/hooks/utils.js +12 -7
  126. package/build/hooks/utils.js.map +1 -1
  127. package/build/index.js +14 -0
  128. package/build/index.js.map +1 -1
  129. package/build/store/actions.js +10 -6
  130. package/build/store/actions.js.map +1 -1
  131. package/build/store/index.js +2 -0
  132. package/build/store/index.js.map +1 -1
  133. package/build/store/private-actions.js +37 -0
  134. package/build/store/private-actions.js.map +1 -1
  135. package/build/store/private-selectors.js +60 -9
  136. package/build/store/private-selectors.js.map +1 -1
  137. package/build/store/reducer.js +44 -3
  138. package/build/store/reducer.js.map +1 -1
  139. package/build/store/resolvers.js +27 -0
  140. package/build/store/resolvers.js.map +1 -0
  141. package/build/store/selectors.js +94 -56
  142. package/build/store/selectors.js.map +1 -1
  143. package/build/store/utils.js +5 -26
  144. package/build/store/utils.js.map +1 -1
  145. package/build/utils/index.js +0 -16
  146. package/build/utils/index.js.map +1 -1
  147. package/build/utils/math.js +13 -0
  148. package/build/utils/math.js.map +1 -1
  149. package/build/utils/object.js +17 -0
  150. package/build/utils/object.js.map +1 -1
  151. package/build/utils/transform-styles/index.js +37 -27
  152. package/build/utils/transform-styles/index.js.map +1 -1
  153. package/build-module/components/block-draggable/index.js +11 -3
  154. package/build-module/components/block-draggable/index.js.map +1 -1
  155. package/build-module/components/block-edit/context.js +1 -0
  156. package/build-module/components/block-edit/context.js.map +1 -1
  157. package/build-module/components/block-edit/index.js +5 -3
  158. package/build-module/components/block-edit/index.js.map +1 -1
  159. package/build-module/components/block-editing-mode/index.js +7 -4
  160. package/build-module/components/block-editing-mode/index.js.map +1 -1
  161. package/build-module/components/block-inspector/index.js +5 -2
  162. package/build-module/components/block-inspector/index.js.map +1 -1
  163. package/build-module/components/block-list/block.js +6 -5
  164. package/build-module/components/block-list/block.js.map +1 -1
  165. package/build-module/components/block-list/block.native.js +11 -7
  166. package/build-module/components/block-list/block.native.js.map +1 -1
  167. package/build-module/components/block-list/index.js +31 -5
  168. package/build-module/components/block-list/index.js.map +1 -1
  169. package/build-module/components/block-list/private-block-context.js +1 -1
  170. package/build-module/components/block-list/private-block-context.js.map +1 -1
  171. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  172. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  173. package/build-module/components/block-lock/toolbar.js +8 -2
  174. package/build-module/components/block-lock/toolbar.js.map +1 -1
  175. package/build-module/components/block-popover/inbetween.js +15 -3
  176. package/build-module/components/block-popover/inbetween.js.map +1 -1
  177. package/build-module/components/block-preview/auto.js +3 -3
  178. package/build-module/components/block-preview/auto.js.map +1 -1
  179. package/build-module/components/block-removal-warning-modal/index.js +3 -2
  180. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  181. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
  182. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  183. package/build-module/components/block-switcher/block-transformations-menu.js +12 -1
  184. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  185. package/build-module/components/block-switcher/index.js +116 -86
  186. package/build-module/components/block-switcher/index.js.map +1 -1
  187. package/build-module/components/block-tools/insertion-point.js +10 -3
  188. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  189. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  190. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  191. package/build-module/components/font-sizes/fluid-utils.js +7 -1
  192. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  193. package/build-module/components/global-styles/border-panel.js +5 -14
  194. package/build-module/components/global-styles/border-panel.js.map +1 -1
  195. package/build-module/components/global-styles/dimensions-panel.js +30 -5
  196. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  197. package/build-module/components/global-styles/effects-panel.js +7 -1
  198. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  199. package/build-module/components/global-styles/hooks.js +11 -8
  200. package/build-module/components/global-styles/hooks.js.map +1 -1
  201. package/build-module/components/global-styles/typography-panel.js +32 -15
  202. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  203. package/build-module/components/global-styles/use-global-styles-output.js +6 -0
  204. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  205. package/build-module/components/iframe/get-compatibility-styles.js +93 -0
  206. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -0
  207. package/build-module/components/iframe/index.js +2 -3
  208. package/build-module/components/iframe/index.js.map +1 -1
  209. package/build-module/components/index.js +1 -1
  210. package/build-module/components/index.js.map +1 -1
  211. package/build-module/components/index.native.js +1 -1
  212. package/build-module/components/index.native.js.map +1 -1
  213. package/build-module/components/inspector-controls/groups.js +2 -0
  214. package/build-module/components/inspector-controls/groups.js.map +1 -1
  215. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  216. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  217. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  218. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  219. package/build-module/components/link-control/link-preview.js +32 -28
  220. package/build-module/components/link-control/link-preview.js.map +1 -1
  221. package/build-module/components/link-control/search-input.js +1 -8
  222. package/build-module/components/link-control/search-input.js.map +1 -1
  223. package/build-module/components/list-view/block-contents.js +3 -1
  224. package/build-module/components/list-view/block-contents.js.map +1 -1
  225. package/build-module/components/list-view/block.js +10 -1
  226. package/build-module/components/list-view/block.js.map +1 -1
  227. package/build-module/components/list-view/branch.js +30 -9
  228. package/build-module/components/list-view/branch.js.map +1 -1
  229. package/build-module/components/list-view/drop-indicator.js +99 -32
  230. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  231. package/build-module/components/list-view/index.js +54 -6
  232. package/build-module/components/list-view/index.js.map +1 -1
  233. package/build-module/components/list-view/leaf.js +2 -2
  234. package/build-module/components/list-view/leaf.js.map +1 -1
  235. package/build-module/components/list-view/use-list-view-block-indexes.js +23 -0
  236. package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -0
  237. package/build-module/components/list-view/use-list-view-drop-zone.js +58 -7
  238. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  239. package/build-module/components/list-view/utils.js +91 -0
  240. package/build-module/components/list-view/utils.js.map +1 -1
  241. package/build-module/components/provider/index.js +1 -1
  242. package/build-module/components/provider/index.js.map +1 -1
  243. package/build-module/components/recursion-provider/index.js +17 -0
  244. package/build-module/components/recursion-provider/index.js.map +1 -1
  245. package/build-module/components/rich-text/index.js +30 -6
  246. package/build-module/components/rich-text/index.js.map +1 -1
  247. package/build-module/components/rich-text/native/index.native.js +9 -9
  248. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  249. package/build-module/components/use-block-drop-zone/index.js +31 -8
  250. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  251. package/build-module/components/use-on-block-drop/index.js +51 -9
  252. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  253. package/build-module/hooks/block-hooks.js +5 -14
  254. package/build-module/hooks/block-hooks.js.map +1 -1
  255. package/build-module/hooks/content-lock-ui.js +19 -43
  256. package/build-module/hooks/content-lock-ui.js.map +1 -1
  257. package/build-module/hooks/dimensions.js +70 -2
  258. package/build-module/hooks/dimensions.js.map +1 -1
  259. package/build-module/hooks/effects.js +51 -0
  260. package/build-module/hooks/effects.js.map +1 -0
  261. package/build-module/hooks/index.js +5 -3
  262. package/build-module/hooks/index.js.map +1 -1
  263. package/build-module/hooks/index.native.js +1 -0
  264. package/build-module/hooks/index.native.js.map +1 -1
  265. package/build-module/hooks/style.js +9 -2
  266. package/build-module/hooks/style.js.map +1 -1
  267. package/build-module/hooks/supports.js +2 -1
  268. package/build-module/hooks/supports.js.map +1 -1
  269. package/build-module/hooks/typography.native.js +2 -2
  270. package/build-module/hooks/typography.native.js.map +1 -1
  271. package/build-module/hooks/use-bindings-attributes.js +112 -0
  272. package/build-module/hooks/use-bindings-attributes.js.map +1 -0
  273. package/build-module/hooks/use-shadow-props.js +39 -0
  274. package/build-module/hooks/use-shadow-props.js.map +1 -0
  275. package/build-module/hooks/utils.js +14 -9
  276. package/build-module/hooks/utils.js.map +1 -1
  277. package/build-module/index.js +1 -1
  278. package/build-module/index.js.map +1 -1
  279. package/build-module/store/actions.js +10 -6
  280. package/build-module/store/actions.js.map +1 -1
  281. package/build-module/store/index.js +2 -0
  282. package/build-module/store/index.js.map +1 -1
  283. package/build-module/store/private-actions.js +35 -0
  284. package/build-module/store/private-actions.js.map +1 -1
  285. package/build-module/store/private-selectors.js +53 -8
  286. package/build-module/store/private-selectors.js.map +1 -1
  287. package/build-module/store/reducer.js +43 -3
  288. package/build-module/store/reducer.js.map +1 -1
  289. package/build-module/store/resolvers.js +20 -0
  290. package/build-module/store/resolvers.js.map +1 -0
  291. package/build-module/store/selectors.js +89 -52
  292. package/build-module/store/selectors.js.map +1 -1
  293. package/build-module/store/utils.js +3 -23
  294. package/build-module/store/utils.js.map +1 -1
  295. package/build-module/utils/index.js +0 -1
  296. package/build-module/utils/index.js.map +1 -1
  297. package/build-module/utils/math.js +12 -0
  298. package/build-module/utils/math.js.map +1 -1
  299. package/build-module/utils/object.js +16 -0
  300. package/build-module/utils/object.js.map +1 -1
  301. package/build-module/utils/transform-styles/index.js +36 -27
  302. package/build-module/utils/transform-styles/index.js.map +1 -1
  303. package/build-style/content-rtl.css +33 -16
  304. package/build-style/content.css +33 -16
  305. package/build-style/default-editor-styles-rtl.css +1 -1
  306. package/build-style/default-editor-styles.css +1 -1
  307. package/build-style/style-rtl.css +169 -114
  308. package/build-style/style.css +169 -114
  309. package/package.json +31 -31
  310. package/src/components/block-canvas/style.scss +8 -1
  311. package/src/components/block-draggable/index.js +16 -5
  312. package/src/components/block-edit/context.js +1 -0
  313. package/src/components/block-edit/index.js +4 -0
  314. package/src/components/block-editing-mode/index.js +12 -7
  315. package/src/components/block-inspector/index.js +5 -2
  316. package/src/components/block-list/block.js +5 -4
  317. package/src/components/block-list/block.native.js +13 -3
  318. package/src/components/block-list/content.scss +34 -5
  319. package/src/components/block-list/index.js +52 -16
  320. package/src/components/block-list/private-block-context.js +1 -1
  321. package/src/components/block-list/use-in-between-inserter.js +1 -2
  322. package/src/components/block-lock/toolbar.js +10 -2
  323. package/src/components/block-popover/inbetween.js +22 -2
  324. package/src/components/block-preview/auto.js +3 -3
  325. package/src/components/block-removal-warning-modal/index.js +3 -2
  326. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -7
  327. package/src/components/block-switcher/block-transformations-menu.js +18 -1
  328. package/src/components/block-switcher/index.js +133 -111
  329. package/src/components/block-switcher/style.scss +6 -4
  330. package/src/components/block-switcher/test/index.js +113 -230
  331. package/src/components/block-toolbar/style.scss +22 -18
  332. package/src/components/block-tools/insertion-point.js +15 -2
  333. package/src/components/block-tools/style.scss +8 -7
  334. package/src/components/dimensions-tool/aspect-ratio-tool.js +4 -1
  335. package/src/components/font-sizes/fluid-utils.js +8 -2
  336. package/src/components/font-sizes/test/fluid-utils.js +9 -0
  337. package/src/components/global-styles/border-panel.js +7 -17
  338. package/src/components/global-styles/dimensions-panel.js +50 -1
  339. package/src/components/global-styles/effects-panel.js +16 -1
  340. package/src/components/global-styles/hooks.js +11 -6
  341. package/src/components/global-styles/typography-panel.js +45 -13
  342. package/src/components/global-styles/use-global-styles-output.js +6 -0
  343. package/src/components/iframe/get-compatibility-styles.js +120 -0
  344. package/src/components/iframe/index.js +2 -3
  345. package/src/components/index.js +4 -2
  346. package/src/components/index.native.js +4 -2
  347. package/src/components/inspector-controls/groups.js +2 -0
  348. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  349. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -0
  350. package/src/components/link-control/link-preview.js +31 -55
  351. package/src/components/link-control/search-input.js +1 -9
  352. package/src/components/link-control/style.scss +31 -85
  353. package/src/components/link-control/test/index.js +2 -1
  354. package/src/components/list-view/block-contents.js +5 -1
  355. package/src/components/list-view/block.js +9 -0
  356. package/src/components/list-view/branch.js +30 -10
  357. package/src/components/list-view/drop-indicator.js +139 -46
  358. package/src/components/list-view/index.js +74 -3
  359. package/src/components/list-view/leaf.js +2 -2
  360. package/src/components/list-view/style.scss +102 -13
  361. package/src/components/list-view/test/use-list-view-drop-zone.js +4 -0
  362. package/src/components/list-view/test/utils.js +218 -1
  363. package/src/components/list-view/use-list-view-block-indexes.js +29 -0
  364. package/src/components/list-view/use-list-view-drop-zone.js +78 -6
  365. package/src/components/list-view/utils.js +116 -0
  366. package/src/components/provider/index.js +3 -1
  367. package/src/components/recursion-provider/README.md +2 -2
  368. package/src/components/recursion-provider/index.js +17 -0
  369. package/src/components/rich-text/index.js +48 -10
  370. package/src/components/rich-text/native/index.native.js +10 -10
  371. package/src/components/use-block-drop-zone/index.js +60 -19
  372. package/src/components/use-block-drop-zone/test/index.js +32 -61
  373. package/src/components/use-on-block-drop/index.js +92 -11
  374. package/src/hooks/block-hooks.js +5 -17
  375. package/src/hooks/content-lock-ui.js +15 -55
  376. package/src/hooks/dimensions.js +74 -3
  377. package/src/hooks/effects.js +57 -0
  378. package/src/hooks/index.js +4 -2
  379. package/src/hooks/index.native.js +1 -0
  380. package/src/hooks/style.js +12 -0
  381. package/src/hooks/supports.js +2 -0
  382. package/src/hooks/test/effects.js +39 -0
  383. package/src/hooks/typography.native.js +2 -2
  384. package/src/hooks/use-bindings-attributes.js +148 -0
  385. package/src/hooks/use-shadow-props.js +37 -0
  386. package/src/hooks/utils.js +30 -10
  387. package/src/index.js +2 -0
  388. package/src/store/actions.js +9 -4
  389. package/src/store/index.js +2 -0
  390. package/src/store/private-actions.js +32 -0
  391. package/src/store/private-selectors.js +78 -21
  392. package/src/store/reducer.js +49 -2
  393. package/src/store/resolvers.js +17 -0
  394. package/src/store/selectors.js +169 -161
  395. package/src/store/test/registry-selectors.js +431 -0
  396. package/src/store/test/selectors.js +14 -400
  397. package/src/store/utils.js +10 -33
  398. package/src/style.scss +0 -1
  399. package/src/utils/index.js +0 -1
  400. package/src/utils/math.js +12 -0
  401. package/src/utils/object.js +16 -0
  402. package/src/utils/transform-styles/index.js +52 -37
  403. package/tsconfig.tsbuildinfo +1 -1
  404. package/build/components/iframe/use-compatibility-styles.js +0 -100
  405. package/build/components/iframe/use-compatibility-styles.js.map +0 -1
  406. package/build/hooks/custom-fields.js +0 -106
  407. package/build/hooks/custom-fields.js.map +0 -1
  408. package/build/utils/block-variation-transforms.js +0 -42
  409. package/build/utils/block-variation-transforms.js.map +0 -1
  410. package/build-module/components/iframe/use-compatibility-styles.js +0 -94
  411. package/build-module/components/iframe/use-compatibility-styles.js.map +0 -1
  412. package/build-module/hooks/custom-fields.js +0 -99
  413. package/build-module/hooks/custom-fields.js.map +0 -1
  414. package/build-module/utils/block-variation-transforms.js +0 -35
  415. package/build-module/utils/block-variation-transforms.js.map +0 -1
  416. package/src/components/block-switcher/test/__snapshots__/index.js.snap +0 -116
  417. package/src/components/contrast-checker/style.scss +0 -3
  418. package/src/components/iframe/use-compatibility-styles.js +0 -122
  419. package/src/hooks/custom-fields.js +0 -115
  420. package/src/utils/block-variation-transforms.js +0 -38
  421. package/src/utils/test/block-variation-transforms.js +0 -94
@@ -1 +0,0 @@
1
- {"version":3,"names":["matchesAttributes","blockAttributes","variation","Object","entries","every","key","value","__experimentalGetMatchingVariation","variations","matches","filter","attributes","keys","length"],"sources":["@wordpress/block-editor/src/utils/block-variation-transforms.js"],"sourcesContent":["/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\nfunction matchesAttributes( blockAttributes, variation ) {\n\treturn Object.entries( variation ).every( ( [ key, value ] ) => {\n\t\tif (\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof blockAttributes[ key ] === 'object'\n\t\t) {\n\t\t\treturn matchesAttributes( blockAttributes[ key ], value );\n\t\t}\n\t\treturn blockAttributes[ key ] === value;\n\t} );\n}\n\n/**\n * Matches the provided block variations with a block's attributes. If no match\n * or more than one matches are found it returns `undefined`. If a single match is\n * found it returns it.\n *\n * This is a simple implementation for now as it takes into account only the attributes\n * of a block variation and not `InnerBlocks`.\n *\n * @param {Object} blockAttributes - The block attributes to try to find a match.\n * @param {WPBlockVariation[]} variations - A list of block variations to test for a match.\n * @return {WPBlockVariation | undefined} - If a match is found returns it. If not or more than one matches are found returns `undefined`.\n */\nexport const __experimentalGetMatchingVariation = (\n\tblockAttributes,\n\tvariations\n) => {\n\tif ( ! variations || ! blockAttributes ) return;\n\tconst matches = variations.filter( ( { attributes } ) => {\n\t\tif ( ! attributes || ! Object.keys( attributes ).length ) return false;\n\t\treturn matchesAttributes( blockAttributes, attributes );\n\t} );\n\tif ( matches.length !== 1 ) return;\n\treturn matches[ 0 ];\n};\n"],"mappings":"AAAA;;AAEA,SAASA,iBAAiBA,CAAEC,eAAe,EAAEC,SAAS,EAAG;EACxD,OAAOC,MAAM,CAACC,OAAO,CAAEF,SAAU,CAAC,CAACG,KAAK,CAAE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM;IAC/D,IACC,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAON,eAAe,CAAEK,GAAG,CAAE,KAAK,QAAQ,EACzC;MACD,OAAON,iBAAiB,CAAEC,eAAe,CAAEK,GAAG,CAAE,EAAEC,KAAM,CAAC;IAC1D;IACA,OAAON,eAAe,CAAEK,GAAG,CAAE,KAAKC,KAAK;EACxC,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kCAAkC,GAAGA,CACjDP,eAAe,EACfQ,UAAU,KACN;EACJ,IAAK,CAAEA,UAAU,IAAI,CAAER,eAAe,EAAG;EACzC,MAAMS,OAAO,GAAGD,UAAU,CAACE,MAAM,CAAE,CAAE;IAAEC;EAAW,CAAC,KAAM;IACxD,IAAK,CAAEA,UAAU,IAAI,CAAET,MAAM,CAACU,IAAI,CAAED,UAAW,CAAC,CAACE,MAAM,EAAG,OAAO,KAAK;IACtE,OAAOd,iBAAiB,CAAEC,eAAe,EAAEW,UAAW,CAAC;EACxD,CAAE,CAAC;EACH,IAAKF,OAAO,CAACI,MAAM,KAAK,CAAC,EAAG;EAC5B,OAAOJ,OAAO,CAAE,CAAC,CAAE;AACpB,CAAC"}
@@ -1,116 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`BlockSwitcherDropdownMenu should render disabled block switcher with multi block of different types when no transforms 1`] = `
4
- <div>
5
- <div
6
- class="components-toolbar"
7
- >
8
- <div>
9
- <button
10
- aria-label="Block Name"
11
- class="components-button components-toolbar__control block-editor-block-switcher__no-switcher-icon has-icon"
12
- data-toolbar-item="true"
13
- disabled=""
14
- type="button"
15
- >
16
- <span
17
- class="block-editor-block-icon has-colors"
18
- >
19
- <svg
20
- aria-hidden="true"
21
- focusable="false"
22
- height="24"
23
- viewBox="0 0 24 24"
24
- width="24"
25
- xmlns="http://www.w3.org/2000/svg"
26
- >
27
- <path
28
- clip-rule="evenodd"
29
- d="M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"
30
- fill-rule="evenodd"
31
- />
32
- </svg>
33
- </span>
34
- </button>
35
- </div>
36
- </div>
37
- </div>
38
- `;
39
-
40
- exports[`BlockSwitcherDropdownMenu should render enabled block switcher with multi block when transforms exist 1`] = `
41
- <div>
42
- <div
43
- class="components-toolbar"
44
- >
45
- <div
46
- class="components-dropdown components-dropdown-menu block-editor-block-switcher"
47
- tabindex="-1"
48
- >
49
- <button
50
- aria-describedby="components-button__description-2"
51
- aria-expanded="false"
52
- aria-haspopup="true"
53
- aria-label="Multiple blocks selected"
54
- class="components-button components-dropdown-menu__toggle has-icon"
55
- data-toolbar-item="true"
56
- type="button"
57
- >
58
- <span
59
- class="block-editor-block-icon block-editor-block-switcher__toggle has-colors"
60
- />
61
- </button>
62
- <div
63
- class="components-visually-hidden emotion-0 emotion-1"
64
- data-wp-c16t="true"
65
- data-wp-component="VisuallyHidden"
66
- style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
67
- >
68
- <span
69
- id="components-button__description-2"
70
- >
71
- Change type of 2 blocks
72
- </span>
73
- </div>
74
- </div>
75
- </div>
76
- </div>
77
- `;
78
-
79
- exports[`BlockSwitcherDropdownMenu should render switcher with blocks 1`] = `
80
- <div>
81
- <div
82
- class="components-toolbar"
83
- >
84
- <div
85
- class="components-dropdown components-dropdown-menu block-editor-block-switcher"
86
- tabindex="-1"
87
- >
88
- <button
89
- aria-describedby="components-button__description-0"
90
- aria-expanded="false"
91
- aria-haspopup="true"
92
- aria-label="Block Name"
93
- class="components-button components-dropdown-menu__toggle has-icon"
94
- data-toolbar-item="true"
95
- type="button"
96
- >
97
- <span
98
- class="block-editor-block-icon block-editor-block-switcher__toggle has-colors"
99
- />
100
- </button>
101
- <div
102
- class="components-visually-hidden emotion-0 emotion-1"
103
- data-wp-c16t="true"
104
- data-wp-component="VisuallyHidden"
105
- style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
106
- >
107
- <span
108
- id="components-button__description-0"
109
- >
110
- Change block type or style
111
- </span>
112
- </div>
113
- </div>
114
- </div>
115
- </div>
116
- `;
@@ -1,3 +0,0 @@
1
- .block-editor-contrast-checker > .components-notice {
2
- margin: 0;
3
- }
@@ -1,122 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useMemo } from '@wordpress/element';
5
-
6
- /**
7
- * Returns a list of stylesheets that target the editor canvas. A stylesheet is
8
- * considered targetting the editor a canvas if it contains the
9
- * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.
10
- *
11
- * Ideally, this hook should be removed in the future and styles should be added
12
- * explicitly as editor styles.
13
- */
14
- export function useCompatibilityStyles() {
15
- // Only memoize the result once on load, since these stylesheets should not
16
- // change.
17
- return useMemo( () => {
18
- // Search the document for stylesheets targetting the editor canvas.
19
- return Array.from( document.styleSheets ).reduce(
20
- ( accumulator, styleSheet ) => {
21
- try {
22
- // May fail for external styles.
23
- // eslint-disable-next-line no-unused-expressions
24
- styleSheet.cssRules;
25
- } catch ( e ) {
26
- return accumulator;
27
- }
28
-
29
- const { ownerNode, cssRules } = styleSheet;
30
-
31
- // Stylesheet is added by another stylesheet. See
32
- // https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/ownerNode#notes.
33
- if ( ownerNode === null ) {
34
- return accumulator;
35
- }
36
-
37
- if ( ! cssRules ) {
38
- return accumulator;
39
- }
40
-
41
- // Don't try to add the reset styles, which were removed as a dependency
42
- // from `edit-blocks` for the iframe since we don't need to reset admin
43
- // styles.
44
- if ( ownerNode.id === 'wp-reset-editor-styles-css' ) {
45
- return accumulator;
46
- }
47
-
48
- // Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs.
49
- if ( ! ownerNode.id ) {
50
- return accumulator;
51
- }
52
-
53
- function matchFromRules( _cssRules ) {
54
- return Array.from( _cssRules ).find(
55
- ( {
56
- selectorText,
57
- conditionText,
58
- cssRules: __cssRules,
59
- } ) => {
60
- // If the rule is conditional then it will not have selector text.
61
- // Recurse into child CSS ruleset to determine selector eligibility.
62
- if ( conditionText ) {
63
- return matchFromRules( __cssRules );
64
- }
65
-
66
- return (
67
- selectorText &&
68
- ( selectorText.includes(
69
- '.editor-styles-wrapper'
70
- ) ||
71
- selectorText.includes( '.wp-block' ) )
72
- );
73
- }
74
- );
75
- }
76
-
77
- if ( matchFromRules( cssRules ) ) {
78
- const isInline = ownerNode.tagName === 'STYLE';
79
-
80
- if ( isInline ) {
81
- // If the current target is inline,
82
- // it could be a dependency of an existing stylesheet.
83
- // Look for that dependency and add it BEFORE the current target.
84
- const mainStylesCssId = ownerNode.id.replace(
85
- '-inline-css',
86
- '-css'
87
- );
88
- const mainStylesElement =
89
- document.getElementById( mainStylesCssId );
90
- if ( mainStylesElement ) {
91
- accumulator.push(
92
- mainStylesElement.cloneNode( true )
93
- );
94
- }
95
- }
96
-
97
- accumulator.push( ownerNode.cloneNode( true ) );
98
-
99
- if ( ! isInline ) {
100
- // If the current target is not inline,
101
- // we still look for inline styles that could be relevant for the current target.
102
- // If they exist, add them AFTER the current target.
103
- const inlineStylesCssId = ownerNode.id.replace(
104
- '-css',
105
- '-inline-css'
106
- );
107
- const inlineStylesElement =
108
- document.getElementById( inlineStylesCssId );
109
- if ( inlineStylesElement ) {
110
- accumulator.push(
111
- inlineStylesElement.cloneNode( true )
112
- );
113
- }
114
- }
115
- }
116
-
117
- return accumulator;
118
- },
119
- []
120
- );
121
- }, [] );
122
- }
@@ -1,115 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { addFilter } from '@wordpress/hooks';
5
- import { PanelBody, TextControl } from '@wordpress/components';
6
- import { __, sprintf } from '@wordpress/i18n';
7
- import { hasBlockSupport } from '@wordpress/blocks';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import { InspectorControls } from '../components';
13
- import { useBlockEditingMode } from '../components/block-editing-mode';
14
-
15
- /**
16
- * Filters registered block settings, extending attributes to include `connections`.
17
- *
18
- * @param {Object} settings Original block settings.
19
- *
20
- * @return {Object} Filtered block settings.
21
- */
22
- function addAttribute( settings ) {
23
- if ( hasBlockSupport( settings, '__experimentalConnections', true ) ) {
24
- // Gracefully handle if settings.attributes.connections is undefined.
25
- settings.attributes = {
26
- ...settings.attributes,
27
- connections: {
28
- type: 'object',
29
- },
30
- };
31
- }
32
-
33
- return settings;
34
- }
35
-
36
- function CustomFieldsControlPure( { name, connections, setAttributes } ) {
37
- const blockEditingMode = useBlockEditingMode();
38
- if ( blockEditingMode !== 'default' ) {
39
- return null;
40
- }
41
-
42
- // If the block is a paragraph or image block, we need to know which
43
- // attribute to use for the connection. Only the `content` attribute
44
- // of the paragraph block and the `url` attribute of the image block are supported.
45
- let attributeName;
46
- if ( name === 'core/paragraph' ) attributeName = 'content';
47
- if ( name === 'core/image' ) attributeName = 'url';
48
-
49
- return (
50
- <InspectorControls>
51
- <PanelBody title={ __( 'Connections' ) } initialOpen={ true }>
52
- <TextControl
53
- __nextHasNoMarginBottom
54
- autoComplete="off"
55
- label={ __( 'Custom field meta_key' ) }
56
- value={
57
- connections?.attributes?.[ attributeName ]?.value || ''
58
- }
59
- onChange={ ( nextValue ) => {
60
- if ( nextValue === '' ) {
61
- setAttributes( {
62
- connections: undefined,
63
- [ attributeName ]: undefined,
64
- placeholder: undefined,
65
- } );
66
- } else {
67
- setAttributes( {
68
- connections: {
69
- attributes: {
70
- // The attributeName will be either `content` or `url`.
71
- [ attributeName ]: {
72
- // Source will be variable, could be post_meta, user_meta, term_meta, etc.
73
- // Could even be a custom source like a social media attribute.
74
- source: 'meta_fields',
75
- value: nextValue,
76
- },
77
- },
78
- },
79
- [ attributeName ]: undefined,
80
- placeholder: sprintf(
81
- 'This content will be replaced on the frontend by the value of "%s" custom field.',
82
- nextValue
83
- ),
84
- } );
85
- }
86
- } }
87
- />
88
- </PanelBody>
89
- </InspectorControls>
90
- );
91
- }
92
-
93
- export default {
94
- edit: CustomFieldsControlPure,
95
- attributeKeys: [ 'connections' ],
96
- hasSupport( name ) {
97
- return (
98
- hasBlockSupport( name, '__experimentalConnections', false ) &&
99
- // Check if the current block is a paragraph or image block.
100
- // Currently, only these two blocks are supported.
101
- [ 'core/paragraph', 'core/image' ].includes( name )
102
- );
103
- },
104
- };
105
-
106
- if (
107
- window.__experimentalConnections ||
108
- window.__experimentalPatternPartialSyncing
109
- ) {
110
- addFilter(
111
- 'blocks.registerBlockType',
112
- 'core/editor/connections/attribute',
113
- addAttribute
114
- );
115
- }
@@ -1,38 +0,0 @@
1
- /** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
2
-
3
- function matchesAttributes( blockAttributes, variation ) {
4
- return Object.entries( variation ).every( ( [ key, value ] ) => {
5
- if (
6
- typeof value === 'object' &&
7
- typeof blockAttributes[ key ] === 'object'
8
- ) {
9
- return matchesAttributes( blockAttributes[ key ], value );
10
- }
11
- return blockAttributes[ key ] === value;
12
- } );
13
- }
14
-
15
- /**
16
- * Matches the provided block variations with a block's attributes. If no match
17
- * or more than one matches are found it returns `undefined`. If a single match is
18
- * found it returns it.
19
- *
20
- * This is a simple implementation for now as it takes into account only the attributes
21
- * of a block variation and not `InnerBlocks`.
22
- *
23
- * @param {Object} blockAttributes - The block attributes to try to find a match.
24
- * @param {WPBlockVariation[]} variations - A list of block variations to test for a match.
25
- * @return {WPBlockVariation | undefined} - If a match is found returns it. If not or more than one matches are found returns `undefined`.
26
- */
27
- export const __experimentalGetMatchingVariation = (
28
- blockAttributes,
29
- variations
30
- ) => {
31
- if ( ! variations || ! blockAttributes ) return;
32
- const matches = variations.filter( ( { attributes } ) => {
33
- if ( ! attributes || ! Object.keys( attributes ).length ) return false;
34
- return matchesAttributes( blockAttributes, attributes );
35
- } );
36
- if ( matches.length !== 1 ) return;
37
- return matches[ 0 ];
38
- };
@@ -1,94 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { __experimentalGetMatchingVariation as getMatchingVariation } from '../block-variation-transforms';
5
-
6
- describe( 'getMatchingVariation', () => {
7
- describe( 'should not find a match', () => {
8
- it( 'when no variations or attributes passed', () => {
9
- expect(
10
- getMatchingVariation( null, { content: 'hi' } )
11
- ).toBeUndefined();
12
- expect( getMatchingVariation( {} ) ).toBeUndefined();
13
- } );
14
- it( 'when no variation matched', () => {
15
- const variations = [
16
- { name: 'one', attributes: { level: 1 } },
17
- { name: 'two', attributes: { level: 2 } },
18
- ];
19
- expect(
20
- getMatchingVariation( { level: 4 }, variations )
21
- ).toBeUndefined();
22
- } );
23
- it( 'when more than one match found', () => {
24
- const variations = [
25
- { name: 'one', attributes: { level: 1 } },
26
- { name: 'two', attributes: { level: 1, content: 'hi' } },
27
- ];
28
- expect(
29
- getMatchingVariation(
30
- { level: 1, content: 'hi', other: 'prop' },
31
- variations
32
- )
33
- ).toBeUndefined();
34
- } );
35
- it( 'when variation is a superset of attributes', () => {
36
- const variations = [
37
- { name: 'one', attributes: { level: 1, content: 'hi' } },
38
- ];
39
- expect(
40
- getMatchingVariation( { level: 1, other: 'prop' }, variations )
41
- ).toBeUndefined();
42
- } );
43
- it( 'when variation has a nested attribute', () => {
44
- const variations = [
45
- { name: 'one', attributes: { query: { author: 'somebody' } } },
46
- { name: 'two', attributes: { query: { author: 'nobody' } } },
47
- ];
48
- expect(
49
- getMatchingVariation(
50
- { query: { author: 'foobar' }, other: 'prop' },
51
- variations
52
- )
53
- ).toBeUndefined();
54
- } );
55
- } );
56
- describe( 'should find a match', () => {
57
- it( 'when variation has one attribute', () => {
58
- const variations = [
59
- { name: 'one', attributes: { level: 1 } },
60
- { name: 'two', attributes: { level: 2 } },
61
- ];
62
- expect(
63
- getMatchingVariation(
64
- { level: 2, content: 'hi', other: 'prop' },
65
- variations
66
- ).name
67
- ).toEqual( 'two' );
68
- } );
69
- it( 'when variation has many attributes', () => {
70
- const variations = [
71
- { name: 'one', attributes: { level: 1, content: 'hi' } },
72
- { name: 'two', attributes: { level: 2 } },
73
- ];
74
- expect(
75
- getMatchingVariation(
76
- { level: 1, content: 'hi', other: 'prop' },
77
- variations
78
- ).name
79
- ).toEqual( 'one' );
80
- } );
81
- it( 'when variation has a nested attribute', () => {
82
- const variations = [
83
- { name: 'one', attributes: { query: { author: 'somebody' } } },
84
- { name: 'two', attributes: { query: { author: 'nobody' } } },
85
- ];
86
- expect(
87
- getMatchingVariation(
88
- { query: { author: 'somebody' }, other: 'prop' },
89
- variations
90
- ).name
91
- ).toEqual( 'one' );
92
- } );
93
- } );
94
- } );