@wordpress/editor 14.45.2-next.v.202605131032.0 → 14.47.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 (326) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/build/components/collab-sidebar/add-note.cjs +6 -0
  3. package/build/components/collab-sidebar/add-note.cjs.map +2 -2
  4. package/build/components/collab-sidebar/hooks.cjs +36 -24
  5. package/build/components/collab-sidebar/hooks.cjs.map +2 -2
  6. package/build/components/collab-sidebar/index.cjs +19 -10
  7. package/build/components/collab-sidebar/index.cjs.map +2 -2
  8. package/build/components/collab-sidebar/note-byline.cjs +16 -9
  9. package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
  10. package/build/components/collab-sidebar/notes.cjs +20 -11
  11. package/build/components/collab-sidebar/notes.cjs.map +2 -2
  12. package/build/components/collab-sidebar/utils.cjs +42 -2
  13. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  14. package/build/components/collaborators-overlay/compute-selection.cjs +39 -15
  15. package/build/components/collaborators-overlay/compute-selection.cjs.map +3 -3
  16. package/build/components/collaborators-overlay/use-block-highlighting.cjs +10 -2
  17. package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +3 -3
  18. package/build/components/collaborators-overlay/use-render-cursors.cjs +15 -7
  19. package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
  20. package/build/components/collaborators-presence/avatar/component.cjs +5 -1
  21. package/build/components/collaborators-presence/avatar/component.cjs.map +3 -3
  22. package/build/components/collaborators-presence/use-collaborator-notifications.cjs +6 -3
  23. package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +2 -2
  24. package/build/components/editor-interface/index.cjs +17 -16
  25. package/build/components/editor-interface/index.cjs.map +3 -3
  26. package/build/components/editor-notices/index.cjs +6 -1
  27. package/build/components/editor-notices/index.cjs.map +3 -3
  28. package/build/components/global-styles/hooks.cjs +12 -1
  29. package/build/components/global-styles/hooks.cjs.map +2 -2
  30. package/build/components/header/index.cjs +11 -6
  31. package/build/components/header/index.cjs.map +2 -2
  32. package/build/components/media/media-editor-modal.cjs +14 -1
  33. package/build/components/media/media-editor-modal.cjs.map +2 -2
  34. package/build/components/post-card-panel/index.cjs +7 -1
  35. package/build/components/post-card-panel/index.cjs.map +3 -3
  36. package/build/components/post-last-revision/index.cjs +28 -8
  37. package/build/components/post-last-revision/index.cjs.map +2 -2
  38. package/build/components/post-locked-modal/index.cjs +9 -6
  39. package/build/components/post-locked-modal/index.cjs.map +2 -2
  40. package/build/components/post-publish-button/label.cjs +0 -7
  41. package/build/components/post-publish-button/label.cjs.map +2 -2
  42. package/build/components/post-publish-panel/prepublish.cjs +8 -1
  43. package/build/components/post-publish-panel/prepublish.cjs.map +3 -3
  44. package/build/components/post-revisions-panel/index.cjs +7 -0
  45. package/build/components/post-revisions-panel/index.cjs.map +2 -2
  46. package/build/components/post-revisions-preview/diff-markers.cjs +21 -13
  47. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  48. package/build/components/post-revisions-preview/revisions-canvas.cjs +7 -1
  49. package/build/components/post-revisions-preview/revisions-canvas.cjs.map +2 -2
  50. package/build/components/post-taxonomies/check.cjs +1 -2
  51. package/build/components/post-taxonomies/check.cjs.map +2 -2
  52. package/build/components/post-taxonomies/index.cjs +1 -2
  53. package/build/components/post-taxonomies/index.cjs.map +2 -2
  54. package/build/components/preferences-modal/index.cjs +1 -1
  55. package/build/components/preferences-modal/index.cjs.map +2 -2
  56. package/build/components/preview-dropdown/index.cjs.map +3 -3
  57. package/build/components/provider/index.cjs +5 -21
  58. package/build/components/provider/index.cjs.map +3 -3
  59. package/build/components/provider/use-block-editor-settings.cjs +16 -9
  60. package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
  61. package/build/components/resizable-editor/resize-handle.cjs +24 -16
  62. package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
  63. package/build/components/sidebar/header.cjs +16 -21
  64. package/build/components/sidebar/header.cjs.map +3 -3
  65. package/build/components/sidebar/index.cjs +2 -6
  66. package/build/components/sidebar/index.cjs.map +2 -2
  67. package/build/components/start-page-options/index.cjs +14 -4
  68. package/build/components/start-page-options/index.cjs.map +2 -2
  69. package/build/components/start-template-options/index.cjs +8 -6
  70. package/build/components/start-template-options/index.cjs.map +2 -2
  71. package/build/components/styles-canvas/style-book.cjs +59 -2
  72. package/build/components/styles-canvas/style-book.cjs.map +2 -2
  73. package/build/components/sync-connection-error-modal/index.cjs +10 -7
  74. package/build/components/sync-connection-error-modal/index.cjs.map +3 -3
  75. package/build/components/template-actions-panel/block-theme-content.cjs +21 -12
  76. package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
  77. package/build/dataviews/store/private-actions.cjs.map +2 -2
  78. package/build/store/private-actions.cjs +17 -1
  79. package/build/store/private-actions.cjs.map +3 -3
  80. package/build/store/private-selectors.cjs +18 -0
  81. package/build/store/private-selectors.cjs.map +2 -2
  82. package/build/store/selectors.cjs +0 -17
  83. package/build/store/selectors.cjs.map +2 -2
  84. package/build/{components/media → utils/media-delete}/index.cjs +12 -13
  85. package/build/utils/media-delete/index.cjs.map +7 -0
  86. package/build/utils/media-finalize/index.cjs +3 -1
  87. package/build/utils/media-finalize/index.cjs.map +2 -2
  88. package/build/utils/sync-error-messages.cjs +9 -0
  89. package/build/utils/sync-error-messages.cjs.map +2 -2
  90. package/build-module/components/collab-sidebar/add-note.mjs +6 -0
  91. package/build-module/components/collab-sidebar/add-note.mjs.map +2 -2
  92. package/build-module/components/collab-sidebar/hooks.mjs +42 -25
  93. package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
  94. package/build-module/components/collab-sidebar/index.mjs +19 -10
  95. package/build-module/components/collab-sidebar/index.mjs.map +2 -2
  96. package/build-module/components/collab-sidebar/note-byline.mjs +17 -10
  97. package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
  98. package/build-module/components/collab-sidebar/notes.mjs +26 -13
  99. package/build-module/components/collab-sidebar/notes.mjs.map +2 -2
  100. package/build-module/components/collab-sidebar/utils.mjs +38 -2
  101. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  102. package/build-module/components/collaborators-overlay/compute-selection.mjs +36 -12
  103. package/build-module/components/collaborators-overlay/compute-selection.mjs.map +2 -2
  104. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +10 -3
  105. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
  106. package/build-module/components/collaborators-overlay/use-render-cursors.mjs +11 -6
  107. package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
  108. package/build-module/components/collaborators-presence/avatar/component.mjs +7 -3
  109. package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
  110. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +6 -3
  111. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
  112. package/build-module/components/editor-interface/index.mjs +22 -17
  113. package/build-module/components/editor-interface/index.mjs.map +2 -2
  114. package/build-module/components/editor-notices/index.mjs +6 -1
  115. package/build-module/components/editor-notices/index.mjs.map +2 -2
  116. package/build-module/components/global-styles/hooks.mjs +12 -1
  117. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  118. package/build-module/components/header/index.mjs +11 -6
  119. package/build-module/components/header/index.mjs.map +2 -2
  120. package/build-module/components/media/media-editor-modal.mjs +14 -1
  121. package/build-module/components/media/media-editor-modal.mjs.map +2 -2
  122. package/build-module/components/post-card-panel/index.mjs +8 -2
  123. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  124. package/build-module/components/post-last-revision/index.mjs +29 -9
  125. package/build-module/components/post-last-revision/index.mjs.map +2 -2
  126. package/build-module/components/post-locked-modal/index.mjs +9 -6
  127. package/build-module/components/post-locked-modal/index.mjs.map +2 -2
  128. package/build-module/components/post-publish-button/label.mjs +0 -7
  129. package/build-module/components/post-publish-button/label.mjs.map +2 -2
  130. package/build-module/components/post-publish-panel/prepublish.mjs +9 -2
  131. package/build-module/components/post-publish-panel/prepublish.mjs.map +2 -2
  132. package/build-module/components/post-revisions-panel/index.mjs +7 -0
  133. package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
  134. package/build-module/components/post-revisions-preview/diff-markers.mjs +22 -14
  135. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  136. package/build-module/components/post-revisions-preview/revisions-canvas.mjs +7 -1
  137. package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
  138. package/build-module/components/post-taxonomies/check.mjs +1 -2
  139. package/build-module/components/post-taxonomies/check.mjs.map +2 -2
  140. package/build-module/components/post-taxonomies/index.mjs +1 -2
  141. package/build-module/components/post-taxonomies/index.mjs.map +2 -2
  142. package/build-module/components/preferences-modal/index.mjs +1 -1
  143. package/build-module/components/preferences-modal/index.mjs.map +2 -2
  144. package/build-module/components/preview-dropdown/index.mjs +2 -2
  145. package/build-module/components/preview-dropdown/index.mjs.map +2 -2
  146. package/build-module/components/provider/index.mjs +6 -22
  147. package/build-module/components/provider/index.mjs.map +2 -2
  148. package/build-module/components/provider/use-block-editor-settings.mjs +16 -9
  149. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  150. package/build-module/components/resizable-editor/resize-handle.mjs +26 -18
  151. package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
  152. package/build-module/components/sidebar/header.mjs +11 -16
  153. package/build-module/components/sidebar/header.mjs.map +2 -2
  154. package/build-module/components/sidebar/index.mjs +2 -7
  155. package/build-module/components/sidebar/index.mjs.map +2 -2
  156. package/build-module/components/start-page-options/index.mjs +14 -4
  157. package/build-module/components/start-page-options/index.mjs.map +2 -2
  158. package/build-module/components/start-template-options/index.mjs +8 -6
  159. package/build-module/components/start-template-options/index.mjs.map +2 -2
  160. package/build-module/components/styles-canvas/style-book.mjs +60 -3
  161. package/build-module/components/styles-canvas/style-book.mjs.map +2 -2
  162. package/build-module/components/sync-connection-error-modal/index.mjs +14 -8
  163. package/build-module/components/sync-connection-error-modal/index.mjs.map +2 -2
  164. package/build-module/components/template-actions-panel/block-theme-content.mjs +21 -13
  165. package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
  166. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  167. package/build-module/store/private-actions.mjs +16 -1
  168. package/build-module/store/private-actions.mjs.map +2 -2
  169. package/build-module/store/private-selectors.mjs +18 -0
  170. package/build-module/store/private-selectors.mjs.map +2 -2
  171. package/build-module/store/selectors.mjs +0 -16
  172. package/build-module/store/selectors.mjs.map +2 -2
  173. package/build-module/utils/media-delete/index.mjs +12 -0
  174. package/build-module/utils/media-delete/index.mjs.map +7 -0
  175. package/build-module/utils/media-finalize/index.mjs +3 -1
  176. package/build-module/utils/media-finalize/index.mjs.map +2 -2
  177. package/build-module/utils/sync-error-messages.mjs +8 -0
  178. package/build-module/utils/sync-error-messages.mjs.map +2 -2
  179. package/build-style/style-rtl.css +462 -408
  180. package/build-style/style.css +462 -408
  181. package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -1
  182. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  183. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  184. package/build-types/components/collab-sidebar/note-byline.d.ts +3 -0
  185. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
  186. package/build-types/components/collab-sidebar/notes.d.ts.map +1 -1
  187. package/build-types/components/collab-sidebar/utils.d.ts +33 -0
  188. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  189. package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -1
  190. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +3 -0
  191. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
  192. package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
  193. package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
  194. package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
  195. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  196. package/build-types/components/editor-notices/index.d.ts.map +1 -1
  197. package/build-types/components/global-styles/hooks.d.ts.map +1 -1
  198. package/build-types/components/media/media-editor-modal.d.ts +6 -2
  199. package/build-types/components/media/media-editor-modal.d.ts.map +1 -1
  200. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  201. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  202. package/build-types/components/post-locked-modal/index.d.ts +1 -6
  203. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  204. package/build-types/components/post-publish-button/label.d.ts.map +1 -1
  205. package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -1
  206. package/build-types/components/post-revisions-panel/index.d.ts +1 -1
  207. package/build-types/components/post-revisions-panel/index.d.ts.map +1 -1
  208. package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
  209. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
  210. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  211. package/build-types/components/post-taxonomies/flat-term-selector.d.ts +1 -6
  212. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +1 -6
  213. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  214. package/build-types/components/provider/index.d.ts.map +1 -1
  215. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  216. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  217. package/build-types/components/sidebar/index.d.ts.map +1 -1
  218. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  219. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  220. package/build-types/components/styles-canvas/style-book.d.ts.map +1 -1
  221. package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -1
  222. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
  223. package/build-types/dataviews/store/private-actions.d.ts +0 -1
  224. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  225. package/build-types/store/private-actions.d.ts +15 -0
  226. package/build-types/store/private-actions.d.ts.map +1 -1
  227. package/build-types/store/private-selectors.d.ts +10 -0
  228. package/build-types/store/private-selectors.d.ts.map +1 -1
  229. package/build-types/store/selectors.d.ts +0 -10
  230. package/build-types/store/selectors.d.ts.map +1 -1
  231. package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
  232. package/build-types/utils/media-delete/index.d.ts +2 -0
  233. package/build-types/utils/media-delete/index.d.ts.map +1 -0
  234. package/build-types/utils/media-finalize/index.d.ts +1 -1
  235. package/build-types/utils/media-finalize/index.d.ts.map +1 -1
  236. package/build-types/utils/sync-error-messages.d.ts +1 -0
  237. package/build-types/utils/sync-error-messages.d.ts.map +1 -1
  238. package/package.json +48 -48
  239. package/src/components/collab-sidebar/add-note.js +9 -0
  240. package/src/components/collab-sidebar/hooks.js +53 -29
  241. package/src/components/collab-sidebar/index.js +28 -14
  242. package/src/components/collab-sidebar/note-byline.js +15 -10
  243. package/src/components/collab-sidebar/notes.js +36 -14
  244. package/src/components/collab-sidebar/test/utils.js +375 -1
  245. package/src/components/collab-sidebar/utils.js +70 -1
  246. package/src/components/collaborators-overlay/compute-selection.ts +67 -19
  247. package/src/components/collaborators-overlay/use-block-highlighting.ts +14 -1
  248. package/src/components/collaborators-overlay/use-render-cursors.ts +15 -4
  249. package/src/components/collaborators-presence/avatar/component.tsx +10 -3
  250. package/src/components/collaborators-presence/avatar/test/index.tsx +50 -18
  251. package/src/components/collaborators-presence/styles/collaborators-presence.scss +4 -1
  252. package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +2 -1
  253. package/src/components/collaborators-presence/use-collaborator-notifications.ts +6 -4
  254. package/src/components/editor-help/help-topic-row.native.js +2 -2
  255. package/src/components/editor-interface/index.js +22 -23
  256. package/src/components/editor-interface/style.scss +4 -0
  257. package/src/components/editor-notices/index.js +7 -1
  258. package/src/components/error-boundary/index.native.js +2 -2
  259. package/src/components/global-styles/hooks.js +26 -0
  260. package/src/components/global-styles-sidebar/style.scss +0 -9
  261. package/src/components/header/index.js +12 -12
  262. package/src/components/media/media-editor-modal.js +20 -2
  263. package/src/components/offline-status/index.native.js +2 -2
  264. package/src/components/post-card-panel/index.js +5 -2
  265. package/src/components/post-last-revision/index.js +37 -9
  266. package/src/components/post-last-revision/style.scss +0 -3
  267. package/src/components/post-locked-modal/index.js +8 -5
  268. package/src/components/post-panel-row/style.scss +1 -0
  269. package/src/components/post-publish-button/label.js +0 -11
  270. package/src/components/post-publish-panel/prepublish.js +6 -2
  271. package/src/components/post-revisions-panel/index.js +8 -0
  272. package/src/components/post-revisions-preview/diff-markers.js +17 -11
  273. package/src/components/post-revisions-preview/revisions-canvas.js +7 -1
  274. package/src/components/post-revisions-preview/style.scss +4 -4
  275. package/src/components/post-taxonomies/check.js +1 -2
  276. package/src/components/post-taxonomies/index.js +1 -2
  277. package/src/components/preferences-modal/index.js +1 -1
  278. package/src/components/preview-dropdown/index.js +2 -2
  279. package/src/components/provider/index.js +10 -31
  280. package/src/components/provider/use-block-editor-settings.js +19 -12
  281. package/src/components/resizable-editor/resize-handle.js +22 -16
  282. package/src/components/sidebar/header.js +18 -28
  283. package/src/components/sidebar/index.js +5 -14
  284. package/src/components/start-page-options/index.js +19 -4
  285. package/src/components/start-template-options/index.js +13 -6
  286. package/src/components/styles-canvas/style-book.js +75 -13
  287. package/src/components/sync-connection-error-modal/index.tsx +25 -11
  288. package/src/components/template-actions-panel/block-theme-content.js +19 -13
  289. package/src/components/text-editor/style.scss +2 -2
  290. package/src/dataviews/store/private-actions.ts +0 -1
  291. package/src/store/private-actions.js +27 -0
  292. package/src/store/private-selectors.js +26 -0
  293. package/src/store/selectors.js +0 -24
  294. package/src/store/test/actions.js +34 -0
  295. package/src/utils/media-delete/index.js +11 -0
  296. package/src/utils/media-finalize/index.js +6 -1
  297. package/src/utils/media-finalize/test/index.js +32 -2
  298. package/src/utils/sync-error-messages.ts +8 -0
  299. package/src/utils/test/sync-error-messages.js +1 -0
  300. package/build/components/global-styles-provider/index.cjs +0 -181
  301. package/build/components/global-styles-provider/index.cjs.map +0 -7
  302. package/build/components/media/index.cjs.map +0 -7
  303. package/build/components/media/metadata-panel.cjs +0 -96
  304. package/build/components/media/metadata-panel.cjs.map +0 -7
  305. package/build/components/media/preview.cjs +0 -39
  306. package/build/components/media/preview.cjs.map +0 -7
  307. package/build-module/components/global-styles-provider/index.mjs +0 -156
  308. package/build-module/components/global-styles-provider/index.mjs.map +0 -7
  309. package/build-module/components/media/index.mjs +0 -8
  310. package/build-module/components/media/index.mjs.map +0 -7
  311. package/build-module/components/media/metadata-panel.mjs +0 -65
  312. package/build-module/components/media/metadata-panel.mjs.map +0 -7
  313. package/build-module/components/media/preview.mjs +0 -21
  314. package/build-module/components/media/preview.mjs.map +0 -7
  315. package/build-types/components/global-styles-provider/index.d.ts +0 -16
  316. package/build-types/components/global-styles-provider/index.d.ts.map +0 -1
  317. package/build-types/components/media/index.d.ts +0 -3
  318. package/build-types/components/media/index.d.ts.map +0 -1
  319. package/build-types/components/media/metadata-panel.d.ts +0 -12
  320. package/build-types/components/media/metadata-panel.d.ts.map +0 -1
  321. package/build-types/components/media/preview.d.ts +0 -9
  322. package/build-types/components/media/preview.d.ts.map +0 -1
  323. package/src/components/global-styles-provider/index.js +0 -207
  324. package/src/components/media/index.js +0 -2
  325. package/src/components/media/metadata-panel.js +0 -77
  326. package/src/components/media/preview.js +0 -35
@@ -1,181 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/editor/src/components/global-styles-provider/index.js
21
- var global_styles_provider_exports = {};
22
- __export(global_styles_provider_exports, {
23
- useGlobalStylesContext: () => useGlobalStylesContext
24
- });
25
- module.exports = __toCommonJS(global_styles_provider_exports);
26
- var import_block_editor = require("@wordpress/block-editor");
27
- var import_core_data = require("@wordpress/core-data");
28
- var import_data = require("@wordpress/data");
29
- var import_element = require("@wordpress/element");
30
- var import_global_styles_engine = require("@wordpress/global-styles-engine");
31
- var import_lock_unlock = require("../../lock-unlock.cjs");
32
- var { cleanEmptyObject } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
33
- function useGlobalStylesUserConfig() {
34
- const { globalStylesId, isReady, settings, styles, _links } = (0, import_data.useSelect)(
35
- (select) => {
36
- const {
37
- getEntityRecord,
38
- getEditedEntityRecord: getEditedEntityRecord2,
39
- hasFinishedResolution,
40
- canUser
41
- } = select(import_core_data.store);
42
- const _globalStylesId = select(import_core_data.store).__experimentalGetCurrentGlobalStylesId();
43
- let record;
44
- const userCanEditGlobalStyles = _globalStylesId ? canUser("update", {
45
- kind: "root",
46
- name: "globalStyles",
47
- id: _globalStylesId
48
- }) : null;
49
- if (_globalStylesId && /*
50
- * Test that the OPTIONS request for user capabilities is complete
51
- * before fetching the global styles entity record.
52
- * This is to avoid fetching the global styles entity unnecessarily.
53
- */
54
- typeof userCanEditGlobalStyles === "boolean") {
55
- if (userCanEditGlobalStyles) {
56
- record = getEditedEntityRecord2(
57
- "root",
58
- "globalStyles",
59
- _globalStylesId
60
- );
61
- } else {
62
- record = getEntityRecord(
63
- "root",
64
- "globalStyles",
65
- _globalStylesId,
66
- { context: "view" }
67
- );
68
- }
69
- }
70
- let hasResolved = false;
71
- if (hasFinishedResolution(
72
- "__experimentalGetCurrentGlobalStylesId"
73
- )) {
74
- if (_globalStylesId) {
75
- hasResolved = userCanEditGlobalStyles ? hasFinishedResolution("getEditedEntityRecord", [
76
- "root",
77
- "globalStyles",
78
- _globalStylesId
79
- ]) : hasFinishedResolution("getEntityRecord", [
80
- "root",
81
- "globalStyles",
82
- _globalStylesId,
83
- { context: "view" }
84
- ]);
85
- } else {
86
- hasResolved = true;
87
- }
88
- }
89
- return {
90
- globalStylesId: _globalStylesId,
91
- isReady: hasResolved,
92
- settings: record?.settings,
93
- styles: record?.styles,
94
- _links: record?._links
95
- };
96
- },
97
- []
98
- );
99
- const { getEditedEntityRecord } = (0, import_data.useSelect)(import_core_data.store);
100
- const { editEntityRecord } = (0, import_data.useDispatch)(import_core_data.store);
101
- const config = (0, import_element.useMemo)(() => {
102
- return {
103
- settings: settings ?? {},
104
- styles: styles ?? {},
105
- _links: _links ?? {}
106
- };
107
- }, [settings, styles, _links]);
108
- const setConfig = (0, import_element.useCallback)(
109
- /**
110
- * Set the global styles config.
111
- * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
112
- * Otherwise, overwrite the current config with the incoming object.
113
- * @param {Object} options Options for editEntityRecord Core selector.
114
- */
115
- (callbackOrObject, options = {}) => {
116
- const record = getEditedEntityRecord(
117
- "root",
118
- "globalStyles",
119
- globalStylesId
120
- );
121
- const currentConfig = {
122
- styles: record?.styles ?? {},
123
- settings: record?.settings ?? {},
124
- _links: record?._links ?? {}
125
- };
126
- const updatedConfig = typeof callbackOrObject === "function" ? callbackOrObject(currentConfig) : callbackOrObject;
127
- editEntityRecord(
128
- "root",
129
- "globalStyles",
130
- globalStylesId,
131
- {
132
- styles: cleanEmptyObject(updatedConfig.styles) || {},
133
- settings: cleanEmptyObject(updatedConfig.settings) || {},
134
- _links: cleanEmptyObject(updatedConfig._links) || {}
135
- },
136
- options
137
- );
138
- },
139
- [globalStylesId, editEntityRecord, getEditedEntityRecord]
140
- );
141
- return [isReady, config, setConfig];
142
- }
143
- function useGlobalStylesBaseConfig() {
144
- const baseConfig = (0, import_data.useSelect)(
145
- (select) => select(import_core_data.store).__experimentalGetCurrentThemeBaseGlobalStyles(),
146
- []
147
- );
148
- return [!!baseConfig, baseConfig];
149
- }
150
- function useGlobalStylesContext() {
151
- const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
152
- const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
153
- const mergedConfig = (0, import_element.useMemo)(() => {
154
- if (!baseConfig || !userConfig) {
155
- return {};
156
- }
157
- return (0, import_global_styles_engine.mergeGlobalStyles)(baseConfig, userConfig);
158
- }, [userConfig, baseConfig]);
159
- const context = (0, import_element.useMemo)(() => {
160
- return {
161
- isReady: isUserConfigReady && isBaseConfigReady,
162
- user: userConfig,
163
- base: baseConfig,
164
- merged: mergedConfig,
165
- setUserConfig
166
- };
167
- }, [
168
- mergedConfig,
169
- userConfig,
170
- baseConfig,
171
- setUserConfig,
172
- isUserConfigReady,
173
- isBaseConfigReady
174
- ]);
175
- return context;
176
- }
177
- // Annotate the CommonJS export names for ESM import in node:
178
- 0 && (module.exports = {
179
- useGlobalStylesContext
180
- });
181
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/global-styles-provider/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { mergeGlobalStyles } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tcanUser,\n\t\t\t} = select( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tlet record;\n\n\t\t\t/*\n\t\t\t * Ensure that the global styles ID request is complete by testing `_globalStylesId`,\n\t\t\t * before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will\n\t\t\t * fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`.\n\t\t\t * NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,\n\t\t\t * or set using the `block_editor_rest_api_preload_paths` filter, if this changes.\n\t\t\t */\n\t\t\tconst userCanEditGlobalStyles = _globalStylesId\n\t\t\t\t? canUser( 'update', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'globalStyles',\n\t\t\t\t\t\tid: _globalStylesId,\n\t\t\t\t } )\n\t\t\t\t: null;\n\n\t\t\tif (\n\t\t\t\t_globalStylesId &&\n\t\t\t\t/*\n\t\t\t\t * Test that the OPTIONS request for user capabilities is complete\n\t\t\t\t * before fetching the global styles entity record.\n\t\t\t\t * This is to avoid fetching the global styles entity unnecessarily.\n\t\t\t\t */\n\t\t\t\ttypeof userCanEditGlobalStyles === 'boolean'\n\t\t\t) {\n\t\t\t\t/*\n\t\t\t\t * Fetch the global styles entity record based on the user's capabilities.\n\t\t\t\t * The default context is `edit` for users who can edit global styles.\n\t\t\t\t * Otherwise, the context is `view`.\n\t\t\t\t * NOTE: There is an equivalent conditional check using `current_user_can()` in the backend\n\t\t\t\t * to preload the global styles entity. Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,\n\t\t\t\t * or set using `block_editor_rest_api_preload_paths` filter, if this changes.\n\t\t\t\t */\n\t\t\t\tif ( userCanEditGlobalStyles ) {\n\t\t\t\t\trecord = getEditedEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\trecord = getEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tif ( _globalStylesId ) {\n\t\t\t\t\thasResolved = userCanEditGlobalStyles\n\t\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t ] )\n\t\t\t\t\t\t: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t\t\t{ context: 'view' },\n\t\t\t\t\t\t ] );\n\t\t\t\t} else {\n\t\t\t\t\thasResolved = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).__experimentalGetCurrentThemeBaseGlobalStyles(),\n\t\t[]\n\t);\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeGlobalStyles( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAsD;AACtD,uBAAmC;AACnC,kBAAuC;AACvC,qBAAqC;AACrC,kCAAkC;AAKlC,yBAAuB;AAEvB,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,oBAAAA,WAAuB;AAE5D,SAAS,4BAA4B;AACpC,QAAM,EAAE,gBAAgB,SAAS,UAAU,QAAQ,OAAO,QAAI;AAAA,IAC7D,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA,uBAAAC;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,iBAAAC,KAAU;AACtB,YAAM,kBACL,OAAQ,iBAAAA,KAAU,EAAE,uCAAuC;AAE5D,UAAI;AASJ,YAAM,0BAA0B,kBAC7B,QAAS,UAAU;AAAA,QACnB,MAAM;AAAA,QACN,MAAM;AAAA,QACN,IAAI;AAAA,MACJ,CAAE,IACF;AAEH,UACC;AAAA;AAAA;AAAA;AAAA;AAAA,MAMA,OAAO,4BAA4B,WAClC;AASD,YAAK,yBAA0B;AAC9B,mBAASD;AAAA,YACR;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,QACD,OAAO;AACN,mBAAS;AAAA,YACR;AAAA,YACA;AAAA,YACA;AAAA,YACA,EAAE,SAAS,OAAO;AAAA,UACnB;AAAA,QACD;AAAA,MACD;AAEA,UAAI,cAAc;AAClB,UACC;AAAA,QACC;AAAA,MACD,GACC;A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iBAAkB,cAAc,QAAS,KAAK,CAAC;AAAA,UACzD,QAAQ,iBAAkB,cAAc,MAAO,KAAK,CAAC;AAAA,QACtD;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,gBAAgB,kBAAkB,qBAAsB;AAAA,EAC3D;AAEA,SAAO,CAAE,SAAS,QAAQ,SAAU;AACrC;AAEA,SAAS,4BAA4B;AACpC,QAAM,iBAAa;AAAA,IAClB,CAAE,WACD,OAAQ,iBAAAA,KAAU,EAAE,8CAA8C;AAAA,IACnE,CAAC;AAAA,EACF;AACA,SAAO,CAAE,CAAC,CAAE,YAAY,UAAW;AACpC;AAEO,SAAS,yBAAyB;AACxC,QAAM,CAAE,mBAAmB,YAAY,aAAc,IACpD,0BAA0B;AAC3B,QAAM,CAAE,mBAAmB,UAAW,IAAI,0BAA0B;AAEpE,QAAM,mBAAe,wBAAS,MAAM;AACnC,QAAK,CAAE,cAAc,CAAE,YAAa;AACnC,aAAO,CAAC;AAAA,IACT;AAEA,eAAO,+CAAmB,YAAY,UAAW;AAAA,EAClD,GAAG,CAAE,YAAY,UAAW,CAAE;AAE9B,QAAM,cAAU,wBAAS,MAAM;AAC9B,WAAO;AAAA,MACN,SAAS,qBAAqB;AAAA,MAC9B,MAAM;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,MACR;AAAA,IACD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
6
- "names": ["blockEditorPrivateApis", "getEditedEntityRecord", "coreStore"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/media/index.js"],
4
- "sourcesContent": ["export { default as MediaPreview } from './preview';\nexport { default as MediaMetadataPanel } from './metadata-panel';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwC;AACxC,4BAA8C;",
6
- "names": []
7
- }
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/editor/src/components/media/metadata-panel.js
31
- var metadata_panel_exports = {};
32
- __export(metadata_panel_exports, {
33
- default: () => MediaMetadataPanel
34
- });
35
- module.exports = __toCommonJS(metadata_panel_exports);
36
- var import_media_editor = require("@wordpress/media-editor");
37
- var import_data = require("@wordpress/data");
38
- var import_element = require("@wordpress/element");
39
- var import_core_data = require("@wordpress/core-data");
40
- var import_store = require("../../store/index.cjs");
41
- var import_post_fields = __toESM(require("../post-fields/index.cjs"));
42
- var import_post_card_panel = __toESM(require("../post-card-panel/index.cjs"));
43
- var import_post_panel_section = __toESM(require("../post-panel-section/index.cjs"));
44
- var import_jsx_runtime = require("react/jsx-runtime");
45
- function MediaMetadataPanel({ onActionPerformed }) {
46
- const { media, postType, postId } = (0, import_data.useSelect)((select) => {
47
- const _postType = select(import_store.store).getCurrentPostType();
48
- const _postId = select(import_store.store).getCurrentPostId();
49
- const currentPost = select(import_core_data.store).getEditedEntityRecord(
50
- "postType",
51
- _postType,
52
- _postId,
53
- {
54
- _embed: "author,wp:attached-to"
55
- }
56
- );
57
- return {
58
- media: currentPost,
59
- postType: _postType,
60
- postId: _postId
61
- };
62
- }, []);
63
- const { editPost } = (0, import_data.useDispatch)(import_store.store);
64
- const fields = (0, import_post_fields.default)({ postType: "attachment" });
65
- const settings = (0, import_element.useMemo)(
66
- () => ({
67
- fields
68
- }),
69
- [fields]
70
- );
71
- const handleUpdate = (updates) => {
72
- editPost(updates);
73
- };
74
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_panel_section.default, { className: "editor-media-metadata-panel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
- import_media_editor.MediaEditorProvider,
76
- {
77
- value: media,
78
- settings,
79
- onChange: handleUpdate,
80
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
- import_media_editor.MediaForm,
82
- {
83
- header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
- import_post_card_panel.default,
85
- {
86
- postType,
87
- postId,
88
- onActionPerformed
89
- }
90
- )
91
- }
92
- )
93
- }
94
- ) });
95
- }
96
- //# sourceMappingURL=metadata-panel.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/media/metadata-panel.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MediaEditorProvider, MediaForm } from '@wordpress/media-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport usePostFields from '../post-fields';\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\n\n/**\n * Media metadata panel for the editor sidebar.\n * Displays a form for editing media properties with PostCardPanel header.\n *\n * @param {Object} props - Component props.\n * @param {Function} props.onActionPerformed - Callback when an action is performed.\n * @return {Element} The MediaMetadataPanel component.\n */\nexport default function MediaMetadataPanel( { onActionPerformed } ) {\n\tconst { media, postType, postId } = useSelect( ( select ) => {\n\t\tconst _postType = select( editorStore ).getCurrentPostType();\n\t\tconst _postId = select( editorStore ).getCurrentPostId();\n\t\tconst currentPost = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId,\n\t\t\t{\n\t\t\t\t_embed: 'author,wp:attached-to',\n\t\t\t}\n\t\t);\n\t\treturn {\n\t\t\tmedia: currentPost,\n\t\t\tpostType: _postType,\n\t\t\tpostId: _postId,\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst fields = usePostFields( { postType: 'attachment' } );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tfields,\n\t\t} ),\n\t\t[ fields ]\n\t);\n\n\tconst handleUpdate = ( updates ) => {\n\t\teditPost( updates );\n\t};\n\n\treturn (\n\t\t<PostPanelSection className=\"editor-media-metadata-panel\">\n\t\t\t<MediaEditorProvider\n\t\t\t\tvalue={ media }\n\t\t\t\tsettings={ settings }\n\t\t\t\tonChange={ handleUpdate }\n\t\t\t>\n\t\t\t\t<MediaForm\n\t\t\t\t\theader={\n\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</MediaEditorProvider>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;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- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/editor/src/components/media/preview.js
21
- var preview_exports = {};
22
- __export(preview_exports, {
23
- default: () => MediaPreview
24
- });
25
- module.exports = __toCommonJS(preview_exports);
26
- var import_media_editor = require("@wordpress/media-editor");
27
- var import_data = require("@wordpress/data");
28
- var import_store = require("../../store/index.cjs");
29
- var import_jsx_runtime = require("react/jsx-runtime");
30
- function MediaPreview(props) {
31
- const { media } = (0, import_data.useSelect)((select) => {
32
- const currentPost = select(import_store.store).getCurrentPost();
33
- return {
34
- media: currentPost
35
- };
36
- }, []);
37
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_editor.MediaEditorProvider, { value: media, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_editor.MediaPreview, { ...props }) });
38
- }
39
- //# sourceMappingURL=preview.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/media/preview.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMediaEditorProvider,\n\tMediaPreview as BaseMediaPreview,\n} from '@wordpress/media-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Media preview component for the editor.\n * Connects the base MediaPreview component to the editor store.\n *\n * @param {Object} props - Additional props to spread on MediaPreview.\n * @return {Element} The MediaPreview component.\n */\nexport default function MediaPreview( props ) {\n\tconst { media } = useSelect( ( select ) => {\n\t\tconst currentPost = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\tmedia: currentPost,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<MediaEditorProvider value={ media }>\n\t\t\t<BaseMediaPreview { ...props } />\n\t\t</MediaEditorProvider>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAGO;AACP,kBAA0B;AAK1B,mBAAqC;AAmBlC;AAVY,SAAR,aAA+B,OAAQ;AAC7C,QAAM,EAAE,MAAM,QAAI,uBAAW,CAAE,WAAY;AAC1C,UAAM,cAAc,OAAQ,aAAAA,KAAY,EAAE,eAAe;AACzD,WAAO;AAAA,MACN,OAAO;AAAA,IACR;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,SACC,4CAAC,2CAAoB,OAAQ,OAC5B,sDAAC,oBAAAC,cAAA,EAAmB,GAAG,OAAQ,GAChC;AAEF;",
6
- "names": ["editorStore", "BaseMediaPreview"]
7
- }
@@ -1,156 +0,0 @@
1
- // packages/editor/src/components/global-styles-provider/index.js
2
- import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
3
- import { store as coreStore } from "@wordpress/core-data";
4
- import { useSelect, useDispatch } from "@wordpress/data";
5
- import { useMemo, useCallback } from "@wordpress/element";
6
- import { mergeGlobalStyles } from "@wordpress/global-styles-engine";
7
- import { unlock } from "../../lock-unlock.mjs";
8
- var { cleanEmptyObject } = unlock(blockEditorPrivateApis);
9
- function useGlobalStylesUserConfig() {
10
- const { globalStylesId, isReady, settings, styles, _links } = useSelect(
11
- (select) => {
12
- const {
13
- getEntityRecord,
14
- getEditedEntityRecord: getEditedEntityRecord2,
15
- hasFinishedResolution,
16
- canUser
17
- } = select(coreStore);
18
- const _globalStylesId = select(coreStore).__experimentalGetCurrentGlobalStylesId();
19
- let record;
20
- const userCanEditGlobalStyles = _globalStylesId ? canUser("update", {
21
- kind: "root",
22
- name: "globalStyles",
23
- id: _globalStylesId
24
- }) : null;
25
- if (_globalStylesId && /*
26
- * Test that the OPTIONS request for user capabilities is complete
27
- * before fetching the global styles entity record.
28
- * This is to avoid fetching the global styles entity unnecessarily.
29
- */
30
- typeof userCanEditGlobalStyles === "boolean") {
31
- if (userCanEditGlobalStyles) {
32
- record = getEditedEntityRecord2(
33
- "root",
34
- "globalStyles",
35
- _globalStylesId
36
- );
37
- } else {
38
- record = getEntityRecord(
39
- "root",
40
- "globalStyles",
41
- _globalStylesId,
42
- { context: "view" }
43
- );
44
- }
45
- }
46
- let hasResolved = false;
47
- if (hasFinishedResolution(
48
- "__experimentalGetCurrentGlobalStylesId"
49
- )) {
50
- if (_globalStylesId) {
51
- hasResolved = userCanEditGlobalStyles ? hasFinishedResolution("getEditedEntityRecord", [
52
- "root",
53
- "globalStyles",
54
- _globalStylesId
55
- ]) : hasFinishedResolution("getEntityRecord", [
56
- "root",
57
- "globalStyles",
58
- _globalStylesId,
59
- { context: "view" }
60
- ]);
61
- } else {
62
- hasResolved = true;
63
- }
64
- }
65
- return {
66
- globalStylesId: _globalStylesId,
67
- isReady: hasResolved,
68
- settings: record?.settings,
69
- styles: record?.styles,
70
- _links: record?._links
71
- };
72
- },
73
- []
74
- );
75
- const { getEditedEntityRecord } = useSelect(coreStore);
76
- const { editEntityRecord } = useDispatch(coreStore);
77
- const config = useMemo(() => {
78
- return {
79
- settings: settings ?? {},
80
- styles: styles ?? {},
81
- _links: _links ?? {}
82
- };
83
- }, [settings, styles, _links]);
84
- const setConfig = useCallback(
85
- /**
86
- * Set the global styles config.
87
- * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
88
- * Otherwise, overwrite the current config with the incoming object.
89
- * @param {Object} options Options for editEntityRecord Core selector.
90
- */
91
- (callbackOrObject, options = {}) => {
92
- const record = getEditedEntityRecord(
93
- "root",
94
- "globalStyles",
95
- globalStylesId
96
- );
97
- const currentConfig = {
98
- styles: record?.styles ?? {},
99
- settings: record?.settings ?? {},
100
- _links: record?._links ?? {}
101
- };
102
- const updatedConfig = typeof callbackOrObject === "function" ? callbackOrObject(currentConfig) : callbackOrObject;
103
- editEntityRecord(
104
- "root",
105
- "globalStyles",
106
- globalStylesId,
107
- {
108
- styles: cleanEmptyObject(updatedConfig.styles) || {},
109
- settings: cleanEmptyObject(updatedConfig.settings) || {},
110
- _links: cleanEmptyObject(updatedConfig._links) || {}
111
- },
112
- options
113
- );
114
- },
115
- [globalStylesId, editEntityRecord, getEditedEntityRecord]
116
- );
117
- return [isReady, config, setConfig];
118
- }
119
- function useGlobalStylesBaseConfig() {
120
- const baseConfig = useSelect(
121
- (select) => select(coreStore).__experimentalGetCurrentThemeBaseGlobalStyles(),
122
- []
123
- );
124
- return [!!baseConfig, baseConfig];
125
- }
126
- function useGlobalStylesContext() {
127
- const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
128
- const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
129
- const mergedConfig = useMemo(() => {
130
- if (!baseConfig || !userConfig) {
131
- return {};
132
- }
133
- return mergeGlobalStyles(baseConfig, userConfig);
134
- }, [userConfig, baseConfig]);
135
- const context = useMemo(() => {
136
- return {
137
- isReady: isUserConfigReady && isBaseConfigReady,
138
- user: userConfig,
139
- base: baseConfig,
140
- merged: mergedConfig,
141
- setUserConfig
142
- };
143
- }, [
144
- mergedConfig,
145
- userConfig,
146
- baseConfig,
147
- setUserConfig,
148
- isUserConfigReady,
149
- isBaseConfigReady
150
- ]);
151
- return context;
152
- }
153
- export {
154
- useGlobalStylesContext
155
- };
156
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/global-styles-provider/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { mergeGlobalStyles } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tcanUser,\n\t\t\t} = select( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tlet record;\n\n\t\t\t/*\n\t\t\t * Ensure that the global styles ID request is complete by testing `_globalStylesId`,\n\t\t\t * before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will\n\t\t\t * fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`.\n\t\t\t * NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,\n\t\t\t * or set using the `block_editor_rest_api_preload_paths` filter, if this changes.\n\t\t\t */\n\t\t\tconst userCanEditGlobalStyles = _globalStylesId\n\t\t\t\t? canUser( 'update', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'globalStyles',\n\t\t\t\t\t\tid: _globalStylesId,\n\t\t\t\t } )\n\t\t\t\t: null;\n\n\t\t\tif (\n\t\t\t\t_globalStylesId &&\n\t\t\t\t/*\n\t\t\t\t * Test that the OPTIONS request for user capabilities is complete\n\t\t\t\t * before fetching the global styles entity record.\n\t\t\t\t * This is to avoid fetching the global styles entity unnecessarily.\n\t\t\t\t */\n\t\t\t\ttypeof userCanEditGlobalStyles === 'boolean'\n\t\t\t) {\n\t\t\t\t/*\n\t\t\t\t * Fetch the global styles entity record based on the user's capabilities.\n\t\t\t\t * The default context is `edit` for users who can edit global styles.\n\t\t\t\t * Otherwise, the context is `view`.\n\t\t\t\t * NOTE: There is an equivalent conditional check using `current_user_can()` in the backend\n\t\t\t\t * to preload the global styles entity. Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,\n\t\t\t\t * or set using `block_editor_rest_api_preload_paths` filter, if this changes.\n\t\t\t\t */\n\t\t\t\tif ( userCanEditGlobalStyles ) {\n\t\t\t\t\trecord = getEditedEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\trecord = getEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tif ( _globalStylesId ) {\n\t\t\t\t\thasResolved = userCanEditGlobalStyles\n\t\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t ] )\n\t\t\t\t\t\t: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t\t\t{ context: 'view' },\n\t\t\t\t\t\t ] );\n\t\t\t\t} else {\n\t\t\t\t\thasResolved = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).__experimentalGetCurrentThemeBaseGlobalStyles(),\n\t\t[]\n\t);\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeGlobalStyles( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n"],
5
- "mappings": ";AAGA,SAAS,eAAe,8BAA8B;AACtD,SAAS,SAAS,iBAAiB;AACnC,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,mBAAmB;AACrC,SAAS,yBAAyB;AAKlC,SAAS,cAAc;AAEvB,IAAM,EAAE,iBAAiB,IAAI,OAAQ,sBAAuB;AAE5D,SAAS,4BAA4B;AACpC,QAAM,EAAE,gBAAgB,SAAS,UAAU,QAAQ,OAAO,IAAI;AAAA,IAC7D,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA,uBAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,SAAU;AACtB,YAAM,kBACL,OAAQ,SAAU,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AAM;AAAA,MACN,QAAQ;AAAA,MACR;AAAA,IACD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
6
- "names": ["getEditedEntityRecord"]
7
- }
@@ -1,8 +0,0 @@
1
- // packages/editor/src/components/media/index.js
2
- import { default as default2 } from "./preview.mjs";
3
- import { default as default3 } from "./metadata-panel.mjs";
4
- export {
5
- default3 as MediaMetadataPanel,
6
- default2 as MediaPreview
7
- };
8
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/media/index.js"],
4
- "sourcesContent": ["export { default as MediaPreview } from './preview';\nexport { default as MediaMetadataPanel } from './metadata-panel';\n"],
5
- "mappings": ";AAAA,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAAqC;",
6
- "names": ["default"]
7
- }
@@ -1,65 +0,0 @@
1
- // packages/editor/src/components/media/metadata-panel.js
2
- import { MediaEditorProvider, MediaForm } from "@wordpress/media-editor";
3
- import { useSelect, useDispatch } from "@wordpress/data";
4
- import { useMemo } from "@wordpress/element";
5
- import { store as coreStore } from "@wordpress/core-data";
6
- import { store as editorStore } from "../../store/index.mjs";
7
- import usePostFields from "../post-fields/index.mjs";
8
- import PostCardPanel from "../post-card-panel/index.mjs";
9
- import PostPanelSection from "../post-panel-section/index.mjs";
10
- import { jsx } from "react/jsx-runtime";
11
- function MediaMetadataPanel({ onActionPerformed }) {
12
- const { media, postType, postId } = useSelect((select) => {
13
- const _postType = select(editorStore).getCurrentPostType();
14
- const _postId = select(editorStore).getCurrentPostId();
15
- const currentPost = select(coreStore).getEditedEntityRecord(
16
- "postType",
17
- _postType,
18
- _postId,
19
- {
20
- _embed: "author,wp:attached-to"
21
- }
22
- );
23
- return {
24
- media: currentPost,
25
- postType: _postType,
26
- postId: _postId
27
- };
28
- }, []);
29
- const { editPost } = useDispatch(editorStore);
30
- const fields = usePostFields({ postType: "attachment" });
31
- const settings = useMemo(
32
- () => ({
33
- fields
34
- }),
35
- [fields]
36
- );
37
- const handleUpdate = (updates) => {
38
- editPost(updates);
39
- };
40
- return /* @__PURE__ */ jsx(PostPanelSection, { className: "editor-media-metadata-panel", children: /* @__PURE__ */ jsx(
41
- MediaEditorProvider,
42
- {
43
- value: media,
44
- settings,
45
- onChange: handleUpdate,
46
- children: /* @__PURE__ */ jsx(
47
- MediaForm,
48
- {
49
- header: /* @__PURE__ */ jsx(
50
- PostCardPanel,
51
- {
52
- postType,
53
- postId,
54
- onActionPerformed
55
- }
56
- )
57
- }
58
- )
59
- }
60
- ) });
61
- }
62
- export {
63
- MediaMetadataPanel as default
64
- };
65
- //# sourceMappingURL=metadata-panel.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/media/metadata-panel.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MediaEditorProvider, MediaForm } from '@wordpress/media-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport usePostFields from '../post-fields';\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\n\n/**\n * Media metadata panel for the editor sidebar.\n * Displays a form for editing media properties with PostCardPanel header.\n *\n * @param {Object} props - Component props.\n * @param {Function} props.onActionPerformed - Callback when an action is performed.\n * @return {Element} The MediaMetadataPanel component.\n */\nexport default function MediaMetadataPanel( { onActionPerformed } ) {\n\tconst { media, postType, postId } = useSelect( ( select ) => {\n\t\tconst _postType = select( editorStore ).getCurrentPostType();\n\t\tconst _postId = select( editorStore ).getCurrentPostId();\n\t\tconst currentPost = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId,\n\t\t\t{\n\t\t\t\t_embed: 'author,wp:attached-to',\n\t\t\t}\n\t\t);\n\t\treturn {\n\t\t\tmedia: currentPost,\n\t\t\tpostType: _postType,\n\t\t\tpostId: _postId,\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst fields = usePostFields( { postType: 'attachment' } );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tfields,\n\t\t} ),\n\t\t[ fields ]\n\t);\n\n\tconst handleUpdate = ( updates ) => {\n\t\teditPost( updates );\n\t};\n\n\treturn (\n\t\t<PostPanelSection className=\"editor-media-metadata-panel\">\n\t\t\t<MediaEditorProvider\n\t\t\t\tvalue={ media }\n\t\t\t\tsettings={ settings }\n\t\t\t\tonChange={ handleUpdate }\n\t\t\t>\n\t\t\t\t<MediaForm\n\t\t\t\t\theader={\n\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</MediaEditorProvider>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,qBAAqB,iBAAiB;AAC/C,SAAS,WAAW,mBAAmB;AACvC,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB;AAKnC,SAAS,SAAS,mBAAmB;AACrC,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,sBAAsB;AAoDvB;AA1CS,SAAR,mBAAqC,EAAE,kBAAkB,GAAI;AACnE,QAAM,EAAE,OAAO,UAAU,OAAO,IAAI,UAAW,CAAE,WAAY;AAC5D,UAAM,YAAY,OAAQ,WAAY,EAAE,mBAAmB;AAC3D,UAAM,UAAU,OAAQ,WAAY,EAAE,iBAAiB;AACvD,UAAM,cAAc,OAAQ,SAAU,EAAE;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,MACA;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