@wordpress/core-data 7.32.0 → 7.32.1-next.ff1cebbba.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 (383) hide show
  1. package/build/actions.js +375 -632
  2. package/build/actions.js.map +7 -1
  3. package/build/batch/create-batch.js +49 -62
  4. package/build/batch/create-batch.js.map +7 -1
  5. package/build/batch/default-processor.js +43 -39
  6. package/build/batch/default-processor.js.map +7 -1
  7. package/build/batch/index.js +38 -17
  8. package/build/batch/index.js.map +7 -1
  9. package/build/dynamic-entities.js +30 -32
  10. package/build/dynamic-entities.js.map +7 -1
  11. package/build/entities.js +298 -410
  12. package/build/entities.js.map +7 -1
  13. package/build/entity-context.js +29 -12
  14. package/build/entity-context.js.map +7 -1
  15. package/build/entity-provider.js +38 -46
  16. package/build/entity-provider.js.map +7 -1
  17. package/build/entity-types/attachment.js +16 -5
  18. package/build/entity-types/attachment.js.map +7 -1
  19. package/build/entity-types/base-entity-records.js +16 -42
  20. package/build/entity-types/base-entity-records.js.map +7 -1
  21. package/build/entity-types/base.js +16 -5
  22. package/build/entity-types/base.js.map +7 -1
  23. package/build/entity-types/comment.js +16 -5
  24. package/build/entity-types/comment.js.map +7 -1
  25. package/build/entity-types/global-styles-revision.js +16 -5
  26. package/build/entity-types/global-styles-revision.js.map +7 -1
  27. package/build/entity-types/helpers.js +16 -5
  28. package/build/entity-types/helpers.js.map +7 -1
  29. package/build/entity-types/index.js +16 -5
  30. package/build/entity-types/index.js.map +7 -1
  31. package/build/entity-types/menu-location.js +16 -5
  32. package/build/entity-types/menu-location.js.map +7 -1
  33. package/build/entity-types/nav-menu-item.js +16 -5
  34. package/build/entity-types/nav-menu-item.js.map +7 -1
  35. package/build/entity-types/nav-menu.js +16 -5
  36. package/build/entity-types/nav-menu.js.map +7 -1
  37. package/build/entity-types/page.js +16 -5
  38. package/build/entity-types/page.js.map +7 -1
  39. package/build/entity-types/plugin.js +16 -5
  40. package/build/entity-types/plugin.js.map +7 -1
  41. package/build/entity-types/post-revision.js +16 -5
  42. package/build/entity-types/post-revision.js.map +7 -1
  43. package/build/entity-types/post-status.js +16 -5
  44. package/build/entity-types/post-status.js.map +7 -1
  45. package/build/entity-types/post.js +16 -5
  46. package/build/entity-types/post.js.map +7 -1
  47. package/build/entity-types/settings.js +16 -5
  48. package/build/entity-types/settings.js.map +7 -1
  49. package/build/entity-types/sidebar.js +16 -5
  50. package/build/entity-types/sidebar.js.map +7 -1
  51. package/build/entity-types/taxonomy.js +16 -5
  52. package/build/entity-types/taxonomy.js.map +7 -1
  53. package/build/entity-types/term.js +16 -5
  54. package/build/entity-types/term.js.map +7 -1
  55. package/build/entity-types/theme.js +16 -5
  56. package/build/entity-types/theme.js.map +7 -1
  57. package/build/entity-types/type.js +16 -5
  58. package/build/entity-types/type.js.map +7 -1
  59. package/build/entity-types/user.js +16 -5
  60. package/build/entity-types/user.js.map +7 -1
  61. package/build/entity-types/widget-type.js +16 -5
  62. package/build/entity-types/widget-type.js.map +7 -1
  63. package/build/entity-types/widget.js +16 -5
  64. package/build/entity-types/widget.js.map +7 -1
  65. package/build/entity-types/wp-template-part.js +16 -5
  66. package/build/entity-types/wp-template-part.js.map +7 -1
  67. package/build/entity-types/wp-template.js +16 -5
  68. package/build/entity-types/wp-template.js.map +7 -1
  69. package/build/fetch/__experimental-fetch-link-suggestions.js +141 -154
  70. package/build/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
  71. package/build/fetch/__experimental-fetch-url-data.js +47 -59
  72. package/build/fetch/__experimental-fetch-url-data.js.map +7 -1
  73. package/build/fetch/index.js +53 -32
  74. package/build/fetch/index.js.map +7 -1
  75. package/build/footnotes/get-footnotes-order.js +38 -25
  76. package/build/footnotes/get-footnotes-order.js.map +7 -1
  77. package/build/footnotes/get-rich-text-values-cached.js +26 -27
  78. package/build/footnotes/get-rich-text-values-cached.js.map +7 -1
  79. package/build/footnotes/index.js +68 -55
  80. package/build/footnotes/index.js.map +7 -1
  81. package/build/hooks/constants.js +33 -12
  82. package/build/hooks/constants.js.map +7 -1
  83. package/build/hooks/index.js +59 -68
  84. package/build/hooks/index.js.map +7 -1
  85. package/build/hooks/memoize.js +34 -12
  86. package/build/hooks/memoize.js.map +7 -1
  87. package/build/hooks/use-entity-block-editor.js +111 -119
  88. package/build/hooks/use-entity-block-editor.js.map +7 -1
  89. package/build/hooks/use-entity-id.js +25 -23
  90. package/build/hooks/use-entity-id.js.map +7 -1
  91. package/build/hooks/use-entity-prop.js +59 -60
  92. package/build/hooks/use-entity-prop.js.map +7 -1
  93. package/build/hooks/use-entity-record.js +95 -155
  94. package/build/hooks/use-entity-record.js.map +7 -1
  95. package/build/hooks/use-entity-records.js +131 -139
  96. package/build/hooks/use-entity-records.js.map +7 -1
  97. package/build/hooks/use-query-select.js +65 -84
  98. package/build/hooks/use-query-select.js.map +7 -1
  99. package/build/hooks/use-resource-permissions.js +92 -145
  100. package/build/hooks/use-resource-permissions.js.map +7 -1
  101. package/build/index.js +96 -153
  102. package/build/index.js.map +7 -1
  103. package/build/lock-unlock.js +31 -14
  104. package/build/lock-unlock.js.map +7 -1
  105. package/build/locks/actions.js +36 -19
  106. package/build/locks/actions.js.map +7 -1
  107. package/build/locks/engine.js +48 -47
  108. package/build/locks/engine.js.map +7 -1
  109. package/build/locks/reducer.js +54 -63
  110. package/build/locks/reducer.js.map +7 -1
  111. package/build/locks/selectors.js +35 -30
  112. package/build/locks/selectors.js.map +7 -1
  113. package/build/locks/utils.js +37 -16
  114. package/build/locks/utils.js.map +7 -1
  115. package/build/name.js +27 -12
  116. package/build/name.js.map +7 -1
  117. package/build/private-actions.js +67 -75
  118. package/build/private-actions.js.map +7 -1
  119. package/build/private-apis.js +33 -16
  120. package/build/private-apis.js.map +7 -1
  121. package/build/private-selectors.js +204 -184
  122. package/build/private-selectors.js.map +7 -1
  123. package/build/queried-data/actions.js +32 -41
  124. package/build/queried-data/actions.js.map +7 -1
  125. package/build/queried-data/get-query-parts.js +41 -79
  126. package/build/queried-data/get-query-parts.js.map +7 -1
  127. package/build/queried-data/index.js +39 -36
  128. package/build/queried-data/index.js.map +7 -1
  129. package/build/queried-data/reducer.js +162 -193
  130. package/build/queried-data/reducer.js.map +7 -1
  131. package/build/queried-data/selectors.js +57 -85
  132. package/build/queried-data/selectors.js.map +7 -1
  133. package/build/reducer.js +279 -404
  134. package/build/reducer.js.map +7 -1
  135. package/build/resolvers.js +553 -600
  136. package/build/resolvers.js.map +7 -1
  137. package/build/selectors.js +456 -981
  138. package/build/selectors.js.map +7 -1
  139. package/build/sync.js +34 -22
  140. package/build/sync.js.map +7 -1
  141. package/build/types.js +16 -5
  142. package/build/types.js.map +7 -1
  143. package/build/utils/conservative-map-item.js +34 -27
  144. package/build/utils/conservative-map-item.js.map +7 -1
  145. package/build/utils/crdt-blocks.js +289 -0
  146. package/build/utils/crdt-blocks.js.map +7 -0
  147. package/build/utils/crdt.js +202 -0
  148. package/build/utils/crdt.js.map +7 -0
  149. package/build/utils/forward-resolver.js +24 -16
  150. package/build/utils/forward-resolver.js.map +7 -1
  151. package/build/utils/get-nested-value.js +26 -21
  152. package/build/utils/get-nested-value.js.map +7 -1
  153. package/build/utils/get-normalized-comma-separable.js +25 -17
  154. package/build/utils/get-normalized-comma-separable.js.map +7 -1
  155. package/build/utils/if-matching-action.js +25 -19
  156. package/build/utils/if-matching-action.js.map +7 -1
  157. package/build/utils/index.js +77 -108
  158. package/build/utils/index.js.map +7 -1
  159. package/build/utils/is-numeric-id.js +22 -12
  160. package/build/utils/is-numeric-id.js.map +7 -1
  161. package/build/utils/is-raw-attribute.js +22 -13
  162. package/build/utils/is-raw-attribute.js.map +7 -1
  163. package/build/utils/log-entity-deprecation.js +37 -38
  164. package/build/utils/log-entity-deprecation.js.map +7 -1
  165. package/build/utils/on-sub-key.js +30 -24
  166. package/build/utils/on-sub-key.js.map +7 -1
  167. package/build/utils/receive-intermediate-results.js +29 -6
  168. package/build/utils/receive-intermediate-results.js.map +7 -1
  169. package/build/utils/replace-action.js +24 -17
  170. package/build/utils/replace-action.js.map +7 -1
  171. package/build/utils/set-nested-value.js +25 -30
  172. package/build/utils/set-nested-value.js.map +7 -1
  173. package/build/utils/user-permissions.js +41 -13
  174. package/build/utils/user-permissions.js.map +7 -1
  175. package/build/utils/with-weak-map-cache.js +26 -22
  176. package/build/utils/with-weak-map-cache.js.map +7 -1
  177. package/build-module/actions.js +322 -601
  178. package/build-module/actions.js.map +7 -1
  179. package/build-module/batch/create-batch.js +21 -57
  180. package/build-module/batch/create-batch.js.map +7 -1
  181. package/build-module/batch/default-processor.js +14 -33
  182. package/build-module/batch/default-processor.js.map +7 -1
  183. package/build-module/batch/index.js +7 -3
  184. package/build-module/batch/index.js.map +7 -1
  185. package/build-module/dynamic-entities.js +7 -28
  186. package/build-module/dynamic-entities.js.map +7 -1
  187. package/build-module/entities.js +263 -399
  188. package/build-module/entities.js.map +7 -1
  189. package/build-module/entity-context.js +7 -7
  190. package/build-module/entity-context.js.map +7 -1
  191. package/build-module/entity-provider.js +19 -42
  192. package/build-module/entity-provider.js.map +7 -1
  193. package/build-module/entity-types/attachment.js +1 -2
  194. package/build-module/entity-types/attachment.js.map +7 -1
  195. package/build-module/entity-types/base-entity-records.js +1 -37
  196. package/build-module/entity-types/base-entity-records.js.map +7 -1
  197. package/build-module/entity-types/base.js +1 -2
  198. package/build-module/entity-types/base.js.map +7 -1
  199. package/build-module/entity-types/comment.js +1 -2
  200. package/build-module/entity-types/comment.js.map +7 -1
  201. package/build-module/entity-types/global-styles-revision.js +1 -2
  202. package/build-module/entity-types/global-styles-revision.js.map +7 -1
  203. package/build-module/entity-types/helpers.js +1 -2
  204. package/build-module/entity-types/helpers.js.map +7 -1
  205. package/build-module/entity-types/index.js +1 -2
  206. package/build-module/entity-types/index.js.map +7 -1
  207. package/build-module/entity-types/menu-location.js +1 -2
  208. package/build-module/entity-types/menu-location.js.map +7 -1
  209. package/build-module/entity-types/nav-menu-item.js +1 -2
  210. package/build-module/entity-types/nav-menu-item.js.map +7 -1
  211. package/build-module/entity-types/nav-menu.js +1 -2
  212. package/build-module/entity-types/nav-menu.js.map +7 -1
  213. package/build-module/entity-types/page.js +1 -2
  214. package/build-module/entity-types/page.js.map +7 -1
  215. package/build-module/entity-types/plugin.js +1 -2
  216. package/build-module/entity-types/plugin.js.map +7 -1
  217. package/build-module/entity-types/post-revision.js +1 -2
  218. package/build-module/entity-types/post-revision.js.map +7 -1
  219. package/build-module/entity-types/post-status.js +1 -2
  220. package/build-module/entity-types/post-status.js.map +7 -1
  221. package/build-module/entity-types/post.js +1 -2
  222. package/build-module/entity-types/post.js.map +7 -1
  223. package/build-module/entity-types/settings.js +1 -2
  224. package/build-module/entity-types/settings.js.map +7 -1
  225. package/build-module/entity-types/sidebar.js +1 -2
  226. package/build-module/entity-types/sidebar.js.map +7 -1
  227. package/build-module/entity-types/taxonomy.js +1 -2
  228. package/build-module/entity-types/taxonomy.js.map +7 -1
  229. package/build-module/entity-types/term.js +1 -2
  230. package/build-module/entity-types/term.js.map +7 -1
  231. package/build-module/entity-types/theme.js +1 -2
  232. package/build-module/entity-types/theme.js.map +7 -1
  233. package/build-module/entity-types/type.js +1 -2
  234. package/build-module/entity-types/type.js.map +7 -1
  235. package/build-module/entity-types/user.js +1 -2
  236. package/build-module/entity-types/user.js.map +7 -1
  237. package/build-module/entity-types/widget-type.js +1 -2
  238. package/build-module/entity-types/widget-type.js.map +7 -1
  239. package/build-module/entity-types/widget.js +1 -2
  240. package/build-module/entity-types/widget.js.map +7 -1
  241. package/build-module/entity-types/wp-template-part.js +1 -2
  242. package/build-module/entity-types/wp-template-part.js.map +7 -1
  243. package/build-module/entity-types/wp-template.js +1 -2
  244. package/build-module/entity-types/wp-template.js.map +7 -1
  245. package/build-module/fetch/__experimental-fetch-link-suggestions.js +111 -149
  246. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
  247. package/build-module/fetch/__experimental-fetch-url-data.js +20 -49
  248. package/build-module/fetch/__experimental-fetch-url-data.js.map +7 -1
  249. package/build-module/fetch/index.js +20 -15
  250. package/build-module/fetch/index.js.map +7 -1
  251. package/build-module/footnotes/get-footnotes-order.js +10 -19
  252. package/build-module/footnotes/get-footnotes-order.js.map +7 -1
  253. package/build-module/footnotes/get-rich-text-values-cached.js +8 -23
  254. package/build-module/footnotes/get-rich-text-values-cached.js.map +7 -1
  255. package/build-module/footnotes/index.js +34 -47
  256. package/build-module/footnotes/index.js.map +7 -1
  257. package/build-module/hooks/constants.js +11 -8
  258. package/build-module/hooks/constants.js.map +7 -1
  259. package/build-module/hooks/index.js +27 -15
  260. package/build-module/hooks/index.js.map +7 -1
  261. package/build-module/hooks/memoize.js +6 -8
  262. package/build-module/hooks/memoize.js.map +7 -1
  263. package/build-module/hooks/use-entity-block-editor.js +80 -110
  264. package/build-module/hooks/use-entity-block-editor.js.map +7 -1
  265. package/build-module/hooks/use-entity-id.js +7 -19
  266. package/build-module/hooks/use-entity-id.js.map +7 -1
  267. package/build-module/hooks/use-entity-prop.js +31 -55
  268. package/build-module/hooks/use-entity-prop.js.map +7 -1
  269. package/build-module/hooks/use-entity-record.js +63 -148
  270. package/build-module/hooks/use-entity-record.js.map +7 -1
  271. package/build-module/hooks/use-entity-records.js +98 -131
  272. package/build-module/hooks/use-entity-records.js.map +7 -1
  273. package/build-module/hooks/use-query-select.js +27 -71
  274. package/build-module/hooks/use-query-select.js.map +7 -1
  275. package/build-module/hooks/use-resource-permissions.js +57 -136
  276. package/build-module/hooks/use-resource-permissions.js.map +7 -1
  277. package/build-module/index.js +49 -71
  278. package/build-module/index.js.map +7 -1
  279. package/build-module/lock-unlock.js +8 -7
  280. package/build-module/lock-unlock.js.map +7 -1
  281. package/build-module/locks/actions.js +8 -13
  282. package/build-module/locks/actions.js.map +7 -1
  283. package/build-module/locks/engine.js +17 -38
  284. package/build-module/locks/engine.js.map +7 -1
  285. package/build-module/locks/reducer.js +37 -59
  286. package/build-module/locks/reducer.js.map +7 -1
  287. package/build-module/locks/selectors.js +16 -23
  288. package/build-module/locks/selectors.js.map +7 -1
  289. package/build-module/locks/utils.js +15 -12
  290. package/build-module/locks/utils.js.map +7 -1
  291. package/build-module/name.js +5 -8
  292. package/build-module/name.js.map +7 -1
  293. package/build-module/private-actions.js +35 -69
  294. package/build-module/private-actions.js.map +7 -1
  295. package/build-module/private-apis.js +8 -8
  296. package/build-module/private-apis.js.map +7 -1
  297. package/build-module/private-selectors.js +167 -174
  298. package/build-module/private-selectors.js.map +7 -1
  299. package/build-module/queried-data/actions.js +11 -38
  300. package/build-module/queried-data/actions.js.map +7 -1
  301. package/build-module/queried-data/get-query-parts.js +20 -75
  302. package/build-module/queried-data/get-query-parts.js.map +7 -1
  303. package/build-module/queried-data/index.js +7 -4
  304. package/build-module/queried-data/index.js.map +7 -1
  305. package/build-module/queried-data/reducer.js +134 -185
  306. package/build-module/queried-data/reducer.js.map +7 -1
  307. package/build-module/queried-data/selectors.js +23 -78
  308. package/build-module/queried-data/selectors.js.map +7 -1
  309. package/build-module/reducer.js +243 -393
  310. package/build-module/reducer.js.map +7 -1
  311. package/build-module/resolvers.js +478 -549
  312. package/build-module/resolvers.js.map +7 -1
  313. package/build-module/selectors.js +410 -953
  314. package/build-module/selectors.js.map +7 -1
  315. package/build-module/sync.js +14 -17
  316. package/build-module/sync.js.map +7 -1
  317. package/build-module/types.js +1 -2
  318. package/build-module/types.js.map +7 -1
  319. package/build-module/utils/conservative-map-item.js +6 -22
  320. package/build-module/utils/conservative-map-item.js.map +7 -1
  321. package/build-module/utils/crdt-blocks.js +255 -0
  322. package/build-module/utils/crdt-blocks.js.map +7 -0
  323. package/build-module/utils/crdt.js +167 -0
  324. package/build-module/utils/crdt.js.map +7 -0
  325. package/build-module/utils/forward-resolver.js +6 -12
  326. package/build-module/utils/forward-resolver.js.map +7 -1
  327. package/build-module/utils/get-nested-value.js +9 -18
  328. package/build-module/utils/get-nested-value.js.map +7 -1
  329. package/build-module/utils/get-normalized-comma-separable.js +7 -13
  330. package/build-module/utils/get-normalized-comma-separable.js.map +7 -1
  331. package/build-module/utils/if-matching-action.js +7 -15
  332. package/build-module/utils/if-matching-action.js.map +7 -1
  333. package/build-module/utils/index.js +35 -14
  334. package/build-module/utils/index.js.map +7 -1
  335. package/build-module/utils/is-numeric-id.js +5 -9
  336. package/build-module/utils/is-numeric-id.js.map +7 -1
  337. package/build-module/utils/is-raw-attribute.js +5 -10
  338. package/build-module/utils/is-raw-attribute.js.map +7 -1
  339. package/build-module/utils/log-entity-deprecation.js +8 -31
  340. package/build-module/utils/log-entity-deprecation.js.map +7 -1
  341. package/build-module/utils/on-sub-key.js +8 -19
  342. package/build-module/utils/on-sub-key.js.map +7 -1
  343. package/build-module/utils/receive-intermediate-results.js +7 -2
  344. package/build-module/utils/receive-intermediate-results.js.map +7 -1
  345. package/build-module/utils/replace-action.js +6 -13
  346. package/build-module/utils/replace-action.js.map +7 -1
  347. package/build-module/utils/set-nested-value.js +8 -27
  348. package/build-module/utils/set-nested-value.js.map +7 -1
  349. package/build-module/utils/user-permissions.js +19 -9
  350. package/build-module/utils/user-permissions.js.map +7 -1
  351. package/build-module/utils/with-weak-map-cache.js +8 -18
  352. package/build-module/utils/with-weak-map-cache.js.map +7 -1
  353. package/build-types/actions.d.ts.map +1 -1
  354. package/build-types/entities.d.ts +0 -56
  355. package/build-types/entities.d.ts.map +1 -1
  356. package/build-types/index.d.ts.map +1 -1
  357. package/build-types/private-selectors.d.ts.map +1 -1
  358. package/build-types/resolvers.d.ts +3 -0
  359. package/build-types/resolvers.d.ts.map +1 -1
  360. package/build-types/selectors.d.ts.map +1 -1
  361. package/build-types/sync.d.ts +6 -1
  362. package/build-types/sync.d.ts.map +1 -1
  363. package/build-types/types.d.ts +9 -0
  364. package/build-types/types.d.ts.map +1 -1
  365. package/build-types/utils/crdt-blocks.d.ts +30 -0
  366. package/build-types/utils/crdt-blocks.d.ts.map +1 -0
  367. package/build-types/utils/crdt.d.ts +49 -0
  368. package/build-types/utils/crdt.d.ts.map +1 -0
  369. package/package.json +26 -19
  370. package/src/actions.js +56 -74
  371. package/src/entities.js +59 -113
  372. package/src/private-selectors.ts +32 -7
  373. package/src/resolvers.js +173 -120
  374. package/src/selectors.ts +0 -13
  375. package/src/sync.ts +12 -0
  376. package/src/test/resolvers.js +183 -0
  377. package/src/types.ts +12 -0
  378. package/src/utils/crdt-blocks.ts +503 -0
  379. package/src/utils/crdt.ts +310 -0
  380. package/src/utils/test/crdt-blocks.ts +375 -0
  381. package/src/utils/test/crdt.ts +254 -0
  382. package/tsconfig.tsbuildinfo +1 -1
  383. package/src/sync.js +0 -27
package/build/reducer.js CHANGED
@@ -1,143 +1,111 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var reducer_exports = {};
30
+ __export(reducer_exports, {
31
+ autosaves: () => autosaves,
32
+ blockPatternCategories: () => blockPatternCategories,
33
+ blockPatterns: () => blockPatterns,
34
+ currentGlobalStylesId: () => currentGlobalStylesId,
35
+ currentTheme: () => currentTheme,
36
+ currentUser: () => currentUser,
37
+ default: () => reducer_default,
38
+ defaultTemplates: () => defaultTemplates,
39
+ editsReference: () => editsReference,
40
+ embedPreviews: () => embedPreviews,
41
+ entities: () => entities,
42
+ entitiesConfig: () => entitiesConfig,
43
+ navigationFallbackId: () => navigationFallbackId,
44
+ registeredPostMeta: () => registeredPostMeta,
45
+ templateAutoDraftId: () => templateAutoDraftId,
46
+ themeBaseGlobalStyles: () => themeBaseGlobalStyles,
47
+ themeGlobalStyleRevisions: () => themeGlobalStyleRevisions,
48
+ themeGlobalStyleVariations: () => themeGlobalStyleVariations,
49
+ undoManager: () => undoManager,
50
+ userPatternCategories: () => userPatternCategories,
51
+ userPermissions: () => userPermissions,
52
+ users: () => users
6
53
  });
7
- exports.autosaves = autosaves;
8
- exports.blockPatternCategories = blockPatternCategories;
9
- exports.blockPatterns = blockPatterns;
10
- exports.currentGlobalStylesId = currentGlobalStylesId;
11
- exports.currentTheme = currentTheme;
12
- exports.currentUser = currentUser;
13
- exports.default = void 0;
14
- exports.defaultTemplates = defaultTemplates;
15
- exports.editsReference = editsReference;
16
- exports.embedPreviews = embedPreviews;
17
- exports.entities = void 0;
18
- exports.entitiesConfig = entitiesConfig;
19
- exports.navigationFallbackId = navigationFallbackId;
20
- exports.registeredPostMeta = registeredPostMeta;
21
- exports.templateAutoDraftId = templateAutoDraftId;
22
- exports.themeBaseGlobalStyles = themeBaseGlobalStyles;
23
- exports.themeGlobalStyleRevisions = themeGlobalStyleRevisions;
24
- exports.themeGlobalStyleVariations = themeGlobalStyleVariations;
25
- exports.undoManager = undoManager;
26
- exports.userPatternCategories = userPatternCategories;
27
- exports.userPermissions = userPermissions;
28
- exports.users = users;
29
- var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
30
- var _compose = require("@wordpress/compose");
31
- var _data = require("@wordpress/data");
32
- var _undoManager = require("@wordpress/undo-manager");
33
- var _utils = require("./utils");
34
- var _queriedData = require("./queried-data");
35
- var _entities = require("./entities");
36
- /**
37
- * External dependencies
38
- */
39
-
40
- /**
41
- * WordPress dependencies
42
- */
43
-
44
- /**
45
- * Internal dependencies
46
- */
47
-
48
- /** @typedef {import('./types').AnyFunction} AnyFunction */
49
-
50
- /**
51
- * Reducer managing authors state. Keyed by id.
52
- *
53
- * @param {Object} state Current state.
54
- * @param {Object} action Dispatched action.
55
- *
56
- * @return {Object} Updated state.
57
- */
58
- function users(state = {
59
- byId: {},
60
- queries: {}
61
- }, action) {
54
+ module.exports = __toCommonJS(reducer_exports);
55
+ var import_es6 = __toESM(require("fast-deep-equal/es6"));
56
+ var import_compose = require("@wordpress/compose");
57
+ var import_data = require("@wordpress/data");
58
+ var import_undo_manager = require("@wordpress/undo-manager");
59
+ var import_utils = require("./utils");
60
+ var import_queried_data = require("./queried-data");
61
+ var import_entities = require("./entities");
62
+ function users(state = { byId: {}, queries: {} }, action) {
62
63
  switch (action.type) {
63
- case 'RECEIVE_USER_QUERY':
64
+ case "RECEIVE_USER_QUERY":
64
65
  return {
65
66
  byId: {
66
67
  ...state.byId,
67
68
  // Key users by their ID.
68
- ...action.users.reduce((newUsers, user) => ({
69
- ...newUsers,
70
- [user.id]: user
71
- }), {})
69
+ ...action.users.reduce(
70
+ (newUsers, user) => ({
71
+ ...newUsers,
72
+ [user.id]: user
73
+ }),
74
+ {}
75
+ )
72
76
  },
73
77
  queries: {
74
78
  ...state.queries,
75
- [action.queryID]: action.users.map(user => user.id)
79
+ [action.queryID]: action.users.map((user) => user.id)
76
80
  }
77
81
  };
78
82
  }
79
83
  return state;
80
84
  }
81
-
82
- /**
83
- * Reducer managing current user state.
84
- *
85
- * @param {Object} state Current state.
86
- * @param {Object} action Dispatched action.
87
- *
88
- * @return {Object} Updated state.
89
- */
90
85
  function currentUser(state = {}, action) {
91
86
  switch (action.type) {
92
- case 'RECEIVE_CURRENT_USER':
87
+ case "RECEIVE_CURRENT_USER":
93
88
  return action.currentUser;
94
89
  }
95
90
  return state;
96
91
  }
97
-
98
- /**
99
- * Reducer managing the current theme.
100
- *
101
- * @param {string|undefined} state Current state.
102
- * @param {Object} action Dispatched action.
103
- *
104
- * @return {string|undefined} Updated state.
105
- */
106
- function currentTheme(state = undefined, action) {
92
+ function currentTheme(state = void 0, action) {
107
93
  switch (action.type) {
108
- case 'RECEIVE_CURRENT_THEME':
94
+ case "RECEIVE_CURRENT_THEME":
109
95
  return action.currentTheme.stylesheet;
110
96
  }
111
97
  return state;
112
98
  }
113
-
114
- /**
115
- * Reducer managing the current global styles id.
116
- *
117
- * @param {string|undefined} state Current state.
118
- * @param {Object} action Dispatched action.
119
- *
120
- * @return {string|undefined} Updated state.
121
- */
122
- function currentGlobalStylesId(state = undefined, action) {
99
+ function currentGlobalStylesId(state = void 0, action) {
123
100
  switch (action.type) {
124
- case 'RECEIVE_CURRENT_GLOBAL_STYLES_ID':
101
+ case "RECEIVE_CURRENT_GLOBAL_STYLES_ID":
125
102
  return action.id;
126
103
  }
127
104
  return state;
128
105
  }
129
-
130
- /**
131
- * Reducer managing the theme base global styles.
132
- *
133
- * @param {Record<string, object>} state Current state.
134
- * @param {Object} action Dispatched action.
135
- *
136
- * @return {Record<string, object>} Updated state.
137
- */
138
106
  function themeBaseGlobalStyles(state = {}, action) {
139
107
  switch (action.type) {
140
- case 'RECEIVE_THEME_GLOBAL_STYLES':
108
+ case "RECEIVE_THEME_GLOBAL_STYLES":
141
109
  return {
142
110
  ...state,
143
111
  [action.stylesheet]: action.globalStyles
@@ -145,18 +113,9 @@ function themeBaseGlobalStyles(state = {}, action) {
145
113
  }
146
114
  return state;
147
115
  }
148
-
149
- /**
150
- * Reducer managing the theme global styles variations.
151
- *
152
- * @param {Record<string, object>} state Current state.
153
- * @param {Object} action Dispatched action.
154
- *
155
- * @return {Record<string, object>} Updated state.
156
- */
157
116
  function themeGlobalStyleVariations(state = {}, action) {
158
117
  switch (action.type) {
159
- case 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS':
118
+ case "RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS":
160
119
  return {
161
120
  ...state,
162
121
  [action.stylesheet]: action.variations
@@ -164,241 +123,202 @@ function themeGlobalStyleVariations(state = {}, action) {
164
123
  }
165
124
  return state;
166
125
  }
167
- const withMultiEntityRecordEdits = reducer => (state, action) => {
168
- if (action.type === 'UNDO' || action.type === 'REDO') {
169
- const {
170
- record
171
- } = action;
126
+ const withMultiEntityRecordEdits = (reducer) => (state, action) => {
127
+ if (action.type === "UNDO" || action.type === "REDO") {
128
+ const { record } = action;
172
129
  let newState = state;
173
- record.forEach(({
174
- id: {
175
- kind,
176
- name,
177
- recordId
178
- },
179
- changes
180
- }) => {
130
+ record.forEach(({ id: { kind, name, recordId }, changes }) => {
181
131
  newState = reducer(newState, {
182
- type: 'EDIT_ENTITY_RECORD',
132
+ type: "EDIT_ENTITY_RECORD",
183
133
  kind,
184
134
  name,
185
135
  recordId,
186
- edits: Object.entries(changes).reduce((acc, [key, value]) => {
187
- acc[key] = action.type === 'UNDO' ? value.from : value.to;
188
- return acc;
189
- }, {})
136
+ edits: Object.entries(changes).reduce(
137
+ (acc, [key, value]) => {
138
+ acc[key] = action.type === "UNDO" ? value.from : value.to;
139
+ return acc;
140
+ },
141
+ {}
142
+ )
190
143
  });
191
144
  });
192
145
  return newState;
193
146
  }
194
147
  return reducer(state, action);
195
148
  };
196
-
197
- /**
198
- * Higher Order Reducer for a given entity config. It supports:
199
- *
200
- * - Fetching
201
- * - Editing
202
- * - Saving
203
- *
204
- * @param {Object} entityConfig Entity config.
205
- *
206
- * @return {AnyFunction} Reducer.
207
- */
208
149
  function entity(entityConfig) {
209
- return (0, _compose.compose)([withMultiEntityRecordEdits,
210
- // Limit to matching action type so we don't attempt to replace action on
211
- // an unhandled action.
212
- (0, _utils.ifMatchingAction)(action => action.name && action.kind && action.name === entityConfig.name && action.kind === entityConfig.kind),
213
- // Inject the entity config into the action.
214
- (0, _utils.replaceAction)(action => {
215
- return {
216
- key: entityConfig.key || _entities.DEFAULT_ENTITY_KEY,
217
- ...action
218
- };
219
- })])((0, _data.combineReducers)({
220
- queriedData: _queriedData.reducer,
221
- edits: (state = {}, action) => {
222
- var _action$query$context;
223
- switch (action.type) {
224
- case 'RECEIVE_ITEMS':
225
- const context = (_action$query$context = action?.query?.context) !== null && _action$query$context !== void 0 ? _action$query$context : 'default';
226
- if (context !== 'default') {
227
- return state;
228
- }
229
- const nextState = {
230
- ...state
231
- };
232
- for (const record of action.items) {
233
- const recordId = record?.[action.key];
234
- const edits = nextState[recordId];
235
- if (!edits) {
236
- continue;
150
+ return (0, import_compose.compose)([
151
+ withMultiEntityRecordEdits,
152
+ // Limit to matching action type so we don't attempt to replace action on
153
+ // an unhandled action.
154
+ (0, import_utils.ifMatchingAction)(
155
+ (action) => action.name && action.kind && action.name === entityConfig.name && action.kind === entityConfig.kind
156
+ ),
157
+ // Inject the entity config into the action.
158
+ (0, import_utils.replaceAction)((action) => {
159
+ return {
160
+ key: entityConfig.key || import_entities.DEFAULT_ENTITY_KEY,
161
+ ...action
162
+ };
163
+ })
164
+ ])(
165
+ (0, import_data.combineReducers)({
166
+ queriedData: import_queried_data.reducer,
167
+ edits: (state = {}, action) => {
168
+ switch (action.type) {
169
+ case "RECEIVE_ITEMS":
170
+ const context = action?.query?.context ?? "default";
171
+ if (context !== "default") {
172
+ return state;
237
173
  }
238
- const nextEdits = Object.keys(edits).reduce((acc, key) => {
239
- var _record$key$raw;
240
- // If the edited value is still different to the persisted value,
241
- // keep the edited value in edits.
242
- if (
243
- // Edits are the "raw" attribute values, but records may have
244
- // objects with more properties, so we use `get` here for the
245
- // comparison.
246
- !(0, _es.default)(edits[key], (_record$key$raw = record[key]?.raw) !== null && _record$key$raw !== void 0 ? _record$key$raw : record[key]) && (
247
- // Sometimes the server alters the sent value which means
248
- // we need to also remove the edits before the api request.
249
- !action.persistedEdits || !(0, _es.default)(edits[key], action.persistedEdits[key]))) {
250
- acc[key] = edits[key];
174
+ const nextState = { ...state };
175
+ for (const record of action.items) {
176
+ const recordId = record?.[action.key];
177
+ const edits = nextState[recordId];
178
+ if (!edits) {
179
+ continue;
180
+ }
181
+ const nextEdits2 = Object.keys(edits).reduce(
182
+ (acc, key) => {
183
+ if (
184
+ // Edits are the "raw" attribute values, but records may have
185
+ // objects with more properties, so we use `get` here for the
186
+ // comparison.
187
+ !(0, import_es6.default)(
188
+ edits[key],
189
+ record[key]?.raw ?? record[key]
190
+ ) && // Sometimes the server alters the sent value which means
191
+ // we need to also remove the edits before the api request.
192
+ (!action.persistedEdits || !(0, import_es6.default)(
193
+ edits[key],
194
+ action.persistedEdits[key]
195
+ ))
196
+ ) {
197
+ acc[key] = edits[key];
198
+ }
199
+ return acc;
200
+ },
201
+ {}
202
+ );
203
+ if (Object.keys(nextEdits2).length) {
204
+ nextState[recordId] = nextEdits2;
205
+ } else {
206
+ delete nextState[recordId];
251
207
  }
252
- return acc;
253
- }, {});
254
- if (Object.keys(nextEdits).length) {
255
- nextState[recordId] = nextEdits;
256
- } else {
257
- delete nextState[recordId];
258
- }
259
- }
260
- return nextState;
261
- case 'EDIT_ENTITY_RECORD':
262
- const nextEdits = {
263
- ...state[action.recordId],
264
- ...action.edits
265
- };
266
- Object.keys(nextEdits).forEach(key => {
267
- // Delete cleared edits so that the properties
268
- // are not considered dirty.
269
- if (nextEdits[key] === undefined) {
270
- delete nextEdits[key];
271
208
  }
209
+ return nextState;
210
+ case "EDIT_ENTITY_RECORD":
211
+ const nextEdits = {
212
+ ...state[action.recordId],
213
+ ...action.edits
214
+ };
215
+ Object.keys(nextEdits).forEach((key) => {
216
+ if (nextEdits[key] === void 0) {
217
+ delete nextEdits[key];
218
+ }
219
+ });
220
+ return {
221
+ ...state,
222
+ [action.recordId]: nextEdits
223
+ };
224
+ }
225
+ return state;
226
+ },
227
+ saving: (state = {}, action) => {
228
+ switch (action.type) {
229
+ case "SAVE_ENTITY_RECORD_START":
230
+ case "SAVE_ENTITY_RECORD_FINISH":
231
+ return {
232
+ ...state,
233
+ [action.recordId]: {
234
+ pending: action.type === "SAVE_ENTITY_RECORD_START",
235
+ error: action.error,
236
+ isAutosave: action.isAutosave
237
+ }
238
+ };
239
+ }
240
+ return state;
241
+ },
242
+ deleting: (state = {}, action) => {
243
+ switch (action.type) {
244
+ case "DELETE_ENTITY_RECORD_START":
245
+ case "DELETE_ENTITY_RECORD_FINISH":
246
+ return {
247
+ ...state,
248
+ [action.recordId]: {
249
+ pending: action.type === "DELETE_ENTITY_RECORD_START",
250
+ error: action.error
251
+ }
252
+ };
253
+ }
254
+ return state;
255
+ },
256
+ revisions: (state = {}, action) => {
257
+ if (action.type === "RECEIVE_ITEM_REVISIONS") {
258
+ const recordKey = action.recordKey;
259
+ delete action.recordKey;
260
+ const newState = (0, import_queried_data.reducer)(state[recordKey], {
261
+ ...action,
262
+ type: "RECEIVE_ITEMS"
272
263
  });
273
264
  return {
274
265
  ...state,
275
- [action.recordId]: nextEdits
276
- };
277
- }
278
- return state;
279
- },
280
- saving: (state = {}, action) => {
281
- switch (action.type) {
282
- case 'SAVE_ENTITY_RECORD_START':
283
- case 'SAVE_ENTITY_RECORD_FINISH':
284
- return {
285
- ...state,
286
- [action.recordId]: {
287
- pending: action.type === 'SAVE_ENTITY_RECORD_START',
288
- error: action.error,
289
- isAutosave: action.isAutosave
290
- }
291
- };
292
- }
293
- return state;
294
- },
295
- deleting: (state = {}, action) => {
296
- switch (action.type) {
297
- case 'DELETE_ENTITY_RECORD_START':
298
- case 'DELETE_ENTITY_RECORD_FINISH':
299
- return {
300
- ...state,
301
- [action.recordId]: {
302
- pending: action.type === 'DELETE_ENTITY_RECORD_START',
303
- error: action.error
304
- }
266
+ [recordKey]: newState
305
267
  };
268
+ }
269
+ if (action.type === "REMOVE_ITEMS") {
270
+ return Object.fromEntries(
271
+ Object.entries(state).filter(
272
+ ([id]) => !action.itemIds.some((itemId) => {
273
+ if (Number.isInteger(itemId)) {
274
+ return itemId === +id;
275
+ }
276
+ return itemId === id;
277
+ })
278
+ )
279
+ );
280
+ }
281
+ return state;
306
282
  }
307
- return state;
308
- },
309
- revisions: (state = {}, action) => {
310
- // Use the same queriedDataReducer shape for revisions.
311
- if (action.type === 'RECEIVE_ITEM_REVISIONS') {
312
- const recordKey = action.recordKey;
313
- delete action.recordKey;
314
- const newState = (0, _queriedData.reducer)(state[recordKey], {
315
- ...action,
316
- type: 'RECEIVE_ITEMS'
317
- });
318
- return {
319
- ...state,
320
- [recordKey]: newState
321
- };
322
- }
323
- if (action.type === 'REMOVE_ITEMS') {
324
- return Object.fromEntries(Object.entries(state).filter(([id]) => !action.itemIds.some(itemId => {
325
- if (Number.isInteger(itemId)) {
326
- return itemId === +id;
327
- }
328
- return itemId === id;
329
- })));
330
- }
331
- return state;
332
- }
333
- }));
283
+ })
284
+ );
334
285
  }
335
-
336
- /**
337
- * Reducer keeping track of the registered entities.
338
- *
339
- * @param {Object} state Current state.
340
- * @param {Object} action Dispatched action.
341
- *
342
- * @return {Object} Updated state.
343
- */
344
- function entitiesConfig(state = _entities.rootEntitiesConfig, action) {
286
+ function entitiesConfig(state = import_entities.rootEntitiesConfig, action) {
345
287
  switch (action.type) {
346
- case 'ADD_ENTITIES':
288
+ case "ADD_ENTITIES":
347
289
  return [...state, ...action.entities];
348
290
  }
349
291
  return state;
350
292
  }
351
-
352
- /**
353
- * Reducer keeping track of the registered entities config and data.
354
- *
355
- * @param {Object} state Current state.
356
- * @param {Object} action Dispatched action.
357
- *
358
- * @return {Object} Updated state.
359
- */
360
293
  const entities = (state = {}, action) => {
361
294
  const newConfig = entitiesConfig(state.config, action);
362
-
363
- // Generates a reducer for the entities nested by `kind` and `name`.
364
- // A config array with shape:
365
- // ```
366
- // [
367
- // { kind: 'taxonomy', name: 'category' },
368
- // { kind: 'taxonomy', name: 'post_tag' },
369
- // { kind: 'postType', name: 'post' },
370
- // { kind: 'postType', name: 'page' },
371
- // ]
372
- // ```
373
- // generates a reducer for state tree with shape:
374
- // ```
375
- // {
376
- // taxonomy: {
377
- // category,
378
- // post_tag,
379
- // },
380
- // postType: {
381
- // post,
382
- // page,
383
- // },
384
- // }
385
- // ```
386
295
  let entitiesDataReducer = state.reducer;
387
296
  if (!entitiesDataReducer || newConfig !== state.config) {
388
297
  const entitiesByKind = newConfig.reduce((acc, record) => {
389
- const {
390
- kind
391
- } = record;
298
+ const { kind } = record;
392
299
  if (!acc[kind]) {
393
300
  acc[kind] = [];
394
301
  }
395
302
  acc[kind].push(record);
396
303
  return acc;
397
304
  }, {});
398
- entitiesDataReducer = (0, _data.combineReducers)(Object.fromEntries(Object.entries(entitiesByKind).map(([kind, subEntities]) => {
399
- const kindReducer = (0, _data.combineReducers)(Object.fromEntries(subEntities.map(entityConfig => [entityConfig.name, entity(entityConfig)])));
400
- return [kind, kindReducer];
401
- })));
305
+ entitiesDataReducer = (0, import_data.combineReducers)(
306
+ Object.fromEntries(
307
+ Object.entries(entitiesByKind).map(
308
+ ([kind, subEntities]) => {
309
+ const kindReducer = (0, import_data.combineReducers)(
310
+ Object.fromEntries(
311
+ subEntities.map((entityConfig) => [
312
+ entityConfig.name,
313
+ entity(entityConfig)
314
+ ])
315
+ )
316
+ );
317
+ return [kind, kindReducer];
318
+ }
319
+ )
320
+ )
321
+ );
402
322
  }
403
323
  const newData = entitiesDataReducer(state.records, action);
404
324
  if (newData === state.records && newConfig === state.config && entitiesDataReducer === state.reducer) {
@@ -410,39 +330,22 @@ const entities = (state = {}, action) => {
410
330
  config: newConfig
411
331
  };
412
332
  };
413
-
414
- /**
415
- * @type {UndoManager}
416
- */
417
- exports.entities = entities;
418
- function undoManager(state = (0, _undoManager.createUndoManager)()) {
333
+ function undoManager(state = (0, import_undo_manager.createUndoManager)()) {
419
334
  return state;
420
335
  }
421
336
  function editsReference(state = {}, action) {
422
337
  switch (action.type) {
423
- case 'EDIT_ENTITY_RECORD':
424
- case 'UNDO':
425
- case 'REDO':
338
+ case "EDIT_ENTITY_RECORD":
339
+ case "UNDO":
340
+ case "REDO":
426
341
  return {};
427
342
  }
428
343
  return state;
429
344
  }
430
-
431
- /**
432
- * Reducer managing embed preview data.
433
- *
434
- * @param {Object} state Current state.
435
- * @param {Object} action Dispatched action.
436
- *
437
- * @return {Object} Updated state.
438
- */
439
345
  function embedPreviews(state = {}, action) {
440
346
  switch (action.type) {
441
- case 'RECEIVE_EMBED_PREVIEW':
442
- const {
443
- url,
444
- preview
445
- } = action;
347
+ case "RECEIVE_EMBED_PREVIEW":
348
+ const { url, preview } = action;
446
349
  return {
447
350
  ...state,
448
351
  [url]: preview
@@ -450,24 +353,14 @@ function embedPreviews(state = {}, action) {
450
353
  }
451
354
  return state;
452
355
  }
453
-
454
- /**
455
- * State which tracks whether the user can perform an action on a REST
456
- * resource.
457
- *
458
- * @param {Object} state Current state.
459
- * @param {Object} action Dispatched action.
460
- *
461
- * @return {Object} Updated state.
462
- */
463
356
  function userPermissions(state = {}, action) {
464
357
  switch (action.type) {
465
- case 'RECEIVE_USER_PERMISSION':
358
+ case "RECEIVE_USER_PERMISSION":
466
359
  return {
467
360
  ...state,
468
361
  [action.key]: action.isAllowed
469
362
  };
470
- case 'RECEIVE_USER_PERMISSIONS':
363
+ case "RECEIVE_USER_PERMISSIONS":
471
364
  return {
472
365
  ...state,
473
366
  ...action.permissions
@@ -475,22 +368,10 @@ function userPermissions(state = {}, action) {
475
368
  }
476
369
  return state;
477
370
  }
478
-
479
- /**
480
- * Reducer returning autosaves keyed by their parent's post id.
481
- *
482
- * @param {Object} state Current state.
483
- * @param {Object} action Dispatched action.
484
- *
485
- * @return {Object} Updated state.
486
- */
487
371
  function autosaves(state = {}, action) {
488
372
  switch (action.type) {
489
- case 'RECEIVE_AUTOSAVES':
490
- const {
491
- postId,
492
- autosaves: autosavesData
493
- } = action;
373
+ case "RECEIVE_AUTOSAVES":
374
+ const { postId, autosaves: autosavesData } = action;
494
375
  return {
495
376
  ...state,
496
377
  [postId]: autosavesData
@@ -500,44 +381,35 @@ function autosaves(state = {}, action) {
500
381
  }
501
382
  function blockPatterns(state = [], action) {
502
383
  switch (action.type) {
503
- case 'RECEIVE_BLOCK_PATTERNS':
384
+ case "RECEIVE_BLOCK_PATTERNS":
504
385
  return action.patterns;
505
386
  }
506
387
  return state;
507
388
  }
508
389
  function blockPatternCategories(state = [], action) {
509
390
  switch (action.type) {
510
- case 'RECEIVE_BLOCK_PATTERN_CATEGORIES':
391
+ case "RECEIVE_BLOCK_PATTERN_CATEGORIES":
511
392
  return action.categories;
512
393
  }
513
394
  return state;
514
395
  }
515
396
  function userPatternCategories(state = [], action) {
516
397
  switch (action.type) {
517
- case 'RECEIVE_USER_PATTERN_CATEGORIES':
398
+ case "RECEIVE_USER_PATTERN_CATEGORIES":
518
399
  return action.patternCategories;
519
400
  }
520
401
  return state;
521
402
  }
522
403
  function navigationFallbackId(state = null, action) {
523
404
  switch (action.type) {
524
- case 'RECEIVE_NAVIGATION_FALLBACK_ID':
405
+ case "RECEIVE_NAVIGATION_FALLBACK_ID":
525
406
  return action.fallbackId;
526
407
  }
527
408
  return state;
528
409
  }
529
-
530
- /**
531
- * Reducer managing the theme global styles revisions.
532
- *
533
- * @param {Record<string, object>} state Current state.
534
- * @param {Object} action Dispatched action.
535
- *
536
- * @return {Record<string, object>} Updated state.
537
- */
538
410
  function themeGlobalStyleRevisions(state = {}, action) {
539
411
  switch (action.type) {
540
- case 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS':
412
+ case "RECEIVE_THEME_GLOBAL_STYLE_REVISIONS":
541
413
  return {
542
414
  ...state,
543
415
  [action.currentId]: action.revisions
@@ -545,18 +417,9 @@ function themeGlobalStyleRevisions(state = {}, action) {
545
417
  }
546
418
  return state;
547
419
  }
548
-
549
- /**
550
- * Reducer managing the template lookup per query.
551
- *
552
- * @param {Record<string, string>} state Current state.
553
- * @param {Object} action Dispatched action.
554
- *
555
- * @return {Record<string, string>} Updated state.
556
- */
557
420
  function defaultTemplates(state = {}, action) {
558
421
  switch (action.type) {
559
- case 'RECEIVE_DEFAULT_TEMPLATE':
422
+ case "RECEIVE_DEFAULT_TEMPLATE":
560
423
  return {
561
424
  ...state,
562
425
  [JSON.stringify(action.query)]: action.templateId
@@ -564,18 +427,9 @@ function defaultTemplates(state = {}, action) {
564
427
  }
565
428
  return state;
566
429
  }
567
-
568
- /**
569
- * Reducer returning an object of registered post meta.
570
- *
571
- * @param {Object} state Current state.
572
- * @param {Object} action Dispatched action.
573
- *
574
- * @return {Object} Updated state.
575
- */
576
430
  function registeredPostMeta(state = {}, action) {
577
431
  switch (action.type) {
578
- case 'RECEIVE_REGISTERED_POST_META':
432
+ case "RECEIVE_REGISTERED_POST_META":
579
433
  return {
580
434
  ...state,
581
435
  [action.postType]: action.registeredPostMeta
@@ -584,12 +438,9 @@ function registeredPostMeta(state = {}, action) {
584
438
  return state;
585
439
  }
586
440
  function templateAutoDraftId(state = {}, action) {
587
- return action.type === 'RECEIVE_TEMPLATE_AUTO_DRAFT_ID' ? {
588
- ...state,
589
- [action.target]: action.id
590
- } : state;
441
+ return action.type === "RECEIVE_TEMPLATE_AUTO_DRAFT_ID" ? { ...state, [action.target]: action.id } : state;
591
442
  }
592
- var _default = exports.default = (0, _data.combineReducers)({
443
+ var reducer_default = (0, import_data.combineReducers)({
593
444
  users,
594
445
  currentTheme,
595
446
  currentGlobalStylesId,
@@ -611,4 +462,28 @@ var _default = exports.default = (0, _data.combineReducers)({
611
462
  registeredPostMeta,
612
463
  templateAutoDraftId
613
464
  });
614
- //# sourceMappingURL=reducer.js.map
465
+ // Annotate the CommonJS export names for ESM import in node:
466
+ 0 && (module.exports = {
467
+ autosaves,
468
+ blockPatternCategories,
469
+ blockPatterns,
470
+ currentGlobalStylesId,
471
+ currentTheme,
472
+ currentUser,
473
+ defaultTemplates,
474
+ editsReference,
475
+ embedPreviews,
476
+ entities,
477
+ entitiesConfig,
478
+ navigationFallbackId,
479
+ registeredPostMeta,
480
+ templateAutoDraftId,
481
+ themeBaseGlobalStyles,
482
+ themeGlobalStyleRevisions,
483
+ themeGlobalStyleVariations,
484
+ undoManager,
485
+ userPatternCategories,
486
+ userPermissions,
487
+ users
488
+ });
489
+ //# sourceMappingURL=reducer.js.map