@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,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -29,6 +31,8 @@ exports.settings = settings;
29
31
  exports.template = template;
30
32
  exports.temporarilyEditingAsBlocks = temporarilyEditingAsBlocks;
31
33
 
34
+ var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
35
+
32
36
  var _lodash = require("lodash");
33
37
 
34
38
  var _compose = require("@wordpress/compose");
@@ -67,16 +71,18 @@ const identity = x => x;
67
71
 
68
72
  function mapBlockOrder(blocks) {
69
73
  let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
70
- const result = {
71
- [rootClientId]: []
72
- };
74
+ const result = new Map();
75
+ const current = [];
76
+ result.set(rootClientId, current);
73
77
  blocks.forEach(block => {
74
78
  const {
75
79
  clientId,
76
80
  innerBlocks
77
81
  } = block;
78
- result[rootClientId].push(clientId);
79
- Object.assign(result, mapBlockOrder(innerBlocks, clientId));
82
+ current.push(clientId);
83
+ mapBlockOrder(innerBlocks, clientId).forEach((order, subClientId) => {
84
+ result.set(subClientId, order);
85
+ });
80
86
  });
81
87
  return result;
82
88
  }
@@ -93,9 +99,25 @@ function mapBlockOrder(blocks) {
93
99
 
94
100
  function mapBlockParents(blocks) {
95
101
  let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
96
- return blocks.reduce((result, block) => Object.assign(result, {
97
- [block.clientId]: rootClientId
98
- }, mapBlockParents(block.innerBlocks, block.clientId)), {});
102
+ const result = [];
103
+ const stack = [[rootClientId, blocks]];
104
+
105
+ while (stack.length) {
106
+ const [parent, currentBlocks] = stack.shift();
107
+ currentBlocks.forEach(_ref => {
108
+ let {
109
+ innerBlocks,
110
+ ...block
111
+ } = _ref;
112
+ result.push([block.clientId, parent]);
113
+
114
+ if (innerBlocks !== null && innerBlocks !== void 0 && innerBlocks.length) {
115
+ stack.push([block.clientId, innerBlocks]);
116
+ }
117
+ });
118
+ }
119
+
120
+ return result;
99
121
  }
100
122
  /**
101
123
  * Helper method to iterate through all blocks, recursing into inner blocks,
@@ -105,12 +127,28 @@ function mapBlockParents(blocks) {
105
127
  * @param {Array} blocks Blocks to flatten.
106
128
  * @param {Function} transform Transforming function to be applied to each block.
107
129
  *
108
- * @return {Object} Flattened object.
130
+ * @return {Array} Flattened object.
109
131
  */
110
132
 
111
133
 
112
134
  function flattenBlocks(blocks) {
113
135
  let transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : identity;
136
+ const result = [];
137
+ const stack = [...blocks];
138
+
139
+ while (stack.length) {
140
+ const {
141
+ innerBlocks,
142
+ ...block
143
+ } = stack.shift();
144
+ stack.push(...innerBlocks);
145
+ result.push([block.clientId, transform(block)]);
146
+ }
147
+
148
+ return result;
149
+ }
150
+
151
+ function getFlattenedClientIds(blocks) {
114
152
  const result = {};
115
153
  const stack = [...blocks];
116
154
 
@@ -120,7 +158,7 @@ function flattenBlocks(blocks) {
120
158
  ...block
121
159
  } = stack.shift();
122
160
  stack.push(...innerBlocks);
123
- result[block.clientId] = transform(block);
161
+ result[block.clientId] = true;
124
162
  }
125
163
 
126
164
  return result;
@@ -132,7 +170,7 @@ function flattenBlocks(blocks) {
132
170
  *
133
171
  * @param {Array} blocks Blocks to flatten.
134
172
  *
135
- * @return {Object} Flattened block attributes object.
173
+ * @return {Array} Flattened block attributes object.
136
174
  */
137
175
 
138
176
 
@@ -146,32 +184,13 @@ function getFlattenedBlocksWithoutAttributes(blocks) {
146
184
  *
147
185
  * @param {Array} blocks Blocks to flatten.
148
186
  *
149
- * @return {Object} Flattened block attributes object.
187
+ * @return {Array} Flattened block attributes object.
150
188
  */
151
189
 
152
190
 
153
191
  function getFlattenedBlockAttributes(blocks) {
154
192
  return flattenBlocks(blocks, block => block.attributes);
155
193
  }
156
- /**
157
- * Returns an object against which it is safe to perform mutating operations,
158
- * given the original object and its current working copy.
159
- *
160
- * @param {Object} original Original object.
161
- * @param {Object} working Working object.
162
- *
163
- * @return {Object} Mutation-safe object.
164
- */
165
-
166
-
167
- function getMutateSafeObject(original, working) {
168
- if (original === working) {
169
- return { ...original
170
- };
171
- }
172
-
173
- return working;
174
- }
175
194
  /**
176
195
  * Returns true if the two object arguments have the same keys, or false
177
196
  * otherwise.
@@ -184,7 +203,7 @@ function getMutateSafeObject(original, working) {
184
203
 
185
204
 
186
205
  function hasSameKeys(a, b) {
187
- return (0, _lodash.isEqual)(Object.keys(a), Object.keys(b));
206
+ return (0, _es.default)(Object.keys(a), Object.keys(b));
188
207
  }
189
208
  /**
190
209
  * Returns true if, given the currently dispatching action and the previously
@@ -199,11 +218,11 @@ function hasSameKeys(a, b) {
199
218
 
200
219
 
201
220
  function isUpdatingSameBlockAttribute(action, lastAction) {
202
- return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && (0, _lodash.isEqual)(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
221
+ return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && (0, _es.default)(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
203
222
  }
204
223
 
205
- function buildBlockTree(state, blocks) {
206
- const result = {};
224
+ function updateBlockTreeForBlocks(state, blocks) {
225
+ const treeToUpdate = state.tree;
207
226
  const stack = [...blocks];
208
227
  const flattenedBlocks = [...blocks];
209
228
 
@@ -215,26 +234,25 @@ function buildBlockTree(state, blocks) {
215
234
 
216
235
 
217
236
  for (const block of flattenedBlocks) {
218
- result[block.clientId] = {};
237
+ treeToUpdate.set(block.clientId, {});
219
238
  }
220
239
 
221
240
  for (const block of flattenedBlocks) {
222
- result[block.clientId] = Object.assign(result[block.clientId], { ...state.byClientId[block.clientId],
223
- attributes: state.attributes[block.clientId],
224
- innerBlocks: block.innerBlocks.map(subBlock => result[subBlock.clientId])
225
- });
241
+ treeToUpdate.set(block.clientId, Object.assign(treeToUpdate.get(block.clientId), { ...state.byClientId.get(block.clientId),
242
+ attributes: state.attributes.get(block.clientId),
243
+ innerBlocks: block.innerBlocks.map(subBlock => treeToUpdate.get(subBlock.clientId))
244
+ }));
226
245
  }
227
-
228
- return result;
229
246
  }
230
247
 
231
- function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
232
- let updateChildrenOfUpdatedClientIds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
248
+ function updateParentInnerBlocksInTree(state, updatedClientIds) {
249
+ let updateChildrenOfUpdatedClientIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
250
+ const treeToUpdate = state.tree;
233
251
  const uncontrolledParents = new Set([]);
234
252
  const controlledParents = new Set();
235
253
 
236
254
  for (const clientId of updatedClientIds) {
237
- let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents[clientId];
255
+ let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId);
238
256
 
239
257
  do {
240
258
  if (state.controlledInnerBlocks[current]) {
@@ -245,7 +263,7 @@ function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
245
263
  } else {
246
264
  // Else continue traversing up through parents.
247
265
  uncontrolledParents.add(current);
248
- current = state.parents[current];
266
+ current = state.parents.get(current);
249
267
  }
250
268
  } while (current !== undefined);
251
269
  } // To make sure the order of assignments doesn't matter,
@@ -253,23 +271,21 @@ function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
253
271
 
254
272
 
255
273
  for (const clientId of uncontrolledParents) {
256
- tree[clientId] = { ...tree[clientId]
257
- };
274
+ treeToUpdate.set(clientId, { ...treeToUpdate.get(clientId)
275
+ });
258
276
  }
259
277
 
260
278
  for (const clientId of uncontrolledParents) {
261
- tree[clientId].innerBlocks = (state.order[clientId] || []).map(subClientId => tree[subClientId]);
279
+ treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId));
262
280
  } // Controlled parent blocks, need a dedicated key for their inner blocks
263
281
  // to be used when doing getBlocks( controlledBlockClientId ).
264
282
 
265
283
 
266
284
  for (const clientId of controlledParents) {
267
- tree['controlled||' + clientId] = {
268
- innerBlocks: (state.order[clientId] || []).map(subClientId => tree[subClientId])
269
- };
285
+ treeToUpdate.set('controlled||' + clientId, {
286
+ innerBlocks: (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId))
287
+ });
270
288
  }
271
-
272
- return tree;
273
289
  }
274
290
  /**
275
291
  * Higher-order reducer intended to compute full block objects key for each block in the post.
@@ -291,61 +307,61 @@ const withBlockTree = reducer => function () {
291
307
  return state;
292
308
  }
293
309
 
294
- newState.tree = state.tree ? state.tree : {};
310
+ newState.tree = state.tree ? state.tree : new Map();
295
311
 
296
312
  switch (action.type) {
297
313
  case 'RECEIVE_BLOCKS':
298
314
  case 'INSERT_BLOCKS':
299
315
  {
300
- const subTree = buildBlockTree(newState, action.blocks);
301
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
302
- ...subTree
303
- }, action.rootClientId ? [action.rootClientId] : [''], true);
316
+ newState.tree = new Map(newState.tree);
317
+ updateBlockTreeForBlocks(newState, action.blocks);
318
+ updateParentInnerBlocksInTree(newState, action.rootClientId ? [action.rootClientId] : [''], true);
304
319
  break;
305
320
  }
306
321
 
307
322
  case 'UPDATE_BLOCK':
308
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
309
- [action.clientId]: { ...newState.tree[action.clientId],
310
- ...newState.byClientId[action.clientId],
311
- attributes: newState.attributes[action.clientId]
312
- }
313
- }, [action.clientId], false);
323
+ newState.tree = new Map(newState.tree);
324
+ newState.tree.set(action.clientId, { ...newState.tree.get(action.clientId),
325
+ ...newState.byClientId.get(action.clientId),
326
+ attributes: newState.attributes.get(action.clientId)
327
+ });
328
+ updateParentInnerBlocksInTree(newState, [action.clientId], false);
314
329
  break;
315
330
 
316
331
  case 'UPDATE_BLOCK_ATTRIBUTES':
317
332
  {
318
- const newSubTree = action.clientIds.reduce((result, clientId) => {
319
- result[clientId] = { ...newState.tree[clientId],
320
- attributes: newState.attributes[clientId]
321
- };
322
- return result;
323
- }, {});
324
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
325
- ...newSubTree
326
- }, action.clientIds, false);
333
+ newState.tree = new Map(newState.tree);
334
+ action.clientIds.forEach(clientId => {
335
+ newState.tree.set(clientId, { ...newState.tree.get(clientId),
336
+ attributes: newState.attributes.get(clientId)
337
+ });
338
+ });
339
+ updateParentInnerBlocksInTree(newState, action.clientIds, false);
327
340
  break;
328
341
  }
329
342
 
330
343
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
331
344
  {
332
- const subTree = buildBlockTree(newState, action.blocks);
333
- newState.tree = updateParentInnerBlocksInTree(newState, { ...(0, _lodash.omit)(newState.tree, action.replacedClientIds.concat( // Controlled inner blocks are only removed
334
- // if the block doesn't move to another position
335
- // otherwise their content will be lost.
336
- action.replacedClientIds.filter(clientId => !subTree[clientId]).map(clientId => 'controlled||' + clientId))),
337
- ...subTree
338
- }, 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.
345
+ const inserterClientIds = getFlattenedClientIds(action.blocks);
346
+ newState.tree = new Map(newState.tree);
347
+ action.replacedClientIds.concat( // Controlled inner blocks are only removed
348
+ // if the block doesn't move to another position
349
+ // otherwise their content will be lost.
350
+ action.replacedClientIds.filter(clientId => !inserterClientIds[clientId]).map(clientId => 'controlled||' + clientId)).forEach(key => {
351
+ newState.tree.delete(key);
352
+ });
353
+ updateBlockTreeForBlocks(newState, action.blocks);
354
+ 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.
339
355
 
340
356
  const parentsOfRemovedBlocks = [];
341
357
 
342
358
  for (const clientId of action.clientIds) {
343
- if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) {
344
- parentsOfRemovedBlocks.push(state.parents[clientId]);
359
+ if (state.parents.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) {
360
+ parentsOfRemovedBlocks.push(state.parents.get(clientId));
345
361
  }
346
362
  }
347
363
 
348
- newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, parentsOfRemovedBlocks, true);
364
+ updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
349
365
  break;
350
366
  }
351
367
 
@@ -353,12 +369,16 @@ const withBlockTree = reducer => function () {
353
369
  const parentsOfRemovedBlocks = [];
354
370
 
355
371
  for (const clientId of action.clientIds) {
356
- if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) {
357
- parentsOfRemovedBlocks.push(state.parents[clientId]);
372
+ if (state.parents.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) {
373
+ parentsOfRemovedBlocks.push(state.parents.get(clientId));
358
374
  }
359
375
  }
360
376
 
361
- newState.tree = updateParentInnerBlocksInTree(newState, (0, _lodash.omit)(newState.tree, action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId))), parentsOfRemovedBlocks, true);
377
+ newState.tree = new Map(newState.tree);
378
+ action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId)).forEach(key => {
379
+ newState.tree.delete(key);
380
+ });
381
+ updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
362
382
  break;
363
383
 
364
384
  case 'MOVE_BLOCKS_TO_POSITION':
@@ -375,7 +395,8 @@ const withBlockTree = reducer => function () {
375
395
  updatedBlockUids.push(action.toRootClientId);
376
396
  }
377
397
 
378
- newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
398
+ newState.tree = new Map(newState.tree);
399
+ updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
379
400
  break;
380
401
  }
381
402
 
@@ -383,28 +404,27 @@ const withBlockTree = reducer => function () {
383
404
  case 'MOVE_BLOCKS_DOWN':
384
405
  {
385
406
  const updatedBlockUids = [action.rootClientId ? action.rootClientId : ''];
386
- newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
407
+ newState.tree = new Map(newState.tree);
408
+ updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
387
409
  break;
388
410
  }
389
411
 
390
412
  case 'SAVE_REUSABLE_BLOCK_SUCCESS':
391
413
  {
392
- const updatedBlockUids = Object.entries(newState.attributes).filter(_ref => {
393
- let [clientId, attributes] = _ref;
394
- return newState.byClientId[clientId].name === 'core/block' && attributes.ref === action.updatedId;
395
- }).map(_ref2 => {
396
- let [clientId] = _ref2;
397
- return clientId;
414
+ const updatedBlockUids = [];
415
+ newState.attributes.forEach((attributes, clientId) => {
416
+ if (newState.byClientId.get(clientId).name === 'core/block' && attributes.ref === action.updatedId) {
417
+ updatedBlockUids.push(clientId);
418
+ }
419
+ });
420
+ newState.tree = new Map(newState.tree);
421
+ updatedBlockUids.forEach(clientId => {
422
+ newState.tree.set(clientId, { ...newState.byClientId.get(clientId),
423
+ attributes: newState.attributes.get(clientId),
424
+ innerBlocks: newState.tree.get(clientId).innerBlocks
425
+ });
398
426
  });
399
- newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
400
- ...updatedBlockUids.reduce((result, clientId) => {
401
- result[clientId] = { ...newState.byClientId[clientId],
402
- attributes: newState.attributes[clientId],
403
- innerBlocks: newState.tree[clientId].innerBlocks
404
- };
405
- return result;
406
- }, {})
407
- }, updatedBlockUids, false);
427
+ updateParentInnerBlocksInTree(newState, updatedBlockUids, false);
408
428
  }
409
429
  }
410
430
 
@@ -501,7 +521,7 @@ const withInnerBlocksRemoveCascade = reducer => (state, action) => {
501
521
  let result = clientIds;
502
522
 
503
523
  for (let i = 0; i < result.length; i++) {
504
- if (!state.order[result[i]] || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
524
+ if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
505
525
  continue;
506
526
  }
507
527
 
@@ -509,7 +529,7 @@ const withInnerBlocksRemoveCascade = reducer => (state, action) => {
509
529
  result = [...result];
510
530
  }
511
531
 
512
- result.push(...state.order[result[i]]);
532
+ result.push(...state.order.get(result[i]));
513
533
  }
514
534
 
515
535
  return result;
@@ -550,19 +570,17 @@ const withInnerBlocksRemoveCascade = reducer => (state, action) => {
550
570
  const withBlockReset = reducer => (state, action) => {
551
571
  if (action.type === 'RESET_BLOCKS') {
552
572
  const newState = { ...state,
553
- byClientId: getFlattenedBlocksWithoutAttributes(action.blocks),
554
- attributes: getFlattenedBlockAttributes(action.blocks),
573
+ byClientId: new Map(getFlattenedBlocksWithoutAttributes(action.blocks)),
574
+ attributes: new Map(getFlattenedBlockAttributes(action.blocks)),
555
575
  order: mapBlockOrder(action.blocks),
556
- parents: mapBlockParents(action.blocks),
576
+ parents: new Map(mapBlockParents(action.blocks)),
557
577
  controlledInnerBlocks: {}
558
578
  };
559
- const subTree = buildBlockTree(newState, action.blocks);
560
- newState.tree = { ...subTree,
561
- // Root.
562
- '': {
563
- innerBlocks: action.blocks.map(subBlock => subTree[subBlock.clientId])
564
- }
565
- };
579
+ newState.tree = new Map(state === null || state === void 0 ? void 0 : state.tree);
580
+ updateBlockTreeForBlocks(newState, action.blocks);
581
+ newState.tree.set('', {
582
+ innerBlocks: action.blocks.map(subBlock => newState.tree.get(subBlock.clientId))
583
+ });
566
584
  return newState;
567
585
  }
568
586
 
@@ -615,11 +633,11 @@ const withReplaceInnerBlocks = reducer => (state, action) => {
615
633
 
616
634
  let stateAfterBlocksRemoval = state;
617
635
 
618
- if (state.order[action.rootClientId]) {
636
+ if (state.order.get(action.rootClientId)) {
619
637
  stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, {
620
638
  type: 'REMOVE_BLOCKS',
621
639
  keepControlledInnerBlocks: nestedControllers,
622
- clientIds: state.order[action.rootClientId]
640
+ clientIds: state.order.get(action.rootClientId)
623
641
  });
624
642
  }
625
643
 
@@ -633,26 +651,21 @@ const withReplaceInnerBlocks = reducer => (state, action) => {
633
651
  // preserve their block order. Otherwise, an inner block controller's blocks
634
652
  // will be deleted entirely from its entity.
635
653
 
636
- stateAfterInsert.order = { ...stateAfterInsert.order,
637
- ...Object.keys(nestedControllers).reduce((result, key) => {
638
- if (state.order[key]) {
639
- result[key] = state.order[key];
640
- }
641
-
642
- return result;
643
- }, {})
644
- };
645
- stateAfterInsert.tree = { ...stateAfterInsert.tree,
646
- ...Object.keys(nestedControllers).reduce((result, _key) => {
647
- const key = `controlled||${_key}`;
648
-
649
- if (state.tree[key]) {
650
- result[key] = state.tree[key];
651
- }
654
+ const stateAfterInsertOrder = new Map(stateAfterInsert.order);
655
+ Object.keys(nestedControllers).forEach(key => {
656
+ if (state.order.get(key)) {
657
+ stateAfterInsertOrder.set(key, state.order.get(key));
658
+ }
659
+ });
660
+ stateAfterInsert.order = stateAfterInsertOrder;
661
+ stateAfterInsert.tree = new Map(stateAfterInsert.tree);
662
+ Object.keys(nestedControllers).forEach(_key => {
663
+ const key = `controlled||${_key}`;
652
664
 
653
- return result;
654
- }, {})
655
- };
665
+ if (state.tree.has(key)) {
666
+ stateAfterInsert.tree.set(key, state.tree.get(key));
667
+ }
668
+ });
656
669
  }
657
670
 
658
671
  return stateAfterInsert;
@@ -682,18 +695,17 @@ const withSaveReusableBlock = reducer => (state, action) => {
682
695
 
683
696
  state = { ...state
684
697
  };
685
- state.attributes = (0, _lodash.mapValues)(state.attributes, (attributes, clientId) => {
698
+ state.attributes = new Map(state.attributes);
699
+ state.attributes.forEach((attributes, clientId) => {
686
700
  const {
687
701
  name
688
- } = state.byClientId[clientId];
702
+ } = state.byClientId.get(clientId);
689
703
 
690
704
  if (name === 'core/block' && attributes.ref === id) {
691
- return { ...attributes,
705
+ state.attributes.set(clientId, { ...attributes,
692
706
  ref: updatedId
693
- };
707
+ });
694
708
  }
695
-
696
- return attributes;
697
709
  });
698
710
  }
699
711
 
@@ -736,137 +748,202 @@ const blocks = (0, _compose.pipe)(_data.combineReducers, withSaveReusableBlock,
736
748
  withBlockTree, // Needs to be before withInnerBlocksRemoveCascade.
737
749
  withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade.
738
750
  withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetControlledBlocks)({
751
+ // The state is using a Map instead of a plain object for performance reasons.
752
+ // You can run the "./test/performance.js" unit test to check the impact
753
+ // code changes can have on this reducer.
739
754
  byClientId() {
740
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
755
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
741
756
  let action = arguments.length > 1 ? arguments[1] : undefined;
742
757
 
743
758
  switch (action.type) {
744
759
  case 'RECEIVE_BLOCKS':
745
760
  case 'INSERT_BLOCKS':
746
- return { ...state,
747
- ...getFlattenedBlocksWithoutAttributes(action.blocks)
748
- };
761
+ {
762
+ const newState = new Map(state);
763
+ getFlattenedBlocksWithoutAttributes(action.blocks).forEach(_ref2 => {
764
+ let [key, value] = _ref2;
765
+ newState.set(key, value);
766
+ });
767
+ return newState;
768
+ }
749
769
 
750
770
  case 'UPDATE_BLOCK':
751
- // Ignore updates if block isn't known.
752
- if (!state[action.clientId]) {
753
- return state;
754
- } // Do nothing if only attributes change.
771
+ {
772
+ // Ignore updates if block isn't known.
773
+ if (!state.has(action.clientId)) {
774
+ return state;
775
+ } // Do nothing if only attributes change.
755
776
 
756
777
 
757
- const changes = (0, _lodash.omit)(action.updates, 'attributes');
778
+ const changes = (0, _lodash.omit)(action.updates, 'attributes');
758
779
 
759
- if ((0, _lodash.isEmpty)(changes)) {
760
- return state;
761
- }
780
+ if ((0, _lodash.isEmpty)(changes)) {
781
+ return state;
782
+ }
762
783
 
763
- return { ...state,
764
- [action.clientId]: { ...state[action.clientId],
784
+ const newState = new Map(state);
785
+ newState.set(action.clientId, { ...state.get(action.clientId),
765
786
  ...changes
766
- }
767
- };
787
+ });
788
+ return newState;
789
+ }
768
790
 
769
791
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
770
- if (!action.blocks) {
771
- return state;
772
- }
792
+ {
793
+ if (!action.blocks) {
794
+ return state;
795
+ }
773
796
 
774
- return { ...(0, _lodash.omit)(state, action.replacedClientIds),
775
- ...getFlattenedBlocksWithoutAttributes(action.blocks)
776
- };
797
+ const newState = new Map(state);
798
+ action.replacedClientIds.forEach(clientId => {
799
+ newState.delete(clientId);
800
+ });
801
+ getFlattenedBlocksWithoutAttributes(action.blocks).forEach(_ref3 => {
802
+ let [key, value] = _ref3;
803
+ newState.set(key, value);
804
+ });
805
+ return newState;
806
+ }
777
807
 
778
808
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
779
- return (0, _lodash.omit)(state, action.removedClientIds);
809
+ {
810
+ const newState = new Map(state);
811
+ action.removedClientIds.forEach(clientId => {
812
+ newState.delete(clientId);
813
+ });
814
+ return newState;
815
+ }
780
816
  }
781
817
 
782
818
  return state;
783
819
  },
784
820
 
821
+ // The state is using a Map instead of a plain object for performance reasons.
822
+ // You can run the "./test/performance.js" unit test to check the impact
823
+ // code changes can have on this reducer.
785
824
  attributes() {
786
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
825
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
787
826
  let action = arguments.length > 1 ? arguments[1] : undefined;
788
827
 
789
828
  switch (action.type) {
790
829
  case 'RECEIVE_BLOCKS':
791
830
  case 'INSERT_BLOCKS':
792
- return { ...state,
793
- ...getFlattenedBlockAttributes(action.blocks)
794
- };
831
+ {
832
+ const newState = new Map(state);
833
+ getFlattenedBlockAttributes(action.blocks).forEach(_ref4 => {
834
+ let [key, value] = _ref4;
835
+ newState.set(key, value);
836
+ });
837
+ return newState;
838
+ }
795
839
 
796
840
  case 'UPDATE_BLOCK':
797
- // Ignore updates if block isn't known or there are no attribute changes.
798
- if (!state[action.clientId] || !action.updates.attributes) {
799
- return state;
800
- }
841
+ {
842
+ // Ignore updates if block isn't known or there are no attribute changes.
843
+ if (!state.get(action.clientId) || !action.updates.attributes) {
844
+ return state;
845
+ }
801
846
 
802
- return { ...state,
803
- [action.clientId]: { ...state[action.clientId],
847
+ const newState = new Map(state);
848
+ newState.set(action.clientId, { ...state.get(action.clientId),
804
849
  ...action.updates.attributes
805
- }
806
- };
850
+ });
851
+ return newState;
852
+ }
807
853
 
808
854
  case 'UPDATE_BLOCK_ATTRIBUTES':
809
855
  {
810
856
  // Avoid a state change if none of the block IDs are known.
811
- if (action.clientIds.every(id => !state[id])) {
857
+ if (action.clientIds.every(id => !state.get(id))) {
812
858
  return state;
813
859
  }
814
860
 
815
- const next = action.clientIds.reduce((accumulator, id) => {
816
- var _action$attributes;
861
+ let hasChange = false;
862
+ const newState = new Map(state);
817
863
 
818
- return { ...accumulator,
819
- [id]: Object.entries(action.uniqueByBlock ? action.attributes[id] : (_action$attributes = action.attributes) !== null && _action$attributes !== void 0 ? _action$attributes : {}).reduce((result, _ref3) => {
820
- let [key, value] = _ref3;
864
+ for (const clientId of action.clientIds) {
865
+ var _action$attributes;
821
866
 
822
- // Consider as updates only changed values.
823
- if (value !== result[key]) {
824
- result = getMutateSafeObject(state[id], result);
825
- result[key] = value;
826
- }
867
+ const updatedAttributeEntries = Object.entries(action.uniqueByBlock ? action.attributes[clientId] : (_action$attributes = action.attributes) !== null && _action$attributes !== void 0 ? _action$attributes : {});
827
868
 
828
- return result;
829
- }, state[id])
830
- };
831
- }, {});
869
+ if (updatedAttributeEntries.length === 0) {
870
+ continue;
871
+ }
832
872
 
833
- if (action.clientIds.every(id => next[id] === state[id])) {
834
- return state;
873
+ let hasUpdatedAttributes = false;
874
+ const existingAttributes = state.get(clientId);
875
+ const newAttributes = {};
876
+ updatedAttributeEntries.forEach(_ref5 => {
877
+ let [key, value] = _ref5;
878
+
879
+ if (existingAttributes[key] !== value) {
880
+ hasUpdatedAttributes = true;
881
+ newAttributes[key] = value;
882
+ }
883
+ });
884
+ hasChange = hasChange || hasUpdatedAttributes;
885
+
886
+ if (hasUpdatedAttributes) {
887
+ newState.set(clientId, { ...existingAttributes,
888
+ ...newAttributes
889
+ });
890
+ }
835
891
  }
836
892
 
837
- return { ...state,
838
- ...next
839
- };
893
+ return hasChange ? newState : state;
840
894
  }
841
895
 
842
896
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
843
- if (!action.blocks) {
844
- return state;
845
- }
897
+ {
898
+ if (!action.blocks) {
899
+ return state;
900
+ }
846
901
 
847
- return { ...(0, _lodash.omit)(state, action.replacedClientIds),
848
- ...getFlattenedBlockAttributes(action.blocks)
849
- };
902
+ const newState = new Map(state);
903
+ action.replacedClientIds.forEach(clientId => {
904
+ newState.delete(clientId);
905
+ });
906
+ getFlattenedBlockAttributes(action.blocks).forEach(_ref6 => {
907
+ let [key, value] = _ref6;
908
+ newState.set(key, value);
909
+ });
910
+ return newState;
911
+ }
850
912
 
851
913
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
852
- return (0, _lodash.omit)(state, action.removedClientIds);
914
+ {
915
+ const newState = new Map(state);
916
+ action.removedClientIds.forEach(clientId => {
917
+ newState.delete(clientId);
918
+ });
919
+ return newState;
920
+ }
853
921
  }
854
922
 
855
923
  return state;
856
924
  },
857
925
 
926
+ // The state is using a Map instead of a plain object for performance reasons.
927
+ // You can run the "./test/performance.js" unit test to check the impact
928
+ // code changes can have on this reducer.
858
929
  order() {
859
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
930
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
860
931
  let action = arguments.length > 1 ? arguments[1] : undefined;
861
932
 
862
933
  switch (action.type) {
863
934
  case 'RECEIVE_BLOCKS':
864
935
  {
936
+ var _state$get;
937
+
865
938
  const blockOrder = mapBlockOrder(action.blocks);
866
- return { ...state,
867
- ...(0, _lodash.omit)(blockOrder, ''),
868
- '': ((state === null || state === void 0 ? void 0 : state['']) || []).concat(blockOrder[''])
869
- };
939
+ const newState = new Map(state);
940
+ blockOrder.forEach((order, clientId) => {
941
+ if (clientId !== '') {
942
+ newState.set(clientId, order);
943
+ }
944
+ });
945
+ newState.set('', ((_state$get = state.get('')) !== null && _state$get !== void 0 ? _state$get : []).concat(blockOrder['']));
946
+ return newState;
870
947
  }
871
948
 
872
949
  case 'INSERT_BLOCKS':
@@ -874,20 +951,22 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
874
951
  const {
875
952
  rootClientId = ''
876
953
  } = action;
877
- const subState = state[rootClientId] || [];
954
+ const subState = state.get(rootClientId) || [];
878
955
  const mappedBlocks = mapBlockOrder(action.blocks, rootClientId);
879
956
  const {
880
957
  index = subState.length
881
958
  } = action;
882
- return { ...state,
883
- ...mappedBlocks,
884
- [rootClientId]: (0, _array.insertAt)(subState, mappedBlocks[rootClientId], index)
885
- };
959
+ const newState = new Map(state);
960
+ mappedBlocks.forEach((order, clientId) => {
961
+ newState.set(clientId, order);
962
+ });
963
+ newState.set(rootClientId, (0, _array.insertAt)(subState, mappedBlocks.get(rootClientId), index));
964
+ return newState;
886
965
  }
887
966
 
888
967
  case 'MOVE_BLOCKS_TO_POSITION':
889
968
  {
890
- var _state$fromRootClient, _state$fromRootClient2;
969
+ var _state$get$filter, _state$get2;
891
970
 
892
971
  const {
893
972
  fromRootClientId = '',
@@ -895,22 +974,22 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
895
974
  clientIds
896
975
  } = action;
897
976
  const {
898
- index = state[toRootClientId].length
977
+ index = state.get(toRootClientId).length
899
978
  } = action; // Moving inside the same parent block.
900
979
 
901
980
  if (fromRootClientId === toRootClientId) {
902
- const subState = state[toRootClientId];
981
+ const subState = state.get(toRootClientId);
903
982
  const fromIndex = subState.indexOf(clientIds[0]);
904
- return { ...state,
905
- [toRootClientId]: (0, _array.moveTo)(state[toRootClientId], fromIndex, index, clientIds.length)
906
- };
983
+ const newState = new Map(state);
984
+ newState.set(toRootClientId, (0, _array.moveTo)(state.get(toRootClientId), fromIndex, index, clientIds.length));
985
+ return newState;
907
986
  } // Moving from a parent block to another.
908
987
 
909
988
 
910
- return { ...state,
911
- [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 : [],
912
- [toRootClientId]: (0, _array.insertAt)(state[toRootClientId], clientIds, index)
913
- };
989
+ const newState = new Map(state);
990
+ 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 : []);
991
+ newState.set(toRootClientId, (0, _array.insertAt)(state.get(toRootClientId), clientIds, index));
992
+ return newState;
914
993
  }
915
994
 
916
995
  case 'MOVE_BLOCKS_UP':
@@ -920,16 +999,16 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
920
999
  rootClientId = ''
921
1000
  } = action;
922
1001
  const firstClientId = clientIds[0];
923
- const subState = state[rootClientId];
1002
+ const subState = state.get(rootClientId);
924
1003
 
925
1004
  if (!subState.length || firstClientId === subState[0]) {
926
1005
  return state;
927
1006
  }
928
1007
 
929
1008
  const firstIndex = subState.indexOf(firstClientId);
930
- return { ...state,
931
- [rootClientId]: (0, _array.moveTo)(subState, firstIndex, firstIndex - 1, clientIds.length)
932
- };
1009
+ const newState = new Map(state);
1010
+ newState.set(rootClientId, (0, _array.moveTo)(subState, firstIndex, firstIndex - 1, clientIds.length));
1011
+ return newState;
933
1012
  }
934
1013
 
935
1014
  case 'MOVE_BLOCKS_DOWN':
@@ -940,16 +1019,16 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
940
1019
  } = action;
941
1020
  const firstClientId = clientIds[0];
942
1021
  const lastClientId = clientIds[clientIds.length - 1];
943
- const subState = state[rootClientId];
1022
+ const subState = state.get(rootClientId);
944
1023
 
945
1024
  if (!subState.length || lastClientId === subState[subState.length - 1]) {
946
1025
  return state;
947
1026
  }
948
1027
 
949
1028
  const firstIndex = subState.indexOf(firstClientId);
950
- return { ...state,
951
- [rootClientId]: (0, _array.moveTo)(subState, firstIndex, firstIndex + 1, clientIds.length)
952
- };
1029
+ const newState = new Map(state);
1030
+ newState.set(rootClientId, (0, _array.moveTo)(subState, firstIndex, firstIndex + 1, clientIds.length));
1031
+ return newState;
953
1032
  }
954
1033
 
955
1034
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
@@ -963,29 +1042,50 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
963
1042
  }
964
1043
 
965
1044
  const mappedBlocks = mapBlockOrder(action.blocks);
966
- return (0, _compose.pipe)([nextState => (0, _lodash.omit)(nextState, action.replacedClientIds), nextState => ({ ...nextState,
967
- ...(0, _lodash.omit)(mappedBlocks, '')
968
- }), nextState => (0, _lodash.mapValues)(nextState, subState => Object.values(subState).reduce((result, clientId) => {
969
- if (clientId === clientIds[0]) {
970
- return [...result, ...mappedBlocks['']];
1045
+ const newState = new Map(state);
1046
+ action.replacedClientIds.forEach(clientId => {
1047
+ newState.delete(clientId);
1048
+ });
1049
+ mappedBlocks.forEach((order, clientId) => {
1050
+ if (clientId !== '') {
1051
+ newState.set(clientId, order);
971
1052
  }
972
-
973
- if (clientIds.indexOf(clientId) === -1) {
974
- result.push(clientId);
975
- }
976
-
977
- return result;
978
- }, []))])(state);
1053
+ });
1054
+ newState.forEach((order, clientId) => {
1055
+ const newSubOrder = Object.values(order).reduce((result, subClientId) => {
1056
+ if (subClientId === clientIds[0]) {
1057
+ return [...result, ...mappedBlocks.get('')];
1058
+ }
1059
+
1060
+ if (clientIds.indexOf(subClientId) === -1) {
1061
+ result.push(subClientId);
1062
+ }
1063
+
1064
+ return result;
1065
+ }, []);
1066
+ newState.set(clientId, newSubOrder);
1067
+ });
1068
+ return newState;
979
1069
  }
980
1070
 
981
1071
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
982
- return (0, _compose.pipe)([// Remove inner block ordering for removed blocks.
983
- nextState => (0, _lodash.omit)(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings.
984
- nextState => (0, _lodash.mapValues)(nextState, subState => {
985
- var _subState$filter;
1072
+ {
1073
+ const newState = new Map(state); // Remove inner block ordering for removed blocks.
986
1074
 
987
- return (_subState$filter = subState === null || subState === void 0 ? void 0 : subState.filter(id => !action.removedClientIds.includes(id))) !== null && _subState$filter !== void 0 ? _subState$filter : [];
988
- })])(state);
1075
+ action.removedClientIds.forEach(clientId => {
1076
+ newState.delete(clientId);
1077
+ });
1078
+ newState.forEach((order, clientId) => {
1079
+ var _order$filter;
1080
+
1081
+ 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 : [];
1082
+
1083
+ if (newSubOrder.length !== order.length) {
1084
+ newState.set(clientId, newSubOrder);
1085
+ }
1086
+ });
1087
+ return newState;
1088
+ }
989
1089
  }
990
1090
 
991
1091
  return state;
@@ -994,37 +1094,60 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
994
1094
  // While technically redundant data as the inverse of `order`, it serves as
995
1095
  // an optimization for the selectors which derive the ancestry of a block.
996
1096
  parents() {
997
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1097
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
998
1098
  let action = arguments.length > 1 ? arguments[1] : undefined;
999
1099
 
1000
1100
  switch (action.type) {
1001
1101
  case 'RECEIVE_BLOCKS':
1002
- return { ...state,
1003
- ...mapBlockParents(action.blocks)
1004
- };
1102
+ {
1103
+ const newState = new Map(state);
1104
+ mapBlockParents(action.blocks).forEach(_ref7 => {
1105
+ let [key, value] = _ref7;
1106
+ newState.set(key, value);
1107
+ });
1108
+ return newState;
1109
+ }
1005
1110
 
1006
1111
  case 'INSERT_BLOCKS':
1007
- return { ...state,
1008
- ...mapBlockParents(action.blocks, action.rootClientId || '')
1009
- };
1112
+ {
1113
+ const newState = new Map(state);
1114
+ mapBlockParents(action.blocks, action.rootClientId || '').forEach(_ref8 => {
1115
+ let [key, value] = _ref8;
1116
+ newState.set(key, value);
1117
+ });
1118
+ return newState;
1119
+ }
1010
1120
 
1011
1121
  case 'MOVE_BLOCKS_TO_POSITION':
1012
1122
  {
1013
- return { ...state,
1014
- ...action.clientIds.reduce((accumulator, id) => {
1015
- accumulator[id] = action.toRootClientId || '';
1016
- return accumulator;
1017
- }, {})
1018
- };
1123
+ const newState = new Map(state);
1124
+ action.clientIds.forEach(id => {
1125
+ newState.set(id, action.toRootClientId || '');
1126
+ });
1127
+ return newState;
1019
1128
  }
1020
1129
 
1021
1130
  case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
1022
- return { ...(0, _lodash.omit)(state, action.replacedClientIds),
1023
- ...mapBlockParents(action.blocks, state[action.clientIds[0]])
1024
- };
1131
+ {
1132
+ const newState = new Map(state);
1133
+ action.replacedClientIds.forEach(clientId => {
1134
+ newState.delete(clientId);
1135
+ });
1136
+ mapBlockParents(action.blocks, state.get(action.clientIds[0])).forEach(_ref9 => {
1137
+ let [key, value] = _ref9;
1138
+ newState.set(key, value);
1139
+ });
1140
+ return newState;
1141
+ }
1025
1142
 
1026
1143
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
1027
- return (0, _lodash.omit)(state, action.removedClientIds);
1144
+ {
1145
+ const newState = new Map(state);
1146
+ action.removedClientIds.forEach(clientId => {
1147
+ newState.delete(clientId);
1148
+ });
1149
+ return newState;
1150
+ }
1028
1151
  }
1029
1152
 
1030
1153
  return state;
@@ -1436,7 +1559,7 @@ function insertionPoint() {
1436
1559
  operation
1437
1560
  }; // Bail out updates if the states are the same.
1438
1561
 
1439
- return (0, _lodash.isEqual)(state, nextState) ? state : nextState;
1562
+ return (0, _es.default)(state, nextState) ? state : nextState;
1440
1563
  }
1441
1564
 
1442
1565
  case 'HIDE_INSERTION_POINT':
@@ -1580,7 +1703,7 @@ const blockListSettings = function () {
1580
1703
  return state;
1581
1704
  }
1582
1705
 
1583
- if ((0, _lodash.isEqual)(state[clientId], action.settings)) {
1706
+ if ((0, _es.default)(state[clientId], action.settings)) {
1584
1707
  return state;
1585
1708
  }
1586
1709