@wordpress/edit-site 5.25.1-next.79a6196f.0 → 5.27.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 (324) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/actions/index.js +139 -36
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/editor-canvas-container/index.js +1 -1
  5. package/build/components/editor-canvas-container/index.js.map +1 -1
  6. package/build/components/global-styles/font-families.js +3 -2
  7. package/build/components/global-styles/font-families.js.map +1 -1
  8. package/build/components/global-styles/font-family-item.js +3 -4
  9. package/build/components/global-styles/font-family-item.js.map +1 -1
  10. package/build/components/global-styles/font-library-modal/context.js +80 -41
  11. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/font-collection.js +49 -22
  13. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/fonts-grid.js +4 -1
  15. package/build/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/index.js +4 -4
  17. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/installed-fonts.js +16 -8
  19. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/library-font-card.js +1 -1
  21. package/build/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  23. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  24. package/build/components/global-styles/font-library-modal/local-fonts.js +13 -4
  25. package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
  26. package/build/components/global-styles/font-library-modal/resolvers.js +49 -20
  27. package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  28. package/build/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
  29. package/build/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
  30. package/build/components/global-styles/font-library-modal/utils/index.js +103 -17
  31. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  32. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +4 -3
  33. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  34. package/build/components/global-styles/screen-typography.js +4 -1
  35. package/build/components/global-styles/screen-typography.js.map +1 -1
  36. package/build/components/layout/hooks.js +6 -5
  37. package/build/components/layout/hooks.js.map +1 -1
  38. package/build/components/layout/index.js +19 -28
  39. package/build/components/layout/index.js.map +1 -1
  40. package/build/components/layout/router.js +135 -0
  41. package/build/components/layout/router.js.map +1 -0
  42. package/build/components/page-pages/index.js +92 -69
  43. package/build/components/page-pages/index.js.map +1 -1
  44. package/build/components/page-patterns/dataviews-pattern-actions.js +11 -6
  45. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  46. package/build/components/page-patterns/index.js +295 -15
  47. package/build/components/page-patterns/index.js.map +1 -1
  48. package/build/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +51 -23
  49. package/build/components/page-templates-template-parts/actions.js.map +1 -0
  50. package/build/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
  51. package/build/components/page-templates-template-parts/index.js +395 -0
  52. package/build/components/page-templates-template-parts/index.js.map +1 -0
  53. package/build/components/preferences-modal/index.js +9 -134
  54. package/build/components/preferences-modal/index.js.map +1 -1
  55. package/build/components/revisions/index.js +1 -1
  56. package/build/components/revisions/index.js.map +1 -1
  57. package/build/components/save-button/index.js +4 -2
  58. package/build/components/save-button/index.js.map +1 -1
  59. package/build/components/save-panel/index.js +6 -5
  60. package/build/components/save-panel/index.js.map +1 -1
  61. package/build/components/sidebar/index.js +3 -1
  62. package/build/components/sidebar/index.js.map +1 -1
  63. package/build/components/sidebar-dataviews/dataview-item.js +3 -1
  64. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  65. package/build/components/sidebar-dataviews/default-views.js +4 -2
  66. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  67. package/build/components/sidebar-dataviews/index.js +2 -2
  68. package/build/components/sidebar-dataviews/index.js.map +1 -1
  69. package/build/components/sidebar-navigation-screen/index.js +8 -7
  70. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  71. package/build/components/sidebar-navigation-screen-pages/index.js +2 -10
  72. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  73. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +26 -3
  74. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
  75. package/build/components/sidebar-navigation-screen-templates-browse/content.js +76 -0
  76. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
  77. package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
  78. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  79. package/build/components/site-hub/index.js +3 -1
  80. package/build/components/site-hub/index.js.map +1 -1
  81. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -12
  82. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  83. package/build/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
  84. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  85. package/build/hooks/commands/use-edit-mode-commands.js +33 -5
  86. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  87. package/build/hooks/push-changes-to-global-styles/index.js +13 -6
  88. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  89. package/build/hooks/template-part-edit.js +7 -6
  90. package/build/hooks/template-part-edit.js.map +1 -1
  91. package/build/index.js +1 -1
  92. package/build/index.js.map +1 -1
  93. package/build/store/actions.js +11 -29
  94. package/build/store/actions.js.map +1 -1
  95. package/build/store/private-actions.js +85 -1
  96. package/build/store/private-actions.js.map +1 -1
  97. package/build/store/selectors.js +2 -2
  98. package/build/store/selectors.js.map +1 -1
  99. package/build/utils/get-is-list-page.js +1 -1
  100. package/build/utils/get-is-list-page.js.map +1 -1
  101. package/build/utils/use-actual-current-theme.js +32 -0
  102. package/build/utils/use-actual-current-theme.js.map +1 -0
  103. package/build-module/components/actions/index.js +139 -36
  104. package/build-module/components/actions/index.js.map +1 -1
  105. package/build-module/components/editor-canvas-container/index.js +1 -1
  106. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  107. package/build-module/components/global-styles/font-families.js +3 -2
  108. package/build-module/components/global-styles/font-families.js.map +1 -1
  109. package/build-module/components/global-styles/font-family-item.js +4 -5
  110. package/build-module/components/global-styles/font-family-item.js.map +1 -1
  111. package/build-module/components/global-styles/font-library-modal/context.js +82 -42
  112. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  113. package/build-module/components/global-styles/font-library-modal/font-collection.js +49 -22
  114. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  115. package/build-module/components/global-styles/font-library-modal/fonts-grid.js +4 -1
  116. package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
  117. package/build-module/components/global-styles/font-library-modal/index.js +4 -4
  118. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  119. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +16 -8
  120. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  121. package/build-module/components/global-styles/font-library-modal/library-font-card.js +1 -1
  122. package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
  123. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  124. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  125. package/build-module/components/global-styles/font-library-modal/local-fonts.js +13 -4
  126. package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
  127. package/build-module/components/global-styles/font-library-modal/resolvers.js +45 -18
  128. package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  129. package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
  130. package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
  131. package/build-module/components/global-styles/font-library-modal/utils/index.js +99 -16
  132. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  133. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +4 -3
  134. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  135. package/build-module/components/global-styles/screen-typography.js +4 -1
  136. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  137. package/build-module/components/layout/hooks.js +6 -5
  138. package/build-module/components/layout/hooks.js.map +1 -1
  139. package/build-module/components/layout/index.js +19 -28
  140. package/build-module/components/layout/index.js.map +1 -1
  141. package/build-module/components/layout/router.js +127 -0
  142. package/build-module/components/layout/router.js.map +1 -0
  143. package/build-module/components/page-pages/index.js +91 -70
  144. package/build-module/components/page-pages/index.js.map +1 -1
  145. package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -6
  146. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  147. package/build-module/components/page-patterns/index.js +296 -16
  148. package/build-module/components/page-patterns/index.js.map +1 -1
  149. package/build-module/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +52 -24
  150. package/build-module/components/page-templates-template-parts/actions.js.map +1 -0
  151. package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
  152. package/build-module/components/page-templates-template-parts/index.js +385 -0
  153. package/build-module/components/page-templates-template-parts/index.js.map +1 -0
  154. package/build-module/components/preferences-modal/index.js +12 -136
  155. package/build-module/components/preferences-modal/index.js.map +1 -1
  156. package/build-module/components/revisions/index.js +1 -1
  157. package/build-module/components/revisions/index.js.map +1 -1
  158. package/build-module/components/save-button/index.js +4 -2
  159. package/build-module/components/save-button/index.js.map +1 -1
  160. package/build-module/components/save-panel/index.js +7 -6
  161. package/build-module/components/save-panel/index.js.map +1 -1
  162. package/build-module/components/sidebar/index.js +3 -1
  163. package/build-module/components/sidebar/index.js.map +1 -1
  164. package/build-module/components/sidebar-dataviews/dataview-item.js +3 -1
  165. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  166. package/build-module/components/sidebar-dataviews/default-views.js +4 -2
  167. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  168. package/build-module/components/sidebar-dataviews/index.js +2 -2
  169. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  170. package/build-module/components/sidebar-navigation-screen/index.js +8 -7
  171. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  172. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -10
  173. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  174. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +27 -4
  175. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
  176. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +68 -0
  177. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
  178. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
  179. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  180. package/build-module/components/site-hub/index.js +3 -1
  181. package/build-module/components/site-hub/index.js.map +1 -1
  182. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -11
  183. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  184. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
  185. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  186. package/build-module/hooks/commands/use-edit-mode-commands.js +33 -5
  187. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  188. package/build-module/hooks/push-changes-to-global-styles/index.js +13 -6
  189. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  190. package/build-module/hooks/template-part-edit.js +7 -6
  191. package/build-module/hooks/template-part-edit.js.map +1 -1
  192. package/build-module/index.js +1 -1
  193. package/build-module/index.js.map +1 -1
  194. package/build-module/store/actions.js +13 -30
  195. package/build-module/store/actions.js.map +1 -1
  196. package/build-module/store/private-actions.js +83 -0
  197. package/build-module/store/private-actions.js.map +1 -1
  198. package/build-module/store/selectors.js +2 -2
  199. package/build-module/store/selectors.js.map +1 -1
  200. package/build-module/utils/get-is-list-page.js +1 -1
  201. package/build-module/utils/get-is-list-page.js.map +1 -1
  202. package/build-module/utils/use-actual-current-theme.js +24 -0
  203. package/build-module/utils/use-actual-current-theme.js.map +1 -0
  204. package/build-style/style-rtl.css +293 -188
  205. package/build-style/style.css +293 -188
  206. package/package.json +42 -42
  207. package/src/components/actions/index.js +236 -84
  208. package/src/components/editor-canvas-container/index.js +1 -1
  209. package/src/components/global-styles/font-families.js +14 -8
  210. package/src/components/global-styles/font-family-item.js +7 -4
  211. package/src/components/global-styles/font-library-modal/context.js +156 -50
  212. package/src/components/global-styles/font-library-modal/font-collection.js +56 -21
  213. package/src/components/global-styles/font-library-modal/fonts-grid.js +6 -2
  214. package/src/components/global-styles/font-library-modal/index.js +4 -4
  215. package/src/components/global-styles/font-library-modal/installed-fonts.js +18 -8
  216. package/src/components/global-styles/font-library-modal/library-font-card.js +2 -1
  217. package/src/components/global-styles/font-library-modal/library-font-variant.js +10 -9
  218. package/src/components/global-styles/font-library-modal/local-fonts.js +14 -4
  219. package/src/components/global-styles/font-library-modal/resolvers.js +50 -17
  220. package/src/components/global-styles/font-library-modal/style.scss +1 -0
  221. package/src/components/global-styles/font-library-modal/utils/filter-fonts.js +19 -2
  222. package/src/components/global-styles/font-library-modal/utils/index.js +136 -29
  223. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +7 -3
  224. package/src/components/global-styles/font-library-modal/utils/test/filter-fonts.spec.js +40 -10
  225. package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +5 -5
  226. package/src/components/global-styles/screen-typography.js +9 -3
  227. package/src/components/global-styles/style.scss +4 -0
  228. package/src/components/header-edit-mode/style.scss +15 -5
  229. package/src/components/layout/hooks.js +6 -5
  230. package/src/components/layout/index.js +80 -96
  231. package/src/components/layout/router.js +121 -0
  232. package/src/components/layout/style.scss +13 -16
  233. package/src/components/page/style.scss +1 -8
  234. package/src/components/page-pages/index.js +142 -148
  235. package/src/components/page-pages/style.scss +41 -2
  236. package/src/components/page-patterns/dataviews-pattern-actions.js +11 -6
  237. package/src/components/page-patterns/index.js +392 -14
  238. package/src/components/page-patterns/style.scss +36 -2
  239. package/src/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +90 -37
  240. package/src/components/{page-templates → page-templates-template-parts}/index.js +198 -169
  241. package/src/components/page-templates-template-parts/style.scss +44 -0
  242. package/src/components/preferences-modal/index.js +8 -211
  243. package/src/components/revisions/index.js +1 -1
  244. package/src/components/save-button/index.js +7 -4
  245. package/src/components/save-panel/index.js +13 -12
  246. package/src/components/sidebar/index.js +4 -5
  247. package/src/components/sidebar-dataviews/dataview-item.js +2 -1
  248. package/src/components/sidebar-dataviews/default-views.js +4 -2
  249. package/src/components/sidebar-dataviews/index.js +8 -6
  250. package/src/components/sidebar-navigation-item/style.scss +1 -1
  251. package/src/components/sidebar-navigation-screen/index.js +19 -10
  252. package/src/components/sidebar-navigation-screen-pages/index.js +2 -10
  253. package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +32 -6
  254. package/src/components/sidebar-navigation-screen-templates-browse/content.js +73 -0
  255. package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -1
  256. package/src/components/site-hub/index.js +4 -1
  257. package/src/components/site-hub/style.scss +1 -12
  258. package/src/components/site-icon/style.scss +1 -1
  259. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +40 -10
  260. package/src/components/sync-state-with-url/use-sync-path-with-url.js +32 -0
  261. package/src/hooks/commands/use-edit-mode-commands.js +50 -3
  262. package/src/hooks/push-changes-to-global-styles/index.js +29 -23
  263. package/src/hooks/template-part-edit.js +12 -12
  264. package/src/index.js +1 -1
  265. package/src/store/actions.js +17 -51
  266. package/src/store/private-actions.js +133 -0
  267. package/src/store/selectors.js +2 -4
  268. package/src/style.scss +1 -1
  269. package/src/utils/get-is-list-page.js +3 -2
  270. package/src/utils/use-actual-current-theme.js +27 -0
  271. package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
  272. package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
  273. package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -71
  274. package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
  275. package/build/components/page-main/index.js +0 -44
  276. package/build/components/page-main/index.js.map +0 -1
  277. package/build/components/page-patterns/dataviews-patterns.js +0 -307
  278. package/build/components/page-patterns/dataviews-patterns.js.map +0 -1
  279. package/build/components/page-template-parts/add-new-template-part.js.map +0 -1
  280. package/build/components/page-template-parts/index.js +0 -81
  281. package/build/components/page-template-parts/index.js.map +0 -1
  282. package/build/components/page-templates/index.js +0 -352
  283. package/build/components/page-templates/index.js.map +0 -1
  284. package/build/components/page-templates/template-actions.js.map +0 -1
  285. package/build/components/post-preview/index.js +0 -29
  286. package/build/components/post-preview/index.js.map +0 -1
  287. package/build/components/preferences-modal/enable-feature.js +0 -36
  288. package/build/components/preferences-modal/enable-feature.js.map +0 -1
  289. package/build/components/preferences-modal/enable-panel-option.js +0 -33
  290. package/build/components/preferences-modal/enable-panel-option.js.map +0 -1
  291. package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -52
  292. package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
  293. package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -63
  294. package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
  295. package/build-module/components/page-main/index.js +0 -36
  296. package/build-module/components/page-main/index.js.map +0 -1
  297. package/build-module/components/page-patterns/dataviews-patterns.js +0 -299
  298. package/build-module/components/page-patterns/dataviews-patterns.js.map +0 -1
  299. package/build-module/components/page-template-parts/add-new-template-part.js.map +0 -1
  300. package/build-module/components/page-template-parts/index.js +0 -73
  301. package/build-module/components/page-template-parts/index.js.map +0 -1
  302. package/build-module/components/page-templates/index.js +0 -344
  303. package/build-module/components/page-templates/index.js.map +0 -1
  304. package/build-module/components/page-templates/template-actions.js.map +0 -1
  305. package/build-module/components/post-preview/index.js +0 -21
  306. package/build-module/components/post-preview/index.js.map +0 -1
  307. package/build-module/components/preferences-modal/enable-feature.js +0 -29
  308. package/build-module/components/preferences-modal/enable-feature.js.map +0 -1
  309. package/build-module/components/preferences-modal/enable-panel-option.js +0 -26
  310. package/build-module/components/preferences-modal/enable-panel-option.js.map +0 -1
  311. package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
  312. package/src/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -62
  313. package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +0 -271
  314. package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +0 -58
  315. package/src/components/page-main/index.js +0 -38
  316. package/src/components/page-patterns/dataviews-patterns.js +0 -380
  317. package/src/components/page-template-parts/index.js +0 -99
  318. package/src/components/page-templates/style.scss +0 -13
  319. package/src/components/post-preview/index.js +0 -16
  320. package/src/components/preferences-modal/enable-feature.js +0 -31
  321. package/src/components/preferences-modal/enable-panel-option.js +0 -23
  322. /package/build/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
  323. /package/build-module/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
  324. /package/src/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.27.0 (2024-01-24)
6
+
7
+ ## 5.26.0 (2024-01-10)
8
+
5
9
  ## 5.25.0 (2023-12-13)
6
10
 
7
11
  ## 5.24.0 (2023-11-29)
@@ -41,10 +41,12 @@ const trashPostAction = {
41
41
  }) {
42
42
  return status !== 'trash';
43
43
  },
44
+ supportsBulk: true,
44
45
  hideModalHeader: true,
45
46
  RenderModal: ({
46
- item: post,
47
- closeModal
47
+ items: posts,
48
+ closeModal,
49
+ onPerform
48
50
  }) => {
49
51
  const {
50
52
  createSuccessNotice,
@@ -55,9 +57,11 @@ const trashPostAction = {
55
57
  } = (0, _data.useDispatch)(_coreData.store);
56
58
  return (0, _react.createElement)(_components.__experimentalVStack, {
57
59
  spacing: "5"
58
- }, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.sprintf)(
60
+ }, (0, _react.createElement)(_components.__experimentalText, null, posts.length === 1 ? (0, _i18n.sprintf)(
59
61
  // translators: %s: The page's title.
60
- (0, _i18n.__)('Are you sure you want to delete "%s"?'), (0, _htmlEntities.decodeEntities)(post.title.rendered))), (0, _react.createElement)(_components.__experimentalHStack, {
62
+ (0, _i18n.__)('Are you sure you want to delete "%s"?'), (0, _htmlEntities.decodeEntities)(posts[0].title.rendered)) : (0, _i18n.sprintf)(
63
+ // translators: %d: The number of pages (2 or more).
64
+ (0, _i18n.__)('Are you sure you want to delete %d pages?'), posts.length)), (0, _react.createElement)(_components.__experimentalHStack, {
61
65
  justify: "right"
62
66
  }, (0, _react.createElement)(_components.Button, {
63
67
  variant: "tertiary",
@@ -65,21 +69,65 @@ const trashPostAction = {
65
69
  }, (0, _i18n.__)('Cancel')), (0, _react.createElement)(_components.Button, {
66
70
  variant: "primary",
67
71
  onClick: async () => {
68
- try {
69
- await deleteEntityRecord('postType', post.type, post.id, {}, {
72
+ const promiseResult = await Promise.allSettled(posts.map(post => {
73
+ return deleteEntityRecord('postType', post.type, post.id, {}, {
70
74
  throwOnError: true
71
75
  });
72
- createSuccessNotice((0, _i18n.sprintf)( /* translators: The page's title. */
73
- (0, _i18n.__)('"%s" moved to the Trash.'), (0, _htmlEntities.decodeEntities)(post.title.rendered)), {
76
+ }));
77
+ // If all the promises were fulfilled with success.
78
+ if (promiseResult.every(({
79
+ status
80
+ }) => status === 'fulfilled')) {
81
+ let successMessage;
82
+ if (promiseResult.length === 1) {
83
+ successMessage = (0, _i18n.sprintf)( /* translators: The posts's title. */
84
+ (0, _i18n.__)('"%s" moved to the Trash.'), (0, _htmlEntities.decodeEntities)(posts[0].title.rendered));
85
+ } else {
86
+ successMessage = (0, _i18n.__)('Pages moved to the Trash.');
87
+ }
88
+ createSuccessNotice(successMessage, {
74
89
  type: 'snackbar',
75
90
  id: 'edit-site-page-trashed'
76
91
  });
77
- } catch (error) {
78
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while moving the page to the trash.');
79
- createErrorNotice(errorMessage, {
80
- type: 'snackbar'
81
- });
92
+ } else {
93
+ // If there was at lease one failure.
94
+ let errorMessage;
95
+ // If we were trying to move a single post to the trash.
96
+ if (promiseResult.length === 1) {
97
+ if (promiseResult[0].reason?.message) {
98
+ errorMessage = promiseResult[0].reason.message;
99
+ } else {
100
+ errorMessage = (0, _i18n.__)('An error occurred while moving the post to the trash.');
101
+ }
102
+ // If we were trying to move multiple posts to the trash
103
+ } else {
104
+ const errorMessages = new Set();
105
+ const failedPromises = promiseResult.filter(({
106
+ status
107
+ }) => status === 'rejected');
108
+ for (const failedPromise of failedPromises) {
109
+ if (failedPromise.reason?.message) {
110
+ errorMessages.add(failedPromise.reason.message);
111
+ }
112
+ }
113
+ if (errorMessages.size === 0) {
114
+ errorMessage = (0, _i18n.__)('An error occurred while moving the posts to the trash.');
115
+ } else if (errorMessages.size === 1) {
116
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
117
+ (0, _i18n.__)('An error occurred while moving the posts to the trash: %s'), [...errorMessages][0]);
118
+ } else {
119
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
120
+ (0, _i18n.__)('Some errors occurred while moving the pages to the trash: %s'), [...errorMessages].join(','));
121
+ }
122
+ createErrorNotice(errorMessage, {
123
+ type: 'snackbar'
124
+ });
125
+ }
82
126
  }
127
+ if (onPerform) {
128
+ onPerform();
129
+ }
130
+ closeModal();
83
131
  }
84
132
  }, (0, _i18n.__)('Delete'))));
85
133
  }
@@ -98,28 +146,69 @@ function usePermanentlyDeletePostAction() {
98
146
  label: (0, _i18n.__)('Permanently delete'),
99
147
  isPrimary: true,
100
148
  icon: _icons.trash,
149
+ supportsBulk: true,
101
150
  isEligible({
102
151
  status
103
152
  }) {
104
153
  return status === 'trash';
105
154
  },
106
- async callback(post) {
107
- try {
108
- await deleteEntityRecord('postType', post.type, post.id, {
155
+ async callback(posts) {
156
+ const promiseResult = await Promise.allSettled(posts.map(post => {
157
+ return deleteEntityRecord('postType', post.type, post.id, {
109
158
  force: true
110
159
  }, {
111
160
  throwOnError: true
112
161
  });
113
- createSuccessNotice((0, _i18n.sprintf)( /* translators: The posts's title. */
114
- (0, _i18n.__)('"%s" permanently deleted.'), (0, _htmlEntities.decodeEntities)(post.title.rendered)), {
162
+ }));
163
+ // If all the promises were fulfilled with success.
164
+ if (promiseResult.every(({
165
+ status
166
+ }) => status === 'fulfilled')) {
167
+ let successMessage;
168
+ if (promiseResult.length === 1) {
169
+ successMessage = (0, _i18n.sprintf)( /* translators: The posts's title. */
170
+ (0, _i18n.__)('"%s" permanently deleted.'), (0, _htmlEntities.decodeEntities)(posts[0].title.rendered));
171
+ } else {
172
+ successMessage = (0, _i18n.__)('The posts were permanently deleted.');
173
+ }
174
+ createSuccessNotice(successMessage, {
115
175
  type: 'snackbar',
116
176
  id: 'edit-site-post-permanently-deleted'
117
177
  });
118
- } catch (error) {
119
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while permanently deleting the post.');
120
- createErrorNotice(errorMessage, {
121
- type: 'snackbar'
122
- });
178
+ } else {
179
+ // If there was at lease one failure.
180
+ let errorMessage;
181
+ // If we were trying to permanently delete a single post.
182
+ if (promiseResult.length === 1) {
183
+ if (promiseResult[0].reason?.message) {
184
+ errorMessage = promiseResult[0].reason.message;
185
+ } else {
186
+ errorMessage = (0, _i18n.__)('An error occurred while permanently deleting the post.');
187
+ }
188
+ // If we were trying to permanently delete multiple posts
189
+ } else {
190
+ const errorMessages = new Set();
191
+ const failedPromises = promiseResult.filter(({
192
+ status
193
+ }) => status === 'rejected');
194
+ for (const failedPromise of failedPromises) {
195
+ if (failedPromise.reason?.message) {
196
+ errorMessages.add(failedPromise.reason.message);
197
+ }
198
+ }
199
+ if (errorMessages.size === 0) {
200
+ errorMessage = (0, _i18n.__)('An error occurred while permanently deleting the posts.');
201
+ } else if (errorMessages.size === 1) {
202
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
203
+ (0, _i18n.__)('An error occurred while permanently deleting the posts: %s'), [...errorMessages][0]);
204
+ } else {
205
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
206
+ (0, _i18n.__)('Some errors occurred while permanently deleting the posts: %s'), [...errorMessages].join(','));
207
+ }
208
+ createErrorNotice(errorMessage, {
209
+ type: 'snackbar'
210
+ });
211
+ }
123
212
  }
124
213
  }
125
214
  }), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
@@ -138,26 +227,37 @@ function useRestorePostAction() {
138
227
  label: (0, _i18n.__)('Restore'),
139
228
  isPrimary: true,
140
229
  icon: _icons.backup,
230
+ supportsBulk: true,
141
231
  isEligible({
142
232
  status
143
233
  }) {
144
234
  return status === 'trash';
145
235
  },
146
- async callback(post) {
147
- await editEntityRecord('postType', post.type, post.id, {
148
- status: 'draft'
149
- });
236
+ async callback(posts) {
150
237
  try {
151
- await saveEditedEntityRecord('postType', post.type, post.id, {
152
- throwOnError: true
153
- });
154
- createSuccessNotice((0, _i18n.sprintf)( /* translators: The posts's title. */
155
- (0, _i18n.__)('"%s" has been restored.'), (0, _htmlEntities.decodeEntities)(post.title.rendered)), {
238
+ for (const post of posts) {
239
+ await editEntityRecord('postType', post.type, post.id, {
240
+ status: 'draft'
241
+ });
242
+ await saveEditedEntityRecord('postType', post.type, post.id, {
243
+ throwOnError: true
244
+ });
245
+ }
246
+ createSuccessNotice(posts.length > 1 ? (0, _i18n.sprintf)( /* translators: The number of posts. */
247
+ (0, _i18n.__)('%d posts have been restored.'), posts.length) : (0, _i18n.sprintf)( /* translators: The number of posts. */
248
+ (0, _i18n.__)('"%s" has been restored.'), (0, _htmlEntities.decodeEntities)(posts[0].title.rendered)), {
156
249
  type: 'snackbar',
157
250
  id: 'edit-site-post-restored'
158
251
  });
159
252
  } catch (error) {
160
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while restoring the post.');
253
+ let errorMessage;
254
+ if (error.message && error.code !== 'unknown_error' && error.message) {
255
+ errorMessage = error.message;
256
+ } else if (posts.length > 1) {
257
+ errorMessage = (0, _i18n.__)('An error occurred while restoring the posts.');
258
+ } else {
259
+ errorMessage = (0, _i18n.__)('An error occurred while restoring the post.');
260
+ }
161
261
  createErrorNotice(errorMessage, {
162
262
  type: 'snackbar'
163
263
  });
@@ -173,7 +273,8 @@ const viewPostAction = {
173
273
  isEligible(post) {
174
274
  return post.status !== 'trash';
175
275
  },
176
- callback(post) {
276
+ callback(posts) {
277
+ const post = posts[0];
177
278
  document.location.href = post.link;
178
279
  }
179
280
  };
@@ -188,7 +289,8 @@ function useEditPostAction() {
188
289
  }) {
189
290
  return status !== 'trash';
190
291
  },
191
- callback(post) {
292
+ callback(posts) {
293
+ const post = posts[0];
192
294
  history.push({
193
295
  postId: post.id,
194
296
  postType: post.type,
@@ -210,7 +312,8 @@ const postRevisionsAction = {
210
312
  const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
211
313
  return lastRevisionId && revisionsCount > 1;
212
314
  },
213
- callback(post) {
315
+ callback(posts) {
316
+ const post = posts[0];
214
317
  const href = (0, _url.addQueryArgs)('revision.php', {
215
318
  revision: post?._links?.['predecessor-version']?.[0]?.id
216
319
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_router","_components","_lockUnlock","useHistory","unlock","routerPrivateApis","trashPostAction","id","label","__","isPrimary","icon","trash","isEligible","status","hideModalHeader","RenderModal","item","post","closeModal","createSuccessNotice","createErrorNotice","useDispatch","noticesStore","deleteEntityRecord","coreStore","_react","createElement","__experimentalVStack","spacing","__experimentalText","sprintf","decodeEntities","title","rendered","__experimentalHStack","justify","Button","variant","onClick","type","throwOnError","error","errorMessage","message","code","exports","usePermanentlyDeletePostAction","useMemo","callback","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","backup","viewPostAction","external","document","location","href","link","useEditPostAction","history","push","postId","postType","canvas","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","addQueryArgs","revision"],"sources":["@wordpress/edit-site/src/components/actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport const trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\thideModalHeader: true,\n\tRenderModal: ( { item: post, closeModal } ) => {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: The page's title.\n\t\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\t\terror.message &&\n\t\t\t\t\t\t\t\t\terror.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the page to the trash.'\n\t\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nexport function usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: trash,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( post ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-permanently-deleted',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nexport function useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( post ) {\n\t\t\t\tawait editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t\ttry {\n\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-restored',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\n}\n\nexport const viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( post ) {\n\t\tdocument.location.href = post.link;\n\t},\n};\n\nexport function useEditPostAction() {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tcallback( post ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n}\nexport const postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( post ) {\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t},\n};\n"],"mappings":";;;;;;;;;;;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AAK,OAAO,EAAG;MAC9B,OAAO,KAAK;IACb;IACA,MAAMwD,cAAc,IAAAF,qBAAA,GACnBlD,IAAI,EAAEqD,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEhE,EAAE,cAAA6D,qBAAA,cAAAA,qBAAA,GAAI,IAAI;IAC3D,MAAMI,cAAc,IAAAH,oBAAA,GACnBnD,IAAI,EAAEqD,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEE,KAAK,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,CAAC;IACvD,OAAOC,cAAc,IAAIE,cAAc,GAAG,CAAC;EAC5C,CAAC;EACDvB,QAAQA,CAAE/B,IAAI,EAAG;IAChB,MAAMyC,IAAI,GAAG,IAAAe,iBAAY,EAAE,cAAc,EAAE;MAC1CC,QAAQ,EAAEzD,IAAI,EAAEqD,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEhE;IAC3D,CAAE,CAAC;IACHkD,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAGA,IAAI;EAC9B;AACD,CAAC;AAACb,OAAA,CAAAqB,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_router","_components","_lockUnlock","useHistory","unlock","routerPrivateApis","trashPostAction","id","label","__","isPrimary","icon","trash","isEligible","status","supportsBulk","hideModalHeader","RenderModal","items","posts","closeModal","onPerform","createSuccessNotice","createErrorNotice","useDispatch","noticesStore","deleteEntityRecord","coreStore","_react","createElement","__experimentalVStack","spacing","__experimentalText","length","sprintf","decodeEntities","title","rendered","__experimentalHStack","justify","Button","variant","onClick","promiseResult","Promise","allSettled","map","post","type","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","exports","usePermanentlyDeletePostAction","useMemo","callback","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","backup","error","code","viewPostAction","external","document","location","href","link","useEditPostAction","history","push","postId","postType","canvas","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","addQueryArgs","revision"],"sources":["@wordpress/edit-site/src/components/actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport const trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items: posts, closeModal, onPerform } ) => {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ posts.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The page's title.\n\t\t\t\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tdecodeEntities( posts[ 0 ].title.rendered )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of pages (2 or more).\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete %d pages?'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tposts[ 0 ].title.rendered\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t\t\t\t'Pages moved to the Trash.'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the post to the trash.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'Some errors occurred while moving the pages to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( onPerform ) {\n\t\t\t\t\t\t\t\tonPerform();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nexport function usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: trash,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tdecodeEntities( posts[ 0 ].title.rendered )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'edit-site-post-permanently-deleted',\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nexport function useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts ) {\n\t\t\t\ttry {\n\t\t\t\t\tfor ( const post of posts ) {\n\t\t\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tposts.length > 1\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities( posts[ 0 ].title.rendered )\n\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-restored',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\tif (\n\t\t\t\t\t\terror.message &&\n\t\t\t\t\t\terror.code !== 'unknown_error' &&\n\t\t\t\t\t\terror.message\n\t\t\t\t\t) {\n\t\t\t\t\t\terrorMessage = error.message;\n\t\t\t\t\t} else if ( posts.length > 1 ) {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\n}\n\nexport const viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts ) {\n\t\tconst post = posts[ 0 ];\n\t\tdocument.location.href = post.link;\n\t},\n};\n\nexport function useEditPostAction() {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tcallback( posts ) {\n\t\t\t\tconst post = posts[ 0 ];\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n}\nexport const postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t},\n};\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAUA,IAAAU,WAAA,GAAAV,OAAA;AAtBA;AACA;AACA;;AAiBA;AACA;AACA;;AAGA,MAAM;EAAEW;AAAW,CAAC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E;MAC1CC,QAAQ,EAAE/C,IAAI,EAAE2C,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEnF;IAC3D,CAAE,CAAC;IACHqE,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAGA,IAAI;EAC9B;AACD,CAAC;AAACf,OAAA,CAAAuB,mBAAA,GAAAA,mBAAA"}
@@ -41,7 +41,7 @@ function getEditorCanvasContainerTitle(view) {
41
41
  return (0, _i18n.__)('Style Book');
42
42
  case 'global-styles-revisions':
43
43
  case 'global-styles-revisions:style-book':
44
- return (0, _i18n.__)('Global styles revisions');
44
+ return (0, _i18n.__)('Style Revisions');
45
45
  default:
46
46
  return '';
47
47
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_resizableEditor","_interopRequireDefault","getEditorCanvasContainerTitle","view","__","createPrivateSlotFill","unlock","componentsPrivateApis","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","useSelect","select","_editorCanvasContainerView","editSiteStore","getEditorCanvasContainerView","_showListViewByDefault","preferencesStore","get","isClosed","setIsClosed","useState","setEditorCanvasContainerView","useDispatch","setIsListViewOpened","editorStore","focusOnMountRef","useFocusOnMount","sectionFocusReturnRef","useFocusReturn","title","useMemo","onCloseContainer","undefined","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","Children","map","child","index","cloneElement","ref","shouldShowCloseButton","_react","createElement","default","className","onKeyDown","Button","icon","closeSmall","label","onClick","showTooltip","useHasEditorCanvasContainer","fills","useSlotFills","length","_default","exports"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState, useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport ResizableEditor from '../block-editor/resizable-editor';\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {string} Translated string corresponding to value of view. Default is ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Global styles revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\n// Creates a private slot fill.\nconst { createPrivateSlotFill } = unlock( componentsPrivateApis );\nconst SLOT_FILL_NAME = 'EditSiteEditorCanvasContainerSlot';\nconst {\n\tprivateKey,\n\tSlot: EditorCanvasContainerSlot,\n\tFill: EditorCanvasContainerFill,\n} = createPrivateSlotFill( SLOT_FILL_NAME );\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\tconst title = useMemo(\n\t\t() => getEditorCanvasContainerTitle( editorCanvasContainerView ),\n\t\t[ editorCanvasContainerView ]\n\t);\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorCanvasContainerFill>\n\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t<section\n\t\t\t\t\tclassName=\"edit-site-editor-canvas-container\"\n\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\taria-label={ title }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t</section>\n\t\t\t</ResizableEditor>\n\t\t</EditorCanvasContainerFill>\n\t);\n}\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( privateKey );\n\treturn !! fills?.length;\n}\n\nEditorCanvasContainer.Slot = EditorCanvasContainerSlot;\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAC,sBAAA,CAAAZ,OAAA;AAtBA;AACA;AACA;;AAeA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASa,6BAA6BA,CAAEC,IAAI,EAAG;EAC9C,QAASA,IAAI;IACZ,KAAK,YAAY;MAChB,OAAO,IAAAC,QAAE,EAAE,YAAa,CAAC;IAC1B,KAAK,yBAAyB;IAC9B,KAAK,o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AS,EAAGpB,aAAe;IAC3B,cAAaJ;EAAO,GAElBmB,qBAAqB,IACtB,IAAAC,MAAA,CAAAC,aAAA,EAACvE,WAAA,CAAA2E,MAAM;IACNF,SAAS,EAAC,iDAAiD;IAC3DG,IAAI,EAAGC,iBAAY;IACnBC,KAAK,EAAGpD,gBAAgB,IAAI,IAAAZ,QAAE,EAAE,OAAQ,CAAG;IAC3CiE,OAAO,EAAG3B,gBAAkB;IAC5B4B,WAAW,EAAG;EAAO,CACrB,CACD,EACCpB,iBACM,CACO,CACS,CAAC;AAE9B;AACA,SAASqB,2BAA2BA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAEhE,UAAW,CAAC;EACxC,OAAO,CAAC,CAAE+D,KAAK,EAAEE,MAAM;AACxB;AAEA5D,qBAAqB,CAACJ,IAAI,GAAGC,yBAAyB;AAAC,IAAAgE,QAAA,GACxC7D,qBAAqB;AAAA8D,OAAA,CAAAd,OAAA,GAAAa,QAAA"}
1
+ {"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_resizableEditor","_interopRequireDefault","getEditorCanvasContainerTitle","view","__","createPrivateSlotFill","unlock","componentsPrivateApis","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","useSelect","select","_editorCanvasContainerView","editSiteStore","getEditorCanvasContainerView","_showListViewByDefault","preferencesStore","get","isClosed","setIsClosed","useState","setEditorCanvasContainerView","useDispatch","setIsListViewOpened","editorStore","focusOnMountRef","useFocusOnMount","sectionFocusReturnRef","useFocusReturn","title","useMemo","onCloseContainer","undefined","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","Children","map","child","index","cloneElement","ref","shouldShowCloseButton","_react","createElement","default","className","onKeyDown","Button","icon","closeSmall","label","onClick","showTooltip","useHasEditorCanvasContainer","fills","useSlotFills","length","_default","exports"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState, useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport ResizableEditor from '../block-editor/resizable-editor';\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {string} Translated string corresponding to value of view. Default is ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Style Revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\n// Creates a private slot fill.\nconst { createPrivateSlotFill } = unlock( componentsPrivateApis );\nconst SLOT_FILL_NAME = 'EditSiteEditorCanvasContainerSlot';\nconst {\n\tprivateKey,\n\tSlot: EditorCanvasContainerSlot,\n\tFill: EditorCanvasContainerFill,\n} = createPrivateSlotFill( SLOT_FILL_NAME );\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\tconst title = useMemo(\n\t\t() => getEditorCanvasContainerTitle( editorCanvasContainerView ),\n\t\t[ editorCanvasContainerView ]\n\t);\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorCanvasContainerFill>\n\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t<section\n\t\t\t\t\tclassName=\"edit-site-editor-canvas-container\"\n\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\taria-label={ title }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t</section>\n\t\t\t</ResizableEditor>\n\t\t</EditorCanvasContainerFill>\n\t);\n}\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( privateKey );\n\treturn !! fills?.length;\n}\n\nEditorCanvasContainer.Slot = EditorCanvasContainerSlot;\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAC,sBAAA,CAAAZ,OAAA;AAtBA;AACA;AACA;;AAeA;AACA;AACA;;AAKA;AACA;AACA;AACA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,CAAA8D,OAAe;IAAC5C,cAAc,EAAGA;EAAgB,GAEjD,IAAA0C,MAAA,CAAAC,aAAA;IACCE,SAAS,EAAC,mCAAmC;IAC7CL,GAAG,EAAGC,qBAAqB,GAAGvB,eAAe,GAAG,IAAM;IACtD4B,SAAS,EAAGpB,aAAe;IAC3B,cAAaJ;EAAO,GAElBmB,qBAAqB,IACtB,IAAAC,MAAA,CAAAC,aAAA,EAACvE,WAAA,CAAA2E,MAAM;IACNF,SAAS,EAAC,iDAAiD;IAC3DG,IAAI,EAAGC,iBAAY;IACnBC,KAAK,EAAGpD,gBAAgB,IAAI,IAAAZ,QAAE,EAAE,OAAQ,CAAG;IAC3CiE,OAAO,EAAG3B,gBAAkB;IAC5B4B,WAAW,EAAG;EAAO,CACrB,CACD,EACCpB,iBACM,CACO,CACS,CAAC;AAE9B;AACA,SAASqB,2BAA2BA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAEhE,UAAW,CAAC;EACxC,OAAO,CAAC,CAAE+D,KAAK,EAAEE,MAAM;AACxB;AAEA5D,qBAAqB,CAACJ,IAAI,GAAGC,yBAAyB;AAAC,IAAAgE,QAAA,GACxC7D,qBAAqB;AAAA8D,OAAA,CAAAd,OAAA,GAAAa,QAAA"}
@@ -31,6 +31,7 @@ function FontFamilies() {
31
31
  themeFonts,
32
32
  customFonts
33
33
  } = (0, _element.useContext)(_context.FontLibraryContext);
34
+ const hasFonts = 0 < customFonts.length || 0 < themeFonts.length;
34
35
  return (0, _react.createElement)(_react.Fragment, null, !!modalTabOpen && (0, _react.createElement)(_fontLibraryModal.default, {
35
36
  onRequestClose: () => toggleModal(),
36
37
  initialTabName: modalTabOpen
@@ -49,7 +50,7 @@ function FontFamilies() {
49
50
  "aria-label": (0, _i18n.__)('Manage fonts'),
50
51
  icon: _icons.typography,
51
52
  size: 'small'
52
- })))), (0, _react.createElement)(_components.__experimentalItemGroup, {
53
+ })))), hasFonts ? (0, _react.createElement)(_components.__experimentalItemGroup, {
53
54
  isBordered: true,
54
55
  isSeparated: true
55
56
  }, customFonts.map(font => (0, _react.createElement)(_fontFamilyItem.default, {
@@ -58,7 +59,7 @@ function FontFamilies() {
58
59
  })), themeFonts.map(font => (0, _react.createElement)(_fontFamilyItem.default, {
59
60
  key: font.slug,
60
61
  font: font
61
- })))));
62
+ }))) : (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('No fonts installed.'))));
62
63
  }
63
64
  var _default = ({
64
65
  ...props
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_icons","_element","_context","_interopRequireWildcard","_fontLibraryModal","_interopRequireDefault","_fontFamilyItem","_subtitle","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","FontFamilies","modalTabOpen","toggleModal","themeFonts","customFonts","useContext","FontLibraryContext","_react","createElement","Fragment","onRequestClose","initialTabName","__experimentalVStack","spacing","__experimentalHStack","justify","level","__","Tooltip","text","Button","onClick","icon","typography","size","__experimentalItemGroup","isBordered","isSeparated","map","font","slug","_default","props","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/font-families.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tButton,\n\tTooltip,\n} from '@wordpress/components';\nimport { typography } from '@wordpress/icons';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FontLibraryProvider, {\n\tFontLibraryContext,\n} from './font-library-modal/context';\nimport FontLibraryModal from './font-library-modal';\nimport FontFamilyItem from './font-family-item';\nimport Subtitle from './subtitle';\n\nfunction FontFamilies() {\n\tconst { modalTabOpen, toggleModal, themeFonts, customFonts } =\n\t\tuseContext( FontLibraryContext );\n\n\treturn (\n\t\t<>\n\t\t\t{ !! modalTabOpen && (\n\t\t\t\t<FontLibraryModal\n\t\t\t\t\tonRequestClose={ () => toggleModal() }\n\t\t\t\t\tinitialTabName={ modalTabOpen }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>\n\t\t\t\t\t<HStack justify=\"flex-end\">\n\t\t\t\t\t\t<Tooltip text={ __( 'Manage fonts' ) }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggleModal( 'installed-fonts' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-label={ __( 'Manage fonts' ) }\n\t\t\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\t\t\tsize={ 'small' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ customFonts.map( ( font ) => (\n\t\t\t\t\t\t<FontFamilyItem key={ font.slug } font={ font } />\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ themeFonts.map( ( font ) => (\n\t\t\t\t\t\t<FontFamilyItem key={ font.slug } font={ font } />\n\t\t\t\t\t) ) }\n\t\t\t\t</ItemGroup>\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default ( { ...props } ) => (\n\t<FontLibraryProvider>\n\t\t<FontFamilies { ...props } />\n\t</FontLibraryProvider>\n);\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAC,uBAAA,CAAAL,OAAA;A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AU;IAACC,WAAW;EAAA,GAC9BvB,WAAW,CAACwB,GAAG,CAAIC,IAAI,IACxB,IAAAtB,MAAA,CAAAC,aAAA,EAAChC,eAAA,CAAAS,OAAc;IAACS,GAAG,EAAGmC,IAAI,CAACC,IAAM;IAACD,IAAI,EAAGA;EAAM,CAAE,CAChD,CAAC,EACD1B,UAAU,CAACyB,GAAG,CAAIC,IAAI,IACvB,IAAAtB,MAAA,CAAAC,aAAA,EAAChC,eAAA,CAAAS,OAAc;IAACS,GAAG,EAAGmC,IAAI,CAACC,IAAM;IAACD,IAAI,EAAGA;EAAM,CAAE,CAChD,CACQ,CACJ,CACP,CAAC;AAEL;AAAC,IAAAE,QAAA,GAEcA,CAAE;EAAE,GAAGC;AAAM,CAAC,KAC5B,IAAAzB,MAAA,CAAAC,aAAA,EAACpC,QAAA,CAAAa,OAAmB,QACnB,IAAAsB,MAAA,CAAAC,aAAA,EAACR,YAAY;EAAA,GAAMgC;AAAK,CAAI,CACR,CACrB;AAAAC,OAAA,CAAAhD,OAAA,GAAA8C,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_components","_icons","_element","_context","_interopRequireWildcard","_fontLibraryModal","_interopRequireDefault","_fontFamilyItem","_subtitle","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","FontFamilies","modalTabOpen","toggleModal","themeFonts","customFonts","useContext","FontLibraryContext","hasFonts","length","_react","createElement","Fragment","onRequestClose","initialTabName","__experimentalVStack","spacing","__experimentalHStack","justify","level","__","Tooltip","text","Button","onClick","icon","typography","size","__experimentalItemGroup","isBordered","isSeparated","map","font","slug","_default","props","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/font-families.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tButton,\n\tTooltip,\n} from '@wordpress/components';\nimport { typography } from '@wordpress/icons';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FontLibraryProvider, {\n\tFontLibraryContext,\n} from './font-library-modal/context';\nimport FontLibraryModal from './font-library-modal';\nimport FontFamilyItem from './font-family-item';\nimport Subtitle from './subtitle';\n\nfunction FontFamilies() {\n\tconst { modalTabOpen, toggleModal, themeFonts, customFonts } =\n\t\tuseContext( FontLibraryContext );\n\n\tconst hasFonts = 0 < customFonts.length || 0 < themeFonts.length;\n\n\treturn (\n\t\t<>\n\t\t\t{ !! modalTabOpen && (\n\t\t\t\t<FontLibraryModal\n\t\t\t\t\tonRequestClose={ () => toggleModal() }\n\t\t\t\t\tinitialTabName={ modalTabOpen }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>\n\t\t\t\t\t<HStack justify=\"flex-end\">\n\t\t\t\t\t\t<Tooltip text={ __( 'Manage fonts' ) }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggleModal( 'installed-fonts' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-label={ __( 'Manage fonts' ) }\n\t\t\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\t\t\tsize={ 'small' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t\t{ hasFonts ? (\n\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t{ customFonts.map( ( font ) => (\n\t\t\t\t\t\t\t<FontFamilyItem key={ font.slug } font={ font } />\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t{ themeFonts.map( ( font ) => (\n\t\t\t\t\t\t\t<FontFamilyItem key={ font.slug } font={ font } />\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t) : (\n\t\t\t\t\t<>{ __( 'No fonts installed.' ) }</>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default ( { ...props } ) => (\n\t<FontLibraryProvider>\n\t\t<FontFamilies { ...props } />\n\t</FontLibraryProvider>\n);\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAC,uBAAA,CAAAL,OAAA;AAGA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,SAAA,GAAAF,sBAAA,CAAAP,OAAA;AAAkC,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAN,wBAAAU,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAA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A,EAACtC,QAAA,CAAAa,OAAmB,QACnB,IAAAwB,MAAA,CAAAC,aAAA,EAACV,YAAY;EAAA,GAAMkC;AAAK,CAAI,CACR,CACrB;AAAAC,OAAA,CAAAlD,OAAA,GAAAgD,QAAA"}
@@ -38,10 +38,9 @@ function FontFamilyItem({
38
38
  }, (0, _react.createElement)(_components.FlexItem, {
39
39
  style: previewStyle
40
40
  }, font.name), (0, _react.createElement)(_components.FlexItem, {
41
- style: {
42
- color: '#9e9e9e'
43
- }
44
- }, variantsCount, ' ', (0, _i18n._n)('variant', 'variants', variantsCount))));
41
+ className: "edit-site-global-styles-screen-typography__font-variants-count"
42
+ }, (0, _i18n.sprintf)( /* translators: %d: Number of font variants. */
43
+ (0, _i18n._n)('%d variant', '%d variants', variantsCount), variantsCount))));
45
44
  }
46
45
  var _default = FontFamilyItem;
47
46
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_element","_context","_previewStyles","FontFamilyItem","font","handleSetLibraryFontSelected","toggleModal","useContext","FontLibraryContext","variantsCount","fontFace","length","handleClick","previewStyle","getFamilyPreviewStyle","_react","createElement","__experimentalItem","onClick","__experimentalHStack","justify","FlexItem","style","name","color","_n","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-family-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalItem as Item,\n\tFlexItem,\n} from '@wordpress/components';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { FontLibraryContext } from './font-library-modal/context';\nimport { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';\n\nfunction FontFamilyItem( { font } ) {\n\tconst { handleSetLibraryFontSelected, toggleModal } =\n\t\tuseContext( FontLibraryContext );\n\n\tconst variantsCount = font?.fontFace?.length || 1;\n\n\tconst handleClick = () => {\n\t\thandleSetLibraryFontSelected( font );\n\t\ttoggleModal( 'installed-fonts' );\n\t};\n\n\tconst previewStyle = getFamilyPreviewStyle( font );\n\n\treturn (\n\t\t<Item onClick={ handleClick }>\n\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t<FlexItem style={ previewStyle }>{ font.name }</FlexItem>\n\t\t\t\t<FlexItem style={ { color: '#9e9e9e' } }>\n\t\t\t\t\t{ variantsCount }{ ' ' }\n\t\t\t\t\t{ _n( 'variant', 'variants', variantsCount ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</Item>\n\t);\n}\n\nexport default FontFamilyItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIA,SAASK,cAAcA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACnC,MAAM;IAAEC,4BAA4B;IAAEC;EAAY,CAAC,GAClD,IAAAC,mBAAU,EAAEC,2BAAmB,CAAC;EAEjC,MAAMC,aAAa,GAAGL,IAAI,EAAEM,QAAQ,EAAEC,MAAM,IAAI,CAAC;EAEjD,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACzBP,4BAA4B,CAAED,IAAK,CAAC;IACpCE,WAAW,CAAE,iBAAkB,CAAC;EACjC,CAAC;EAED,MAAMO,YAAY,GAAG,IAAAC,oCAAqB,EAAEV,IAAK,CAAC;EAElD,OACC,IAAAW,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAkB,kBAAI;IAACC,OAAO,EAAGN;EAAa,GAC5B,IAAAG,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAoB,oBAAM;IAACC,OAAO,EAAC;EAAe,GAC9B,IAAAL,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAsB,QAAQ;IAACC,KAAK,EAAGT;EAAc,GAAGT,IAAI,CAACmB,IAAgB,CAAC,EACzD,IAAAR,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAsB,QAAQ;IAACC,KAAK,EAAG;MAAEE,KAAK,EAAE;IAAU;EAAG,GACrCf,aAAa,EAAI,GAAG,EACpB,IAAAgB,QAAE,EAAE,SAAS,EAAE,UAAU,EAAEhB,aAAc,CAClC,CACH,CACH,CAAC;AAET;AAAC,IAAAiB,QAAA,GAEcvB,cAAc;AAAAwB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_components","_element","_context","_previewStyles","FontFamilyItem","font","handleSetLibraryFontSelected","toggleModal","useContext","FontLibraryContext","variantsCount","fontFace","length","handleClick","previewStyle","getFamilyPreviewStyle","_react","createElement","__experimentalItem","onClick","__experimentalHStack","justify","FlexItem","style","name","className","sprintf","_n","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-family-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalItem as Item,\n\tFlexItem,\n} from '@wordpress/components';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { FontLibraryContext } from './font-library-modal/context';\nimport { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';\n\nfunction FontFamilyItem( { font } ) {\n\tconst { handleSetLibraryFontSelected, toggleModal } =\n\t\tuseContext( FontLibraryContext );\n\n\tconst variantsCount = font?.fontFace?.length || 1;\n\n\tconst handleClick = () => {\n\t\thandleSetLibraryFontSelected( font );\n\t\ttoggleModal( 'installed-fonts' );\n\t};\n\n\tconst previewStyle = getFamilyPreviewStyle( font );\n\n\treturn (\n\t\t<Item onClick={ handleClick }>\n\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t<FlexItem style={ previewStyle }>{ font.name }</FlexItem>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles-screen-typography__font-variants-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: Number of font variants. */\n\t\t\t\t\t\t_n( '%d variant', '%d variants', variantsCount ),\n\t\t\t\t\t\tvariantsCount\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</Item>\n\t);\n}\n\nexport default FontFamilyItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIA,SAASK,cAAcA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACnC,MAAM;IAAEC,4BAA4B;IAAEC;EAAY,CAAC,GAClD,IAAAC,mBAAU,EAAEC,2BAAmB,CAAC;EAEjC,MAAMC,aAAa,GAAGL,IAAI,EAAEM,QAAQ,EAAEC,MAAM,IAAI,CAAC;EAEjD,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACzBP,4BAA4B,CAAED,IAAK,CAAC;IACpCE,WAAW,CAAE,iBAAkB,CAAC;EACjC,CAAC;EAED,MAAMO,YAAY,GAAG,IAAAC,oCAAqB,EAAEV,IAAK,CAAC;EAElD,OACC,IAAAW,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAkB,kBAAI;IAACC,OAAO,EAAGN;EAAa,GAC5B,IAAAG,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAoB,oBAAM;IAACC,OAAO,EAAC;EAAe,GAC9B,IAAAL,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAsB,QAAQ;IAACC,KAAK,EAAGT;EAAc,GAAGT,IAAI,CAACmB,IAAgB,CAAC,EACzD,IAAAR,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAsB,QAAQ;IAACG,SAAS,EAAC;EAAgE,GACjF,IAAAC,aAAO,GACR;EACA,IAA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