@wordpress/core-data 7.51.0 → 7.53.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 (494) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -0
  3. package/build/actions.cjs +64 -2
  4. package/build/actions.cjs.map +3 -3
  5. package/build/awareness/awareness-state.cjs.map +2 -2
  6. package/build/awareness/base-awareness.cjs.map +2 -2
  7. package/build/awareness/block-lookup.cjs.map +2 -2
  8. package/build/awareness/post-editor-awareness.cjs +7 -0
  9. package/build/awareness/post-editor-awareness.cjs.map +2 -2
  10. package/build/awareness/typed-awareness.cjs.map +2 -2
  11. package/build/awareness/types.cjs.map +1 -1
  12. package/build/awareness/utils.cjs.map +2 -2
  13. package/build/batch/create-batch.cjs.map +2 -2
  14. package/build/batch/default-processor.cjs.map +2 -2
  15. package/build/components/entities-saved-states/entity-record-item.cjs +67 -0
  16. package/build/components/entities-saved-states/entity-record-item.cjs.map +7 -0
  17. package/build/components/entities-saved-states/entity-type-list.cjs +135 -0
  18. package/build/components/entities-saved-states/entity-type-list.cjs.map +7 -0
  19. package/build/components/entities-saved-states/hooks/use-is-dirty.cjs +101 -0
  20. package/build/components/entities-saved-states/hooks/use-is-dirty.cjs.map +7 -0
  21. package/build/components/entities-saved-states/index.cjs +215 -0
  22. package/build/components/entities-saved-states/index.cjs.map +7 -0
  23. package/build/dynamic-entities.cjs.map +2 -2
  24. package/build/entities.cjs +2 -0
  25. package/build/entities.cjs.map +2 -2
  26. package/build/entity-context.cjs.map +2 -2
  27. package/build/entity-provider.cjs.map +2 -2
  28. package/build/entity-types/attachment.cjs.map +1 -1
  29. package/build/entity-types/base.cjs.map +1 -1
  30. package/build/entity-types/comment.cjs.map +1 -1
  31. package/build/entity-types/font-collection.cjs.map +1 -1
  32. package/build/entity-types/font-family.cjs.map +1 -1
  33. package/build/entity-types/global-styles-revision.cjs.map +1 -1
  34. package/build/entity-types/helpers.cjs.map +1 -1
  35. package/build/entity-types/icon.cjs.map +1 -1
  36. package/build/entity-types/index.cjs.map +1 -1
  37. package/build/entity-types/menu-location.cjs.map +1 -1
  38. package/build/entity-types/nav-menu-item.cjs.map +1 -1
  39. package/build/entity-types/nav-menu.cjs.map +1 -1
  40. package/build/entity-types/page.cjs.map +1 -1
  41. package/build/entity-types/plugin.cjs.map +1 -1
  42. package/build/entity-types/post-revision.cjs.map +1 -1
  43. package/build/entity-types/post-status.cjs.map +1 -1
  44. package/build/entity-types/post.cjs.map +1 -1
  45. package/build/entity-types/settings.cjs.map +1 -1
  46. package/build/entity-types/sidebar.cjs.map +1 -1
  47. package/build/entity-types/taxonomy.cjs.map +1 -1
  48. package/build/entity-types/term.cjs.map +1 -1
  49. package/build/entity-types/theme.cjs.map +1 -1
  50. package/build/entity-types/type.cjs.map +1 -1
  51. package/build/entity-types/user.cjs.map +1 -1
  52. package/build/entity-types/widget-type.cjs.map +1 -1
  53. package/build/entity-types/widget.cjs.map +1 -1
  54. package/build/entity-types/wp-template-part.cjs.map +1 -1
  55. package/build/entity-types/wp-template.cjs.map +1 -1
  56. package/build/fetch/__experimental-fetch-link-suggestions.cjs.map +2 -2
  57. package/build/fetch/__experimental-fetch-url-data.cjs.map +2 -2
  58. package/build/fetch/index.cjs.map +2 -2
  59. package/build/footnotes/get-footnotes-order.cjs.map +2 -2
  60. package/build/footnotes/get-rich-text-values-cached.cjs.map +2 -2
  61. package/build/footnotes/index.cjs +12 -1
  62. package/build/footnotes/index.cjs.map +3 -3
  63. package/build/hooks/index.cjs.map +2 -2
  64. package/build/hooks/use-entity-block-editor.cjs.map +2 -2
  65. package/build/hooks/use-entity-id.cjs.map +2 -2
  66. package/build/hooks/use-entity-prop.cjs.map +2 -2
  67. package/build/hooks/use-entity-record.cjs.map +2 -2
  68. package/build/hooks/use-entity-records.cjs +2 -2
  69. package/build/hooks/use-entity-records.cjs.map +2 -2
  70. package/build/hooks/use-post-editor-awareness-state.cjs.map +2 -2
  71. package/build/hooks/use-query-select.cjs.map +2 -2
  72. package/build/hooks/use-resource-permissions.cjs.map +2 -2
  73. package/build/hooks/utils.cjs.map +2 -2
  74. package/build/index.cjs.map +2 -2
  75. package/build/lock-unlock.cjs.map +2 -2
  76. package/build/locks/actions.cjs.map +2 -2
  77. package/build/locks/engine.cjs.map +2 -2
  78. package/build/locks/reducer.cjs.map +2 -2
  79. package/build/locks/selectors.cjs.map +2 -2
  80. package/build/private-actions.cjs +132 -0
  81. package/build/private-actions.cjs.map +3 -3
  82. package/build/private-apis.cjs +22 -0
  83. package/build/private-apis.cjs.map +3 -3
  84. package/build/private-selectors.cjs +5 -0
  85. package/build/private-selectors.cjs.map +2 -2
  86. package/build/queried-data/get-query-parts.cjs.map +2 -2
  87. package/build/queried-data/reducer.cjs.map +2 -2
  88. package/build/queried-data/selectors.cjs.map +2 -2
  89. package/build/reducer.cjs.map +2 -2
  90. package/build/resolvers.cjs +21 -26
  91. package/build/resolvers.cjs.map +2 -2
  92. package/build/selectors.cjs.map +2 -2
  93. package/build/sync.cjs +26 -0
  94. package/build/sync.cjs.map +2 -2
  95. package/build/types.cjs.map +1 -1
  96. package/build/utils/block-selection-history.cjs.map +2 -2
  97. package/build/utils/clear-unchanged-edits.cjs.map +2 -2
  98. package/build/utils/conservative-map-item.cjs.map +2 -2
  99. package/build/utils/crdt-blocks.cjs.map +2 -2
  100. package/build/utils/crdt-selection.cjs.map +2 -2
  101. package/build/utils/crdt-text.cjs.map +2 -2
  102. package/build/utils/crdt-user-selections.cjs +43 -16
  103. package/build/utils/crdt-user-selections.cjs.map +3 -3
  104. package/build/utils/crdt-utils.cjs.map +2 -2
  105. package/build/utils/crdt.cjs +4 -2
  106. package/build/utils/crdt.cjs.map +2 -2
  107. package/build/utils/get-template-info.cjs +53 -0
  108. package/build/utils/get-template-info.cjs.map +7 -0
  109. package/build/utils/get-template-part-icon.cjs +43 -0
  110. package/build/utils/get-template-part-icon.cjs.map +7 -0
  111. package/build/utils/log-entity-deprecation.cjs.map +2 -2
  112. package/build/utils/save-crdt-doc.cjs.map +2 -2
  113. package/build-module/actions.mjs +68 -2
  114. package/build-module/actions.mjs.map +2 -2
  115. package/build-module/awareness/awareness-state.mjs.map +2 -2
  116. package/build-module/awareness/base-awareness.mjs.map +2 -2
  117. package/build-module/awareness/block-lookup.mjs.map +2 -2
  118. package/build-module/awareness/post-editor-awareness.mjs +7 -0
  119. package/build-module/awareness/post-editor-awareness.mjs.map +2 -2
  120. package/build-module/awareness/typed-awareness.mjs.map +2 -2
  121. package/build-module/awareness/utils.mjs.map +2 -2
  122. package/build-module/batch/create-batch.mjs.map +2 -2
  123. package/build-module/batch/default-processor.mjs.map +2 -2
  124. package/build-module/components/entities-saved-states/entity-record-item.mjs +46 -0
  125. package/build-module/components/entities-saved-states/entity-record-item.mjs.map +7 -0
  126. package/build-module/components/entities-saved-states/entity-type-list.mjs +104 -0
  127. package/build-module/components/entities-saved-states/entity-type-list.mjs.map +7 -0
  128. package/build-module/components/entities-saved-states/hooks/use-is-dirty.mjs +76 -0
  129. package/build-module/components/entities-saved-states/hooks/use-is-dirty.mjs.map +7 -0
  130. package/build-module/components/entities-saved-states/index.mjs +187 -0
  131. package/build-module/components/entities-saved-states/index.mjs.map +7 -0
  132. package/build-module/dynamic-entities.mjs.map +2 -2
  133. package/build-module/entities.mjs +2 -0
  134. package/build-module/entities.mjs.map +2 -2
  135. package/build-module/entity-context.mjs.map +2 -2
  136. package/build-module/entity-provider.mjs.map +2 -2
  137. package/build-module/fetch/__experimental-fetch-link-suggestions.mjs.map +2 -2
  138. package/build-module/fetch/__experimental-fetch-url-data.mjs.map +2 -2
  139. package/build-module/fetch/index.mjs.map +2 -2
  140. package/build-module/footnotes/get-footnotes-order.mjs.map +2 -2
  141. package/build-module/footnotes/get-rich-text-values-cached.mjs.map +2 -2
  142. package/build-module/footnotes/index.mjs +12 -1
  143. package/build-module/footnotes/index.mjs.map +2 -2
  144. package/build-module/hooks/index.mjs.map +2 -2
  145. package/build-module/hooks/use-entity-block-editor.mjs.map +2 -2
  146. package/build-module/hooks/use-entity-id.mjs.map +2 -2
  147. package/build-module/hooks/use-entity-prop.mjs.map +2 -2
  148. package/build-module/hooks/use-entity-record.mjs.map +2 -2
  149. package/build-module/hooks/use-entity-records.mjs +2 -2
  150. package/build-module/hooks/use-entity-records.mjs.map +2 -2
  151. package/build-module/hooks/use-post-editor-awareness-state.mjs.map +2 -2
  152. package/build-module/hooks/use-query-select.mjs.map +2 -2
  153. package/build-module/hooks/use-resource-permissions.mjs.map +2 -2
  154. package/build-module/hooks/utils.mjs.map +2 -2
  155. package/build-module/index.mjs.map +2 -2
  156. package/build-module/lock-unlock.mjs.map +2 -2
  157. package/build-module/locks/actions.mjs.map +2 -2
  158. package/build-module/locks/engine.mjs.map +2 -2
  159. package/build-module/locks/reducer.mjs.map +2 -2
  160. package/build-module/locks/selectors.mjs.map +2 -2
  161. package/build-module/private-actions.mjs +131 -0
  162. package/build-module/private-actions.mjs.map +2 -2
  163. package/build-module/private-apis.mjs +21 -1
  164. package/build-module/private-apis.mjs.map +2 -2
  165. package/build-module/private-selectors.mjs +4 -0
  166. package/build-module/private-selectors.mjs.map +2 -2
  167. package/build-module/queried-data/get-query-parts.mjs.map +2 -2
  168. package/build-module/queried-data/reducer.mjs.map +2 -2
  169. package/build-module/queried-data/selectors.mjs.map +2 -2
  170. package/build-module/reducer.mjs.map +2 -2
  171. package/build-module/resolvers.mjs +21 -26
  172. package/build-module/resolvers.mjs.map +2 -2
  173. package/build-module/selectors.mjs.map +2 -2
  174. package/build-module/sync.mjs +23 -0
  175. package/build-module/sync.mjs.map +2 -2
  176. package/build-module/utils/block-selection-history.mjs.map +2 -2
  177. package/build-module/utils/clear-unchanged-edits.mjs.map +2 -2
  178. package/build-module/utils/conservative-map-item.mjs.map +2 -2
  179. package/build-module/utils/crdt-blocks.mjs.map +2 -2
  180. package/build-module/utils/crdt-selection.mjs.map +2 -2
  181. package/build-module/utils/crdt-text.mjs.map +2 -2
  182. package/build-module/utils/crdt-user-selections.mjs +43 -16
  183. package/build-module/utils/crdt-user-selections.mjs.map +3 -3
  184. package/build-module/utils/crdt-utils.mjs.map +2 -2
  185. package/build-module/utils/crdt.mjs +2 -1
  186. package/build-module/utils/crdt.mjs.map +2 -2
  187. package/build-module/utils/get-template-info.mjs +28 -0
  188. package/build-module/utils/get-template-info.mjs.map +7 -0
  189. package/build-module/utils/get-template-part-icon.mjs +24 -0
  190. package/build-module/utils/get-template-part-icon.mjs.map +7 -0
  191. package/build-module/utils/log-entity-deprecation.mjs.map +2 -2
  192. package/build-module/utils/save-crdt-doc.mjs.map +2 -2
  193. package/build-types/actions.d.ts +4 -0
  194. package/build-types/actions.d.ts.map +1 -1
  195. package/build-types/awareness/awareness-state.d.ts.map +1 -1
  196. package/build-types/awareness/base-awareness.d.ts +0 -3
  197. package/build-types/awareness/base-awareness.d.ts.map +1 -1
  198. package/build-types/awareness/block-lookup.d.ts +0 -3
  199. package/build-types/awareness/block-lookup.d.ts.map +1 -1
  200. package/build-types/awareness/post-editor-awareness.d.ts +0 -3
  201. package/build-types/awareness/post-editor-awareness.d.ts.map +1 -1
  202. package/build-types/awareness/typed-awareness.d.ts +0 -3
  203. package/build-types/awareness/typed-awareness.d.ts.map +1 -1
  204. package/build-types/awareness/types.d.ts +0 -6
  205. package/build-types/awareness/types.d.ts.map +1 -1
  206. package/build-types/awareness/utils.d.ts +0 -3
  207. package/build-types/awareness/utils.d.ts.map +1 -1
  208. package/build-types/batch/create-batch.d.ts.map +1 -1
  209. package/build-types/batch/default-processor.d.ts.map +1 -1
  210. package/build-types/components/entities-saved-states/entity-record-item.d.ts +6 -0
  211. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -0
  212. package/build-types/components/entities-saved-states/entity-type-list.d.ts +6 -0
  213. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -0
  214. package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts +11 -0
  215. package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts.map +1 -0
  216. package/build-types/components/entities-saved-states/index.d.ts +49 -0
  217. package/build-types/components/entities-saved-states/index.d.ts.map +1 -0
  218. package/build-types/dynamic-entities.d.ts +0 -3
  219. package/build-types/dynamic-entities.d.ts.map +1 -1
  220. package/build-types/entities.d.ts.map +1 -1
  221. package/build-types/entity-context.d.ts.map +1 -1
  222. package/build-types/entity-provider.d.ts.map +1 -1
  223. package/build-types/entity-types/attachment.d.ts +0 -3
  224. package/build-types/entity-types/attachment.d.ts.map +1 -1
  225. package/build-types/entity-types/base.d.ts +0 -3
  226. package/build-types/entity-types/base.d.ts.map +1 -1
  227. package/build-types/entity-types/comment.d.ts +0 -3
  228. package/build-types/entity-types/comment.d.ts.map +1 -1
  229. package/build-types/entity-types/font-collection.d.ts +0 -3
  230. package/build-types/entity-types/font-collection.d.ts.map +1 -1
  231. package/build-types/entity-types/font-family.d.ts +0 -3
  232. package/build-types/entity-types/font-family.d.ts.map +1 -1
  233. package/build-types/entity-types/global-styles-revision.d.ts +0 -3
  234. package/build-types/entity-types/global-styles-revision.d.ts.map +1 -1
  235. package/build-types/entity-types/helpers.d.ts +0 -3
  236. package/build-types/entity-types/helpers.d.ts.map +1 -1
  237. package/build-types/entity-types/icon.d.ts +0 -3
  238. package/build-types/entity-types/icon.d.ts.map +1 -1
  239. package/build-types/entity-types/index.d.ts +0 -3
  240. package/build-types/entity-types/index.d.ts.map +1 -1
  241. package/build-types/entity-types/menu-location.d.ts +0 -3
  242. package/build-types/entity-types/menu-location.d.ts.map +1 -1
  243. package/build-types/entity-types/nav-menu-item.d.ts +0 -3
  244. package/build-types/entity-types/nav-menu-item.d.ts.map +1 -1
  245. package/build-types/entity-types/nav-menu.d.ts +0 -3
  246. package/build-types/entity-types/nav-menu.d.ts.map +1 -1
  247. package/build-types/entity-types/page.d.ts +0 -3
  248. package/build-types/entity-types/page.d.ts.map +1 -1
  249. package/build-types/entity-types/plugin.d.ts +0 -3
  250. package/build-types/entity-types/plugin.d.ts.map +1 -1
  251. package/build-types/entity-types/post-revision.d.ts +0 -3
  252. package/build-types/entity-types/post-revision.d.ts.map +1 -1
  253. package/build-types/entity-types/post-status.d.ts +0 -3
  254. package/build-types/entity-types/post-status.d.ts.map +1 -1
  255. package/build-types/entity-types/post.d.ts +0 -3
  256. package/build-types/entity-types/post.d.ts.map +1 -1
  257. package/build-types/entity-types/settings.d.ts +0 -3
  258. package/build-types/entity-types/settings.d.ts.map +1 -1
  259. package/build-types/entity-types/sidebar.d.ts +0 -3
  260. package/build-types/entity-types/sidebar.d.ts.map +1 -1
  261. package/build-types/entity-types/taxonomy.d.ts +0 -3
  262. package/build-types/entity-types/taxonomy.d.ts.map +1 -1
  263. package/build-types/entity-types/term.d.ts +0 -3
  264. package/build-types/entity-types/term.d.ts.map +1 -1
  265. package/build-types/entity-types/test/attachment.test.d.ts +0 -8
  266. package/build-types/entity-types/test/attachment.test.d.ts.map +1 -1
  267. package/build-types/entity-types/theme.d.ts +0 -3
  268. package/build-types/entity-types/theme.d.ts.map +1 -1
  269. package/build-types/entity-types/type.d.ts +0 -3
  270. package/build-types/entity-types/type.d.ts.map +1 -1
  271. package/build-types/entity-types/user.d.ts +0 -3
  272. package/build-types/entity-types/user.d.ts.map +1 -1
  273. package/build-types/entity-types/widget-type.d.ts +0 -3
  274. package/build-types/entity-types/widget-type.d.ts.map +1 -1
  275. package/build-types/entity-types/widget.d.ts +0 -3
  276. package/build-types/entity-types/widget.d.ts.map +1 -1
  277. package/build-types/entity-types/wp-template-part.d.ts +0 -3
  278. package/build-types/entity-types/wp-template-part.d.ts.map +1 -1
  279. package/build-types/entity-types/wp-template.d.ts +0 -3
  280. package/build-types/entity-types/wp-template.d.ts.map +1 -1
  281. package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts.map +1 -1
  282. package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -1
  283. package/build-types/fetch/index.d.ts.map +1 -1
  284. package/build-types/footnotes/get-footnotes-order.d.ts.map +1 -1
  285. package/build-types/footnotes/get-rich-text-values-cached.d.ts.map +1 -1
  286. package/build-types/footnotes/index.d.ts.map +1 -1
  287. package/build-types/hooks/index.d.ts +0 -3
  288. package/build-types/hooks/index.d.ts.map +1 -1
  289. package/build-types/hooks/use-entity-block-editor.d.ts.map +1 -1
  290. package/build-types/hooks/use-entity-id.d.ts.map +1 -1
  291. package/build-types/hooks/use-entity-prop.d.ts.map +1 -1
  292. package/build-types/hooks/use-entity-record.d.ts.map +1 -1
  293. package/build-types/hooks/use-entity-records.d.ts.map +1 -1
  294. package/build-types/hooks/use-post-editor-awareness-state.d.ts.map +1 -1
  295. package/build-types/hooks/use-query-select.d.ts.map +1 -1
  296. package/build-types/hooks/use-resource-permissions.d.ts.map +1 -1
  297. package/build-types/hooks/utils.d.ts +0 -6
  298. package/build-types/hooks/utils.d.ts.map +1 -1
  299. package/build-types/index.d.ts +1 -0
  300. package/build-types/index.d.ts.map +1 -1
  301. package/build-types/lock-unlock.d.ts.map +1 -1
  302. package/build-types/locks/actions.d.ts.map +1 -1
  303. package/build-types/locks/engine.d.ts.map +1 -1
  304. package/build-types/locks/reducer.d.ts.map +1 -1
  305. package/build-types/locks/selectors.d.ts.map +1 -1
  306. package/build-types/private-actions.d.ts +19 -0
  307. package/build-types/private-actions.d.ts.map +1 -1
  308. package/build-types/private-apis.d.ts +13 -3
  309. package/build-types/private-apis.d.ts.map +1 -1
  310. package/build-types/private-selectors.d.ts +12 -3
  311. package/build-types/private-selectors.d.ts.map +1 -1
  312. package/build-types/queried-data/get-query-parts.d.ts.map +1 -1
  313. package/build-types/queried-data/reducer.d.ts.map +1 -1
  314. package/build-types/queried-data/selectors.d.ts.map +1 -1
  315. package/build-types/reducer.d.ts.map +1 -1
  316. package/build-types/resolvers.d.ts +1 -2
  317. package/build-types/resolvers.d.ts.map +1 -1
  318. package/build-types/selectors.d.ts.map +1 -1
  319. package/build-types/sync.d.ts +31 -3
  320. package/build-types/sync.d.ts.map +1 -1
  321. package/build-types/types.d.ts +9 -8
  322. package/build-types/types.d.ts.map +1 -1
  323. package/build-types/utils/block-selection-history.d.ts +0 -6
  324. package/build-types/utils/block-selection-history.d.ts.map +1 -1
  325. package/build-types/utils/clear-unchanged-edits.d.ts.map +1 -1
  326. package/build-types/utils/conservative-map-item.d.ts.map +1 -1
  327. package/build-types/utils/crdt-blocks.d.ts +0 -3
  328. package/build-types/utils/crdt-blocks.d.ts.map +1 -1
  329. package/build-types/utils/crdt-selection.d.ts +0 -3
  330. package/build-types/utils/crdt-selection.d.ts.map +1 -1
  331. package/build-types/utils/crdt-text.d.ts +0 -3
  332. package/build-types/utils/crdt-text.d.ts.map +1 -1
  333. package/build-types/utils/crdt-user-selections.d.ts.map +1 -1
  334. package/build-types/utils/crdt-utils.d.ts +0 -6
  335. package/build-types/utils/crdt-utils.d.ts.map +1 -1
  336. package/build-types/utils/crdt.d.ts +8 -0
  337. package/build-types/utils/crdt.d.ts.map +1 -1
  338. package/build-types/utils/get-template-info.d.ts +13 -0
  339. package/build-types/utils/get-template-info.d.ts.map +1 -0
  340. package/build-types/utils/get-template-part-icon.d.ts +9 -0
  341. package/build-types/utils/get-template-part-icon.d.ts.map +1 -0
  342. package/build-types/utils/log-entity-deprecation.d.ts.map +1 -1
  343. package/build-types/utils/save-crdt-doc.d.ts.map +1 -1
  344. package/package.json +28 -22
  345. package/src/actions.js +120 -13
  346. package/src/awareness/awareness-state.ts +0 -3
  347. package/src/awareness/base-awareness.ts +0 -8
  348. package/src/awareness/block-lookup.ts +1 -8
  349. package/src/awareness/post-editor-awareness.ts +13 -10
  350. package/src/awareness/test/awareness-state.ts +0 -11
  351. package/src/awareness/test/base-awareness.ts +0 -7
  352. package/src/awareness/test/block-lookup.ts +0 -8
  353. package/src/awareness/test/post-editor-awareness.ts +0 -7
  354. package/src/awareness/test/typed-awareness.ts +0 -11
  355. package/src/awareness/test/utils.ts +0 -3
  356. package/src/awareness/typed-awareness.ts +0 -7
  357. package/src/awareness/types.ts +0 -7
  358. package/src/awareness/utils.ts +0 -3
  359. package/src/batch/create-batch.js +0 -3
  360. package/src/batch/default-processor.js +0 -4
  361. package/src/batch/test/create-batch.js +0 -3
  362. package/src/batch/test/default-processor.js +0 -7
  363. package/src/components/entities-saved-states/entity-record-item.js +53 -0
  364. package/src/components/entities-saved-states/entity-type-list.js +123 -0
  365. package/src/components/entities-saved-states/hooks/use-is-dirty.js +98 -0
  366. package/src/components/entities-saved-states/index.js +231 -0
  367. package/src/components/entities-saved-states/style.scss +70 -0
  368. package/src/components/entities-saved-states/test/use-is-dirty.js +147 -0
  369. package/src/dynamic-entities.ts +0 -3
  370. package/src/entities.js +2 -11
  371. package/src/entity-context.js +0 -3
  372. package/src/entity-provider.js +0 -7
  373. package/src/entity-types/attachment.ts +0 -4
  374. package/src/entity-types/base.ts +0 -3
  375. package/src/entity-types/comment.ts +0 -3
  376. package/src/entity-types/font-collection.ts +0 -3
  377. package/src/entity-types/font-family.ts +0 -3
  378. package/src/entity-types/global-styles-revision.ts +0 -4
  379. package/src/entity-types/helpers.ts +0 -3
  380. package/src/entity-types/icon.ts +0 -4
  381. package/src/entity-types/index.ts +0 -3
  382. package/src/entity-types/menu-location.ts +0 -4
  383. package/src/entity-types/nav-menu-item.ts +0 -4
  384. package/src/entity-types/nav-menu.ts +0 -4
  385. package/src/entity-types/page.ts +0 -4
  386. package/src/entity-types/plugin.ts +0 -4
  387. package/src/entity-types/post-revision.ts +0 -4
  388. package/src/entity-types/post-status.ts +0 -3
  389. package/src/entity-types/post.ts +0 -4
  390. package/src/entity-types/settings.ts +0 -4
  391. package/src/entity-types/sidebar.ts +0 -4
  392. package/src/entity-types/taxonomy.ts +0 -4
  393. package/src/entity-types/term.ts +0 -4
  394. package/src/entity-types/test/attachment.test.ts +0 -4
  395. package/src/entity-types/theme.ts +0 -4
  396. package/src/entity-types/type.ts +0 -4
  397. package/src/entity-types/user.ts +0 -4
  398. package/src/entity-types/widget-type.ts +0 -4
  399. package/src/entity-types/widget.ts +0 -4
  400. package/src/entity-types/wp-template-part.ts +0 -4
  401. package/src/entity-types/wp-template.ts +0 -4
  402. package/src/fetch/__experimental-fetch-link-suggestions.ts +0 -3
  403. package/src/fetch/__experimental-fetch-url-data.js +0 -3
  404. package/src/fetch/index.js +0 -7
  405. package/src/fetch/test/__experimental-fetch-link-suggestions.js +0 -3
  406. package/src/fetch/test/__experimental-fetch-url-data.js +1 -7
  407. package/src/footnotes/get-footnotes-order.js +0 -3
  408. package/src/footnotes/get-rich-text-values-cached.js +0 -7
  409. package/src/footnotes/index.js +21 -8
  410. package/src/footnotes/test/index.js +57 -0
  411. package/src/hooks/index.ts +0 -3
  412. package/src/hooks/test/use-entity-record.js +0 -12
  413. package/src/hooks/test/use-entity-records.js +0 -12
  414. package/src/hooks/test/use-post-editor-awareness-state.ts +0 -7
  415. package/src/hooks/test/use-query-select.js +0 -11
  416. package/src/hooks/test/use-resource-permissions.js +0 -12
  417. package/src/hooks/use-entity-block-editor.js +0 -7
  418. package/src/hooks/use-entity-id.js +0 -7
  419. package/src/hooks/use-entity-prop.js +0 -7
  420. package/src/hooks/use-entity-record.ts +0 -7
  421. package/src/hooks/use-entity-records.ts +2 -9
  422. package/src/hooks/use-post-editor-awareness-state.ts +0 -7
  423. package/src/hooks/use-query-select.ts +0 -7
  424. package/src/hooks/use-resource-permissions.ts +0 -7
  425. package/src/hooks/utils.ts +0 -7
  426. package/src/index.js +0 -7
  427. package/src/lock-unlock.ts +0 -3
  428. package/src/locks/actions.js +0 -3
  429. package/src/locks/engine.js +0 -3
  430. package/src/locks/reducer.js +0 -3
  431. package/src/locks/selectors.js +0 -3
  432. package/src/locks/test/engine.js +0 -3
  433. package/src/locks/test/reducer.js +0 -7
  434. package/src/locks/test/selectors.js +0 -7
  435. package/src/locks/test/utils.js +0 -7
  436. package/src/private-actions.js +182 -7
  437. package/src/private-apis.ts +21 -4
  438. package/src/private-selectors.ts +22 -7
  439. package/src/queried-data/get-query-parts.js +0 -7
  440. package/src/queried-data/reducer.js +0 -7
  441. package/src/queried-data/selectors.js +0 -7
  442. package/src/queried-data/test/actions.js +0 -3
  443. package/src/queried-data/test/get-query-parts.js +0 -3
  444. package/src/queried-data/test/reducer.js +0 -7
  445. package/src/queried-data/test/selectors.js +0 -3
  446. package/src/reducer.js +0 -11
  447. package/src/resolvers.js +23 -40
  448. package/src/selectors.ts +0 -7
  449. package/src/style.scss +1 -0
  450. package/src/sync.ts +64 -7
  451. package/src/test/actions.js +843 -8
  452. package/src/test/deprecated-entity-logging.js +0 -7
  453. package/src/test/entities.js +0 -8
  454. package/src/test/entity-provider.js +0 -11
  455. package/src/test/private-actions.js +297 -7
  456. package/src/test/private-selectors.js +0 -3
  457. package/src/test/reducer.js +0 -7
  458. package/src/test/resolvers.js +0 -12
  459. package/src/test/rtc-rich-text-offset-space.test.js +0 -12
  460. package/src/test/selectors.js +0 -7
  461. package/src/test/store.js +8 -15
  462. package/src/types.ts +14 -12
  463. package/src/utils/block-selection-history.ts +0 -10
  464. package/src/utils/clear-unchanged-edits.ts +0 -3
  465. package/src/utils/conservative-map-item.js +0 -3
  466. package/src/utils/crdt-blocks.ts +0 -11
  467. package/src/utils/crdt-selection.ts +0 -7
  468. package/src/utils/crdt-text.ts +0 -3
  469. package/src/utils/crdt-user-selections.ts +85 -23
  470. package/src/utils/crdt-utils.ts +0 -7
  471. package/src/utils/crdt.ts +1 -12
  472. package/src/utils/get-template-info.js +46 -0
  473. package/src/utils/get-template-part-icon.js +27 -0
  474. package/src/utils/log-entity-deprecation.ts +0 -7
  475. package/src/utils/save-crdt-doc.js +0 -7
  476. package/src/utils/test/block-selection-history.test.ts +0 -7
  477. package/src/utils/test/clear-unchanged-edits.js +0 -3
  478. package/src/utils/test/conservative-map-item.js +0 -3
  479. package/src/utils/test/crdt-blocks.ts +0 -17
  480. package/src/utils/test/crdt-user-selections.ts +107 -30
  481. package/src/utils/test/crdt-utils.ts +0 -7
  482. package/src/utils/test/crdt.ts +0 -16
  483. package/src/utils/test/get-nested-value.js +0 -3
  484. package/src/utils/test/get-normalized-comma-separable.js +0 -3
  485. package/src/utils/test/get-template-info.js +218 -0
  486. package/src/utils/test/if-matching-action.js +0 -7
  487. package/src/utils/test/is-numeric-id.js +0 -3
  488. package/src/utils/test/log-entity-deprecation.js +0 -7
  489. package/src/utils/test/replace-action.js +0 -3
  490. package/src/utils/test/rtc-rich-text-cursor-scope.test.js +0 -14
  491. package/src/utils/test/rtc-rich-text-offset-space.test.js +0 -14
  492. package/src/utils/test/save-crdt-doc.js +0 -7
  493. package/src/utils/test/set-nested-value.js +0 -3
  494. package/src/utils/test/with-weak-map-cache.js +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-template-info.d.ts","sourceRoot":"","sources":["../../src/utils/get-template-info.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,WAJzB;IAAuB,aAAa,QACpC;IAAwB,aAAa,AAArC,CACA,QAAA;IAAuB,QAAQ,MACjC;CAAA,OAmCA,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Helper function to retrieve the corresponding icon by area name.
3
+ *
4
+ * @param {string} areaOrIconName The area name (e.g., 'header', 'navigation-overlay').
5
+ *
6
+ * @return {Object} The corresponding icon.
7
+ */
8
+ export declare function getTemplatePartIcon(areaOrIconName: string): any;
9
+ //# sourceMappingURL=get-template-part-icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-template-part-icon.d.ts","sourceRoot":"","sources":["../../src/utils/get-template-part-icon.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAE,cAAc,EAJxC,MAIwC,OAWlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"log-entity-deprecation.d.ts","sourceRoot":"","sources":["../../src/utils/log-entity-deprecation.ts"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC3C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,EACC,uBAAuB,EACvB,mBAA2B,GAC3B,GAAE;IACF,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACzB,QAkCN"}
1
+ {"version":3,"file":"log-entity-deprecation.d.ts","sourceRoot":"","sources":["../../src/utils/log-entity-deprecation.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC3C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,EACC,uBAAuB,EACvB,mBAA2B,GAC3B,GAAE;IACF,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACzB,QAkCN"}
@@ -1 +1 @@
1
- {"version":3,"file":"save-crdt-doc.d.ts","sourceRoot":"","sources":["../../src/utils/save-crdt-doc.js"],"names":[],"mappings":"AAiCA;;;;;GAKG;AACH,wBAAsB,WAAW,CAAE,UAAU,EAHlC,OAAO,iBAAiB,EAAE,UAGQ,EAAE,QAAQ,EAF5C,OAAO,iBAAiB,EAAE,QAEkB,iBAwBtD"}
1
+ {"version":3,"file":"save-crdt-doc.d.ts","sourceRoot":"","sources":["../../src/utils/save-crdt-doc.js"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,wBAAsB,WAAW,CAAE,UAAU,EAHlC,OAAO,iBAAiB,EAAE,UAGQ,EAAE,QAAQ,EAF5C,OAAO,iBAAiB,EAAE,QAEkB,iBAwBtD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-data",
3
- "version": "7.51.0",
3
+ "version": "7.53.0",
4
4
  "description": "Access to and manipulation of core WordPress entities.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -48,35 +48,41 @@
48
48
  "build-module/index.mjs"
49
49
  ],
50
50
  "dependencies": {
51
- "@wordpress/api-fetch": "^7.51.0",
52
- "@wordpress/block-editor": "^16.0.0",
53
- "@wordpress/blocks": "^15.24.0",
54
- "@wordpress/compose": "^8.4.0",
55
- "@wordpress/data": "^10.51.0",
56
- "@wordpress/deprecated": "^4.51.0",
57
- "@wordpress/element": "^8.3.0",
58
- "@wordpress/html-entities": "^4.51.0",
59
- "@wordpress/i18n": "^6.24.0",
60
- "@wordpress/is-shallow-equal": "^5.51.0",
61
- "@wordpress/private-apis": "^1.51.0",
62
- "@wordpress/rich-text": "^7.51.0",
63
- "@wordpress/sync": "^1.51.0",
64
- "@wordpress/undo-manager": "^1.51.0",
65
- "@wordpress/url": "^4.51.0",
66
- "@wordpress/warning": "^3.51.0",
51
+ "@wordpress/api-fetch": "^7.53.0",
52
+ "@wordpress/base-styles": "^12.1.0",
53
+ "@wordpress/block-editor": "^16.2.0",
54
+ "@wordpress/blocks": "^15.26.0",
55
+ "@wordpress/components": "^39.0.0",
56
+ "@wordpress/compose": "^8.6.0",
57
+ "@wordpress/data": "^10.53.0",
58
+ "@wordpress/deprecated": "^4.53.0",
59
+ "@wordpress/element": "^8.5.0",
60
+ "@wordpress/global-styles-engine": "^1.20.0",
61
+ "@wordpress/html-entities": "^4.53.0",
62
+ "@wordpress/i18n": "^6.26.0",
63
+ "@wordpress/icons": "^15.4.0",
64
+ "@wordpress/is-shallow-equal": "^5.53.0",
65
+ "@wordpress/notices": "^5.53.0",
66
+ "@wordpress/private-apis": "^1.53.0",
67
+ "@wordpress/rich-text": "^7.53.0",
68
+ "@wordpress/sync": "^1.53.0",
69
+ "@wordpress/undo-manager": "^1.53.0",
70
+ "@wordpress/url": "^4.53.0",
71
+ "@wordpress/warning": "^3.53.0",
67
72
  "change-case": "^4.1.2",
73
+ "clsx": "^2.1.1",
68
74
  "equivalent-key-map": "^0.2.2",
69
75
  "fast-deep-equal": "^3.1.3",
70
- "memize": "^2.1.0",
76
+ "memize": "^2.1.1",
71
77
  "uuid": "^14.0.0"
72
78
  },
73
79
  "devDependencies": {
74
- "@jest/globals": "^30.2.0",
80
+ "@jest/globals": "^30.4.1",
75
81
  "@testing-library/dom": "^10.4.1",
76
82
  "@testing-library/react": "^16.3.2",
77
- "@types/jest": "^29.5.14",
83
+ "@types/jest": "^30.0.0",
78
84
  "@types/node": "^20.19.39",
79
- "@wordpress/block-library": "^10.2.0",
85
+ "@wordpress/block-library": "^10.4.0",
80
86
  "deep-freeze": "^0.0.1"
81
87
  },
82
88
  "peerDependencies": {
@@ -92,5 +98,5 @@
92
98
  "publishConfig": {
93
99
  "access": "public"
94
100
  },
95
- "gitHead": "e9a74f9c14095a34398ecd4d1f7a908e55051205"
101
+ "gitHead": "989764d42ff93e33684aaf0b96a5b7f3d9bbff52"
96
102
  }
package/src/actions.js CHANGED
@@ -1,34 +1,85 @@
1
- /**
2
- * External dependencies
3
- */
1
+ import fastDeepEqual from 'fast-deep-equal/es6/index.js';
4
2
  import { v4 as uuid } from 'uuid';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
3
  import apiFetch from '@wordpress/api-fetch';
10
4
  import { addQueryArgs } from '@wordpress/url';
11
5
  import deprecated from '@wordpress/deprecated';
12
-
13
- /**
14
- * Internal dependencies
15
- */
16
6
  import { clearUnchangedEdits, getNestedValue, setNestedValue } from './utils';
17
7
  import { receiveItems, removeItems, receiveQueriedItems } from './queried-data';
18
8
  import { DEFAULT_ENTITY_KEY } from './entities';
19
9
  import { createBatch } from './batch';
20
10
  import { STORE_NAME } from './name';
21
11
  import {
12
+ CRDT_AUTOSAVE_SNAPSHOT_KEY,
22
13
  LOCAL_EDITOR_ORIGIN,
23
14
  LOCAL_UNDO_IGNORED_ORIGIN,
24
15
  getSyncManager,
25
16
  } from './sync';
26
17
  import logEntityDeprecation from './utils/log-entity-deprecation';
18
+ import {
19
+ getRawValue,
20
+ POST_META_KEY_FOR_CRDT_DOC_PERSISTENCE,
21
+ } from './utils/crdt';
27
22
 
28
23
  function addTitleToAutoDraft( record ) {
29
24
  return record.status === 'auto-draft' ? { ...record, title: '' } : record;
30
25
  }
31
26
 
27
+ // Post meta is applied to the CRDT one subkey at a time, so compare the save
28
+ // response at the same granularity to avoid carrying stale sibling values.
29
+ function getServerMutatedMetaFields( updatedMeta, persistedMeta, syncedMeta ) {
30
+ const baseline = { ...persistedMeta, ...syncedMeta };
31
+
32
+ return Object.fromEntries(
33
+ Object.entries( updatedMeta ?? {} ).filter( ( [ key, value ] ) => {
34
+ if ( key === POST_META_KEY_FOR_CRDT_DOC_PERSISTENCE ) {
35
+ // The persisted CRDT snapshot may change on save and is
36
+ // intentionally excluded from CRDT meta synchronization, so it
37
+ // is not a server mutation.
38
+ return false;
39
+ }
40
+
41
+ return ! fastDeepEqual( value, baseline[ key ] );
42
+ } )
43
+ );
44
+ }
45
+
46
+ function getServerMutatedFields(
47
+ updatedRecord,
48
+ persistedRecord,
49
+ syncedChanges
50
+ ) {
51
+ return Object.fromEntries(
52
+ Object.entries( updatedRecord ).flatMap( ( [ key, value ] ) => {
53
+ if ( key === 'meta' ) {
54
+ const serverMutatedMeta = getServerMutatedMetaFields(
55
+ value,
56
+ persistedRecord.meta,
57
+ syncedChanges.meta
58
+ );
59
+
60
+ return Object.keys( serverMutatedMeta ).length
61
+ ? [ [ key, serverMutatedMeta ] ]
62
+ : [];
63
+ }
64
+
65
+ const baseline =
66
+ key in syncedChanges
67
+ ? syncedChanges[ key ]
68
+ : persistedRecord[ key ];
69
+
70
+ // The save response nests raw attributes as `{ raw, rendered }`
71
+ // while the baseline holds raw strings; compare raw values so the
72
+ // shape difference does not read as a server mutation.
73
+ const wasServerMutated = ! fastDeepEqual(
74
+ getRawValue( value ) ?? value,
75
+ getRawValue( baseline ) ?? baseline
76
+ );
77
+
78
+ return wasServerMutated ? [ [ key, value ] ] : [];
79
+ } )
80
+ );
81
+ }
82
+
32
83
  /**
33
84
  * Returns an action object used in signalling that authors have been received.
34
85
  * Ignored from documentation as it's internal to the data store.
@@ -383,6 +434,9 @@ export const deleteEntityRecord =
383
434
  * @param {Object} edits The edits.
384
435
  * @param {Object} options Options for the edit.
385
436
  * @param {boolean} [options.undoIgnore] Whether to ignore the edit in undo history or not.
437
+ * @param {boolean} [options.isCached] Whether the edit is transient (e.g. typing). Transient
438
+ * edits are staged and eventually merged into the
439
+ * preceding undo level instead of creating a new one.
386
440
  *
387
441
  * @return {Object} Action object.
388
442
  */
@@ -668,6 +722,25 @@ export const saveEntityRecord =
668
722
  ? select.getRawEntityRecord( kind, name, recordId )
669
723
  : {};
670
724
 
725
+ // `saveEntityRecord` can be called directly, bypassing
726
+ // `editEntityRecord`, so make sure its changes enter the
727
+ // CRDT first. An autosave snapshots the document below, and
728
+ // a regular save creates the persisted document from it, so
729
+ // both must see these changes.
730
+ if (
731
+ entityConfig.syncConfig &&
732
+ ! __unstableSkipSyncUpdate &&
733
+ ! isNewRecord &&
734
+ persistedRecord
735
+ ) {
736
+ getSyncManager()?.update(
737
+ `${ kind }/${ name }`,
738
+ recordId,
739
+ record,
740
+ LOCAL_UNDO_IGNORED_ORIGIN
741
+ );
742
+ }
743
+
671
744
  // Most of this autosave logic is very specific to posts.
672
745
  // This is fine for now as it is the only supported autosave,
673
746
  // but ideally this should all be handled in the back end,
@@ -701,6 +774,21 @@ export const saveEntityRecord =
701
774
  : undefined,
702
775
  }
703
776
  );
777
+ // Capture the CRDT snapshot in the same tick as the
778
+ // payload so it describes exactly the content being
779
+ // autosaved.
780
+ if ( entityConfig.syncConfig ) {
781
+ const crdtSnapshot =
782
+ getSyncManager()?.getEntitySnapshot(
783
+ `${ kind }/${ name }`,
784
+ recordId
785
+ );
786
+
787
+ if ( crdtSnapshot ) {
788
+ data[ CRDT_AUTOSAVE_SNAPSHOT_KEY ] = crdtSnapshot;
789
+ }
790
+ }
791
+
704
792
  updatedRecord = await __unstableFetch( {
705
793
  path: `${ path }/autosaves`,
706
794
  method: 'POST',
@@ -774,21 +862,40 @@ export const saveEntityRecord =
774
862
  method: recordId ? 'PUT' : 'POST',
775
863
  data: edits,
776
864
  } );
865
+ // Pass the pre-`__unstablePrePersist` edits so the reducer
866
+ // can clear the persisted edits from state. The values
867
+ // added by `__unstablePrePersist` (e.g. a fresh CRDT
868
+ // snapshot in `meta`) never exist in the state edits, so
869
+ // comparing against them would fail to match and leave the
870
+ // record dirty after a successful save.
777
871
  dispatch.receiveEntityRecords(
778
872
  kind,
779
873
  name,
780
874
  updatedRecord,
781
875
  undefined,
782
876
  true,
783
- edits
877
+ record
784
878
  );
785
879
  if ( entityConfig.syncConfig ) {
880
+ let syncChanges;
881
+ if ( __unstableSkipSyncUpdate ) {
882
+ syncChanges = {};
883
+ } else if ( isNewRecord || ! persistedRecord ) {
884
+ syncChanges = updatedRecord;
885
+ } else {
886
+ syncChanges = getServerMutatedFields(
887
+ updatedRecord,
888
+ persistedRecord,
889
+ record
890
+ );
891
+ }
892
+
786
893
  // Use an untracked origin so that the save
787
894
  // response does not create undo levels.
788
895
  getSyncManager()?.update(
789
896
  `${ kind }/${ name }`,
790
897
  recordId,
791
- __unstableSkipSyncUpdate ? {} : updatedRecord,
898
+ syncChanges,
792
899
  LOCAL_UNDO_IGNORED_ORIGIN,
793
900
  { isSave: true }
794
901
  );
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import { REMOVAL_DELAY_IN_MS } from './config';
5
2
  import { TypedAwareness } from './typed-awareness';
6
3
  import type { EnhancedState, EqualityFieldCheck } from './types';
@@ -1,15 +1,7 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { resolveSelect } from '@wordpress/data';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import { AwarenessState } from './awareness-state';
10
3
  import { STORE_NAME as coreStore } from '../name';
11
4
  import { generateCollaboratorInfo, areCollaboratorInfosEqual } from './utils';
12
-
13
5
  import type { BaseState } from './types';
14
6
 
15
7
  export abstract class BaseAwarenessState<
@@ -1,14 +1,7 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { useSelect } from '@wordpress/data';
5
2
  import { Y } from '@wordpress/sync';
6
- // @ts-ignore No exported types for block editor store selectors.
3
+ // @ts-expect-error `@wordpress/block-editor` does not expose type declarations for its entry point.
7
4
  import { store as blockEditorStore } from '@wordpress/block-editor';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
5
  import type { AbsoluteBlockIndexPath } from '../types';
13
6
  import { unlock } from '../lock-unlock';
14
7
 
@@ -1,14 +1,7 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { dispatch, select, subscribe } from '@wordpress/data';
5
2
  import { Y } from '@wordpress/sync';
6
- // @ts-ignore No exported types for block editor store selectors.
3
+ // @ts-expect-error `@wordpress/block-editor` does not expose type declarations for its entry point.
7
4
  import { store as blockEditorStore } from '@wordpress/block-editor';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
5
  import { BaseAwarenessState, baseEqualityFieldChecks } from './base-awareness';
13
6
  import {
14
7
  getBlockPathInYdoc,
@@ -30,7 +23,6 @@ import {
30
23
  SelectionType,
31
24
  SelectionDirection,
32
25
  } from '../utils/crdt-user-selections';
33
-
34
26
  import type {
35
27
  ResolvedSelection,
36
28
  SelectionState,
@@ -200,7 +192,7 @@ export class PostEditorAwareness extends BaseAwarenessState< PostEditorState > {
200
192
  undoIgnore: true,
201
193
  };
202
194
 
203
- // @ts-ignore Types are not provided when using store name instead of store instance.
195
+ // @ts-expect-error Types are not provided when using the store name instead of the store instance.
204
196
  dispatch( coreStore ).editEntityRecord(
205
197
  this.kind,
206
198
  this.name,
@@ -288,7 +280,18 @@ export class PostEditorAwareness extends BaseAwarenessState< PostEditorState > {
288
280
  };
289
281
  }
290
282
 
283
+ // SelectionInMultipleBlocks is decomposed by the caller into per-endpoint
284
+ // Cursor / WholeBlock calls and should never arrive here directly.
285
+ if ( selection.type === SelectionType.SelectionInMultipleBlocks ) {
286
+ return {
287
+ richTextOffset: null,
288
+ localClientId: null,
289
+ attributeKey: null,
290
+ };
291
+ }
292
+
291
293
  // Text-based selections: resolve cursor position and navigate up.
294
+ // SelectionCursor → cursorPosition; SelectionInOneBlock → cursorStartPosition.
292
295
  const cursorPos =
293
296
  'cursorPosition' in selection
294
297
  ? selection.cursorPosition
@@ -1,6 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import {
5
2
  describe,
6
3
  expect,
@@ -9,15 +6,7 @@ import {
9
6
  beforeEach,
10
7
  afterEach,
11
8
  } from '@jest/globals';
12
-
13
- /**
14
- * WordPress dependencies
15
- */
16
9
  import { Y } from '@wordpress/sync';
17
-
18
- /**
19
- * Internal dependencies
20
- */
21
10
  import { AwarenessState } from '../awareness-state';
22
11
  import type { EnhancedState, EqualityFieldCheck } from '../types';
23
12
 
@@ -1,12 +1,5 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { Y } from '@wordpress/sync';
5
2
  import { resolveSelect } from '@wordpress/data';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
3
  import {
11
4
  BaseAwarenessState,
12
5
  BaseAwareness,
@@ -1,19 +1,11 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { Y } from '@wordpress/sync';
5
2
  import { renderHook } from '@testing-library/react';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
3
  import {
11
4
  getBlockPathInYdoc,
12
5
  getContainingBlockYMap,
13
6
  resolveBlockClientIdByPath,
14
7
  usePostContentBlocks,
15
8
  } from '../block-lookup';
16
-
17
9
  import type { EditorStoreBlock } from '../block-lookup';
18
10
 
19
11
  type MockBlock = EditorStoreBlock & {
@@ -1,12 +1,5 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { Y } from '@wordpress/sync';
5
2
  import { dispatch, select, subscribe, resolveSelect } from '@wordpress/data';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
3
  import { PostEditorAwareness } from '../post-editor-awareness';
11
4
  import { SelectionType } from '../../utils/crdt-user-selections';
12
5
  import type {
@@ -1,16 +1,5 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { describe, expect, test, beforeEach, afterEach } from '@jest/globals';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
2
  import { Y } from '@wordpress/sync';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
3
  import { TypedAwareness } from '../typed-awareness';
15
4
  import type { EnhancedState } from '../types';
16
5
 
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import { areCollaboratorInfosEqual, generateCollaboratorInfo } from '../utils';
5
2
  import type { CollaboratorInfo } from '../types';
6
3
  import type { User } from '../../entity-types';
@@ -1,11 +1,4 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { Awareness } from '@wordpress/sync';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import { getRecordValue } from './utils';
10
3
 
11
4
  /**
@@ -1,11 +1,4 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import type { Y } from '@wordpress/sync';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import type { SelectionState } from '../types';
10
3
  import type { User } from '../entity-types';
11
4
 
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import type { User } from '../entity-types';
5
2
  import type { CollaboratorInfo } from './types';
6
3
 
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import defaultProcessor from './default-processor';
5
2
 
6
3
  /**
@@ -1,6 +1,3 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import apiFetch from '@wordpress/api-fetch';
5
2
 
6
3
  /**
@@ -41,7 +38,6 @@ export default async function defaultProcessor( requests ) {
41
38
 
42
39
  const results = [];
43
40
 
44
- // @ts-ignore We would have crashed or never gotten to this point if we hadn't received the maxItems count.
45
41
  for ( const batchRequests of chunk( requests, maxItems ) ) {
46
42
  const batchResponse = await apiFetch( {
47
43
  path: '/batch/v1',
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import createBatch from '../create-batch';
5
2
 
6
3
  describe( 'createBatch', () => {
@@ -1,11 +1,4 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import apiFetch from '@wordpress/api-fetch';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import defaultProcessor from '../default-processor';
10
3
 
11
4
  jest.mock( '@wordpress/api-fetch' );
@@ -0,0 +1,53 @@
1
+ import { CheckboxControl, PanelRow } from '@wordpress/components';
2
+ import { __ } from '@wordpress/i18n';
3
+ import { useSelect } from '@wordpress/data';
4
+ import { decodeEntities } from '@wordpress/html-entities';
5
+ import { STORE_NAME } from '../../name';
6
+ import { getTemplateInfo } from '../../utils/get-template-info';
7
+
8
+ export default function EntityRecordItem( { record, checked, onChange } ) {
9
+ const { name, kind, title, key } = record;
10
+
11
+ // Handle templates that might use default descriptive titles.
12
+ const { entityRecordTitle } = useSelect(
13
+ ( select ) => {
14
+ if ( 'postType' !== kind || 'wp_template' !== name ) {
15
+ return {
16
+ entityRecordTitle: title,
17
+ };
18
+ }
19
+
20
+ const template = select( STORE_NAME ).getEditedEntityRecord(
21
+ kind,
22
+ name,
23
+ key
24
+ );
25
+
26
+ const { default_template_types: templateTypes = [] } =
27
+ select( STORE_NAME ).getCurrentTheme() ?? {};
28
+
29
+ return {
30
+ entityRecordTitle: getTemplateInfo( {
31
+ template,
32
+ templateTypes,
33
+ } ).title,
34
+ };
35
+ },
36
+ [ name, kind, title, key ]
37
+ );
38
+
39
+ return (
40
+ <>
41
+ <PanelRow>
42
+ <CheckboxControl
43
+ label={
44
+ decodeEntities( entityRecordTitle ) || __( 'Untitled' )
45
+ }
46
+ checked={ checked }
47
+ onChange={ onChange }
48
+ className="entities-saved-states__change-control"
49
+ />
50
+ </PanelRow>
51
+ </>
52
+ );
53
+ }