@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
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { omit, mapValues, isEqual, isEmpty } from 'lodash';
4
+ import fastDeepEqual from 'fast-deep-equal/es6';
5
+ import { omit, isEmpty } from 'lodash';
5
6
  /**
6
7
  * WordPress dependencies
7
8
  */
@@ -31,16 +32,18 @@ const identity = x => x;
31
32
 
32
33
  function mapBlockOrder(blocks) {
33
34
  let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
34
- const result = {
35
- [rootClientId]: []
36
- };
35
+ const result = new Map();
36
+ const current = [];
37
+ result.set(rootClientId, current);
37
38
  blocks.forEach(block => {
38
39
  const {
39
40
  clientId,
40
41
  innerBlocks
41
42
  } = block;
42
- result[rootClientId].push(clientId);
43
- Object.assign(result, mapBlockOrder(innerBlocks, clientId));
43
+ current.push(clientId);
44
+ mapBlockOrder(innerBlocks, clientId).forEach((order, subClientId) => {
45
+ result.set(subClientId, order);
46
+ });
44
47
  });
45
48
  return result;
46
49
  }
@@ -57,9 +60,25 @@ function mapBlockOrder(blocks) {
57
60
 
58
61
  function mapBlockParents(blocks) {
59
62
  let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
60
- return blocks.reduce((result, block) => Object.assign(result, {
61
- [block.clientId]: rootClientId
62
- }, mapBlockParents(block.innerBlocks, block.clientId)), {});
63
+ const result = [];
64
+ const stack = [[rootClientId, blocks]];
65
+
66
+ while (stack.length) {
67
+ const [parent, currentBlocks] = stack.shift();
68
+ currentBlocks.forEach(_ref => {
69
+ let {
70
+ innerBlocks,
71
+ ...block
72
+ } = _ref;
73
+ result.push([block.clientId, parent]);
74
+
75
+ if (innerBlocks !== null && innerBlocks !== void 0 && innerBlocks.length) {
76
+ stack.push([block.clientId, innerBlocks]);
77
+ }
78
+ });
79
+ }
80
+
81
+ return result;
63
82
  }
64
83
  /**
65
84
  * Helper method to iterate through all blocks, recursing into inner blocks,
@@ -69,12 +88,28 @@ function mapBlockParents(blocks) {
69
88
  * @param {Array} blocks Blocks to flatten.
70
89
  * @param {Function} transform Transforming function to be applied to each block.
71
90
  *
72
- * @return {Object} Flattened object.
91
+ * @return {Array} Flattened object.
73
92
  */
74
93
 
75
94
 
76
95
  function flattenBlocks(blocks) {
77
96
  let transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : identity;
97
+ const result = [];
98
+ const stack = [...blocks];
99
+
100
+ while (stack.length) {
101
+ const {
102
+ innerBlocks,
103
+ ...block
104
+ } = stack.shift();
105
+ stack.push(...innerBlocks);
106
+ result.push([block.clientId, transform(block)]);
107
+ }
108
+
109
+ return result;
110
+ }
111
+
112
+ function getFlattenedClientIds(blocks) {
78
113
  const result = {};
79
114
  const stack = [...blocks];
80
115
 
@@ -84,7 +119,7 @@ function flattenBlocks(blocks) {
84
119
  ...block
85
120
  } = stack.shift();
86
121
  stack.push(...innerBlocks);
87
- result[block.clientId] = transform(block);
122
+ result[block.clientId] = true;
88
123
  }
89
124
 
90
125
  return result;
@@ -96,7 +131,7 @@ function flattenBlocks(blocks) {
96
131
  *
97
132
  * @param {Array} blocks Blocks to flatten.
98
133
  *
99
- * @return {Object} Flattened block attributes object.
134
+ * @return {Array} Flattened block attributes object.
100
135
  */
101
136
 
102
137
 
@@ -110,32 +145,13 @@ function getFlattenedBlocksWithoutAttributes(blocks) {
110
145
  *
111
146
  * @param {Array} blocks Blocks to flatten.
112
147
  *
113
- * @return {Object} Flattened block attributes object.
148
+ * @return {Array} Flattened block attributes object.
114
149
  */
115
150
 
116
151
 
117
152
  function getFlattenedBlockAttributes(blocks) {
118
153
  return flattenBlocks(blocks, block => block.attributes);
119
154
  }
120
- /**
121
- * Returns an object against which it is safe to perform mutating operations,
122
- * given the original object and its current working copy.
123
- *
124
- * @param {Object} original Original object.
125
- * @param {Object} working Working object.
126
- *
127
- * @return {Object} Mutation-safe object.
128
- */
129
-
130
-
131
- function getMutateSafeObject(original, working) {
132
- if (original === working) {
133
- return { ...original
134
- };
135
- }
136
-
137
- return working;
138
- }
139
155
  /**
140
156
  * Returns true if the two object arguments have the same keys, or false
141
157
  * otherwise.
@@ -148,7 +164,7 @@ function getMutateSafeObject(original, working) {
148
164
 
149
165
 
150
166
  export function hasSameKeys(a, b) {
151
- return isEqual(Object.keys(a), Object.keys(b));
167
+ return fastDeepEqual(Object.keys(a), Object.keys(b));
152
168
  }
153
169
  /**
154
170
  * Returns true if, given the currently dispatching action and the previously
@@ -162,11 +178,11 @@ export function hasSameKeys(a, b) {
162
178
  */
163
179
 
164
180
  export function isUpdatingSameBlockAttribute(action, lastAction) {
165
- return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && isEqual(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
181
+ return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && fastDeepEqual(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
166
182
  }
167
183
 
168
- function buildBlockTree(state, blocks) {
169
- const result = {};
184
+ function updateBlockTreeForBlocks(state, blocks) {
185
+ const treeToUpdate = state.tree;
170
186
  const stack = [...blocks];
171
187
  const flattenedBlocks = [...blocks];
172
188
 
@@ -178,26 +194,25 @@ function buildBlockTree(state, blocks) {
178
194
 
179
195
 
180
196
  for (const block of flattenedBlocks) {
181
- result[block.clientId] = {};
197
+ treeToUpdate.set(block.clientId, {});
182
198
  }
183
199
 
184
200
  for (const block of flattenedBlocks) {
185
- result[block.clientId] = Object.assign(result[block.clientId], { ...state.byClientId[block.clientId],
186
- attributes: state.attributes[block.clientId],
187
- innerBlocks: block.innerBlocks.map(subBlock => result[subBlock.clientId])
188
- });
201
+ treeToUpdate.set(block.clientId, Object.assign(treeToUpdate.get(block.clientId), { ...state.byClientId.get(block.clientId),
202
+ attributes: state.attributes.get(block.clientId),
203
+ innerBlocks: block.innerBlocks.map(subBlock => treeToUpdate.get(subBlock.clientId))
204
+ }));
189
205
  }
190
-
191
- return result;
192
206
  }
193
207
 
194
- function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
195
- let updateChildrenOfUpdatedClientIds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
208
+ function updateParentInnerBlocksInTree(state, updatedClientIds) {
209
+ let updateChildrenOfUpdatedClientIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
210
+ const treeToUpdate = state.tree;
196
211
  const uncontrolledParents = new Set([]);
197
212
  const controlledParents = new Set();
198
213
 
199
214
  for (const clientId of updatedClientIds) {
200
- let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents[clientId];
215
+ let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId);
201
216
 
202
217
  do {
203
218
  if (state.controlledInnerBlocks[current]) {
@@ -208,7 +223,7 @@ function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
208
223
  } else {
209
224
  // Else continue traversing up through parents.
210
225
  uncontrolledParents.add(current);
211
- current = state.parents[current];
226
+ current = state.parents.get(current);
212
227
  }
213
228
  } while (current !== undefined);
214
229
  } // To make sure the order of assignments doesn't matter,
@@ -216,23 +231,21 @@ function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
216
231
 
217
232
 
218
233
  for (const clientId of uncontrolledParents) {
219
- tree[clientId] = { ...tree[clientId]
220
- };
234
+ treeToUpdate.set(clientId, { ...treeToUpdate.get(clientId)
235
+ });
221
236
  }
222
237
 
223
238
  for (const clientId of uncontrolledParents) {
224
- tree[clientId].innerBlocks = (state.order[clientId] || []).map(subClientId => tree[subClientId]);
239
+ treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId));
225
240
  } // Controlled parent blocks, need a dedicated key for their inner blocks
226
241
  // to be used when doing getBlocks( controlledBlockClientId ).
227
242
 
228
243
 
229
244
  for (const clientId of controlledParents) {
230
- tree['controlled||' + clientId] = {
231
- innerBlocks: (state.order[clientId] || []).map(subClientId => tree[subClientId])
232
- };
245
+ treeToUpdate.set('controlled||' + clientId, {
246
+ innerBlocks: (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId))
247
+ });
233
248
  }
234
-
235
- return tree;
236
249
  }
237
250
  /**
238
251
  * Higher-order reducer intended to compute full block objects key for each block in the post.
@@ -254,61 +267,61 @@ const withBlockTree = reducer => function () {
254
267
  return state;
255
268
  }
256
269
 
257
- newState.tree = state.tree ? state.tree : {};
270
+ newState.tree = state.tree ? state.tree : new Map();
258
271
 
259
272
  switch (action.type) {
260
273
  case 'RECEIVE_BLOCKS':
261
274
  case 'INSERT_BLOCKS':
262
275
  {
263
- const subTree = buildBlockTree(newState, action.blocks);
264
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
265
- ...subTree
266
- }, action.rootClientId ? [action.rootClientId] : [''], true);
276
+ newState.tree = new Map(newState.tree);
277
+ updateBlockTreeForBlocks(newState, action.blocks);
278
+ updateParentInnerBlocksInTree(newState, action.rootClientId ? [action.rootClientId] : [''], true);
267
279
  break;
268
280
  }
269
281
 
270
282
  case 'UPDATE_BLOCK':
271
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
272
- [action.clientId]: { ...newState.tree[action.clientId],
273
- ...newState.byClientId[action.clientId],
274
- attributes: newState.attributes[action.clientId]
275
- }
276
- }, [action.clientId], false);
283
+ newState.tree = new Map(newState.tree);
284
+ newState.tree.set(action.clientId, { ...newState.tree.get(action.clientId),
285
+ ...newState.byClientId.get(action.clientId),
286
+ attributes: newState.attributes.get(action.clientId)
287
+ });
288
+ updateParentInnerBlocksInTree(newState, [action.clientId], false);
277
289
  break;
278
290
 
279
291
  case 'UPDATE_BLOCK_ATTRIBUTES':
280
292
  {
281
- const newSubTree = action.clientIds.reduce((result, clientId) => {
282
- result[clientId] = { ...newState.tree[clientId],
283
- attributes: newState.attributes[clientId]
284
- };
285
- return result;
286
- }, {});
287
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
288
- ...newSubTree
289
- }, action.clientIds, false);
293
+ newState.tree = new Map(newState.tree);
294
+ action.clientIds.forEach(clientId => {
295
+ newState.tree.set(clientId, { ...newState.tree.get(clientId),
296
+ attributes: newState.attributes.get(clientId)
297
+ });
298
+ });
299
+ updateParentInnerBlocksInTree(newState, action.clientIds, false);
290
300
  break;
291
301
  }
292
302
 
293
303
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
294
304
  {
295
- const subTree = buildBlockTree(newState, action.blocks);
296
- newState.tree = updateParentInnerBlocksInTree(newState, { ...omit(newState.tree, action.replacedClientIds.concat( // Controlled inner blocks are only removed
297
- // if the block doesn't move to another position
298
- // otherwise their content will be lost.
299
- action.replacedClientIds.filter(clientId => !subTree[clientId]).map(clientId => 'controlled||' + clientId))),
300
- ...subTree
301
- }, action.blocks.map(b => b.clientId), false); // If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
305
+ const inserterClientIds = getFlattenedClientIds(action.blocks);
306
+ newState.tree = new Map(newState.tree);
307
+ action.replacedClientIds.concat( // Controlled inner blocks are only removed
308
+ // if the block doesn't move to another position
309
+ // otherwise their content will be lost.
310
+ action.replacedClientIds.filter(clientId => !inserterClientIds[clientId]).map(clientId => 'controlled||' + clientId)).forEach(key => {
311
+ newState.tree.delete(key);
312
+ });
313
+ updateBlockTreeForBlocks(newState, action.blocks);
314
+ updateParentInnerBlocksInTree(newState, action.blocks.map(b => b.clientId), false); // If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
302
315
 
303
316
  const parentsOfRemovedBlocks = [];
304
317
 
305
318
  for (const clientId of action.clientIds) {
306
- if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) {
307
- parentsOfRemovedBlocks.push(state.parents[clientId]);
319
+ if (state.parents.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) {
320
+ parentsOfRemovedBlocks.push(state.parents.get(clientId));
308
321
  }
309
322
  }
310
323
 
311
- newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, parentsOfRemovedBlocks, true);
324
+ updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
312
325
  break;
313
326
  }
314
327
 
@@ -316,12 +329,16 @@ const withBlockTree = reducer => function () {
316
329
  const parentsOfRemovedBlocks = [];
317
330
 
318
331
  for (const clientId of action.clientIds) {
319
- if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) {
320
- parentsOfRemovedBlocks.push(state.parents[clientId]);
332
+ if (state.parents.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) {
333
+ parentsOfRemovedBlocks.push(state.parents.get(clientId));
321
334
  }
322
335
  }
323
336
 
324
- newState.tree = updateParentInnerBlocksInTree(newState, omit(newState.tree, action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId))), parentsOfRemovedBlocks, true);
337
+ newState.tree = new Map(newState.tree);
338
+ action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId)).forEach(key => {
339
+ newState.tree.delete(key);
340
+ });
341
+ updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
325
342
  break;
326
343
 
327
344
  case 'MOVE_BLOCKS_TO_POSITION':
@@ -338,7 +355,8 @@ const withBlockTree = reducer => function () {
338
355
  updatedBlockUids.push(action.toRootClientId);
339
356
  }
340
357
 
341
- newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
358
+ newState.tree = new Map(newState.tree);
359
+ updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
342
360
  break;
343
361
  }
344
362
 
@@ -346,28 +364,27 @@ const withBlockTree = reducer => function () {
346
364
  case 'MOVE_BLOCKS_DOWN':
347
365
  {
348
366
  const updatedBlockUids = [action.rootClientId ? action.rootClientId : ''];
349
- newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
367
+ newState.tree = new Map(newState.tree);
368
+ updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
350
369
  break;
351
370
  }
352
371
 
353
372
  case 'SAVE_REUSABLE_BLOCK_SUCCESS':
354
373
  {
355
- const updatedBlockUids = Object.entries(newState.attributes).filter(_ref => {
356
- let [clientId, attributes] = _ref;
357
- return newState.byClientId[clientId].name === 'core/block' && attributes.ref === action.updatedId;
358
- }).map(_ref2 => {
359
- let [clientId] = _ref2;
360
- return clientId;
374
+ const updatedBlockUids = [];
375
+ newState.attributes.forEach((attributes, clientId) => {
376
+ if (newState.byClientId.get(clientId).name === 'core/block' && attributes.ref === action.updatedId) {
377
+ updatedBlockUids.push(clientId);
378
+ }
361
379
  });
362
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
363
- ...updatedBlockUids.reduce((result, clientId) => {
364
- result[clientId] = { ...newState.byClientId[clientId],
365
- attributes: newState.attributes[clientId],
366
- innerBlocks: newState.tree[clientId].innerBlocks
367
- };
368
- return result;
369
- }, {})
370
- }, updatedBlockUids, false);
380
+ newState.tree = new Map(newState.tree);
381
+ updatedBlockUids.forEach(clientId => {
382
+ newState.tree.set(clientId, { ...newState.byClientId.get(clientId),
383
+ attributes: newState.attributes.get(clientId),
384
+ innerBlocks: newState.tree.get(clientId).innerBlocks
385
+ });
386
+ });
387
+ updateParentInnerBlocksInTree(newState, updatedBlockUids, false);
371
388
  }
372
389
  }
373
390
 
@@ -464,7 +481,7 @@ const withInnerBlocksRemoveCascade = reducer => (state, action) => {
464
481
  let result = clientIds;
465
482
 
466
483
  for (let i = 0; i < result.length; i++) {
467
- if (!state.order[result[i]] || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
484
+ if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
468
485
  continue;
469
486
  }
470
487
 
@@ -472,7 +489,7 @@ const withInnerBlocksRemoveCascade = reducer => (state, action) => {
472
489
  result = [...result];
473
490
  }
474
491
 
475
- result.push(...state.order[result[i]]);
492
+ result.push(...state.order.get(result[i]));
476
493
  }
477
494
 
478
495
  return result;
@@ -513,19 +530,17 @@ const withInnerBlocksRemoveCascade = reducer => (state, action) => {
513
530
  const withBlockReset = reducer => (state, action) => {
514
531
  if (action.type === 'RESET_BLOCKS') {
515
532
  const newState = { ...state,
516
- byClientId: getFlattenedBlocksWithoutAttributes(action.blocks),
517
- attributes: getFlattenedBlockAttributes(action.blocks),
533
+ byClientId: new Map(getFlattenedBlocksWithoutAttributes(action.blocks)),
534
+ attributes: new Map(getFlattenedBlockAttributes(action.blocks)),
518
535
  order: mapBlockOrder(action.blocks),
519
- parents: mapBlockParents(action.blocks),
536
+ parents: new Map(mapBlockParents(action.blocks)),
520
537
  controlledInnerBlocks: {}
521
538
  };
522
- const subTree = buildBlockTree(newState, action.blocks);
523
- newState.tree = { ...subTree,
524
- // Root.
525
- '': {
526
- innerBlocks: action.blocks.map(subBlock => subTree[subBlock.clientId])
527
- }
528
- };
539
+ newState.tree = new Map(state === null || state === void 0 ? void 0 : state.tree);
540
+ updateBlockTreeForBlocks(newState, action.blocks);
541
+ newState.tree.set('', {
542
+ innerBlocks: action.blocks.map(subBlock => newState.tree.get(subBlock.clientId))
543
+ });
529
544
  return newState;
530
545
  }
531
546
 
@@ -578,11 +593,11 @@ const withReplaceInnerBlocks = reducer => (state, action) => {
578
593
 
579
594
  let stateAfterBlocksRemoval = state;
580
595
 
581
- if (state.order[action.rootClientId]) {
596
+ if (state.order.get(action.rootClientId)) {
582
597
  stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, {
583
598
  type: 'REMOVE_BLOCKS',
584
599
  keepControlledInnerBlocks: nestedControllers,
585
- clientIds: state.order[action.rootClientId]
600
+ clientIds: state.order.get(action.rootClientId)
586
601
  });
587
602
  }
588
603
 
@@ -596,26 +611,21 @@ const withReplaceInnerBlocks = reducer => (state, action) => {
596
611
  // preserve their block order. Otherwise, an inner block controller's blocks
597
612
  // will be deleted entirely from its entity.
598
613
 
599
- stateAfterInsert.order = { ...stateAfterInsert.order,
600
- ...Object.keys(nestedControllers).reduce((result, key) => {
601
- if (state.order[key]) {
602
- result[key] = state.order[key];
603
- }
604
-
605
- return result;
606
- }, {})
607
- };
608
- stateAfterInsert.tree = { ...stateAfterInsert.tree,
609
- ...Object.keys(nestedControllers).reduce((result, _key) => {
610
- const key = `controlled||${_key}`;
611
-
612
- if (state.tree[key]) {
613
- result[key] = state.tree[key];
614
- }
614
+ const stateAfterInsertOrder = new Map(stateAfterInsert.order);
615
+ Object.keys(nestedControllers).forEach(key => {
616
+ if (state.order.get(key)) {
617
+ stateAfterInsertOrder.set(key, state.order.get(key));
618
+ }
619
+ });
620
+ stateAfterInsert.order = stateAfterInsertOrder;
621
+ stateAfterInsert.tree = new Map(stateAfterInsert.tree);
622
+ Object.keys(nestedControllers).forEach(_key => {
623
+ const key = `controlled||${_key}`;
615
624
 
616
- return result;
617
- }, {})
618
- };
625
+ if (state.tree.has(key)) {
626
+ stateAfterInsert.tree.set(key, state.tree.get(key));
627
+ }
628
+ });
619
629
  }
620
630
 
621
631
  return stateAfterInsert;
@@ -645,18 +655,17 @@ const withSaveReusableBlock = reducer => (state, action) => {
645
655
 
646
656
  state = { ...state
647
657
  };
648
- state.attributes = mapValues(state.attributes, (attributes, clientId) => {
658
+ state.attributes = new Map(state.attributes);
659
+ state.attributes.forEach((attributes, clientId) => {
649
660
  const {
650
661
  name
651
- } = state.byClientId[clientId];
662
+ } = state.byClientId.get(clientId);
652
663
 
653
664
  if (name === 'core/block' && attributes.ref === id) {
654
- return { ...attributes,
665
+ state.attributes.set(clientId, { ...attributes,
655
666
  ref: updatedId
656
- };
667
+ });
657
668
  }
658
-
659
- return attributes;
660
669
  });
661
670
  }
662
671
 
@@ -699,137 +708,202 @@ export const blocks = pipe(combineReducers, withSaveReusableBlock, // Needs to b
699
708
  withBlockTree, // Needs to be before withInnerBlocksRemoveCascade.
700
709
  withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade.
701
710
  withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetControlledBlocks)({
711
+ // The state is using a Map instead of a plain object for performance reasons.
712
+ // You can run the "./test/performance.js" unit test to check the impact
713
+ // code changes can have on this reducer.
702
714
  byClientId() {
703
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
715
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
704
716
  let action = arguments.length > 1 ? arguments[1] : undefined;
705
717
 
706
718
  switch (action.type) {
707
719
  case 'RECEIVE_BLOCKS':
708
720
  case 'INSERT_BLOCKS':
709
- return { ...state,
710
- ...getFlattenedBlocksWithoutAttributes(action.blocks)
711
- };
721
+ {
722
+ const newState = new Map(state);
723
+ getFlattenedBlocksWithoutAttributes(action.blocks).forEach(_ref2 => {
724
+ let [key, value] = _ref2;
725
+ newState.set(key, value);
726
+ });
727
+ return newState;
728
+ }
712
729
 
713
730
  case 'UPDATE_BLOCK':
714
- // Ignore updates if block isn't known.
715
- if (!state[action.clientId]) {
716
- return state;
717
- } // Do nothing if only attributes change.
731
+ {
732
+ // Ignore updates if block isn't known.
733
+ if (!state.has(action.clientId)) {
734
+ return state;
735
+ } // Do nothing if only attributes change.
718
736
 
719
737
 
720
- const changes = omit(action.updates, 'attributes');
738
+ const changes = omit(action.updates, 'attributes');
721
739
 
722
- if (isEmpty(changes)) {
723
- return state;
724
- }
740
+ if (isEmpty(changes)) {
741
+ return state;
742
+ }
725
743
 
726
- return { ...state,
727
- [action.clientId]: { ...state[action.clientId],
744
+ const newState = new Map(state);
745
+ newState.set(action.clientId, { ...state.get(action.clientId),
728
746
  ...changes
729
- }
730
- };
747
+ });
748
+ return newState;
749
+ }
731
750
 
732
751
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
733
- if (!action.blocks) {
734
- return state;
735
- }
752
+ {
753
+ if (!action.blocks) {
754
+ return state;
755
+ }
736
756
 
737
- return { ...omit(state, action.replacedClientIds),
738
- ...getFlattenedBlocksWithoutAttributes(action.blocks)
739
- };
757
+ const newState = new Map(state);
758
+ action.replacedClientIds.forEach(clientId => {
759
+ newState.delete(clientId);
760
+ });
761
+ getFlattenedBlocksWithoutAttributes(action.blocks).forEach(_ref3 => {
762
+ let [key, value] = _ref3;
763
+ newState.set(key, value);
764
+ });
765
+ return newState;
766
+ }
740
767
 
741
768
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
742
- return omit(state, action.removedClientIds);
769
+ {
770
+ const newState = new Map(state);
771
+ action.removedClientIds.forEach(clientId => {
772
+ newState.delete(clientId);
773
+ });
774
+ return newState;
775
+ }
743
776
  }
744
777
 
745
778
  return state;
746
779
  },
747
780
 
781
+ // The state is using a Map instead of a plain object for performance reasons.
782
+ // You can run the "./test/performance.js" unit test to check the impact
783
+ // code changes can have on this reducer.
748
784
  attributes() {
749
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
785
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
750
786
  let action = arguments.length > 1 ? arguments[1] : undefined;
751
787
 
752
788
  switch (action.type) {
753
789
  case 'RECEIVE_BLOCKS':
754
790
  case 'INSERT_BLOCKS':
755
- return { ...state,
756
- ...getFlattenedBlockAttributes(action.blocks)
757
- };
791
+ {
792
+ const newState = new Map(state);
793
+ getFlattenedBlockAttributes(action.blocks).forEach(_ref4 => {
794
+ let [key, value] = _ref4;
795
+ newState.set(key, value);
796
+ });
797
+ return newState;
798
+ }
758
799
 
759
800
  case 'UPDATE_BLOCK':
760
- // Ignore updates if block isn't known or there are no attribute changes.
761
- if (!state[action.clientId] || !action.updates.attributes) {
762
- return state;
763
- }
801
+ {
802
+ // Ignore updates if block isn't known or there are no attribute changes.
803
+ if (!state.get(action.clientId) || !action.updates.attributes) {
804
+ return state;
805
+ }
764
806
 
765
- return { ...state,
766
- [action.clientId]: { ...state[action.clientId],
807
+ const newState = new Map(state);
808
+ newState.set(action.clientId, { ...state.get(action.clientId),
767
809
  ...action.updates.attributes
768
- }
769
- };
810
+ });
811
+ return newState;
812
+ }
770
813
 
771
814
  case 'UPDATE_BLOCK_ATTRIBUTES':
772
815
  {
773
816
  // Avoid a state change if none of the block IDs are known.
774
- if (action.clientIds.every(id => !state[id])) {
817
+ if (action.clientIds.every(id => !state.get(id))) {
775
818
  return state;
776
819
  }
777
820
 
778
- const next = action.clientIds.reduce((accumulator, id) => {
779
- var _action$attributes;
821
+ let hasChange = false;
822
+ const newState = new Map(state);
780
823
 
781
- return { ...accumulator,
782
- [id]: Object.entries(action.uniqueByBlock ? action.attributes[id] : (_action$attributes = action.attributes) !== null && _action$attributes !== void 0 ? _action$attributes : {}).reduce((result, _ref3) => {
783
- let [key, value] = _ref3;
824
+ for (const clientId of action.clientIds) {
825
+ var _action$attributes;
784
826
 
785
- // Consider as updates only changed values.
786
- if (value !== result[key]) {
787
- result = getMutateSafeObject(state[id], result);
788
- result[key] = value;
789
- }
827
+ const updatedAttributeEntries = Object.entries(action.uniqueByBlock ? action.attributes[clientId] : (_action$attributes = action.attributes) !== null && _action$attributes !== void 0 ? _action$attributes : {});
790
828
 
791
- return result;
792
- }, state[id])
793
- };
794
- }, {});
829
+ if (updatedAttributeEntries.length === 0) {
830
+ continue;
831
+ }
795
832
 
796
- if (action.clientIds.every(id => next[id] === state[id])) {
797
- return state;
833
+ let hasUpdatedAttributes = false;
834
+ const existingAttributes = state.get(clientId);
835
+ const newAttributes = {};
836
+ updatedAttributeEntries.forEach(_ref5 => {
837
+ let [key, value] = _ref5;
838
+
839
+ if (existingAttributes[key] !== value) {
840
+ hasUpdatedAttributes = true;
841
+ newAttributes[key] = value;
842
+ }
843
+ });
844
+ hasChange = hasChange || hasUpdatedAttributes;
845
+
846
+ if (hasUpdatedAttributes) {
847
+ newState.set(clientId, { ...existingAttributes,
848
+ ...newAttributes
849
+ });
850
+ }
798
851
  }
799
852
 
800
- return { ...state,
801
- ...next
802
- };
853
+ return hasChange ? newState : state;
803
854
  }
804
855
 
805
856
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
806
- if (!action.blocks) {
807
- return state;
808
- }
857
+ {
858
+ if (!action.blocks) {
859
+ return state;
860
+ }
809
861
 
810
- return { ...omit(state, action.replacedClientIds),
811
- ...getFlattenedBlockAttributes(action.blocks)
812
- };
862
+ const newState = new Map(state);
863
+ action.replacedClientIds.forEach(clientId => {
864
+ newState.delete(clientId);
865
+ });
866
+ getFlattenedBlockAttributes(action.blocks).forEach(_ref6 => {
867
+ let [key, value] = _ref6;
868
+ newState.set(key, value);
869
+ });
870
+ return newState;
871
+ }
813
872
 
814
873
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
815
- return omit(state, action.removedClientIds);
874
+ {
875
+ const newState = new Map(state);
876
+ action.removedClientIds.forEach(clientId => {
877
+ newState.delete(clientId);
878
+ });
879
+ return newState;
880
+ }
816
881
  }
817
882
 
818
883
  return state;
819
884
  },
820
885
 
886
+ // The state is using a Map instead of a plain object for performance reasons.
887
+ // You can run the "./test/performance.js" unit test to check the impact
888
+ // code changes can have on this reducer.
821
889
  order() {
822
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
890
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
823
891
  let action = arguments.length > 1 ? arguments[1] : undefined;
824
892
 
825
893
  switch (action.type) {
826
894
  case 'RECEIVE_BLOCKS':
827
895
  {
896
+ var _state$get;
897
+
828
898
  const blockOrder = mapBlockOrder(action.blocks);
829
- return { ...state,
830
- ...omit(blockOrder, ''),
831
- '': ((state === null || state === void 0 ? void 0 : state['']) || []).concat(blockOrder[''])
832
- };
899
+ const newState = new Map(state);
900
+ blockOrder.forEach((order, clientId) => {
901
+ if (clientId !== '') {
902
+ newState.set(clientId, order);
903
+ }
904
+ });
905
+ newState.set('', ((_state$get = state.get('')) !== null && _state$get !== void 0 ? _state$get : []).concat(blockOrder['']));
906
+ return newState;
833
907
  }
834
908
 
835
909
  case 'INSERT_BLOCKS':
@@ -837,20 +911,22 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
837
911
  const {
838
912
  rootClientId = ''
839
913
  } = action;
840
- const subState = state[rootClientId] || [];
914
+ const subState = state.get(rootClientId) || [];
841
915
  const mappedBlocks = mapBlockOrder(action.blocks, rootClientId);
842
916
  const {
843
917
  index = subState.length
844
918
  } = action;
845
- return { ...state,
846
- ...mappedBlocks,
847
- [rootClientId]: insertAt(subState, mappedBlocks[rootClientId], index)
848
- };
919
+ const newState = new Map(state);
920
+ mappedBlocks.forEach((order, clientId) => {
921
+ newState.set(clientId, order);
922
+ });
923
+ newState.set(rootClientId, insertAt(subState, mappedBlocks.get(rootClientId), index));
924
+ return newState;
849
925
  }
850
926
 
851
927
  case 'MOVE_BLOCKS_TO_POSITION':
852
928
  {
853
- var _state$fromRootClient, _state$fromRootClient2;
929
+ var _state$get$filter, _state$get2;
854
930
 
855
931
  const {
856
932
  fromRootClientId = '',
@@ -858,22 +934,22 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
858
934
  clientIds
859
935
  } = action;
860
936
  const {
861
- index = state[toRootClientId].length
937
+ index = state.get(toRootClientId).length
862
938
  } = action; // Moving inside the same parent block.
863
939
 
864
940
  if (fromRootClientId === toRootClientId) {
865
- const subState = state[toRootClientId];
941
+ const subState = state.get(toRootClientId);
866
942
  const fromIndex = subState.indexOf(clientIds[0]);
867
- return { ...state,
868
- [toRootClientId]: moveTo(state[toRootClientId], fromIndex, index, clientIds.length)
869
- };
943
+ const newState = new Map(state);
944
+ newState.set(toRootClientId, moveTo(state.get(toRootClientId), fromIndex, index, clientIds.length));
945
+ return newState;
870
946
  } // Moving from a parent block to another.
871
947
 
872
948
 
873
- return { ...state,
874
- [fromRootClientId]: (_state$fromRootClient = (_state$fromRootClient2 = state[fromRootClientId]) === null || _state$fromRootClient2 === void 0 ? void 0 : _state$fromRootClient2.filter(id => !clientIds.includes(id))) !== null && _state$fromRootClient !== void 0 ? _state$fromRootClient : [],
875
- [toRootClientId]: insertAt(state[toRootClientId], clientIds, index)
876
- };
949
+ const newState = new Map(state);
950
+ newState.set(fromRootClientId, (_state$get$filter = (_state$get2 = state.get(fromRootClientId)) === null || _state$get2 === void 0 ? void 0 : _state$get2.filter(id => !clientIds.includes(id))) !== null && _state$get$filter !== void 0 ? _state$get$filter : []);
951
+ newState.set(toRootClientId, insertAt(state.get(toRootClientId), clientIds, index));
952
+ return newState;
877
953
  }
878
954
 
879
955
  case 'MOVE_BLOCKS_UP':
@@ -883,16 +959,16 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
883
959
  rootClientId = ''
884
960
  } = action;
885
961
  const firstClientId = clientIds[0];
886
- const subState = state[rootClientId];
962
+ const subState = state.get(rootClientId);
887
963
 
888
964
  if (!subState.length || firstClientId === subState[0]) {
889
965
  return state;
890
966
  }
891
967
 
892
968
  const firstIndex = subState.indexOf(firstClientId);
893
- return { ...state,
894
- [rootClientId]: moveTo(subState, firstIndex, firstIndex - 1, clientIds.length)
895
- };
969
+ const newState = new Map(state);
970
+ newState.set(rootClientId, moveTo(subState, firstIndex, firstIndex - 1, clientIds.length));
971
+ return newState;
896
972
  }
897
973
 
898
974
  case 'MOVE_BLOCKS_DOWN':
@@ -903,16 +979,16 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
903
979
  } = action;
904
980
  const firstClientId = clientIds[0];
905
981
  const lastClientId = clientIds[clientIds.length - 1];
906
- const subState = state[rootClientId];
982
+ const subState = state.get(rootClientId);
907
983
 
908
984
  if (!subState.length || lastClientId === subState[subState.length - 1]) {
909
985
  return state;
910
986
  }
911
987
 
912
988
  const firstIndex = subState.indexOf(firstClientId);
913
- return { ...state,
914
- [rootClientId]: moveTo(subState, firstIndex, firstIndex + 1, clientIds.length)
915
- };
989
+ const newState = new Map(state);
990
+ newState.set(rootClientId, moveTo(subState, firstIndex, firstIndex + 1, clientIds.length));
991
+ return newState;
916
992
  }
917
993
 
918
994
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
@@ -926,29 +1002,50 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
926
1002
  }
927
1003
 
928
1004
  const mappedBlocks = mapBlockOrder(action.blocks);
929
- return pipe([nextState => omit(nextState, action.replacedClientIds), nextState => ({ ...nextState,
930
- ...omit(mappedBlocks, '')
931
- }), nextState => mapValues(nextState, subState => Object.values(subState).reduce((result, clientId) => {
932
- if (clientId === clientIds[0]) {
933
- return [...result, ...mappedBlocks['']];
1005
+ const newState = new Map(state);
1006
+ action.replacedClientIds.forEach(clientId => {
1007
+ newState.delete(clientId);
1008
+ });
1009
+ mappedBlocks.forEach((order, clientId) => {
1010
+ if (clientId !== '') {
1011
+ newState.set(clientId, order);
934
1012
  }
935
-
936
- if (clientIds.indexOf(clientId) === -1) {
937
- result.push(clientId);
938
- }
939
-
940
- return result;
941
- }, []))])(state);
1013
+ });
1014
+ newState.forEach((order, clientId) => {
1015
+ const newSubOrder = Object.values(order).reduce((result, subClientId) => {
1016
+ if (subClientId === clientIds[0]) {
1017
+ return [...result, ...mappedBlocks.get('')];
1018
+ }
1019
+
1020
+ if (clientIds.indexOf(subClientId) === -1) {
1021
+ result.push(subClientId);
1022
+ }
1023
+
1024
+ return result;
1025
+ }, []);
1026
+ newState.set(clientId, newSubOrder);
1027
+ });
1028
+ return newState;
942
1029
  }
943
1030
 
944
1031
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
945
- return pipe([// Remove inner block ordering for removed blocks.
946
- nextState => omit(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings.
947
- nextState => mapValues(nextState, subState => {
948
- var _subState$filter;
1032
+ {
1033
+ const newState = new Map(state); // Remove inner block ordering for removed blocks.
949
1034
 
950
- return (_subState$filter = subState === null || subState === void 0 ? void 0 : subState.filter(id => !action.removedClientIds.includes(id))) !== null && _subState$filter !== void 0 ? _subState$filter : [];
951
- })])(state);
1035
+ action.removedClientIds.forEach(clientId => {
1036
+ newState.delete(clientId);
1037
+ });
1038
+ newState.forEach((order, clientId) => {
1039
+ var _order$filter;
1040
+
1041
+ const newSubOrder = (_order$filter = order === null || order === void 0 ? void 0 : order.filter(id => !action.removedClientIds.includes(id))) !== null && _order$filter !== void 0 ? _order$filter : [];
1042
+
1043
+ if (newSubOrder.length !== order.length) {
1044
+ newState.set(clientId, newSubOrder);
1045
+ }
1046
+ });
1047
+ return newState;
1048
+ }
952
1049
  }
953
1050
 
954
1051
  return state;
@@ -957,37 +1054,60 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
957
1054
  // While technically redundant data as the inverse of `order`, it serves as
958
1055
  // an optimization for the selectors which derive the ancestry of a block.
959
1056
  parents() {
960
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1057
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
961
1058
  let action = arguments.length > 1 ? arguments[1] : undefined;
962
1059
 
963
1060
  switch (action.type) {
964
1061
  case 'RECEIVE_BLOCKS':
965
- return { ...state,
966
- ...mapBlockParents(action.blocks)
967
- };
1062
+ {
1063
+ const newState = new Map(state);
1064
+ mapBlockParents(action.blocks).forEach(_ref7 => {
1065
+ let [key, value] = _ref7;
1066
+ newState.set(key, value);
1067
+ });
1068
+ return newState;
1069
+ }
968
1070
 
969
1071
  case 'INSERT_BLOCKS':
970
- return { ...state,
971
- ...mapBlockParents(action.blocks, action.rootClientId || '')
972
- };
1072
+ {
1073
+ const newState = new Map(state);
1074
+ mapBlockParents(action.blocks, action.rootClientId || '').forEach(_ref8 => {
1075
+ let [key, value] = _ref8;
1076
+ newState.set(key, value);
1077
+ });
1078
+ return newState;
1079
+ }
973
1080
 
974
1081
  case 'MOVE_BLOCKS_TO_POSITION':
975
1082
  {
976
- return { ...state,
977
- ...action.clientIds.reduce((accumulator, id) => {
978
- accumulator[id] = action.toRootClientId || '';
979
- return accumulator;
980
- }, {})
981
- };
1083
+ const newState = new Map(state);
1084
+ action.clientIds.forEach(id => {
1085
+ newState.set(id, action.toRootClientId || '');
1086
+ });
1087
+ return newState;
982
1088
  }
983
1089
 
984
1090
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
985
- return { ...omit(state, action.replacedClientIds),
986
- ...mapBlockParents(action.blocks, state[action.clientIds[0]])
987
- };
1091
+ {
1092
+ const newState = new Map(state);
1093
+ action.replacedClientIds.forEach(clientId => {
1094
+ newState.delete(clientId);
1095
+ });
1096
+ mapBlockParents(action.blocks, state.get(action.clientIds[0])).forEach(_ref9 => {
1097
+ let [key, value] = _ref9;
1098
+ newState.set(key, value);
1099
+ });
1100
+ return newState;
1101
+ }
988
1102
 
989
1103
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
990
- return omit(state, action.removedClientIds);
1104
+ {
1105
+ const newState = new Map(state);
1106
+ action.removedClientIds.forEach(clientId => {
1107
+ newState.delete(clientId);
1108
+ });
1109
+ return newState;
1110
+ }
991
1111
  }
992
1112
 
993
1113
  return state;
@@ -1388,7 +1508,7 @@ export function insertionPoint() {
1388
1508
  operation
1389
1509
  }; // Bail out updates if the states are the same.
1390
1510
 
1391
- return isEqual(state, nextState) ? state : nextState;
1511
+ return fastDeepEqual(state, nextState) ? state : nextState;
1392
1512
  }
1393
1513
 
1394
1514
  case 'HIDE_INSERTION_POINT':
@@ -1528,7 +1648,7 @@ export const blockListSettings = function () {
1528
1648
  return state;
1529
1649
  }
1530
1650
 
1531
- if (isEqual(state[clientId], action.settings)) {
1651
+ if (fastDeepEqual(state[clientId], action.settings)) {
1532
1652
  return state;
1533
1653
  }
1534
1654