@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
@@ -1,57 +1,25 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import apiFetch from '@wordpress/api-fetch';
5
- import { addQueryArgs, prependHTTP, isURL, getProtocol, isValidProtocol } from '@wordpress/url';
6
-
7
- /**
8
- * A simple in-memory cache for requests.
9
- * This avoids repeat HTTP requests which may be beneficial
10
- * for those wishing to preserve low-bandwidth.
11
- */
12
- const CACHE = new Map();
13
-
14
- /**
15
- * @typedef WPRemoteUrlData
16
- *
17
- * @property {string} title contents of the remote URL's `<title>` tag.
18
- */
19
-
20
- /**
21
- * Fetches data about a remote URL.
22
- * eg: <title> tag, favicon...etc.
23
- *
24
- * @async
25
- * @param {string} url the URL to request details from.
26
- * @param {?Object} options any options to pass to the underlying fetch.
27
- * @example
28
- * ```js
29
- * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
30
- *
31
- * //...
32
- *
33
- * export function initialize( id, settings ) {
34
- *
35
- * settings.__experimentalFetchUrlData = (
36
- * url
37
- * ) => fetchUrlData( url );
38
- * ```
39
- * @return {Promise< WPRemoteUrlData[] >} Remote URL data.
40
- */
1
+ import apiFetch from "@wordpress/api-fetch";
2
+ import {
3
+ addQueryArgs,
4
+ prependHTTP,
5
+ isURL,
6
+ getProtocol,
7
+ isValidProtocol
8
+ } from "@wordpress/url";
9
+ const CACHE = /* @__PURE__ */ new Map();
41
10
  const fetchUrlData = async (url, options = {}) => {
42
- const endpoint = '/wp-block-editor/v1/url-details';
11
+ const endpoint = "/wp-block-editor/v1/url-details";
43
12
  const args = {
44
13
  url: prependHTTP(url)
45
14
  };
46
15
  if (!isURL(url)) {
47
16
  return Promise.reject(`${url} is not a valid URL.`);
48
17
  }
49
-
50
- // Test for "http" based URL as it is possible for valid
51
- // yet unusable URLs such as `tel:123456` to be passed.
52
18
  const protocol = getProtocol(url);
53
- if (!protocol || !isValidProtocol(protocol) || !protocol.startsWith('http') || !/^https?:\/\/[^\/\s]/i.test(url)) {
54
- return Promise.reject(`${url} does not have a valid protocol. URLs must be "http" based`);
19
+ if (!protocol || !isValidProtocol(protocol) || !protocol.startsWith("http") || !/^https?:\/\/[^\/\s]/i.test(url)) {
20
+ return Promise.reject(
21
+ `${url} does not have a valid protocol. URLs must be "http" based`
22
+ );
55
23
  }
56
24
  if (CACHE.has(url)) {
57
25
  return CACHE.get(url);
@@ -59,10 +27,13 @@ const fetchUrlData = async (url, options = {}) => {
59
27
  return apiFetch({
60
28
  path: addQueryArgs(endpoint, args),
61
29
  ...options
62
- }).then(res => {
30
+ }).then((res) => {
63
31
  CACHE.set(url, res);
64
32
  return res;
65
33
  });
66
34
  };
67
- export default fetchUrlData;
68
- //# sourceMappingURL=__experimental-fetch-url-data.js.map
35
+ var experimental_fetch_url_data_default = fetchUrlData;
36
+ export {
37
+ experimental_fetch_url_data_default as default
38
+ };
39
+ //# sourceMappingURL=__experimental-fetch-url-data.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["apiFetch","addQueryArgs","prependHTTP","isURL","getProtocol","isValidProtocol","CACHE","Map","fetchUrlData","url","options","endpoint","args","Promise","reject","protocol","startsWith","test","has","get","path","then","res","set"],"sources":["@wordpress/core-data/src/fetch/__experimental-fetch-url-data.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\taddQueryArgs,\n\tprependHTTP,\n\tisURL,\n\tgetProtocol,\n\tisValidProtocol,\n} from '@wordpress/url';\n\n/**\n * A simple in-memory cache for requests.\n * This avoids repeat HTTP requests which may be beneficial\n * for those wishing to preserve low-bandwidth.\n */\nconst CACHE = new Map();\n\n/**\n * @typedef WPRemoteUrlData\n *\n * @property {string} title contents of the remote URL's `<title>` tag.\n */\n\n/**\n * Fetches data about a remote URL.\n * eg: <title> tag, favicon...etc.\n *\n * @async\n * @param {string} url the URL to request details from.\n * @param {?Object} options any options to pass to the underlying fetch.\n * @example\n * ```js\n * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';\n *\n * //...\n *\n * export function initialize( id, settings ) {\n *\n * settings.__experimentalFetchUrlData = (\n * url\n * ) => fetchUrlData( url );\n * ```\n * @return {Promise< WPRemoteUrlData[] >} Remote URL data.\n */\nconst fetchUrlData = async ( url, options = {} ) => {\n\tconst endpoint = '/wp-block-editor/v1/url-details';\n\n\tconst args = {\n\t\turl: prependHTTP( url ),\n\t};\n\n\tif ( ! isURL( url ) ) {\n\t\treturn Promise.reject( `${ url } is not a valid URL.` );\n\t}\n\n\t// Test for \"http\" based URL as it is possible for valid\n\t// yet unusable URLs such as `tel:123456` to be passed.\n\tconst protocol = getProtocol( url );\n\n\tif (\n\t\t! protocol ||\n\t\t! isValidProtocol( protocol ) ||\n\t\t! protocol.startsWith( 'http' ) ||\n\t\t! /^https?:\\/\\/[^\\/\\s]/i.test( url )\n\t) {\n\t\treturn Promise.reject(\n\t\t\t`${ url } does not have a valid protocol. URLs must be \"http\" based`\n\t\t);\n\t}\n\n\tif ( CACHE.has( url ) ) {\n\t\treturn CACHE.get( url );\n\t}\n\n\treturn apiFetch( {\n\t\tpath: addQueryArgs( endpoint, args ),\n\t\t...options,\n\t} ).then( ( res ) => {\n\t\tCACHE.set( url, res );\n\t\treturn res;\n\t} );\n};\n\nexport default fetchUrlData;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SACCC,YAAY,EACZC,WAA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AC;AACJ,CAAC;AAED,eAAed,YAAY","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/fetch/__experimental-fetch-url-data.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\taddQueryArgs,\n\tprependHTTP,\n\tisURL,\n\tgetProtocol,\n\tisValidProtocol,\n} from '@wordpress/url';\n\n/**\n * A simple in-memory cache for requests.\n * This avoids repeat HTTP requests which may be beneficial\n * for those wishing to preserve low-bandwidth.\n */\nconst CACHE = new Map();\n\n/**\n * @typedef WPRemoteUrlData\n *\n * @property {string} title contents of the remote URL's `<title>` tag.\n */\n\n/**\n * Fetches data about a remote URL.\n * eg: <title> tag, favicon...etc.\n *\n * @async\n * @param {string} url the URL to request details from.\n * @param {?Object} options any options to pass to the underlying fetch.\n * @example\n * ```js\n * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';\n *\n * //...\n *\n * export function initialize( id, settings ) {\n *\n * settings.__experimentalFetchUrlData = (\n * url\n * ) => fetchUrlData( url );\n * ```\n * @return {Promise< WPRemoteUrlData[] >} Remote URL data.\n */\nconst fetchUrlData = async ( url, options = {} ) => {\n\tconst endpoint = '/wp-block-editor/v1/url-details';\n\n\tconst args = {\n\t\turl: prependHTTP( url ),\n\t};\n\n\tif ( ! isURL( url ) ) {\n\t\treturn Promise.reject( `${ url } is not a valid URL.` );\n\t}\n\n\t// Test for \"http\" based URL as it is possible for valid\n\t// yet unusable URLs such as `tel:123456` to be passed.\n\tconst protocol = getProtocol( url );\n\n\tif (\n\t\t! protocol ||\n\t\t! isValidProtocol( protocol ) ||\n\t\t! protocol.startsWith( 'http' ) ||\n\t\t! /^https?:\\/\\/[^\\/\\s]/i.test( url )\n\t) {\n\t\treturn Promise.reject(\n\t\t\t`${ url } does not have a valid protocol. URLs must be \"http\" based`\n\t\t);\n\t}\n\n\tif ( CACHE.has( url ) ) {\n\t\treturn CACHE.get( url );\n\t}\n\n\treturn apiFetch( {\n\t\tpath: addQueryArgs( endpoint, args ),\n\t\t...options,\n\t} ).then( ( res ) => {\n\t\tCACHE.set( url, res );\n\t\treturn res;\n\t} );\n};\n\nexport default fetchUrlData;\n"],
5
+ "mappings": "AAGA,OAAO,cAAc;AACrB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAOP,MAAM,QAAQ,oBAAI,IAAI;AA6BtB,MAAM,eAAe,OAAQ,KAAK,UAAU,CAAC,MAAO;AACnD,QAAM,WAAW;AAEjB,QAAM,OAAO;AAAA,IACZ,KAAK,YAAa,GAAI;AAAA,EACvB;AAEA,MAAK,CAAE,MAAO,GAAI,GAAI;AACrB,WAAO,QAAQ,OAAQ,GAAI,GAAI,sBAAuB;AAAA,EACvD;AAIA,QAAM,WAAW,YAAa,GAAI;AAElC,MACC,CAAE,YACF,CAAE,gBAAiB,QAAS,KAC5B,CAAE,SAAS,WAAY,MAAO,KAC9B,CAAE,uBAAuB,KAAM,GAAI,GAClC;AACD,WAAO,QAAQ;AAAA,MACd,GAAI,GAAI;AAAA,IACT;AAAA,EACD;AAEA,MAAK,MAAM,IAAK,GAAI,GAAI;AACvB,WAAO,MAAM,IAAK,GAAI;AAAA,EACvB;AAEA,SAAO,SAAU;AAAA,IAChB,MAAM,aAAc,UAAU,IAAK;AAAA,IACnC,GAAG;AAAA,EACJ,CAAE,EAAE,KAAM,CAAE,QAAS;AACpB,UAAM,IAAK,KAAK,GAAI;AACpB,WAAO;AAAA,EACR,CAAE;AACH;AAEA,IAAO,sCAAQ;",
6
+ "names": []
7
+ }
@@ -1,21 +1,26 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { camelCase } from 'change-case';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import apiFetch from '@wordpress/api-fetch';
10
- export { default as __experimentalFetchLinkSuggestions } from './__experimental-fetch-link-suggestions';
11
- export { default as __experimentalFetchUrlData } from './__experimental-fetch-url-data';
12
- export async function fetchBlockPatterns() {
1
+ import { camelCase } from "change-case";
2
+ import apiFetch from "@wordpress/api-fetch";
3
+ import { default as default2 } from "./__experimental-fetch-link-suggestions";
4
+ import { default as default3 } from "./__experimental-fetch-url-data";
5
+ async function fetchBlockPatterns() {
13
6
  const restPatterns = await apiFetch({
14
- path: '/wp/v2/block-patterns/patterns'
7
+ path: "/wp/v2/block-patterns/patterns"
15
8
  });
16
9
  if (!restPatterns) {
17
10
  return [];
18
11
  }
19
- return restPatterns.map(pattern => Object.fromEntries(Object.entries(pattern).map(([key, value]) => [camelCase(key), value])));
12
+ return restPatterns.map(
13
+ (pattern) => Object.fromEntries(
14
+ Object.entries(pattern).map(([key, value]) => [
15
+ camelCase(key),
16
+ value
17
+ ])
18
+ )
19
+ );
20
20
  }
21
- //# sourceMappingURL=index.js.map
21
+ export {
22
+ default2 as __experimentalFetchLinkSuggestions,
23
+ default3 as __experimentalFetchUrlData,
24
+ fetchBlockPatterns
25
+ };
26
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["camelCase","apiFetch","default","__experimentalFetchLinkSuggestions","__experimentalFetchUrlData","fetchBlockPatterns","restPatterns","path","map","pattern","Object","fromEntries","entries","key","value"],"sources":["@wordpress/core-data/src/fetch/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\nexport { default as __experimentalFetchLinkSuggestions } from './__experimental-fetch-link-suggestions';\nexport { default as __experimentalFetchUrlData } from './__experimental-fetch-url-data';\n\nexport async function fetchBlockPatterns() {\n\tconst restPatterns = await apiFetch( {\n\t\tpath: '/wp/v2/block-patterns/patterns',\n\t} );\n\tif ( ! restPatterns ) {\n\t\treturn [];\n\t}\n\treturn restPatterns.map( ( pattern ) =>\n\t\tObject.fromEntries(\n\t\t\tObject.entries( pattern ).map( ( [ key, value ] ) => [\n\t\t\t\tcamelCase( key ),\n\t\t\t\tvalue,\n\t\t\t] )\n\t\t)\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,aAAa;;AAEvC;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,sBAAsB;AAE3C,SAASC,OAAO,IAAIC,kCAAkC,QAAQ,yCAAyC;AACvG,SAASD,OAAO,IAAIE,0BAA0B,QAAQ,iCAAiC;AAEvF,OAAO,eAAeC,kBAAkBA,CAAA,EAAG;EAC1C,MAAMC,YAAY,GAAG,MAAML,QAAQ,CAAE;IACpCM,IAAI,EAAE;EACP,CAAE,CAAC;EACH,IAAK,CAAED,YAAY,EAAG;IACrB,OAAO,EAAE;EACV;EACA,OAAOA,YAAY,CAACE,GAAG,CAAIC,OAAO,IACjCC,MAAM,CAACC,WAAW,CACjBD,MAAM,CAACE,OAAO,CAAEH,OAAQ,CAAC,CAACD,GAAG,CAAE,CAAE,CAAEK,GAAG,EAAEC,KAAK,CAAE,KAAM,CACpDd,SAAS,CAAEa,GAAI,CAAC,EAChBC,KAAK,CACJ,CACH,CACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/fetch/index.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\nexport { default as __experimentalFetchLinkSuggestions } from './__experimental-fetch-link-suggestions';\nexport { default as __experimentalFetchUrlData } from './__experimental-fetch-url-data';\n\nexport async function fetchBlockPatterns() {\n\tconst restPatterns = await apiFetch( {\n\t\tpath: '/wp/v2/block-patterns/patterns',\n\t} );\n\tif ( ! restPatterns ) {\n\t\treturn [];\n\t}\n\treturn restPatterns.map( ( pattern ) =>\n\t\tObject.fromEntries(\n\t\t\tObject.entries( pattern ).map( ( [ key, value ] ) => [\n\t\t\t\tcamelCase( key ),\n\t\t\t\tvalue,\n\t\t\t] )\n\t\t)\n\t);\n}\n"],
5
+ "mappings": "AAGA,SAAS,iBAAiB;AAK1B,OAAO,cAAc;AAErB,SAAoB,WAAXA,gBAAqD;AAC9D,SAAoB,WAAXA,gBAA6C;AAEtD,eAAsB,qBAAqB;AAC1C,QAAM,eAAe,MAAM,SAAU;AAAA,IACpC,MAAM;AAAA,EACP,CAAE;AACF,MAAK,CAAE,cAAe;AACrB,WAAO,CAAC;AAAA,EACT;AACA,SAAO,aAAa;AAAA,IAAK,CAAE,YAC1B,OAAO;AAAA,MACN,OAAO,QAAS,OAAQ,EAAE,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO;AAAA,QACpD,UAAW,GAAI;AAAA,QACf;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AACD;",
6
+ "names": ["default"]
7
+ }
@@ -1,8 +1,5 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import getRichTextValuesCached from './get-rich-text-values-cached';
5
- const cache = new WeakMap();
1
+ import getRichTextValuesCached from "./get-rich-text-values-cached";
2
+ const cache = /* @__PURE__ */ new WeakMap();
6
3
  function getBlockFootnotesOrder(block) {
7
4
  if (!cache.has(block)) {
8
5
  const order = [];
@@ -10,14 +7,9 @@ function getBlockFootnotesOrder(block) {
10
7
  if (!value) {
11
8
  continue;
12
9
  }
13
-
14
- // replacements is a sparse array, use forEach to skip empty slots.
15
- value.replacements.forEach(({
16
- type,
17
- attributes
18
- }) => {
19
- if (type === 'core/footnote') {
20
- order.push(attributes['data-fn']);
10
+ value.replacements.forEach(({ type, attributes }) => {
11
+ if (type === "core/footnote") {
12
+ order.push(attributes["data-fn"]);
21
13
  }
22
14
  });
23
15
  }
@@ -25,11 +17,10 @@ function getBlockFootnotesOrder(block) {
25
17
  }
26
18
  return cache.get(block);
27
19
  }
28
- export default function getFootnotesOrder(blocks) {
29
- // We can only separate getting order from blocks at the root level. For
30
- // deeper inner blocks, this will not work since it's possible to have both
31
- // inner blocks and block attributes, so order needs to be computed from the
32
- // Edit functions as a whole.
20
+ function getFootnotesOrder(blocks) {
33
21
  return blocks.flatMap(getBlockFootnotesOrder);
34
22
  }
35
- //# sourceMappingURL=get-footnotes-order.js.map
23
+ export {
24
+ getFootnotesOrder as default
25
+ };
26
+ //# sourceMappingURL=get-footnotes-order.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getRichTextValuesCached","cache","WeakMap","getBlockFootnotesOrder","block","has","order","value","replacements","forEach","type","attributes","push","set","get","getFootnotesOrder","blocks","flatMap"],"sources":["@wordpress/core-data/src/footnotes/get-footnotes-order.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getRichTextValuesCached from './get-rich-text-values-cached';\n\nconst cache = new WeakMap();\n\nfunction getBlockFootnotesOrder( block ) {\n\tif ( ! cache.has( block ) ) {\n\t\tconst order = [];\n\t\tfor ( const value of getRichTextValuesCached( block ) ) {\n\t\t\tif ( ! value ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// replacements is a sparse array, use forEach to skip empty slots.\n\t\t\tvalue.replacements.forEach( ( { type, attributes } ) => {\n\t\t\t\tif ( type === 'core/footnote' ) {\n\t\t\t\t\torder.push( attributes[ 'data-fn' ] );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\tcache.set( block, order );\n\t}\n\n\treturn cache.get( block );\n}\n\nexport default function getFootnotesOrder( blocks ) {\n\t// We can only separate getting order from blocks at the root level. For\n\t// deeper inner blocks, this will not work since it's possible to have both\n\t// inner blocks and block attributes, so order needs to be computed from the\n\t// Edit functions as a whole.\n\treturn blocks.flatMap( getBlockFootnotesOrder );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,uBAAuB,MAAM,+BAA+B;AAEnE,MAAMC,KAAK,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE3B,SAASC,sBAAsBA,CAAEC,KAAK,EAAG;EACxC,IAAK,CAAEH,KAAK,CAACI,GAAG,CAAED,KAAM,CAAC,EAAG;IAC3B,MAAME,KAAK,GAAG,EAAE;IAChB,KAAM,MAAMC,KAAK,IAAIP,uBAAuB,CAAEI,KAAM,CAAC,EAAG;MACvD,IAAK,CAAEG,KAAK,EAAG;QACd;MACD;;MAEA;MACAA,KAAK,CAACC,YAAY,CAACC,OAAO,CAAE,CAAE;QAAEC,IAAI;QAAEC;MAAW,CAAC,KAAM;QACvD,IAAKD,IAAI,KAAK,eAAe,EAAG;UAC/BJ,KAAK,CAACM,IAAI,CAAED,UAAU,CAAE,SAAS,CAAG,CAAC;QACtC;MACD,CAAE,CAAC;IACJ;IACAV,KAAK,CAACY,GAAG,CAAET,KAAK,EAAEE,KAAM,CAAC;EAC1B;EAEA,OAAOL,KAAK,CAACa,GAAG,CAAEV,KAAM,CAAC;AAC1B;AAEA,eAAe,SAASW,iBAAiBA,CAAEC,MAAM,EAAG;EACnD;EACA;EACA;EACA;EACA,OAAOA,MAAM,CAACC,OAAO,CAAEd,sBAAuB,CAAC;AAChD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/footnotes/get-footnotes-order.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport getRichTextValuesCached from './get-rich-text-values-cached';\n\nconst cache = new WeakMap();\n\nfunction getBlockFootnotesOrder( block ) {\n\tif ( ! cache.has( block ) ) {\n\t\tconst order = [];\n\t\tfor ( const value of getRichTextValuesCached( block ) ) {\n\t\t\tif ( ! value ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// replacements is a sparse array, use forEach to skip empty slots.\n\t\t\tvalue.replacements.forEach( ( { type, attributes } ) => {\n\t\t\t\tif ( type === 'core/footnote' ) {\n\t\t\t\t\torder.push( attributes[ 'data-fn' ] );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\tcache.set( block, order );\n\t}\n\n\treturn cache.get( block );\n}\n\nexport default function getFootnotesOrder( blocks ) {\n\t// We can only separate getting order from blocks at the root level. For\n\t// deeper inner blocks, this will not work since it's possible to have both\n\t// inner blocks and block attributes, so order needs to be computed from the\n\t// Edit functions as a whole.\n\treturn blocks.flatMap( getBlockFootnotesOrder );\n}\n"],
5
+ "mappings": "AAGA,OAAO,6BAA6B;AAEpC,MAAM,QAAQ,oBAAI,QAAQ;AAE1B,SAAS,uBAAwB,OAAQ;AACxC,MAAK,CAAE,MAAM,IAAK,KAAM,GAAI;AAC3B,UAAM,QAAQ,CAAC;AACf,eAAY,SAAS,wBAAyB,KAAM,GAAI;AACvD,UAAK,CAAE,OAAQ;AACd;AAAA,MACD;AAGA,YAAM,aAAa,QAAS,CAAE,EAAE,MAAM,WAAW,MAAO;AACvD,YAAK,SAAS,iBAAkB;AAC/B,gBAAM,KAAM,WAAY,SAAU,CAAE;AAAA,QACrC;AAAA,MACD,CAAE;AAAA,IACH;AACA,UAAM,IAAK,OAAO,KAAM;AAAA,EACzB;AAEA,SAAO,MAAM,IAAK,KAAM;AACzB;AAEe,SAAR,kBAAoC,QAAS;AAKnD,SAAO,OAAO,QAAS,sBAAuB;AAC/C;",
6
+ "names": []
7
+ }
@@ -1,26 +1,8 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import { unlock } from '../lock-unlock';
10
-
11
- // TODO: The following line should have been:
12
- //
13
- // const unlockedApis = unlock( blockEditorPrivateApis );
14
- //
15
- // But there are hidden circular dependencies in RNMobile code, specifically in
16
- // certain native components in the `components` package that depend on
17
- // `block-editor`. What follows is a workaround that defers the `unlock` call
18
- // to prevent native code from failing.
19
- //
20
- // Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.
1
+ import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
2
+ import { unlock } from "../lock-unlock";
21
3
  let unlockedApis;
22
- const cache = new WeakMap();
23
- export default function getRichTextValuesCached(block) {
4
+ const cache = /* @__PURE__ */ new WeakMap();
5
+ function getRichTextValuesCached(block) {
24
6
  if (!unlockedApis) {
25
7
  unlockedApis = unlock(blockEditorPrivateApis);
26
8
  }
@@ -30,4 +12,7 @@ export default function getRichTextValuesCached(block) {
30
12
  }
31
13
  return cache.get(block);
32
14
  }
33
- //# sourceMappingURL=get-rich-text-values-cached.js.map
15
+ export {
16
+ getRichTextValuesCached as default
17
+ };
18
+ //# sourceMappingURL=get-rich-text-values-cached.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["privateApis","blockEditorPrivateApis","unlock","unlockedApis","cache","WeakMap","getRichTextValuesCached","block","has","values","getRichTextValues","set","get"],"sources":["@wordpress/core-data/src/footnotes/get-rich-text-values-cached.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// TODO: The following line should have been:\n//\n// const unlockedApis = unlock( blockEditorPrivateApis );\n//\n// But there are hidden circular dependencies in RNMobile code, specifically in\n// certain native components in the `components` package that depend on\n// `block-editor`. What follows is a workaround that defers the `unlock` call\n// to prevent native code from failing.\n//\n// Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.\nlet unlockedApis;\n\nconst cache = new WeakMap();\n\nexport default function getRichTextValuesCached( block ) {\n\tif ( ! unlockedApis ) {\n\t\tunlockedApis = unlock( blockEditorPrivateApis );\n\t}\n\n\tif ( ! cache.has( block ) ) {\n\t\tconst values = unlockedApis.getRichTextValues( [ block ] );\n\t\tcache.set( block, values );\n\t}\n\treturn cache.get( block );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,YAAY;AAEhB,MAAMC,KAAK,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE3B,eAAe,SAASC,uBAAuBA,CAAEC,KAAK,EAAG;EACxD,IAAK,CAAEJ,YAAY,EAAG;IACrBA,YAAY,GAAGD,MAAM,CAAED,sBAAuB,CAAC;EAChD;EAEA,IAAK,CAAEG,KAAK,CAACI,GAAG,CAAED,KAAM,CAAC,EAAG;IAC3B,MAAME,MAAM,GAAGN,YAAY,CAACO,iBAAiB,CAAE,CAAEH,KAAK,CAAG,CAAC;IAC1DH,KAAK,CAACO,GAAG,CAAEJ,KAAK,EAAEE,MAAO,CAAC;EAC3B;EACA,OAAOL,KAAK,CAACQ,GAAG,CAAEL,KAAM,CAAC;AAC1B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/footnotes/get-rich-text-values-cached.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// TODO: The following line should have been:\n//\n// const unlockedApis = unlock( blockEditorPrivateApis );\n//\n// But there are hidden circular dependencies in RNMobile code, specifically in\n// certain native components in the `components` package that depend on\n// `block-editor`. What follows is a workaround that defers the `unlock` call\n// to prevent native code from failing.\n//\n// Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.\nlet unlockedApis;\n\nconst cache = new WeakMap();\n\nexport default function getRichTextValuesCached( block ) {\n\tif ( ! unlockedApis ) {\n\t\tunlockedApis = unlock( blockEditorPrivateApis );\n\t}\n\n\tif ( ! cache.has( block ) ) {\n\t\tconst values = unlockedApis.getRichTextValues( [ block ] );\n\t\tcache.set( block, values );\n\t}\n\treturn cache.get( block );\n}\n"],
5
+ "mappings": "AAGA,SAAS,eAAe,8BAA8B;AAKtD,SAAS,cAAc;AAYvB,IAAI;AAEJ,MAAM,QAAQ,oBAAI,QAAQ;AAEX,SAAR,wBAA0C,OAAQ;AACxD,MAAK,CAAE,cAAe;AACrB,mBAAe,OAAQ,sBAAuB;AAAA,EAC/C;AAEA,MAAK,CAAE,MAAM,IAAK,KAAM,GAAI;AAC3B,UAAM,SAAS,aAAa,kBAAmB,CAAE,KAAM,CAAE;AACzD,UAAM,IAAK,OAAO,MAAO;AAAA,EAC1B;AACA,SAAO,MAAM,IAAK,KAAM;AACzB;",
6
+ "names": []
7
+ }
@@ -1,71 +1,58 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { RichTextData, create, toHTMLString } from '@wordpress/rich-text';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import getFootnotesOrder from './get-footnotes-order';
1
+ import { RichTextData, create, toHTMLString } from "@wordpress/rich-text";
2
+ import getFootnotesOrder from "./get-footnotes-order";
10
3
  let oldFootnotes = {};
11
- export function updateFootnotesFromMeta(blocks, meta) {
12
- const output = {
13
- blocks
14
- };
4
+ function updateFootnotesFromMeta(blocks, meta) {
5
+ const output = { blocks };
15
6
  if (!meta) {
16
7
  return output;
17
8
  }
18
-
19
- // If meta.footnotes is empty, it means the meta is not registered.
20
- if (meta.footnotes === undefined) {
9
+ if (meta.footnotes === void 0) {
21
10
  return output;
22
11
  }
23
12
  const newOrder = getFootnotesOrder(blocks);
24
13
  const footnotes = meta.footnotes ? JSON.parse(meta.footnotes) : [];
25
- const currentOrder = footnotes.map(fn => fn.id);
26
- if (currentOrder.join('') === newOrder.join('')) {
14
+ const currentOrder = footnotes.map((fn) => fn.id);
15
+ if (currentOrder.join("") === newOrder.join("")) {
27
16
  return output;
28
17
  }
29
- const newFootnotes = newOrder.map(fnId => footnotes.find(fn => fn.id === fnId) || oldFootnotes[fnId] || {
30
- id: fnId,
31
- content: ''
32
- });
18
+ const newFootnotes = newOrder.map(
19
+ (fnId) => footnotes.find((fn) => fn.id === fnId) || oldFootnotes[fnId] || {
20
+ id: fnId,
21
+ content: ""
22
+ }
23
+ );
33
24
  function updateAttributes(attributes) {
34
- // Only attempt to update attributes, if attributes is an object.
35
- if (!attributes || Array.isArray(attributes) || typeof attributes !== 'object') {
25
+ if (!attributes || Array.isArray(attributes) || typeof attributes !== "object") {
36
26
  return attributes;
37
27
  }
38
- attributes = {
39
- ...attributes
40
- };
28
+ attributes = { ...attributes };
41
29
  for (const key in attributes) {
42
30
  const value = attributes[key];
43
31
  if (Array.isArray(value)) {
44
32
  attributes[key] = value.map(updateAttributes);
45
33
  continue;
46
34
  }
47
-
48
- // To do, remove support for string values?
49
- if (typeof value !== 'string' && !(value instanceof RichTextData)) {
35
+ if (typeof value !== "string" && !(value instanceof RichTextData)) {
50
36
  continue;
51
37
  }
52
- const richTextValue = typeof value === 'string' ? RichTextData.fromHTMLString(value) : new RichTextData(value);
38
+ const richTextValue = typeof value === "string" ? RichTextData.fromHTMLString(value) : new RichTextData(value);
53
39
  let hasFootnotes = false;
54
- richTextValue.replacements.forEach(replacement => {
55
- if (replacement.type === 'core/footnote') {
56
- const id = replacement.attributes['data-fn'];
40
+ richTextValue.replacements.forEach((replacement) => {
41
+ if (replacement.type === "core/footnote") {
42
+ const id = replacement.attributes["data-fn"];
57
43
  const index = newOrder.indexOf(id);
58
- // The innerHTML contains the count wrapped in a link.
59
44
  const countValue = create({
60
45
  html: replacement.innerHTML
61
46
  });
62
47
  countValue.text = String(index + 1);
63
- countValue.formats = Array.from({
64
- length: countValue.text.length
65
- }, () => countValue.formats[0]);
66
- countValue.replacements = Array.from({
67
- length: countValue.text.length
68
- }, () => countValue.replacements[0]);
48
+ countValue.formats = Array.from(
49
+ { length: countValue.text.length },
50
+ () => countValue.formats[0]
51
+ );
52
+ countValue.replacements = Array.from(
53
+ { length: countValue.text.length },
54
+ () => countValue.replacements[0]
55
+ );
69
56
  replacement.innerHTML = toHTMLString({
70
57
  value: countValue
71
58
  });
@@ -73,13 +60,13 @@ export function updateFootnotesFromMeta(blocks, meta) {
73
60
  }
74
61
  });
75
62
  if (hasFootnotes) {
76
- attributes[key] = typeof value === 'string' ? richTextValue.toHTMLString() : richTextValue;
63
+ attributes[key] = typeof value === "string" ? richTextValue.toHTMLString() : richTextValue;
77
64
  }
78
65
  }
79
66
  return attributes;
80
67
  }
81
68
  function updateBlocksAttributes(__blocks) {
82
- return __blocks.map(block => {
69
+ return __blocks.map((block) => {
83
70
  return {
84
71
  ...block,
85
72
  attributes: updateAttributes(block.attributes),
@@ -87,9 +74,6 @@ export function updateFootnotesFromMeta(blocks, meta) {
87
74
  };
88
75
  });
89
76
  }
90
-
91
- // We need to go through all block attributes deeply and update the
92
- // footnote anchor numbering (textContent) to match the new order.
93
77
  const newBlocks = updateBlocksAttributes(blocks);
94
78
  oldFootnotes = {
95
79
  ...oldFootnotes,
@@ -108,4 +92,7 @@ export function updateFootnotesFromMeta(blocks, meta) {
108
92
  blocks: newBlocks
109
93
  };
110
94
  }
111
- //# sourceMappingURL=index.js.map
95
+ export {
96
+ updateFootnotesFromMeta
97
+ };
98
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["RichTextData","create","toHTMLString","getFootnotesOrder","oldFootnotes","updateFootnotesFromMeta","blocks","meta","output","footnotes","undefined","newOrder","JSON","parse","currentOrder","map","fn","id","join","newFootnotes","fnId","find","content","updateAttributes","attributes","Array","isArray","key","value","richTextValue","fromHTMLString","hasFootnotes","replacements","forEach","replacement","type","index","indexOf","countValue","html","innerHTML","text","String","formats","from","length","updateBlocksAttributes","__blocks","block","innerBlocks","newBlocks","reduce","acc","includes","stringify"],"sources":["@wordpress/core-data/src/footnotes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RichTextData, create, toHTMLString } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport getFootnotesOrder from './get-footnotes-order';\n\nlet oldFootnotes = {};\n\nexport function updateFootnotesFromMeta( blocks, meta ) {\n\tconst output = { blocks };\n\tif ( ! meta ) {\n\t\treturn output;\n\t}\n\n\t// If meta.footnotes is empty, it means the meta is not registered.\n\tif ( meta.footnotes === undefined ) {\n\t\treturn output;\n\t}\n\n\tconst newOrder = getFootnotesOrder( blocks );\n\n\tconst footnotes = meta.footnotes ? JSON.parse( meta.footnotes ) : [];\n\tconst currentOrder = footnotes.map( ( fn ) => fn.id );\n\n\tif ( currentOrder.join( '' ) === newOrder.join( '' ) ) {\n\t\treturn output;\n\t}\n\n\tconst newFootnotes = newOrder.map(\n\t\t( fnId ) =>\n\t\t\tfootnotes.find( ( fn ) => fn.id === fnId ) ||\n\t\t\toldFootnotes[ fnId ] || {\n\t\t\t\tid: fnId,\n\t\t\t\tcontent: '',\n\t\t\t}\n\t);\n\n\tfunction updateAttributes( attributes ) {\n\t\t// Only attempt to update attributes, if attributes is an object.\n\t\tif (\n\t\t\t! attributes ||\n\t\t\tArray.isArray( attributes ) ||\n\t\t\ttypeof attributes !== 'object'\n\t\t) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes = { ...attributes };\n\n\t\tfor ( const key in attributes ) {\n\t\t\tconst value = attributes[ key ];\n\n\t\t\tif ( Array.isArray( value ) ) {\n\t\t\t\tattributes[ key ] = value.map( updateAttributes );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// To do, remove support for string values?\n\t\t\tif (\n\t\t\t\ttypeof value !== 'string' &&\n\t\t\t\t! ( value instanceof RichTextData )\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst richTextValue =\n\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t? RichTextData.fromHTMLString( value )\n\t\t\t\t\t: new RichTextData( value );\n\n\t\t\tlet hasFootnotes = false;\n\n\t\t\trichTextValue.replacements.forEach( ( replacement ) => {\n\t\t\t\tif ( replacement.type === 'core/footnote' ) {\n\t\t\t\t\tconst id = replacement.attributes[ 'data-fn' ];\n\t\t\t\t\tconst index = newOrder.indexOf( id );\n\t\t\t\t\t// The innerHTML contains the count wrapped in a link.\n\t\t\t\t\tconst countValue = create( {\n\t\t\t\t\t\thtml: replacement.innerHTML,\n\t\t\t\t\t} );\n\t\t\t\t\tcountValue.text = String( index + 1 );\n\t\t\t\t\tcountValue.formats = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.formats[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\tcountValue.replacements = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.replacements[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\treplacement.innerHTML = toHTMLString( {\n\t\t\t\t\t\tvalue: countValue,\n\t\t\t\t\t} );\n\t\t\t\t\thasFootnotes = true;\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tif ( hasFootnotes ) {\n\t\t\t\tattributes[ key ] =\n\t\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t\t? richTextValue.toHTMLString()\n\t\t\t\t\t\t: richTextValue;\n\t\t\t}\n\t\t}\n\n\t\treturn attributes;\n\t}\n\n\tfunction updateBlocksAttributes( __blocks ) {\n\t\treturn __blocks.map( ( block ) => {\n\t\t\treturn {\n\t\t\t\t...block,\n\t\t\t\tattributes: updateAttributes( block.attributes ),\n\t\t\t\tinnerBlocks: updateBlocksAttributes( block.innerBlocks ),\n\t\t\t};\n\t\t} );\n\t}\n\n\t// We need to go through all block attributes deeply and update the\n\t// footnote anchor numbering (textContent) to match the new order.\n\tconst newBlocks = updateBlocksAttributes( blocks );\n\n\toldFootnotes = {\n\t\t...oldFootnotes,\n\t\t...footnotes.reduce( ( acc, fn ) => {\n\t\t\tif ( ! newOrder.includes( fn.id ) ) {\n\t\t\t\tacc[ fn.id ] = fn;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} ),\n\t};\n\n\treturn {\n\t\tmeta: {\n\t\t\t...meta,\n\t\t\tfootnotes: JSON.stringify( newFootnotes ),\n\t\t},\n\t\tblocks: newBlocks,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,MAAM,EAAEC,YAAY,QAAQ,sBAAsB;;AAEzE;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,uBAAuB;AAErD,IAAIC,YAAY,GAAG,CAAC,CAAC;AAErB,OAAO,SAASC,uBAAuBA,CAAEC,MAAM,EAAEC,IAAI,EAA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nBP,UAAU,CAAEG,GAAG,CAAE,GAChB,OAAOC,KAAK,KAAK,QAAQ,GACtBC,aAAa,CAAC3B,YAAY,CAAC,CAAC,GAC5B2B,aAAa;MAClB;IACD;IAEA,OAAOL,UAAU;EAClB;EAEA,SAASsB,sBAAsBA,CAAEC,QAAQ,EAAG;IAC3C,OAAOA,QAAQ,CAAChC,GAAG,CAAIiC,KAAK,IAAM;MACjC,OAAO;QACN,GAAGA,KAAK;QACRxB,UAAU,EAAED,gBAAgB,CAAEyB,KAAK,CAACxB,UAAW,CAAC;QAChDyB,WAAW,EAAEH,sBAAsB,CAAEE,KAAK,CAACC,WAAY;MACxD,CAAC;IACF,CAAE,CAAC;EACJ;;EAEA;EACA;EACA,MAAMC,SAAS,GAAGJ,sBAAsB,CAAExC,MAAO,CAAC;EAElDF,YAAY,GAAG;IACd,GAAGA,YAAY;IACf,GAAGK,SAAS,CAAC0C,MAAM,CAAE,CAAEC,GAAG,EAAEpC,EAAE,KAAM;MACnC,IAAK,CAAEL,QAAQ,CAAC0C,QAAQ,CAAErC,EAAE,CAACC,EAAG,CAAC,EAAG;QACnCmC,GAAG,CAAEpC,EAAE,CAACC,EAAE,CAAE,GAAGD,EAAE;MAClB;MACA,OAAOoC,GAAG;IACX,CAAC,EAAE,CAAC,CAAE;EACP,CAAC;EAED,OAAO;IACN7C,IAAI,EAAE;MACL,GAAGA,IAAI;MACPE,SAAS,EAAEG,IAAI,CAAC0C,SAAS,CAAEnC,YAAa;IACzC,CAAC;IACDb,MAAM,EAAE4C;EACT,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/footnotes/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichTextData, create, toHTMLString } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport getFootnotesOrder from './get-footnotes-order';\n\nlet oldFootnotes = {};\n\nexport function updateFootnotesFromMeta( blocks, meta ) {\n\tconst output = { blocks };\n\tif ( ! meta ) {\n\t\treturn output;\n\t}\n\n\t// If meta.footnotes is empty, it means the meta is not registered.\n\tif ( meta.footnotes === undefined ) {\n\t\treturn output;\n\t}\n\n\tconst newOrder = getFootnotesOrder( blocks );\n\n\tconst footnotes = meta.footnotes ? JSON.parse( meta.footnotes ) : [];\n\tconst currentOrder = footnotes.map( ( fn ) => fn.id );\n\n\tif ( currentOrder.join( '' ) === newOrder.join( '' ) ) {\n\t\treturn output;\n\t}\n\n\tconst newFootnotes = newOrder.map(\n\t\t( fnId ) =>\n\t\t\tfootnotes.find( ( fn ) => fn.id === fnId ) ||\n\t\t\toldFootnotes[ fnId ] || {\n\t\t\t\tid: fnId,\n\t\t\t\tcontent: '',\n\t\t\t}\n\t);\n\n\tfunction updateAttributes( attributes ) {\n\t\t// Only attempt to update attributes, if attributes is an object.\n\t\tif (\n\t\t\t! attributes ||\n\t\t\tArray.isArray( attributes ) ||\n\t\t\ttypeof attributes !== 'object'\n\t\t) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes = { ...attributes };\n\n\t\tfor ( const key in attributes ) {\n\t\t\tconst value = attributes[ key ];\n\n\t\t\tif ( Array.isArray( value ) ) {\n\t\t\t\tattributes[ key ] = value.map( updateAttributes );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// To do, remove support for string values?\n\t\t\tif (\n\t\t\t\ttypeof value !== 'string' &&\n\t\t\t\t! ( value instanceof RichTextData )\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst richTextValue =\n\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t? RichTextData.fromHTMLString( value )\n\t\t\t\t\t: new RichTextData( value );\n\n\t\t\tlet hasFootnotes = false;\n\n\t\t\trichTextValue.replacements.forEach( ( replacement ) => {\n\t\t\t\tif ( replacement.type === 'core/footnote' ) {\n\t\t\t\t\tconst id = replacement.attributes[ 'data-fn' ];\n\t\t\t\t\tconst index = newOrder.indexOf( id );\n\t\t\t\t\t// The innerHTML contains the count wrapped in a link.\n\t\t\t\t\tconst countValue = create( {\n\t\t\t\t\t\thtml: replacement.innerHTML,\n\t\t\t\t\t} );\n\t\t\t\t\tcountValue.text = String( index + 1 );\n\t\t\t\t\tcountValue.formats = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.formats[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\tcountValue.replacements = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.replacements[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\treplacement.innerHTML = toHTMLString( {\n\t\t\t\t\t\tvalue: countValue,\n\t\t\t\t\t} );\n\t\t\t\t\thasFootnotes = true;\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tif ( hasFootnotes ) {\n\t\t\t\tattributes[ key ] =\n\t\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t\t? richTextValue.toHTMLString()\n\t\t\t\t\t\t: richTextValue;\n\t\t\t}\n\t\t}\n\n\t\treturn attributes;\n\t}\n\n\tfunction updateBlocksAttributes( __blocks ) {\n\t\treturn __blocks.map( ( block ) => {\n\t\t\treturn {\n\t\t\t\t...block,\n\t\t\t\tattributes: updateAttributes( block.attributes ),\n\t\t\t\tinnerBlocks: updateBlocksAttributes( block.innerBlocks ),\n\t\t\t};\n\t\t} );\n\t}\n\n\t// We need to go through all block attributes deeply and update the\n\t// footnote anchor numbering (textContent) to match the new order.\n\tconst newBlocks = updateBlocksAttributes( blocks );\n\n\toldFootnotes = {\n\t\t...oldFootnotes,\n\t\t...footnotes.reduce( ( acc, fn ) => {\n\t\t\tif ( ! newOrder.includes( fn.id ) ) {\n\t\t\t\tacc[ fn.id ] = fn;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} ),\n\t};\n\n\treturn {\n\t\tmeta: {\n\t\t\t...meta,\n\t\t\tfootnotes: JSON.stringify( newFootnotes ),\n\t\t},\n\t\tblocks: newBlocks,\n\t};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[]
7
+ }
@@ -1,8 +1,11 @@
1
- export let Status = /*#__PURE__*/function (Status) {
2
- Status["Idle"] = "IDLE";
3
- Status["Resolving"] = "RESOLVING";
4
- Status["Error"] = "ERROR";
5
- Status["Success"] = "SUCCESS";
6
- return Status;
7
- }({});
8
- //# sourceMappingURL=constants.js.map
1
+ var Status = /* @__PURE__ */ ((Status2) => {
2
+ Status2["Idle"] = "IDLE";
3
+ Status2["Resolving"] = "RESOLVING";
4
+ Status2["Error"] = "ERROR";
5
+ Status2["Success"] = "SUCCESS";
6
+ return Status2;
7
+ })(Status || {});
8
+ export {
9
+ Status
10
+ };
11
+ //# sourceMappingURL=constants.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["Status"],"sources":["@wordpress/core-data/src/hooks/constants.ts"],"sourcesContent":["export const enum Status {\n\tIdle = 'IDLE',\n\tResolving = 'RESOLVING',\n\tError = 'ERROR',\n\tSuccess = 'SUCCESS',\n}\n"],"mappings":"AAAA,WAAkBA,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/constants.ts"],
4
+ "sourcesContent": ["export const enum Status {\n\tIdle = 'IDLE',\n\tResolving = 'RESOLVING',\n\tError = 'ERROR',\n\tSuccess = 'SUCCESS',\n}\n"],
5
+ "mappings": "AAAO,IAAW,SAAX,kBAAWA,YAAX;AACN,EAAAA,QAAA,UAAO;AACP,EAAAA,QAAA,eAAY;AACZ,EAAAA,QAAA,WAAQ;AACR,EAAAA,QAAA,aAAU;AAJO,SAAAA;AAAA,GAAA;",
6
+ "names": ["Status"]
7
+ }
@@ -1,15 +1,27 @@
1
- /**
2
- * Internal dependencies
3
- */
4
-
5
- /**
6
- * Utility type that adds permissions to any record type.
7
- */
8
-
9
- export { default as useEntityRecord, __experimentalUseEntityRecord } from './use-entity-record';
10
- export { default as useEntityRecords, __experimentalUseEntityRecords } from './use-entity-records';
11
- export { default as useResourcePermissions, __experimentalUseResourcePermissions } from './use-resource-permissions';
12
- export { default as useEntityBlockEditor } from './use-entity-block-editor';
13
- export { default as useEntityId } from './use-entity-id';
14
- export { default as useEntityProp } from './use-entity-prop';
15
- //# sourceMappingURL=index.js.map
1
+ import {
2
+ default as default2,
3
+ __experimentalUseEntityRecord
4
+ } from "./use-entity-record";
5
+ import {
6
+ default as default3,
7
+ __experimentalUseEntityRecords
8
+ } from "./use-entity-records";
9
+ import {
10
+ default as default4,
11
+ __experimentalUseResourcePermissions
12
+ } from "./use-resource-permissions";
13
+ import { default as default5 } from "./use-entity-block-editor";
14
+ import { default as default6 } from "./use-entity-id";
15
+ import { default as default7 } from "./use-entity-prop";
16
+ export {
17
+ __experimentalUseEntityRecord,
18
+ __experimentalUseEntityRecords,
19
+ __experimentalUseResourcePermissions,
20
+ default5 as useEntityBlockEditor,
21
+ default6 as useEntityId,
22
+ default7 as useEntityProp,
23
+ default2 as useEntityRecord,
24
+ default3 as useEntityRecords,
25
+ default4 as useResourcePermissions
26
+ };
27
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["default","useEntityRecord","__experimentalUseEntityRecord","useEntityRecords","__experimentalUseEntityRecords","useResourcePermissions","__experimentalUseResourcePermissions","useEntityBlockEditor","useEntityId","useEntityProp"],"sources":["@wordpress/core-data/src/hooks/index.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { WithPermissions } from './use-entity-records';\n\n/**\n * Utility type that adds permissions to any record type.\n */\nexport type { WithPermissions };\nexport {\n\tdefault as useEntityRecord,\n\t__experimentalUseEntityRecord,\n} from './use-entity-record';\nexport {\n\tdefault as useEntityRecords,\n\t__experimentalUseEntityRecords,\n} from './use-entity-records';\nexport {\n\tdefault as useResourcePermissions,\n\t__experimentalUseResourcePermissions,\n} from './use-resource-permissions';\nexport { default as useEntityBlockEditor } from './use-entity-block-editor';\nexport { default as useEntityId } from './use-entity-id';\nexport { default as useEntityProp } from './use-entity-prop';\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;;AAEA,SACCA,OAAO,IAAIC,eAAe,EAC1BC,6BAA6B,QACvB,qBAAqB;AAC5B,SACCF,OAAO,IAAIG,gBAAgB,EAC3BC,8BAA8B,QACxB,sBAAsB;AAC7B,SACCJ,OAAO,IAAIK,sBAAsB,EACjCC,oCAAoC,QAC9B,4BAA4B;AACnC,SAASN,OAAO,IAAIO,oBAAoB,QAAQ,2BAA2B;AAC3E,SAASP,OAAO,IAAIQ,WAAW,QAAQ,iBAAiB;AACxD,SAASR,OAAO,IAAIS,aAAa,QAAQ,mBAAmB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/index.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { WithPermissions } from './use-entity-records';\n\n/**\n * Utility type that adds permissions to any record type.\n */\nexport type { WithPermissions };\nexport {\n\tdefault as useEntityRecord,\n\t__experimentalUseEntityRecord,\n} from './use-entity-record';\nexport {\n\tdefault as useEntityRecords,\n\t__experimentalUseEntityRecords,\n} from './use-entity-records';\nexport {\n\tdefault as useResourcePermissions,\n\t__experimentalUseResourcePermissions,\n} from './use-resource-permissions';\nexport { default as useEntityBlockEditor } from './use-entity-block-editor';\nexport { default as useEntityId } from './use-entity-id';\nexport { default as useEntityProp } from './use-entity-prop';\n"],
5
+ "mappings": "AASA;AAAA,EACY,WAAXA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACY,WAAXA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACY,WAAXA;AAAA,EACA;AAAA,OACM;AACP,SAAoB,WAAXA,gBAAuC;AAChD,SAAoB,WAAXA,gBAA8B;AACvC,SAAoB,WAAXA,gBAAgC;",
6
+ "names": ["default"]
7
+ }
@@ -1,8 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import memoize from 'memize';
5
-
6
- // re-export due to restrictive esModuleInterop setting
7
- export default memoize;
8
- //# sourceMappingURL=memoize.js.map
1
+ import memoize from "memize";
2
+ var memoize_default = memoize;
3
+ export {
4
+ memoize_default as default
5
+ };
6
+ //# sourceMappingURL=memoize.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["memoize"],"sources":["@wordpress/core-data/src/hooks/memoize.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n// re-export due to restrictive esModuleInterop setting\nexport default memoize;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,OAAO,MAAM,QAAQ;;AAE5B;AACA,eAAeA,OAAO","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/memoize.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n// re-export due to restrictive esModuleInterop setting\nexport default memoize;\n"],
5
+ "mappings": "AAGA,OAAO,aAAa;AAGpB,IAAO,kBAAQ;",
6
+ "names": []
7
+ }