@wordpress/block-editor 10.5.0 → 11.0.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 (488) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/autocompleters/block.js +2 -6
  3. package/build/autocompleters/block.js.map +1 -1
  4. package/build/autocompleters/link.js +2 -0
  5. package/build/autocompleters/link.js.map +1 -1
  6. package/build/components/block-card/index.js +51 -3
  7. package/build/components/block-card/index.js.map +1 -1
  8. package/build/components/block-draggable/index.native.js +46 -39
  9. package/build/components/block-draggable/index.native.js.map +1 -1
  10. package/build/components/block-edit/edit.js +4 -3
  11. package/build/components/block-edit/edit.js.map +1 -1
  12. package/build/components/block-edit/edit.native.js +4 -7
  13. package/build/components/block-edit/edit.native.js.map +1 -1
  14. package/build/components/block-inspector/index.js +35 -33
  15. package/build/components/block-inspector/index.js.map +1 -1
  16. package/build/components/block-list/block-list-context.native.js +5 -8
  17. package/build/components/block-list/block-list-context.native.js.map +1 -1
  18. package/build/components/block-list/block.js +55 -24
  19. package/build/components/block-list/block.js.map +1 -1
  20. package/build/components/block-list/block.native.js +61 -28
  21. package/build/components/block-list/block.native.js.map +1 -1
  22. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +12 -4
  23. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  24. package/build/components/block-pattern-setup/index.js +3 -2
  25. package/build/components/block-pattern-setup/index.js.map +1 -1
  26. package/build/components/block-patterns-list/index.js +33 -11
  27. package/build/components/block-patterns-list/index.js.map +1 -1
  28. package/build/components/block-preview/auto.js +9 -3
  29. package/build/components/block-preview/auto.js.map +1 -1
  30. package/build/components/block-preview/index.js +5 -9
  31. package/build/components/block-preview/index.js.map +1 -1
  32. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
  33. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  34. package/build/components/block-toolbar/index.js +5 -1
  35. package/build/components/block-toolbar/index.js.map +1 -1
  36. package/build/components/block-tools/insertion-point.js +8 -49
  37. package/build/components/block-tools/insertion-point.js.map +1 -1
  38. package/build/components/block-variation-picker/index.js +1 -2
  39. package/build/components/block-variation-picker/index.js.map +1 -1
  40. package/build/components/height-control/index.js +115 -0
  41. package/build/components/height-control/index.js.map +1 -0
  42. package/build/components/iframe/index.js +11 -8
  43. package/build/components/iframe/index.js.map +1 -1
  44. package/build/components/image-editor/use-save-image.js +2 -0
  45. package/build/components/image-editor/use-save-image.js.map +1 -1
  46. package/build/components/image-editor/zoom-dropdown.js +1 -0
  47. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  48. package/build/components/index.js +9 -0
  49. package/build/components/index.js.map +1 -1
  50. package/build/components/inner-blocks/index.js +20 -6
  51. package/build/components/inner-blocks/index.js.map +1 -1
  52. package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
  53. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  54. package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  55. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  56. package/build/components/inserter/block-patterns-tab.js +25 -46
  57. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  58. package/build/components/inserter/block-types-tab.js +3 -1
  59. package/build/components/inserter/block-types-tab.js.map +1 -1
  60. package/build/components/inserter/hooks/use-debounced-input.js +27 -0
  61. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
  62. package/build/components/inserter/index.js +8 -3
  63. package/build/components/inserter/index.js.map +1 -1
  64. package/build/components/inserter/index.native.js +3 -4
  65. package/build/components/inserter/index.native.js.map +1 -1
  66. package/build/components/inserter/media-tab/hooks.js +103 -0
  67. package/build/components/inserter/media-tab/hooks.js.map +1 -0
  68. package/build/components/inserter/media-tab/index.js +32 -0
  69. package/build/components/inserter/media-tab/index.js.map +1 -0
  70. package/build/components/inserter/media-tab/media-list.js +100 -0
  71. package/build/components/inserter/media-tab/media-list.js.map +1 -0
  72. package/build/components/inserter/media-tab/media-panel.js +96 -0
  73. package/build/components/inserter/media-tab/media-panel.js.map +1 -0
  74. package/build/components/inserter/media-tab/media-tab.js +120 -0
  75. package/build/components/inserter/media-tab/media-tab.js.map +1 -0
  76. package/build/components/inserter/media-tab/utils.js +54 -0
  77. package/build/components/inserter/media-tab/utils.js.map +1 -0
  78. package/build/components/inserter/menu.js +35 -12
  79. package/build/components/inserter/menu.js.map +1 -1
  80. package/build/components/inserter/mobile-tab-navigation.js +70 -0
  81. package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
  82. package/build/components/inserter/quick-inserter.js +1 -0
  83. package/build/components/inserter/quick-inserter.js.map +1 -1
  84. package/build/components/inserter/search-results.js +3 -1
  85. package/build/components/inserter/search-results.js.map +1 -1
  86. package/build/components/inserter/tabs.js +16 -2
  87. package/build/components/inserter/tabs.js.map +1 -1
  88. package/build/components/inserter-list-item/index.js +4 -1
  89. package/build/components/inserter-list-item/index.js.map +1 -1
  90. package/build/components/inspector-controls/groups.js +2 -0
  91. package/build/components/inspector-controls/groups.js.map +1 -1
  92. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
  93. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  94. package/build/components/inspector-controls-tabs/index.js +71 -0
  95. package/build/components/inspector-controls-tabs/index.js.map +1 -0
  96. package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
  97. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  98. package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
  99. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  100. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
  101. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  102. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
  103. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  104. package/build/components/inspector-controls-tabs/utils.js +37 -0
  105. package/build/components/inspector-controls-tabs/utils.js.map +1 -0
  106. package/build/components/link-control/index.js +1 -0
  107. package/build/components/link-control/index.js.map +1 -1
  108. package/build/components/link-control/search-input.js +0 -1
  109. package/build/components/link-control/search-input.js.map +1 -1
  110. package/build/components/link-control/use-internal-input-value.js +3 -3
  111. package/build/components/link-control/use-internal-input-value.js.map +1 -1
  112. package/build/components/list-view/block.js +5 -2
  113. package/build/components/list-view/block.js.map +1 -1
  114. package/build/components/list-view/branch.js +13 -12
  115. package/build/components/list-view/branch.js.map +1 -1
  116. package/build/components/media-upload/index.native.js +2 -3
  117. package/build/components/media-upload/index.native.js.map +1 -1
  118. package/build/components/off-canvas-editor/appender.js +104 -0
  119. package/build/components/off-canvas-editor/appender.js.map +1 -0
  120. package/build/components/off-canvas-editor/block-edit-button.js +50 -0
  121. package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
  122. package/build/components/off-canvas-editor/block.js +36 -4
  123. package/build/components/off-canvas-editor/block.js.map +1 -1
  124. package/build/components/off-canvas-editor/branch.js +3 -5
  125. package/build/components/off-canvas-editor/branch.js.map +1 -1
  126. package/build/components/off-canvas-editor/index.js +20 -11
  127. package/build/components/off-canvas-editor/index.js.map +1 -1
  128. package/build/components/off-canvas-editor/leaf.js +1 -1
  129. package/build/components/off-canvas-editor/leaf.js.map +1 -1
  130. package/build/components/off-canvas-editor/link-ui.js +185 -0
  131. package/build/components/off-canvas-editor/link-ui.js.map +1 -0
  132. package/build/components/off-canvas-editor/update-attributes.js +108 -0
  133. package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
  134. package/build/components/rich-text/format-toolbar/index.js +8 -4
  135. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  136. package/build/components/rich-text/index.js +3 -3
  137. package/build/components/rich-text/index.js.map +1 -1
  138. package/build/components/rich-text/index.native.js +0 -2
  139. package/build/components/rich-text/index.native.js.map +1 -1
  140. package/build/components/rich-text/use-insert-replacement-text.js +43 -0
  141. package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
  142. package/build/components/rich-text/use-undo-automatic-change.js +9 -1
  143. package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
  144. package/build/components/rich-text/utils.js +1 -19
  145. package/build/components/rich-text/utils.js.map +1 -1
  146. package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
  147. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  148. package/build/components/ungroup-button/index.native.js +4 -2
  149. package/build/components/ungroup-button/index.native.js.map +1 -1
  150. package/build/components/url-input/index.js +46 -43
  151. package/build/components/url-input/index.js.map +1 -1
  152. package/build/components/use-block-display-information/index.js +8 -4
  153. package/build/components/use-block-display-information/index.js.map +1 -1
  154. package/build/components/use-setting/index.js +9 -1
  155. package/build/components/use-setting/index.js.map +1 -1
  156. package/build/hooks/child-layout.js +209 -0
  157. package/build/hooks/child-layout.js.map +1 -0
  158. package/build/hooks/content-lock-ui.js +1 -1
  159. package/build/hooks/content-lock-ui.js.map +1 -1
  160. package/build/hooks/dimensions.js +25 -7
  161. package/build/hooks/dimensions.js.map +1 -1
  162. package/build/hooks/layout.js +57 -1
  163. package/build/hooks/layout.js.map +1 -1
  164. package/build/hooks/min-height.js +4 -10
  165. package/build/hooks/min-height.js.map +1 -1
  166. package/build/store/reducer.js +393 -270
  167. package/build/store/reducer.js.map +1 -1
  168. package/build/store/selectors.js +57 -47
  169. package/build/store/selectors.js.map +1 -1
  170. package/build/utils/sorting.js +63 -0
  171. package/build/utils/sorting.js.map +1 -0
  172. package/build-module/autocompleters/block.js +2 -6
  173. package/build-module/autocompleters/block.js.map +1 -1
  174. package/build-module/autocompleters/link.js +2 -0
  175. package/build-module/autocompleters/link.js.map +1 -1
  176. package/build-module/components/block-card/index.js +45 -3
  177. package/build-module/components/block-card/index.js.map +1 -1
  178. package/build-module/components/block-draggable/index.native.js +40 -31
  179. package/build-module/components/block-draggable/index.native.js.map +1 -1
  180. package/build-module/components/block-edit/edit.js +4 -2
  181. package/build-module/components/block-edit/edit.js.map +1 -1
  182. package/build-module/components/block-edit/edit.native.js +4 -6
  183. package/build-module/components/block-edit/edit.native.js.map +1 -1
  184. package/build-module/components/block-inspector/index.js +32 -30
  185. package/build-module/components/block-inspector/index.js.map +1 -1
  186. package/build-module/components/block-list/block-list-context.native.js +5 -8
  187. package/build-module/components/block-list/block-list-context.native.js.map +1 -1
  188. package/build-module/components/block-list/block.js +55 -25
  189. package/build-module/components/block-list/block.js.map +1 -1
  190. package/build-module/components/block-list/block.native.js +61 -28
  191. package/build-module/components/block-list/block.native.js.map +1 -1
  192. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +13 -6
  193. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  194. package/build-module/components/block-pattern-setup/index.js +3 -2
  195. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  196. package/build-module/components/block-patterns-list/index.js +35 -13
  197. package/build-module/components/block-patterns-list/index.js.map +1 -1
  198. package/build-module/components/block-preview/auto.js +9 -3
  199. package/build-module/components/block-preview/auto.js.map +1 -1
  200. package/build-module/components/block-preview/index.js +5 -8
  201. package/build-module/components/block-preview/index.js.map +1 -1
  202. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
  203. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  204. package/build-module/components/block-toolbar/index.js +6 -2
  205. package/build-module/components/block-toolbar/index.js.map +1 -1
  206. package/build-module/components/block-tools/insertion-point.js +8 -49
  207. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  208. package/build-module/components/block-variation-picker/index.js +1 -2
  209. package/build-module/components/block-variation-picker/index.js.map +1 -1
  210. package/build-module/components/height-control/index.js +103 -0
  211. package/build-module/components/height-control/index.js.map +1 -0
  212. package/build-module/components/iframe/index.js +11 -8
  213. package/build-module/components/iframe/index.js.map +1 -1
  214. package/build-module/components/image-editor/use-save-image.js +2 -0
  215. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  216. package/build-module/components/image-editor/zoom-dropdown.js +1 -0
  217. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  218. package/build-module/components/index.js +1 -0
  219. package/build-module/components/index.js.map +1 -1
  220. package/build-module/components/inner-blocks/index.js +22 -8
  221. package/build-module/components/inner-blocks/index.js.map +1 -1
  222. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
  223. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  224. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  225. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  226. package/build-module/components/inserter/block-patterns-tab.js +27 -49
  227. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  228. package/build-module/components/inserter/block-types-tab.js +3 -2
  229. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  230. package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
  231. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
  232. package/build-module/components/inserter/index.js +8 -3
  233. package/build-module/components/inserter/index.js.map +1 -1
  234. package/build-module/components/inserter/index.native.js +3 -5
  235. package/build-module/components/inserter/index.native.js.map +1 -1
  236. package/build-module/components/inserter/media-tab/hooks.js +89 -0
  237. package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
  238. package/build-module/components/inserter/media-tab/index.js +4 -0
  239. package/build-module/components/inserter/media-tab/index.js.map +1 -0
  240. package/build-module/components/inserter/media-tab/media-list.js +86 -0
  241. package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
  242. package/build-module/components/inserter/media-tab/media-panel.js +77 -0
  243. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
  244. package/build-module/components/inserter/media-tab/media-tab.js +100 -0
  245. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
  246. package/build-module/components/inserter/media-tab/utils.js +45 -0
  247. package/build-module/components/inserter/media-tab/utils.js.map +1 -0
  248. package/build-module/components/inserter/menu.js +33 -12
  249. package/build-module/components/inserter/menu.js.map +1 -1
  250. package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
  251. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
  252. package/build-module/components/inserter/quick-inserter.js +1 -0
  253. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  254. package/build-module/components/inserter/search-results.js +3 -2
  255. package/build-module/components/inserter/search-results.js.map +1 -1
  256. package/build-module/components/inserter/tabs.js +15 -2
  257. package/build-module/components/inserter/tabs.js.map +1 -1
  258. package/build-module/components/inserter-list-item/index.js +5 -2
  259. package/build-module/components/inserter-list-item/index.js.map +1 -1
  260. package/build-module/components/inspector-controls/groups.js +2 -0
  261. package/build-module/components/inspector-controls/groups.js.map +1 -1
  262. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
  263. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  264. package/build-module/components/inspector-controls-tabs/index.js +56 -0
  265. package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
  266. package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
  267. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  268. package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
  269. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  270. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
  271. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  272. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
  273. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  274. package/build-module/components/inspector-controls-tabs/utils.js +26 -0
  275. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
  276. package/build-module/components/link-control/index.js +1 -0
  277. package/build-module/components/link-control/index.js.map +1 -1
  278. package/build-module/components/link-control/search-input.js +0 -1
  279. package/build-module/components/link-control/search-input.js.map +1 -1
  280. package/build-module/components/link-control/use-internal-input-value.js +3 -3
  281. package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
  282. package/build-module/components/list-view/block.js +5 -2
  283. package/build-module/components/list-view/block.js.map +1 -1
  284. package/build-module/components/list-view/branch.js +12 -11
  285. package/build-module/components/list-view/branch.js.map +1 -1
  286. package/build-module/components/media-upload/index.native.js +2 -4
  287. package/build-module/components/media-upload/index.native.js.map +1 -1
  288. package/build-module/components/off-canvas-editor/appender.js +89 -0
  289. package/build-module/components/off-canvas-editor/appender.js.map +1 -0
  290. package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
  291. package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
  292. package/build-module/components/off-canvas-editor/block.js +36 -6
  293. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  294. package/build-module/components/off-canvas-editor/branch.js +3 -4
  295. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  296. package/build-module/components/off-canvas-editor/index.js +20 -12
  297. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  298. package/build-module/components/off-canvas-editor/leaf.js +1 -1
  299. package/build-module/components/off-canvas-editor/leaf.js.map +1 -1
  300. package/build-module/components/off-canvas-editor/link-ui.js +165 -0
  301. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
  302. package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
  303. package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
  304. package/build-module/components/rich-text/format-toolbar/index.js +6 -2
  305. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  306. package/build-module/components/rich-text/index.js +2 -3
  307. package/build-module/components/rich-text/index.js.map +1 -1
  308. package/build-module/components/rich-text/index.native.js +0 -2
  309. package/build-module/components/rich-text/index.native.js.map +1 -1
  310. package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
  311. package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
  312. package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
  313. package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
  314. package/build-module/components/rich-text/utils.js +1 -16
  315. package/build-module/components/rich-text/utils.js.map +1 -1
  316. package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
  317. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  318. package/build-module/components/ungroup-button/index.native.js +3 -2
  319. package/build-module/components/ungroup-button/index.native.js.map +1 -1
  320. package/build-module/components/url-input/index.js +46 -43
  321. package/build-module/components/url-input/index.js.map +1 -1
  322. package/build-module/components/use-block-display-information/index.js +9 -5
  323. package/build-module/components/use-block-display-information/index.js.map +1 -1
  324. package/build-module/components/use-setting/index.js +8 -1
  325. package/build-module/components/use-setting/index.js.map +1 -1
  326. package/build-module/hooks/child-layout.js +189 -0
  327. package/build-module/hooks/child-layout.js.map +1 -0
  328. package/build-module/hooks/content-lock-ui.js +1 -1
  329. package/build-module/hooks/content-lock-ui.js.map +1 -1
  330. package/build-module/hooks/dimensions.js +25 -8
  331. package/build-module/hooks/dimensions.js.map +1 -1
  332. package/build-module/hooks/layout.js +55 -0
  333. package/build-module/hooks/layout.js.map +1 -1
  334. package/build-module/hooks/min-height.js +3 -9
  335. package/build-module/hooks/min-height.js.map +1 -1
  336. package/build-module/store/reducer.js +391 -271
  337. package/build-module/store/reducer.js.map +1 -1
  338. package/build-module/store/selectors.js +54 -47
  339. package/build-module/store/selectors.js.map +1 -1
  340. package/build-module/utils/sorting.js +56 -0
  341. package/build-module/utils/sorting.js.map +1 -0
  342. package/build-style/content-rtl.css +701 -0
  343. package/build-style/content.css +701 -0
  344. package/build-style/default-editor-styles-rtl.css +14 -0
  345. package/build-style/default-editor-styles.css +14 -0
  346. package/build-style/style-rtl.css +286 -662
  347. package/build-style/style.css +286 -662
  348. package/package.json +32 -30
  349. package/src/autocompleters/block.js +2 -6
  350. package/src/autocompleters/link.js +2 -0
  351. package/src/components/alignment-control/test/index.js +4 -1
  352. package/src/components/block-alignment-control/test/index.js +4 -1
  353. package/src/components/block-card/index.js +46 -2
  354. package/src/components/block-card/style.scss +4 -0
  355. package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
  356. package/src/components/block-draggable/content.scss +20 -0
  357. package/src/components/block-draggable/index.native.js +54 -40
  358. package/src/components/block-draggable/style.scss +0 -21
  359. package/src/components/block-draggable/test/helpers.native.js +7 -9
  360. package/src/components/block-draggable/test/index.native.js +35 -45
  361. package/src/components/block-edit/edit.js +5 -2
  362. package/src/components/block-edit/edit.native.js +5 -6
  363. package/src/components/block-inspector/index.js +96 -81
  364. package/src/components/block-inspector/style.scss +9 -1
  365. package/src/components/block-list/block-list-context.native.js +5 -8
  366. package/src/components/block-list/block.js +74 -23
  367. package/src/components/block-list/block.native.js +78 -23
  368. package/src/components/block-list/{style.scss → content.scss} +1 -15
  369. package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
  370. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +24 -6
  371. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -2
  372. package/src/components/block-pattern-setup/index.js +2 -1
  373. package/src/components/block-patterns-list/index.js +47 -24
  374. package/src/components/block-preview/README.md +15 -10
  375. package/src/components/block-preview/auto.js +7 -1
  376. package/src/components/block-preview/content.scss +4 -0
  377. package/src/components/block-preview/index.js +7 -12
  378. package/src/components/block-preview/style.scss +0 -7
  379. package/src/components/block-preview/test/index.js +18 -35
  380. package/src/components/block-selection-clearer/test/index.js +12 -12
  381. package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
  382. package/src/components/block-switcher/test/index.js +4 -0
  383. package/src/components/block-toolbar/index.js +12 -5
  384. package/src/components/block-toolbar/style.scss +10 -0
  385. package/src/components/block-tools/insertion-point.js +3 -47
  386. package/src/components/block-tools/style.scss +12 -5
  387. package/src/components/block-variation-picker/index.js +1 -4
  388. package/src/components/block-vertical-alignment-control/test/index.js +4 -1
  389. package/src/components/default-block-appender/{style.scss → content.scss} +0 -0
  390. package/src/components/height-control/index.js +123 -0
  391. package/src/components/height-control/stories/index.js +21 -0
  392. package/src/components/height-control/style.scss +5 -0
  393. package/src/components/iframe/index.js +25 -18
  394. package/src/components/image-editor/use-save-image.js +2 -0
  395. package/src/components/image-editor/zoom-dropdown.js +1 -0
  396. package/src/components/index.js +1 -0
  397. package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
  398. package/src/components/inner-blocks/index.js +23 -6
  399. package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
  400. package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  401. package/src/components/inserter/block-patterns-tab.js +28 -71
  402. package/src/components/inserter/block-types-tab.js +3 -2
  403. package/src/components/inserter/hooks/use-debounced-input.js +17 -0
  404. package/src/components/inserter/index.js +10 -2
  405. package/src/components/inserter/index.native.js +1 -1
  406. package/src/components/inserter/media-tab/hooks.js +88 -0
  407. package/src/components/inserter/media-tab/index.js +3 -0
  408. package/src/components/inserter/media-tab/media-list.js +93 -0
  409. package/src/components/inserter/media-tab/media-panel.js +83 -0
  410. package/src/components/inserter/media-tab/media-tab.js +135 -0
  411. package/src/components/inserter/media-tab/utils.js +37 -0
  412. package/src/components/inserter/menu.js +55 -13
  413. package/src/components/inserter/mobile-tab-navigation.js +85 -0
  414. package/src/components/inserter/quick-inserter.js +1 -0
  415. package/src/components/inserter/search-results.js +3 -2
  416. package/src/components/inserter/stories/index.js +1 -1
  417. package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
  418. package/src/components/inserter/style.scss +176 -11
  419. package/src/components/inserter/tabs.js +12 -1
  420. package/src/components/inserter-list-item/index.js +11 -1
  421. package/src/components/inserter-list-item/style.scss +26 -0
  422. package/src/components/inspector-controls/groups.js +2 -0
  423. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
  424. package/src/components/inspector-controls-tabs/index.js +62 -0
  425. package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
  426. package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
  427. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
  428. package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
  429. package/src/components/inspector-controls-tabs/utils.js +28 -0
  430. package/src/components/line-height-control/test/index.js +5 -5
  431. package/src/components/link-control/README.md +1 -1
  432. package/src/components/link-control/index.js +1 -0
  433. package/src/components/link-control/search-input.js +0 -1
  434. package/src/components/link-control/test/index.js +188 -401
  435. package/src/components/link-control/use-internal-input-value.js +3 -3
  436. package/src/components/list-view/block.js +3 -0
  437. package/src/components/list-view/branch.js +10 -8
  438. package/src/components/list-view/style.scss +20 -9
  439. package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
  440. package/src/components/media-replace-flow/test/index.js +37 -9
  441. package/src/components/media-upload/test/index.native.js +2 -0
  442. package/src/components/off-canvas-editor/appender.js +93 -0
  443. package/src/components/off-canvas-editor/block-edit-button.js +27 -0
  444. package/src/components/off-canvas-editor/block.js +88 -22
  445. package/src/components/off-canvas-editor/branch.js +3 -5
  446. package/src/components/off-canvas-editor/index.js +59 -33
  447. package/src/components/off-canvas-editor/leaf.js +5 -1
  448. package/src/components/off-canvas-editor/link-ui.js +166 -0
  449. package/src/components/off-canvas-editor/style.scss +17 -388
  450. package/src/components/off-canvas-editor/update-attributes.js +99 -0
  451. package/src/components/plain-text/{style.scss → content.scss} +0 -0
  452. package/src/components/recursion-provider/test/index.js +27 -29
  453. package/src/components/rich-text/content.scss +42 -0
  454. package/src/components/rich-text/format-toolbar/index.js +6 -4
  455. package/src/components/rich-text/index.js +2 -2
  456. package/src/components/rich-text/index.native.js +0 -2
  457. package/src/components/rich-text/style.scss +0 -43
  458. package/src/components/rich-text/use-insert-replacement-text.js +31 -0
  459. package/src/components/rich-text/use-undo-automatic-change.js +7 -1
  460. package/src/components/rich-text/utils.js +2 -21
  461. package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
  462. package/src/components/ungroup-button/index.native.js +6 -2
  463. package/src/components/url-input/index.js +57 -73
  464. package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
  465. package/src/components/url-popover/test/index.js +21 -9
  466. package/src/components/use-block-display-information/index.js +14 -5
  467. package/src/components/use-setting/index.js +13 -1
  468. package/src/components/use-setting/test/index.js +99 -0
  469. package/src/content.scss +10 -0
  470. package/src/hooks/child-layout.js +190 -0
  471. package/src/hooks/content-lock-ui.js +1 -1
  472. package/src/hooks/dimensions.js +45 -7
  473. package/src/hooks/layout.js +60 -0
  474. package/src/hooks/min-height.js +2 -19
  475. package/src/store/reducer.js +459 -423
  476. package/src/store/selectors.js +56 -57
  477. package/src/store/test/performance.js +71 -0
  478. package/src/store/test/reducer.js +623 -491
  479. package/src/store/test/selectors.js +1820 -1306
  480. package/src/style.scss +4 -7
  481. package/src/utils/sorting.js +54 -0
  482. package/src/utils/test/sorting.js +49 -0
  483. package/tsconfig.tsbuildinfo +1 -1
  484. package/build/components/block-preview/live.js +0 -30
  485. package/build/components/block-preview/live.js.map +0 -1
  486. package/build-module/components/block-preview/live.js +0 -20
  487. package/build-module/components/block-preview/live.js.map +0 -1
  488. package/src/components/block-preview/live.js +0 -19
@@ -210,38 +210,48 @@ describe( 'state', () => {
210
210
  } );
211
211
  it( 'can replace a child block', () => {
212
212
  const existingState = deepFreeze( {
213
- byClientId: {
214
- chicken: {
215
- clientId: 'chicken',
216
- name: 'core/test-parent-block',
217
- isValid: true,
218
- },
219
- 'chicken-child': {
220
- clientId: 'chicken-child',
221
- name: 'core/test-child-block',
222
- isValid: true,
223
- },
224
- },
225
- attributes: {
226
- chicken: {},
227
- 'chicken-child': {
228
- attr: true,
229
- },
230
- },
231
- order: {
232
- '': [ 'chicken' ],
233
- chicken: [ 'chicken-child' ],
234
- 'chicken-child': [],
235
- },
236
- parents: {
237
- chicken: '',
238
- 'chicken-child': 'chicken',
239
- },
240
- tree: {
241
- '': {},
242
- chicken: {},
243
- 'chicken-child': {},
244
- },
213
+ byClientId: new Map(
214
+ Object.entries( {
215
+ chicken: {
216
+ clientId: 'chicken',
217
+ name: 'core/test-parent-block',
218
+ isValid: true,
219
+ },
220
+ 'chicken-child': {
221
+ clientId: 'chicken-child',
222
+ name: 'core/test-child-block',
223
+ isValid: true,
224
+ },
225
+ } )
226
+ ),
227
+ attributes: new Map(
228
+ Object.entries( {
229
+ chicken: {},
230
+ 'chicken-child': {
231
+ attr: true,
232
+ },
233
+ } )
234
+ ),
235
+ order: new Map(
236
+ Object.entries( {
237
+ '': [ 'chicken' ],
238
+ chicken: [ 'chicken-child' ],
239
+ 'chicken-child': [],
240
+ } )
241
+ ),
242
+ parents: new Map(
243
+ Object.entries( {
244
+ chicken: '',
245
+ 'chicken-child': 'chicken',
246
+ } )
247
+ ),
248
+ tree: new Map(
249
+ Object.entries( {
250
+ '': {},
251
+ chicken: {},
252
+ 'chicken-child': {},
253
+ } )
254
+ ),
245
255
  controlledInnerBlocks: {},
246
256
  } );
247
257
 
@@ -264,66 +274,84 @@ describe( 'state', () => {
264
274
  expect( restState ).toEqual( {
265
275
  isPersistentChange: true,
266
276
  isIgnoredChange: false,
267
- byClientId: {
268
- chicken: {
269
- clientId: 'chicken',
270
- name: 'core/test-parent-block',
271
- isValid: true,
272
- },
273
- [ newChildBlockId ]: {
274
- clientId: newChildBlockId,
275
- name: 'core/test-child-block',
276
- isValid: true,
277
- },
278
- },
279
- attributes: {
280
- chicken: {},
281
- [ newChildBlockId ]: {
282
- attr: false,
283
- attr2: 'perfect',
284
- },
285
- },
286
- order: {
287
- '': [ 'chicken' ],
288
- chicken: [ newChildBlockId ],
289
- [ newChildBlockId ]: [],
290
- },
291
- parents: {
292
- [ newChildBlockId ]: 'chicken',
293
- chicken: '',
294
- },
277
+ byClientId: new Map(
278
+ Object.entries( {
279
+ chicken: {
280
+ clientId: 'chicken',
281
+ name: 'core/test-parent-block',
282
+ isValid: true,
283
+ },
284
+ [ newChildBlockId ]: {
285
+ clientId: newChildBlockId,
286
+ name: 'core/test-child-block',
287
+ isValid: true,
288
+ },
289
+ } )
290
+ ),
291
+ attributes: new Map(
292
+ Object.entries( {
293
+ chicken: {},
294
+ [ newChildBlockId ]: {
295
+ attr: false,
296
+ attr2: 'perfect',
297
+ },
298
+ } )
299
+ ),
300
+ order: new Map(
301
+ Object.entries( {
302
+ '': [ 'chicken' ],
303
+ chicken: [ newChildBlockId ],
304
+ [ newChildBlockId ]: [],
305
+ } )
306
+ ),
307
+ parents: new Map(
308
+ Object.entries( {
309
+ [ newChildBlockId ]: 'chicken',
310
+ chicken: '',
311
+ } )
312
+ ),
295
313
  controlledInnerBlocks: {},
296
314
  } );
297
- expect( state.tree.chicken ).not.toBe(
298
- existingState.tree.chicken
315
+ expect( state.tree.get( 'chicken' ) ).not.toBe(
316
+ existingState.tree.get( 'chicken' )
299
317
  );
300
318
  } );
301
319
 
302
320
  it( 'can insert a child block', () => {
303
321
  const existingState = deepFreeze( {
304
- byClientId: {
305
- chicken: {
306
- clientId: 'chicken',
307
- name: 'core/test-parent-block',
308
- isValid: true,
309
- },
310
- },
311
- attributes: {
312
- chicken: {},
313
- },
314
- order: {
315
- '': [ 'chicken' ],
316
- chicken: [],
317
- },
318
- parents: {
319
- chicken: '',
320
- },
321
- tree: {
322
- '': {
323
- innerBlocks: [],
324
- },
325
- chicken: {},
326
- },
322
+ byClientId: new Map(
323
+ Object.entries( {
324
+ chicken: {
325
+ clientId: 'chicken',
326
+ name: 'core/test-parent-block',
327
+ isValid: true,
328
+ },
329
+ } )
330
+ ),
331
+ attributes: new Map(
332
+ Object.entries( {
333
+ chicken: {},
334
+ } )
335
+ ),
336
+ order: new Map(
337
+ Object.entries( {
338
+ '': [ 'chicken' ],
339
+ chicken: [],
340
+ } )
341
+ ),
342
+ parents: new Map(
343
+ Object.entries( {
344
+ chicken: '',
345
+ } )
346
+ ),
347
+ tree: new Map(
348
+ Object.entries( {
349
+ '': {
350
+ innerBlocks: [],
351
+ },
352
+ chicken: {},
353
+ } )
354
+ ),
327
355
  controlledInnerBlocks: {},
328
356
  } );
329
357
 
@@ -346,46 +374,54 @@ describe( 'state', () => {
346
374
  expect( restState ).toEqual( {
347
375
  isPersistentChange: true,
348
376
  isIgnoredChange: false,
349
- byClientId: {
350
- chicken: {
351
- clientId: 'chicken',
352
- name: 'core/test-parent-block',
353
- isValid: true,
354
- },
355
- [ newChildBlockId ]: {
356
- clientId: newChildBlockId,
357
- name: 'core/test-child-block',
358
- isValid: true,
359
- },
360
- },
361
- attributes: {
362
- chicken: {},
363
- [ newChildBlockId ]: {
364
- attr: false,
365
- attr2: 'perfect',
366
- },
367
- },
368
- order: {
369
- '': [ 'chicken' ],
370
- chicken: [ newChildBlockId ],
371
- [ newChildBlockId ]: [],
372
- },
373
- parents: {
374
- [ newChildBlockId ]: 'chicken',
375
- chicken: '',
376
- },
377
+ byClientId: new Map(
378
+ Object.entries( {
379
+ chicken: {
380
+ clientId: 'chicken',
381
+ name: 'core/test-parent-block',
382
+ isValid: true,
383
+ },
384
+ [ newChildBlockId ]: {
385
+ clientId: newChildBlockId,
386
+ name: 'core/test-child-block',
387
+ isValid: true,
388
+ },
389
+ } )
390
+ ),
391
+ attributes: new Map(
392
+ Object.entries( {
393
+ chicken: {},
394
+ [ newChildBlockId ]: {
395
+ attr: false,
396
+ attr2: 'perfect',
397
+ },
398
+ } )
399
+ ),
400
+ order: new Map(
401
+ Object.entries( {
402
+ '': [ 'chicken' ],
403
+ chicken: [ newChildBlockId ],
404
+ [ newChildBlockId ]: [],
405
+ } )
406
+ ),
407
+ parents: new Map(
408
+ Object.entries( {
409
+ [ newChildBlockId ]: 'chicken',
410
+ chicken: '',
411
+ } )
412
+ ),
377
413
  controlledInnerBlocks: {},
378
414
  } );
379
- expect( state.tree.chicken ).not.toBe(
380
- existingState.tree.chicken
415
+ expect( state.tree.get( 'chicken' ) ).not.toBe(
416
+ existingState.tree.get( 'chicken' )
381
417
  );
382
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
383
- state.tree.chicken
418
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
419
+ state.tree.get( 'chicken' )
384
420
  );
385
- expect( state.tree.chicken.innerBlocks[ 0 ] ).toBe(
386
- state.tree[ newChildBlockId ]
421
+ expect( state.tree.get( 'chicken' ).innerBlocks[ 0 ] ).toBe(
422
+ state.tree.get( newChildBlockId )
387
423
  );
388
- expect( state.tree[ newChildBlockId ] ).toEqual( {
424
+ expect( state.tree.get( newChildBlockId ) ).toEqual( {
389
425
  clientId: newChildBlockId,
390
426
  innerBlocks: [],
391
427
  isValid: true,
@@ -399,44 +435,52 @@ describe( 'state', () => {
399
435
 
400
436
  it( 'can replace multiple child blocks', () => {
401
437
  const existingState = deepFreeze( {
402
- byClientId: {
403
- chicken: {
404
- clientId: 'chicken',
405
- name: 'core/test-parent-block',
406
- isValid: true,
407
- },
408
- 'chicken-child': {
409
- clientId: 'chicken-child',
410
- name: 'core/test-child-block',
411
- isValid: true,
412
- },
413
- 'chicken-child-2': {
414
- clientId: 'chicken-child',
415
- name: 'core/test-child-block',
416
- isValid: true,
417
- },
418
- },
419
- attributes: {
420
- chicken: {},
421
- 'chicken-child': {
422
- attr: true,
423
- },
424
- 'chicken-child-2': {
425
- attr2: 'ok',
426
- },
427
- },
428
- order: {
429
- '': [ 'chicken' ],
430
- chicken: [ 'chicken-child', 'chicken-child-2' ],
431
- 'chicken-child': [],
432
- 'chicken-child-2': [],
433
- },
434
- parents: {
435
- chicken: '',
436
- 'chicken-child': 'chicken',
437
- 'chicken-child-2': 'chicken',
438
- },
439
- tree: {},
438
+ byClientId: new Map(
439
+ Object.entries( {
440
+ chicken: {
441
+ clientId: 'chicken',
442
+ name: 'core/test-parent-block',
443
+ isValid: true,
444
+ },
445
+ 'chicken-child': {
446
+ clientId: 'chicken-child',
447
+ name: 'core/test-child-block',
448
+ isValid: true,
449
+ },
450
+ 'chicken-child-2': {
451
+ clientId: 'chicken-child',
452
+ name: 'core/test-child-block',
453
+ isValid: true,
454
+ },
455
+ } )
456
+ ),
457
+ attributes: new Map(
458
+ Object.entries( {
459
+ chicken: {},
460
+ 'chicken-child': {
461
+ attr: true,
462
+ },
463
+ 'chicken-child-2': {
464
+ attr2: 'ok',
465
+ },
466
+ } )
467
+ ),
468
+ order: new Map(
469
+ Object.entries( {
470
+ '': [ 'chicken' ],
471
+ chicken: [ 'chicken-child', 'chicken-child-2' ],
472
+ 'chicken-child': [],
473
+ 'chicken-child-2': [],
474
+ } )
475
+ ),
476
+ parents: new Map(
477
+ Object.entries( {
478
+ chicken: '',
479
+ 'chicken-child': 'chicken',
480
+ 'chicken-child-2': 'chicken',
481
+ } )
482
+ ),
483
+ tree: new Map(),
440
484
  controlledInnerBlocks: {},
441
485
  } );
442
486
 
@@ -470,75 +514,83 @@ describe( 'state', () => {
470
514
  expect( restState ).toEqual( {
471
515
  isPersistentChange: true,
472
516
  isIgnoredChange: false,
473
- byClientId: {
474
- chicken: {
475
- clientId: 'chicken',
476
- name: 'core/test-parent-block',
477
- isValid: true,
478
- },
479
- [ newChildBlockId1 ]: {
480
- clientId: newChildBlockId1,
481
- name: 'core/test-child-block',
482
- isValid: true,
483
- },
484
- [ newChildBlockId2 ]: {
485
- clientId: newChildBlockId2,
486
- name: 'core/test-child-block',
487
- isValid: true,
488
- },
489
- [ newChildBlockId3 ]: {
490
- clientId: newChildBlockId3,
491
- name: 'core/test-child-block',
492
- isValid: true,
493
- },
494
- },
495
- attributes: {
496
- chicken: {},
497
- [ newChildBlockId1 ]: {
498
- attr: false,
499
- attr2: 'perfect',
500
- },
501
- [ newChildBlockId2 ]: {
502
- attr: true,
503
- attr2: 'not-perfect',
504
- },
505
- [ newChildBlockId3 ]: {
506
- attr2: 'hello',
507
- },
508
- },
509
- order: {
510
- '': [ 'chicken' ],
511
- chicken: [
512
- newChildBlockId1,
513
- newChildBlockId2,
514
- newChildBlockId3,
515
- ],
516
- [ newChildBlockId1 ]: [],
517
- [ newChildBlockId2 ]: [],
518
- [ newChildBlockId3 ]: [],
519
- },
520
- parents: {
521
- chicken: '',
522
- [ newChildBlockId1 ]: 'chicken',
523
- [ newChildBlockId2 ]: 'chicken',
524
- [ newChildBlockId3 ]: 'chicken',
525
- },
517
+ byClientId: new Map(
518
+ Object.entries( {
519
+ chicken: {
520
+ clientId: 'chicken',
521
+ name: 'core/test-parent-block',
522
+ isValid: true,
523
+ },
524
+ [ newChildBlockId1 ]: {
525
+ clientId: newChildBlockId1,
526
+ name: 'core/test-child-block',
527
+ isValid: true,
528
+ },
529
+ [ newChildBlockId2 ]: {
530
+ clientId: newChildBlockId2,
531
+ name: 'core/test-child-block',
532
+ isValid: true,
533
+ },
534
+ [ newChildBlockId3 ]: {
535
+ clientId: newChildBlockId3,
536
+ name: 'core/test-child-block',
537
+ isValid: true,
538
+ },
539
+ } )
540
+ ),
541
+ attributes: new Map(
542
+ Object.entries( {
543
+ chicken: {},
544
+ [ newChildBlockId1 ]: {
545
+ attr: false,
546
+ attr2: 'perfect',
547
+ },
548
+ [ newChildBlockId2 ]: {
549
+ attr: true,
550
+ attr2: 'not-perfect',
551
+ },
552
+ [ newChildBlockId3 ]: {
553
+ attr2: 'hello',
554
+ },
555
+ } )
556
+ ),
557
+ order: new Map(
558
+ Object.entries( {
559
+ '': [ 'chicken' ],
560
+ chicken: [
561
+ newChildBlockId1,
562
+ newChildBlockId2,
563
+ newChildBlockId3,
564
+ ],
565
+ [ newChildBlockId1 ]: [],
566
+ [ newChildBlockId2 ]: [],
567
+ [ newChildBlockId3 ]: [],
568
+ } )
569
+ ),
570
+ parents: new Map(
571
+ Object.entries( {
572
+ chicken: '',
573
+ [ newChildBlockId1 ]: 'chicken',
574
+ [ newChildBlockId2 ]: 'chicken',
575
+ [ newChildBlockId3 ]: 'chicken',
576
+ } )
577
+ ),
526
578
  controlledInnerBlocks: {},
527
579
  } );
528
580
 
529
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
530
- state.tree.chicken
581
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
582
+ state.tree.get( 'chicken' )
531
583
  );
532
- expect( state.tree.chicken.innerBlocks[ 0 ] ).toBe(
533
- state.tree[ newChildBlockId1 ]
584
+ expect( state.tree.get( 'chicken' ).innerBlocks[ 0 ] ).toBe(
585
+ state.tree.get( newChildBlockId1 )
534
586
  );
535
- expect( state.tree.chicken.innerBlocks[ 1 ] ).toBe(
536
- state.tree[ newChildBlockId2 ]
587
+ expect( state.tree.get( 'chicken' ).innerBlocks[ 1 ] ).toBe(
588
+ state.tree.get( newChildBlockId2 )
537
589
  );
538
- expect( state.tree.chicken.innerBlocks[ 2 ] ).toBe(
539
- state.tree[ newChildBlockId3 ]
590
+ expect( state.tree.get( 'chicken' ).innerBlocks[ 2 ] ).toBe(
591
+ state.tree.get( newChildBlockId3 )
540
592
  );
541
- expect( state.tree[ newChildBlockId1 ] ).toEqual( {
593
+ expect( state.tree.get( newChildBlockId1 ) ).toEqual( {
542
594
  innerBlocks: [],
543
595
  clientId: newChildBlockId1,
544
596
  name: 'core/test-child-block',
@@ -552,42 +604,52 @@ describe( 'state', () => {
552
604
 
553
605
  it( 'can replace a child block that has other children', () => {
554
606
  const existingState = deepFreeze( {
555
- byClientId: {
556
- chicken: {
557
- clientId: 'chicken',
558
- name: 'core/test-parent-block',
559
- isValid: true,
560
- },
561
- 'chicken-child': {
562
- clientId: 'chicken-child',
563
- name: 'core/test-child-block',
564
- isValid: true,
565
- },
566
- 'chicken-grand-child': {
567
- clientId: 'chicken-child',
568
- name: 'core/test-block',
569
- isValid: true,
570
- },
571
- },
572
- attributes: {
573
- chicken: {},
574
- 'chicken-child': {},
575
- 'chicken-grand-child': {},
576
- },
577
- order: {
578
- '': [ 'chicken' ],
579
- chicken: [ 'chicken-child' ],
580
- 'chicken-child': [ 'chicken-grand-child' ],
581
- 'chicken-grand-child': [],
582
- },
583
- parents: {
584
- chicken: '',
585
- 'chicken-child': 'chicken',
586
- 'chicken-grand-child': 'chicken-child',
587
- },
588
- tree: {
589
- chicken: {},
590
- },
607
+ byClientId: new Map(
608
+ Object.entries( {
609
+ chicken: {
610
+ clientId: 'chicken',
611
+ name: 'core/test-parent-block',
612
+ isValid: true,
613
+ },
614
+ 'chicken-child': {
615
+ clientId: 'chicken-child',
616
+ name: 'core/test-child-block',
617
+ isValid: true,
618
+ },
619
+ 'chicken-grand-child': {
620
+ clientId: 'chicken-child',
621
+ name: 'core/test-block',
622
+ isValid: true,
623
+ },
624
+ } )
625
+ ),
626
+ attributes: new Map(
627
+ Object.entries( {
628
+ chicken: {},
629
+ 'chicken-child': {},
630
+ 'chicken-grand-child': {},
631
+ } )
632
+ ),
633
+ order: new Map(
634
+ Object.entries( {
635
+ '': [ 'chicken' ],
636
+ chicken: [ 'chicken-child' ],
637
+ 'chicken-child': [ 'chicken-grand-child' ],
638
+ 'chicken-grand-child': [],
639
+ } )
640
+ ),
641
+ parents: new Map(
642
+ Object.entries( {
643
+ chicken: '',
644
+ 'chicken-child': 'chicken',
645
+ 'chicken-grand-child': 'chicken-child',
646
+ } )
647
+ ),
648
+ tree: new Map(
649
+ Object.entries( {
650
+ chicken: {},
651
+ } )
652
+ ),
591
653
  controlledInnerBlocks: {},
592
654
  } );
593
655
 
@@ -607,37 +669,45 @@ describe( 'state', () => {
607
669
  expect( restState ).toEqual( {
608
670
  isPersistentChange: true,
609
671
  isIgnoredChange: false,
610
- byClientId: {
611
- chicken: {
612
- clientId: 'chicken',
613
- name: 'core/test-parent-block',
614
- isValid: true,
615
- },
616
- [ newChildBlockId ]: {
617
- clientId: newChildBlockId,
618
- name: 'core/test-block',
619
- isValid: true,
620
- },
621
- },
622
- attributes: {
623
- chicken: {},
624
- [ newChildBlockId ]: {},
625
- },
626
- order: {
627
- '': [ 'chicken' ],
628
- chicken: [ newChildBlockId ],
629
- [ newChildBlockId ]: [],
630
- },
631
- parents: {
632
- chicken: '',
633
- [ newChildBlockId ]: 'chicken',
634
- },
672
+ byClientId: new Map(
673
+ Object.entries( {
674
+ chicken: {
675
+ clientId: 'chicken',
676
+ name: 'core/test-parent-block',
677
+ isValid: true,
678
+ },
679
+ [ newChildBlockId ]: {
680
+ clientId: newChildBlockId,
681
+ name: 'core/test-block',
682
+ isValid: true,
683
+ },
684
+ } )
685
+ ),
686
+ attributes: new Map(
687
+ Object.entries( {
688
+ chicken: {},
689
+ [ newChildBlockId ]: {},
690
+ } )
691
+ ),
692
+ order: new Map(
693
+ Object.entries( {
694
+ '': [ 'chicken' ],
695
+ chicken: [ newChildBlockId ],
696
+ [ newChildBlockId ]: [],
697
+ } )
698
+ ),
699
+ parents: new Map(
700
+ Object.entries( {
701
+ chicken: '',
702
+ [ newChildBlockId ]: 'chicken',
703
+ } )
704
+ ),
635
705
  controlledInnerBlocks: {},
636
706
  } );
637
707
 
638
708
  // The block object of the parent should be updated.
639
- expect( state.tree.chicken ).not.toBe(
640
- existingState.tree.chicken
709
+ expect( state.tree.get( 'chicken' ) ).not.toBe(
710
+ existingState.tree.get( 'chicken' )
641
711
  );
642
712
  } );
643
713
  } );
@@ -646,13 +716,13 @@ describe( 'state', () => {
646
716
  const state = blocks( undefined, {} );
647
717
 
648
718
  expect( state ).toEqual( {
649
- byClientId: {},
650
- attributes: {},
651
- order: {},
652
- parents: {},
719
+ byClientId: new Map(),
720
+ attributes: new Map(),
721
+ order: new Map(),
722
+ parents: new Map(),
653
723
  isPersistentChange: true,
654
724
  isIgnoredChange: false,
655
- tree: {},
725
+ tree: new Map(),
656
726
  controlledInnerBlocks: {},
657
727
  } );
658
728
  } );
@@ -664,20 +734,20 @@ describe( 'state', () => {
664
734
  blocks: [ { clientId: 'bananas', innerBlocks: [] } ],
665
735
  } );
666
736
 
667
- expect( Object.keys( state.byClientId ) ).toHaveLength( 1 );
668
- expect( Object.values( state.byClientId )[ 0 ].clientId ).toBe(
737
+ expect( state.byClientId.size ).toBe( 1 );
738
+ expect( state.byClientId.get( 'bananas' ).clientId ).toBe(
669
739
  'bananas'
670
740
  );
671
- expect( state.order ).toEqual( {
741
+ expect( Object.fromEntries( state.order ) ).toEqual( {
672
742
  '': [ 'bananas' ],
673
743
  bananas: [],
674
744
  } );
675
- expect( state.tree.bananas ).toEqual( {
745
+ expect( state.tree.get( 'bananas' ) ).toEqual( {
676
746
  clientId: 'bananas',
677
747
  innerBlocks: [],
678
748
  } );
679
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
680
- state.tree.bananas
749
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
750
+ state.tree.get( 'bananas' )
681
751
  );
682
752
  } );
683
753
  } );
@@ -696,8 +766,8 @@ describe( 'state', () => {
696
766
  ],
697
767
  } );
698
768
 
699
- expect( Object.keys( state.byClientId ) ).toHaveLength( 2 );
700
- expect( state.order ).toEqual( {
769
+ expect( state.byClientId.size ).toBe( 2 );
770
+ expect( Object.fromEntries( state.order ) ).toEqual( {
701
771
  '': [ 'bananas' ],
702
772
  apples: [],
703
773
  bananas: [ 'apples' ],
@@ -727,21 +797,21 @@ describe( 'state', () => {
727
797
  ],
728
798
  } );
729
799
 
730
- expect( Object.keys( state.byClientId ) ).toHaveLength( 2 );
731
- expect( Object.values( state.byClientId )[ 1 ].clientId ).toBe(
732
- 'ribs'
733
- );
734
- expect( state.order ).toEqual( {
800
+ expect( state.byClientId.size ).toBe( 2 );
801
+ expect( state.byClientId.get( 'ribs' ).clientId ).toBe( 'ribs' );
802
+ expect( Object.fromEntries( state.order ) ).toEqual( {
735
803
  '': [ 'chicken', 'ribs' ],
736
804
  chicken: [],
737
805
  ribs: [],
738
806
  } );
739
807
 
740
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
741
- state.tree.chicken
808
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
809
+ state.tree.get( 'chicken' )
742
810
  );
743
- expect( state.tree[ '' ].innerBlocks[ 1 ] ).toBe( state.tree.ribs );
744
- expect( state.tree.chicken ).toEqual( {
811
+ expect( state.tree.get( '' ).innerBlocks[ 1 ] ).toBe(
812
+ state.tree.get( 'ribs' )
813
+ );
814
+ expect( state.tree.get( 'chicken' ) ).toEqual( {
745
815
  clientId: 'chicken',
746
816
  name: 'core/test-block',
747
817
  attributes: {},
@@ -773,24 +843,22 @@ describe( 'state', () => {
773
843
  ],
774
844
  } );
775
845
 
776
- expect( Object.keys( state.byClientId ) ).toHaveLength( 1 );
777
- expect( Object.values( state.byClientId )[ 0 ].name ).toBe(
846
+ expect( state.byClientId.size ).toBe( 1 );
847
+ expect( state.byClientId.get( 'wings' ).name ).toBe(
778
848
  'core/freeform'
779
849
  );
780
- expect( Object.values( state.byClientId )[ 0 ].clientId ).toBe(
781
- 'wings'
782
- );
783
- expect( state.order ).toEqual( {
850
+ expect( state.byClientId.get( 'wings' ).clientId ).toBe( 'wings' );
851
+ expect( Object.fromEntries( state.order ) ).toEqual( {
784
852
  '': [ 'wings' ],
785
853
  wings: [],
786
854
  } );
787
- expect( state.parents ).toEqual( {
855
+ expect( Object.fromEntries( state.parents ) ).toEqual( {
788
856
  wings: '',
789
857
  } );
790
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
791
- state.tree.wings
858
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
859
+ state.tree.get( 'wings' )
792
860
  );
793
- expect( state.tree.wings ).toEqual( {
861
+ expect( state.tree.get( 'wings' ) ).toEqual( {
794
862
  clientId: 'wings',
795
863
  name: 'core/freeform',
796
864
  innerBlocks: [],
@@ -815,8 +883,8 @@ describe( 'state', () => {
815
883
  blocks: [],
816
884
  } );
817
885
 
818
- expect( Object.keys( state.byClientId ) ).toHaveLength( 0 );
819
- expect( state.tree[ '' ].innerBlocks ).toHaveLength( 0 );
886
+ expect( state.byClientId.size ).toBe( 0 );
887
+ expect( state.tree.get( '' ).innerBlocks ).toHaveLength( 0 );
820
888
  } );
821
889
 
822
890
  it( 'should replace the block and remove references to its inner blocks', () => {
@@ -850,18 +918,18 @@ describe( 'state', () => {
850
918
  ],
851
919
  } );
852
920
 
853
- expect( Object.keys( state.byClientId ) ).toHaveLength( 1 );
854
- expect( state.order ).toEqual( {
921
+ expect( state.byClientId.size ).toBe( 1 );
922
+ expect( Object.fromEntries( state.order ) ).toEqual( {
855
923
  '': [ 'wings' ],
856
924
  wings: [],
857
925
  } );
858
- expect( state.parents ).toEqual( {
926
+ expect( Object.fromEntries( state.parents ) ).toEqual( {
859
927
  wings: '',
860
928
  } );
861
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
862
- state.tree.wings
929
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
930
+ state.tree.get( 'wings' )
863
931
  );
864
- expect( state.tree.wings ).toEqual( {
932
+ expect( state.tree.get( 'wings' ) ).toEqual( {
865
933
  clientId: 'wings',
866
934
  name: 'core/freeform',
867
935
  innerBlocks: [],
@@ -885,21 +953,21 @@ describe( 'state', () => {
885
953
  blocks: [ replacementBlock ],
886
954
  } );
887
955
 
888
- expect( state.order ).toEqual( {
956
+ expect( Object.fromEntries( state.order ) ).toEqual( {
889
957
  '': [ wrapperBlock.clientId ],
890
958
  [ wrapperBlock.clientId ]: [ replacementBlock.clientId ],
891
959
  [ replacementBlock.clientId ]: [],
892
960
  } );
893
961
 
894
- expect( state.parents ).toEqual( {
962
+ expect( Object.fromEntries( state.parents ) ).toEqual( {
895
963
  [ wrapperBlock.clientId ]: '',
896
964
  [ replacementBlock.clientId ]: wrapperBlock.clientId,
897
965
  } );
898
966
 
899
- expect( state.tree[ wrapperBlock.clientId ].innerBlocks[ 0 ] ).toBe(
900
- state.tree[ replacementBlock.clientId ]
901
- );
902
- expect( state.tree[ replacementBlock.clientId ] ).toEqual( {
967
+ expect(
968
+ state.tree.get( wrapperBlock.clientId ).innerBlocks[ 0 ]
969
+ ).toBe( state.tree.get( replacementBlock.clientId ) );
970
+ expect( state.tree.get( replacementBlock.clientId ) ).toEqual( {
903
971
  clientId: replacementBlock.clientId,
904
972
  name: 'core/test-block',
905
973
  innerBlocks: [],
@@ -932,22 +1000,22 @@ describe( 'state', () => {
932
1000
  ],
933
1001
  } );
934
1002
 
935
- expect( Object.keys( replacedState.byClientId ) ).toHaveLength( 1 );
936
- expect( Object.values( originalState.byClientId )[ 0 ].name ).toBe(
1003
+ expect( replacedState.byClientId.size ).toBe( 1 );
1004
+ expect( originalState.byClientId.get( 'chicken' ).name ).toBe(
937
1005
  'core/test-block'
938
1006
  );
939
- expect( Object.values( replacedState.byClientId )[ 0 ].name ).toBe(
1007
+ expect( replacedState.byClientId.get( 'chicken' ).name ).toBe(
940
1008
  'core/freeform'
941
1009
  );
942
- expect(
943
- Object.values( replacedState.byClientId )[ 0 ].clientId
944
- ).toBe( 'chicken' );
945
- expect( replacedState.order ).toEqual( {
1010
+ expect( replacedState.byClientId.get( 'chicken' ).clientId ).toBe(
1011
+ 'chicken'
1012
+ );
1013
+ expect( Object.fromEntries( replacedState.order ) ).toEqual( {
946
1014
  '': [ 'chicken' ],
947
1015
  chicken: [],
948
1016
  } );
949
- expect( originalState.tree.chicken ).not.toBe(
950
- replacedState.tree.chicken
1017
+ expect( originalState.tree.get( 'chicken' ) ).not.toBe(
1018
+ replacedState.tree.get( 'chicken' )
951
1019
  );
952
1020
 
953
1021
  const nestedBlock = {
@@ -977,16 +1045,16 @@ describe( 'state', () => {
977
1045
  blocks: [ replacementNestedBlock ],
978
1046
  } );
979
1047
 
980
- expect( replacedNestedState.order ).toEqual( {
1048
+ expect( Object.fromEntries( replacedNestedState.order ) ).toEqual( {
981
1049
  '': [ wrapperBlock.clientId ],
982
1050
  [ wrapperBlock.clientId ]: [ replacementNestedBlock.clientId ],
983
1051
  [ replacementNestedBlock.clientId ]: [],
984
1052
  } );
985
1053
 
986
- expect( originalNestedState.byClientId.chicken.name ).toBe(
1054
+ expect( originalNestedState.byClientId.get( 'chicken' ).name ).toBe(
987
1055
  'core/test-block'
988
1056
  );
989
- expect( replacedNestedState.byClientId.chicken.name ).toBe(
1057
+ expect( replacedNestedState.byClientId.get( 'chicken' ).name ).toBe(
990
1058
  'core/freeform'
991
1059
  );
992
1060
  } );
@@ -1013,19 +1081,19 @@ describe( 'state', () => {
1013
1081
  },
1014
1082
  } );
1015
1083
 
1016
- expect( state.byClientId.chicken ).toEqual( {
1084
+ expect( state.byClientId.get( 'chicken' ) ).toEqual( {
1017
1085
  clientId: 'chicken',
1018
1086
  name: 'core/test-block',
1019
1087
  isValid: true,
1020
1088
  } );
1021
1089
 
1022
- expect( state.attributes.chicken ).toEqual( {
1090
+ expect( state.attributes.get( 'chicken' ) ).toEqual( {
1023
1091
  content: 'ribs',
1024
1092
  } );
1025
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
1026
- state.tree.chicken
1093
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
1094
+ state.tree.get( 'chicken' )
1027
1095
  );
1028
- expect( state.tree.chicken ).toEqual( {
1096
+ expect( state.tree.get( 'chicken' ) ).toEqual( {
1029
1097
  clientId: 'chicken',
1030
1098
  name: 'core/test-block',
1031
1099
  innerBlocks: [],
@@ -1058,20 +1126,20 @@ describe( 'state', () => {
1058
1126
  updatedId: 3,
1059
1127
  } );
1060
1128
 
1061
- expect( state.byClientId.chicken ).toEqual( {
1129
+ expect( state.byClientId.get( 'chicken' ) ).toEqual( {
1062
1130
  clientId: 'chicken',
1063
1131
  name: 'core/block',
1064
1132
  isValid: false,
1065
1133
  } );
1066
1134
 
1067
- expect( state.attributes.chicken ).toEqual( {
1135
+ expect( state.attributes.get( 'chicken' ) ).toEqual( {
1068
1136
  ref: 3,
1069
1137
  } );
1070
1138
 
1071
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
1072
- state.tree.chicken
1139
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
1140
+ state.tree.get( 'chicken' )
1073
1141
  );
1074
- expect( state.tree.chicken ).toEqual( {
1142
+ expect( state.tree.get( 'chicken' ) ).toEqual( {
1075
1143
  clientId: 'chicken',
1076
1144
  name: 'core/block',
1077
1145
  isValid: false,
@@ -1105,12 +1173,16 @@ describe( 'state', () => {
1105
1173
  clientIds: [ 'ribs' ],
1106
1174
  } );
1107
1175
 
1108
- expect( state.order[ '' ] ).toEqual( [ 'ribs', 'chicken' ] );
1109
- expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe( state.tree.ribs );
1110
- expect( state.tree[ '' ].innerBlocks[ 1 ] ).toBe(
1111
- state.tree.chicken
1176
+ expect( state.order.get( '' ) ).toEqual( [ 'ribs', 'chicken' ] );
1177
+ expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
1178
+ state.tree.get( 'ribs' )
1179
+ );
1180
+ expect( state.tree.get( '' ).innerBlocks[ 1 ] ).toBe(
1181
+ state.tree.get( 'chicken' )
1182
+ );
1183
+ expect( state.tree.get( 'chicken' ) ).toBe(
1184
+ original.tree.get( 'chicken' )
1112
1185
  );
1113
- expect( state.tree.chicken ).toBe( original.tree.chicken );
1114
1186
  } );
1115
1187
 
1116
1188
  it( 'should move the nested block up', () => {
@@ -1130,7 +1202,7 @@ describe( 'state', () => {
1130
1202
  rootClientId: wrapperBlock.clientId,
1131
1203
  } );
1132
1204
 
1133
- expect( state.order ).toEqual( {
1205
+ expect( Object.fromEntries( state.order ) ).toEqual( {
1134
1206
  '': [ wrapperBlock.clientId ],
1135
1207
  [ wrapperBlock.clientId ]: [
1136
1208
  movedBlock.clientId,
@@ -1140,14 +1212,14 @@ describe( 'state', () => {
1140
1212
  [ siblingBlock.clientId ]: [],
1141
1213
  } );
1142
1214
 
1143
- expect( state.tree[ wrapperBlock.clientId ].innerBlocks[ 0 ] ).toBe(
1144
- state.tree[ movedBlock.clientId ]
1145
- );
1146
- expect( state.tree[ wrapperBlock.clientId ].innerBlocks[ 1 ] ).toBe(
1147
- state.tree[ siblingBlock.clientId ]
1148
- );
1149
- expect( state.tree[ movedBlock.clientId ] ).toBe(
1150
- original.tree[ movedBlock.clientId ]
1215
+ expect(
1216
+ state.tree.get( wrapperBlock.clientId ).innerBlocks[ 0 ]
1217
+ ).toBe( state.tree.get( movedBlock.clientId ) );
1218
+ expect(
1219
+ state.tree.get( wrapperBlock.clientId ).innerBlocks[ 1 ]
1220
+ ).toBe( state.tree.get( siblingBlock.clientId ) );
1221
+ expect( state.tree.get( movedBlock.clientId ) ).toBe(
1222
+ original.tree.get( movedBlock.clientId )
1151
1223
  );
1152
1224
  } );
1153
1225
 
@@ -1180,7 +1252,7 @@ describe( 'state', () => {
1180
1252
  clientIds: [ 'ribs', 'veggies' ],
1181
1253
  } );
1182
1254
 
1183
- expect( state.order[ '' ] ).toEqual( [
1255
+ expect( state.order.get( '' ) ).toEqual( [
1184
1256
  'ribs',
1185
1257
  'veggies',
1186
1258
  'chicken',
@@ -1206,7 +1278,7 @@ describe( 'state', () => {
1206
1278
  rootClientId: wrapperBlock.clientId,
1207
1279
  } );
1208
1280
 
1209
- expect( state.order ).toEqual( {
1281
+ expect( Object.fromEntries( state.order ) ).toEqual( {
1210
1282
  '': [ wrapperBlock.clientId ],
1211
1283
  [ wrapperBlock.clientId ]: [
1212
1284
  movedBlockA.clientId,
@@ -1268,7 +1340,7 @@ describe( 'state', () => {
1268
1340
  clientIds: [ 'chicken' ],
1269
1341
  } );
1270
1342
 
1271
- expect( state.order[ '' ] ).toEqual( [ 'ribs', 'chicken' ] );
1343
+ expect( state.order.get( '' ) ).toEqual( [ 'ribs', 'chicken' ] );
1272
1344
  } );
1273
1345
 
1274
1346
  it( 'should move the nested block down', () => {
@@ -1288,7 +1360,7 @@ describe( 'state', () => {
1288
1360
  rootClientId: wrapperBlock.clientId,
1289
1361
  } );
1290
1362
 
1291
- expect( state.order ).toEqual( {
1363
+ expect( Object.fromEntries( state.order ) ).toEqual( {
1292
1364
  '': [ wrapperBlock.clientId ],
1293
1365
  [ wrapperBlock.clientId ]: [
1294
1366
  siblingBlock.clientId,
@@ -1328,7 +1400,7 @@ describe( 'state', () => {
1328
1400
  clientIds: [ 'chicken', 'ribs' ],
1329
1401
  } );
1330
1402
 
1331
- expect( state.order[ '' ] ).toEqual( [
1403
+ expect( state.order.get( '' ) ).toEqual( [
1332
1404
  'veggies',
1333
1405
  'chicken',
1334
1406
  'ribs',
@@ -1354,7 +1426,7 @@ describe( 'state', () => {
1354
1426
  rootClientId: wrapperBlock.clientId,
1355
1427
  } );
1356
1428
 
1357
- expect( state.order ).toEqual( {
1429
+ expect( Object.fromEntries( state.order ) ).toEqual( {
1358
1430
  '': [ wrapperBlock.clientId ],
1359
1431
  [ wrapperBlock.clientId ]: [
1360
1432
  siblingBlock.clientId,
@@ -1416,21 +1488,23 @@ describe( 'state', () => {
1416
1488
  clientIds: [ 'chicken' ],
1417
1489
  } );
1418
1490
 
1419
- expect( state.order[ '' ] ).toEqual( [ 'ribs' ] );
1420
- expect( state.order ).not.toHaveProperty( 'chicken' );
1421
- expect( state.parents ).toEqual( {
1491
+ expect( state.order.get( '' ) ).toEqual( [ 'ribs' ] );
1492
+ expect( Object.fromEntries( state.order ) ).not.toHaveProperty(
1493
+ 'chicken'
1494
+ );
1495
+ expect( Object.fromEntries( state.parents ) ).toEqual( {
1422
1496
  ribs: '',
1423
1497
  } );
1424
- expect( state.byClientId ).toEqual( {
1498
+ expect( Object.fromEntries( state.byClientId ) ).toEqual( {
1425
1499
  ribs: {
1426
1500
  clientId: 'ribs',
1427
1501
  name: 'core/test-block',
1428
1502
  },
1429
1503
  } );
1430
- expect( state.attributes ).toEqual( {
1504
+ expect( Object.fromEntries( state.attributes ) ).toEqual( {
1431
1505
  ribs: {},
1432
1506
  } );
1433
- expect( state.tree[ '' ].innerBlocks ).toHaveLength( 1 );
1507
+ expect( state.tree.get( '' ).innerBlocks ).toHaveLength( 1 );
1434
1508
  } );
1435
1509
 
1436
1510
  it( 'should remove multiple blocks', () => {
@@ -1462,19 +1536,23 @@ describe( 'state', () => {
1462
1536
  clientIds: [ 'chicken', 'veggies' ],
1463
1537
  } );
1464
1538
 
1465
- expect( state.order[ '' ] ).toEqual( [ 'ribs' ] );
1466
- expect( state.order ).not.toHaveProperty( 'chicken' );
1467
- expect( state.order ).not.toHaveProperty( 'veggies' );
1468
- expect( state.parents ).toEqual( {
1539
+ expect( state.order.get( '' ) ).toEqual( [ 'ribs' ] );
1540
+ expect( Object.fromEntries( state.order ) ).not.toHaveProperty(
1541
+ 'chicken'
1542
+ );
1543
+ expect( Object.fromEntries( state.order ) ).not.toHaveProperty(
1544
+ 'veggies'
1545
+ );
1546
+ expect( Object.fromEntries( state.parents ) ).toEqual( {
1469
1547
  ribs: '',
1470
1548
  } );
1471
- expect( state.byClientId ).toEqual( {
1549
+ expect( Object.fromEntries( state.byClientId ) ).toEqual( {
1472
1550
  ribs: {
1473
1551
  clientId: 'ribs',
1474
1552
  name: 'core/test-block',
1475
1553
  },
1476
1554
  } );
1477
- expect( state.attributes ).toEqual( {
1555
+ expect( Object.fromEntries( state.attributes ) ).toEqual( {
1478
1556
  ribs: {},
1479
1557
  } );
1480
1558
  } );
@@ -1496,11 +1574,11 @@ describe( 'state', () => {
1496
1574
  clientIds: [ block.clientId ],
1497
1575
  } );
1498
1576
 
1499
- expect( state.byClientId ).toEqual( {} );
1500
- expect( state.order ).toEqual( {
1577
+ expect( state.byClientId ).toEqual( new Map() );
1578
+ expect( Object.fromEntries( state.order ) ).toEqual( {
1501
1579
  '': [],
1502
1580
  } );
1503
- expect( state.parents ).toEqual( {} );
1581
+ expect( Object.fromEntries( state.parents ) ).toEqual( {} );
1504
1582
  } );
1505
1583
 
1506
1584
  it( 'should insert at the specified index', () => {
@@ -1534,8 +1612,8 @@ describe( 'state', () => {
1534
1612
  ],
1535
1613
  } );
1536
1614
 
1537
- expect( Object.keys( state.byClientId ) ).toHaveLength( 3 );
1538
- expect( state.order[ '' ] ).toEqual( [
1615
+ expect( state.byClientId.size ).toBe( 3 );
1616
+ expect( state.order.get( '' ) ).toEqual( [
1539
1617
  'kumquat',
1540
1618
  'persimmon',
1541
1619
  'loquat',
@@ -1572,7 +1650,7 @@ describe( 'state', () => {
1572
1650
  index: 0,
1573
1651
  } );
1574
1652
 
1575
- expect( state.order[ '' ] ).toEqual( [
1653
+ expect( state.order.get( '' ) ).toEqual( [
1576
1654
  'ribs',
1577
1655
  'chicken',
1578
1656
  'veggies',
@@ -1609,7 +1687,7 @@ describe( 'state', () => {
1609
1687
  index: 2,
1610
1688
  } );
1611
1689
 
1612
- expect( state.order[ '' ] ).toEqual( [
1690
+ expect( state.order.get( '' ) ).toEqual( [
1613
1691
  'chicken',
1614
1692
  'veggies',
1615
1693
  'ribs',
@@ -1646,7 +1724,7 @@ describe( 'state', () => {
1646
1724
  index: 1,
1647
1725
  } );
1648
1726
 
1649
- expect( state.order[ '' ] ).toEqual( [
1727
+ expect( state.order.get( '' ) ).toEqual( [
1650
1728
  'chicken',
1651
1729
  'ribs',
1652
1730
  'veggies',
@@ -1683,7 +1761,7 @@ describe( 'state', () => {
1683
1761
  index: 0,
1684
1762
  } );
1685
1763
 
1686
- expect( state.order[ '' ] ).toEqual( [
1764
+ expect( state.order.get( '' ) ).toEqual( [
1687
1765
  'ribs',
1688
1766
  'veggies',
1689
1767
  'chicken',
@@ -1722,8 +1800,11 @@ describe( 'state', () => {
1722
1800
  index: 0,
1723
1801
  } );
1724
1802
 
1725
- expect( state.order[ '' ] ).toEqual( [ 'chicken' ] );
1726
- expect( state.order.chicken ).toEqual( [ 'ribs', 'veggies' ] );
1803
+ expect( state.order.get( '' ) ).toEqual( [ 'chicken' ] );
1804
+ expect( state.order.get( 'chicken' ) ).toEqual( [
1805
+ 'ribs',
1806
+ 'veggies',
1807
+ ] );
1727
1808
  } );
1728
1809
 
1729
1810
  describe( 'blocks', () => {
@@ -1795,7 +1876,42 @@ describe( 'state', () => {
1795
1876
  },
1796
1877
  } );
1797
1878
 
1798
- expect( state.attributes.kumquat.updated ).toBe( true );
1879
+ expect( state.attributes.get( 'kumquat' ).updated ).toBe(
1880
+ true
1881
+ );
1882
+ } );
1883
+
1884
+ it( 'should not updated equal attributes', () => {
1885
+ const original = deepFreeze(
1886
+ blocks( undefined, {
1887
+ type: 'RESET_BLOCKS',
1888
+ blocks: [
1889
+ {
1890
+ clientId: 'kumquat',
1891
+ attributes: {},
1892
+ innerBlocks: [],
1893
+ },
1894
+ ],
1895
+ } )
1896
+ );
1897
+ const state = blocks( original, {
1898
+ type: 'UPDATE_BLOCK_ATTRIBUTES',
1899
+ clientIds: [ 'kumquat' ],
1900
+ attributes: {
1901
+ updated: true,
1902
+ },
1903
+ } );
1904
+ const updatedState = blocks( state, {
1905
+ type: 'UPDATE_BLOCK_ATTRIBUTES',
1906
+ clientIds: [ 'kumquat' ],
1907
+ attributes: {
1908
+ updated: true,
1909
+ },
1910
+ } );
1911
+
1912
+ expect( state.attributes.get( 'kumquat' ) ).toBe(
1913
+ updatedState.attributes.get( 'kumquat' )
1914
+ );
1799
1915
  } );
1800
1916
 
1801
1917
  it( 'should return with attribute block updates when attributes are unique by block', () => {
@@ -1820,7 +1936,9 @@ describe( 'state', () => {
1820
1936
  uniqueByBlock: true,
1821
1937
  } );
1822
1938
 
1823
- expect( state.attributes.kumquat.updated ).toBe( true );
1939
+ expect( state.attributes.get( 'kumquat' ).updated ).toBe(
1940
+ true
1941
+ );
1824
1942
  } );
1825
1943
 
1826
1944
  it( 'should accumulate attribute block updates', () => {
@@ -1846,7 +1964,7 @@ describe( 'state', () => {
1846
1964
  },
1847
1965
  } );
1848
1966
 
1849
- expect( state.attributes.kumquat ).toEqual( {
1967
+ expect( state.attributes.get( 'kumquat' ) ).toEqual( {
1850
1968
  updated: true,
1851
1969
  moreUpdated: true,
1852
1970
  } );
@@ -1914,7 +2032,7 @@ describe( 'state', () => {
1914
2032
  clientIds: [ 'kumquat' ],
1915
2033
  } );
1916
2034
 
1917
- expect( state.attributes.kumquat ).toEqual( {} );
2035
+ expect( state.attributes.get( 'kumquat' ) ).toEqual( {} );
1918
2036
  } );
1919
2037
  } );
1920
2038
 
@@ -2111,105 +2229,115 @@ describe( 'state', () => {
2111
2229
  expect( state.controlledInnerBlocks.chicken ).toBe( true );
2112
2230
  // The previous content of the block should be removed
2113
2231
  expect( state.byClientId.child ).toBeUndefined();
2114
- expect( state.tree.child ).toBeUndefined();
2115
- expect( state.tree.chicken.innerBlocks ).toEqual( [] );
2232
+ expect( state.tree.get( 'child' ) ).toBeUndefined();
2233
+ expect( state.tree.get( 'chicken' ).innerBlocks ).toEqual(
2234
+ []
2235
+ );
2116
2236
  } );
2117
2237
  it( 'should preserve the controlled blocks in state and re-attach them in other pieces of state(order, tree, etc..), when we replace inner blocks', () => {
2118
2238
  const initialState = {
2119
- byClientId: {
2120
- 'group-id': {
2121
- clientId: 'group-id',
2122
- name: 'core/group',
2123
- isValid: true,
2124
- },
2125
- 'reusable-id': {
2126
- clientId: 'reusable-id',
2127
- name: 'core/block',
2128
- isValid: true,
2129
- },
2130
- 'paragraph-id': {
2131
- clientId: 'paragraph-id',
2132
- name: 'core/paragraph',
2133
- isValid: true,
2134
- },
2135
- },
2136
- order: {
2137
- '': [ 'group-id' ],
2138
- 'group-id': [ 'reusable-id' ],
2139
- 'reusable-id': [ 'paragraph-id' ],
2140
- 'paragraph-id': [],
2141
- },
2239
+ byClientId: new Map(
2240
+ Object.entries( {
2241
+ 'group-id': {
2242
+ clientId: 'group-id',
2243
+ name: 'core/group',
2244
+ isValid: true,
2245
+ },
2246
+ 'reusable-id': {
2247
+ clientId: 'reusable-id',
2248
+ name: 'core/block',
2249
+ isValid: true,
2250
+ },
2251
+ 'paragraph-id': {
2252
+ clientId: 'paragraph-id',
2253
+ name: 'core/paragraph',
2254
+ isValid: true,
2255
+ },
2256
+ } )
2257
+ ),
2258
+ order: new Map(
2259
+ Object.entries( {
2260
+ '': [ 'group-id' ],
2261
+ 'group-id': [ 'reusable-id' ],
2262
+ 'reusable-id': [ 'paragraph-id' ],
2263
+ 'paragraph-id': [],
2264
+ } )
2265
+ ),
2142
2266
  controlledInnerBlocks: {
2143
2267
  'reusable-id': true,
2144
2268
  },
2145
- parents: {
2146
- 'group-id': '',
2147
- 'reusable-id': 'group-id',
2148
- 'paragraph-id': 'reusable-id',
2149
- },
2150
- tree: {
2151
- 'group-id': {
2152
- clientId: 'group-id',
2153
- name: 'core/group',
2154
- isValid: true,
2155
- innerBlocks: [
2156
- {
2157
- clientId: 'reusable-id',
2158
- name: 'core/block',
2159
- isValid: true,
2160
- attributes: {
2161
- ref: 687,
2269
+ parents: new Map(
2270
+ Object.entries( {
2271
+ 'group-id': '',
2272
+ 'reusable-id': 'group-id',
2273
+ 'paragraph-id': 'reusable-id',
2274
+ } )
2275
+ ),
2276
+ tree: new Map(
2277
+ Object.entries( {
2278
+ 'group-id': {
2279
+ clientId: 'group-id',
2280
+ name: 'core/group',
2281
+ isValid: true,
2282
+ innerBlocks: [
2283
+ {
2284
+ clientId: 'reusable-id',
2285
+ name: 'core/block',
2286
+ isValid: true,
2287
+ attributes: {
2288
+ ref: 687,
2289
+ },
2290
+ innerBlocks: [],
2162
2291
  },
2163
- innerBlocks: [],
2292
+ ],
2293
+ },
2294
+ 'reusable-id': {
2295
+ clientId: 'reusable-id',
2296
+ name: 'core/block',
2297
+ isValid: true,
2298
+ attributes: {
2299
+ ref: 687,
2164
2300
  },
2165
- ],
2166
- },
2167
- 'reusable-id': {
2168
- clientId: 'reusable-id',
2169
- name: 'core/block',
2170
- isValid: true,
2171
- attributes: {
2172
- ref: 687,
2301
+ innerBlocks: [],
2173
2302
  },
2174
- innerBlocks: [],
2175
- },
2176
- '': {
2177
- innerBlocks: [
2178
- {
2179
- clientId: 'group-id',
2180
- name: 'core/group',
2181
- isValid: true,
2182
- innerBlocks: [
2183
- {
2184
- clientId: 'reusable-id',
2185
- name: 'core/block',
2186
- isValid: true,
2187
- attributes: {
2188
- ref: 687,
2303
+ '': {
2304
+ innerBlocks: [
2305
+ {
2306
+ clientId: 'group-id',
2307
+ name: 'core/group',
2308
+ isValid: true,
2309
+ innerBlocks: [
2310
+ {
2311
+ clientId: 'reusable-id',
2312
+ name: 'core/block',
2313
+ isValid: true,
2314
+ attributes: {
2315
+ ref: 687,
2316
+ },
2317
+ innerBlocks: [],
2189
2318
  },
2190
- innerBlocks: [],
2191
- },
2192
- ],
2193
- },
2194
- ],
2195
- },
2196
- 'paragraph-id': {
2197
- clientId: 'paragraph-id',
2198
- name: 'core/paragraph',
2199
- isValid: true,
2200
- innerBlocks: [],
2201
- },
2202
- 'controlled||reusable-id': {
2203
- innerBlocks: [
2204
- {
2205
- clientId: 'paragraph-id',
2206
- name: 'core/paragraph',
2207
- isValid: true,
2208
- innerBlocks: [],
2209
- },
2210
- ],
2211
- },
2212
- },
2319
+ ],
2320
+ },
2321
+ ],
2322
+ },
2323
+ 'paragraph-id': {
2324
+ clientId: 'paragraph-id',
2325
+ name: 'core/paragraph',
2326
+ isValid: true,
2327
+ innerBlocks: [],
2328
+ },
2329
+ 'controlled||reusable-id': {
2330
+ innerBlocks: [
2331
+ {
2332
+ clientId: 'paragraph-id',
2333
+ name: 'core/paragraph',
2334
+ isValid: true,
2335
+ innerBlocks: [],
2336
+ },
2337
+ ],
2338
+ },
2339
+ } )
2340
+ ),
2213
2341
  };
2214
2342
  // We will dispatch an action that replaces the inner
2215
2343
  // blocks with the same inner blocks, which contain
@@ -2231,11 +2359,15 @@ describe( 'state', () => {
2231
2359
  updateSelection: false,
2232
2360
  };
2233
2361
  const state = blocks( initialState, action );
2234
- expect( state.order ).toEqual(
2235
- expect.objectContaining( initialState.order )
2362
+ expect( Object.fromEntries( state.order ) ).toEqual(
2363
+ expect.objectContaining(
2364
+ Object.fromEntries( initialState.order )
2365
+ )
2236
2366
  );
2237
- expect( state.tree ).toEqual(
2238
- expect.objectContaining( initialState.tree )
2367
+ expect( Object.fromEntries( state.tree ) ).toEqual(
2368
+ expect.objectContaining(
2369
+ Object.fromEntries( initialState.tree )
2370
+ )
2239
2371
  );
2240
2372
  } );
2241
2373
  } );