@wordpress/edit-site 5.18.0 → 5.19.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 (427) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-pattern/index.js +62 -1
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/add-new-template/index.js +3 -2
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +6 -1
  7. package/build/components/add-new-template/new-template.js.map +1 -1
  8. package/build/components/add-new-template/utils.js +6 -1
  9. package/build/components/add-new-template/utils.js.map +1 -1
  10. package/build/components/app/index.js +2 -7
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/back-button.js +3 -2
  13. package/build/components/block-editor/back-button.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +20 -16
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/site-editor-canvas.js +1 -3
  17. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  18. package/build/components/block-editor/use-site-editor-settings.js +8 -4
  19. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  20. package/build/components/canvas-loader/index.js +18 -1
  21. package/build/components/canvas-loader/index.js.map +1 -1
  22. package/build/components/editor/index.js +3 -8
  23. package/build/components/editor/index.js.map +1 -1
  24. package/build/components/global-styles/dimensions-panel.js +5 -4
  25. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  26. package/build/components/global-styles/font-families.js +68 -0
  27. package/build/components/global-styles/font-families.js.map +1 -0
  28. package/build/components/global-styles/font-family-item.js +47 -0
  29. package/build/components/global-styles/font-family-item.js.map +1 -0
  30. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +31 -0
  31. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -0
  32. package/build/components/global-styles/font-library-modal/context.js +285 -0
  33. package/build/components/global-styles/font-library-modal/context.js.map +1 -0
  34. package/build/components/global-styles/font-library-modal/font-card.js +58 -0
  35. package/build/components/global-styles/font-library-modal/font-card.js.map +1 -0
  36. package/build/components/global-styles/font-library-modal/font-demo.js +69 -0
  37. package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -0
  38. package/build/components/global-styles/font-library-modal/font-variant.js +51 -0
  39. package/build/components/global-styles/font-library-modal/font-variant.js.map +1 -0
  40. package/build/components/global-styles/font-library-modal/fonts-grid.js +54 -0
  41. package/build/components/global-styles/font-library-modal/fonts-grid.js.map +1 -0
  42. package/build/components/global-styles/font-library-modal/index.js +47 -0
  43. package/build/components/global-styles/font-library-modal/index.js.map +1 -0
  44. package/build/components/global-styles/font-library-modal/installed-fonts.js +128 -0
  45. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -0
  46. package/build/components/global-styles/font-library-modal/library-font-card.js +44 -0
  47. package/build/components/global-styles/font-library-modal/library-font-card.js.map +1 -0
  48. package/build/components/global-styles/font-library-modal/library-font-details.js +43 -0
  49. package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -0
  50. package/build/components/global-styles/font-library-modal/library-font-variant.js +59 -0
  51. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -0
  52. package/build/components/global-styles/font-library-modal/local-fonts.js +143 -0
  53. package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -0
  54. package/build/components/global-styles/font-library-modal/resolvers.js +37 -0
  55. package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -0
  56. package/build/components/global-styles/font-library-modal/tab-layout.js +45 -0
  57. package/build/components/global-styles/font-library-modal/tab-layout.js.map +1 -0
  58. package/build/components/global-styles/font-library-modal/utils/constants.js +37 -0
  59. package/build/components/global-styles/font-library-modal/utils/constants.js.map +1 -0
  60. package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +58 -0
  61. package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -0
  62. package/build/components/global-styles/font-library-modal/utils/index.js +205 -0
  63. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -0
  64. package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +22 -0
  65. package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -0
  66. package/build/components/global-styles/font-library-modal/utils/toggleFont.js +92 -0
  67. package/build/components/global-styles/font-library-modal/utils/toggleFont.js.map +1 -0
  68. package/build/components/global-styles/global-styles-provider.js +7 -12
  69. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  70. package/build/components/global-styles/screen-block.js +34 -21
  71. package/build/components/global-styles/screen-block.js.map +1 -1
  72. package/build/components/global-styles/screen-revisions/index.js +1 -3
  73. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  74. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +0 -1
  75. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  76. package/build/components/global-styles/screen-typography.js +4 -72
  77. package/build/components/global-styles/screen-typography.js.map +1 -1
  78. package/build/components/global-styles/style-variations-container.js +3 -5
  79. package/build/components/global-styles/style-variations-container.js.map +1 -1
  80. package/build/components/global-styles/typogrphy-elements.js +96 -0
  81. package/build/components/global-styles/typogrphy-elements.js.map +1 -0
  82. package/build/components/page-patterns/duplicate-menu-item.js +52 -16
  83. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
  84. package/build/components/page-patterns/grid-item.js +46 -20
  85. package/build/components/page-patterns/grid-item.js.map +1 -1
  86. package/build/components/page-patterns/header.js +3 -7
  87. package/build/components/page-patterns/header.js.map +1 -1
  88. package/build/components/page-patterns/index.js +3 -3
  89. package/build/components/page-patterns/index.js.map +1 -1
  90. package/build/components/page-patterns/patterns-list.js +7 -7
  91. package/build/components/page-patterns/patterns-list.js.map +1 -1
  92. package/build/components/page-patterns/rename-menu-item.js +6 -5
  93. package/build/components/page-patterns/rename-menu-item.js.map +1 -1
  94. package/build/components/page-patterns/search-items.js +8 -2
  95. package/build/components/page-patterns/search-items.js.map +1 -1
  96. package/build/components/page-patterns/use-patterns.js +53 -27
  97. package/build/components/page-patterns/use-patterns.js.map +1 -1
  98. package/build/components/page-patterns/utils.js +1 -20
  99. package/build/components/page-patterns/utils.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/page-panels/edit-template.js +33 -24
  101. package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/page-panels/hooks.js +64 -0
  103. package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -0
  104. package/build/components/sidebar-edit-mode/page-panels/index.js +1 -4
  105. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  106. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
  107. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  108. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +56 -0
  109. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -0
  110. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +91 -0
  111. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -0
  112. package/build/components/sidebar-edit-mode/template-panel/index.js +11 -9
  113. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  114. package/build/components/sidebar-edit-mode/template-panel/last-revision.js +6 -4
  115. package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
  116. package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +211 -0
  117. package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +1 -0
  118. package/build/components/sidebar-navigation-screen/index.js +6 -4
  119. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-screen-details-footer/index.js +32 -4
  121. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  122. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +4 -2
  123. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  124. package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -31
  125. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  126. package/build/components/sidebar-navigation-screen-page/index.js +3 -3
  127. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  128. package/build/components/sidebar-navigation-screen-pattern/index.js +18 -8
  129. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +34 -5
  131. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-patterns/index.js +7 -35
  133. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  134. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +38 -4
  135. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  136. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
  137. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-template/index.js +2 -2
  139. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-templates/index.js +1 -1
  141. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  142. package/build/components/template-actions/index.js +7 -4
  143. package/build/components/template-actions/index.js.map +1 -1
  144. package/build/components/template-actions/rename-menu-item.js +3 -2
  145. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  146. package/build/components/welcome-guide/styles.js +2 -2
  147. package/build/components/welcome-guide/styles.js.map +1 -1
  148. package/build/hooks/push-changes-to-global-styles/index.js +5 -37
  149. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  150. package/build/store/actions.js +29 -6
  151. package/build/store/actions.js.map +1 -1
  152. package/build/utils/constants.js +45 -2
  153. package/build/utils/constants.js.map +1 -1
  154. package/build/utils/is-template-removable.js +6 -1
  155. package/build/utils/is-template-removable.js.map +1 -1
  156. package/build/utils/is-template-revertable.js +6 -1
  157. package/build/utils/is-template-revertable.js.map +1 -1
  158. package/build-module/components/add-new-pattern/index.js +66 -5
  159. package/build-module/components/add-new-pattern/index.js.map +1 -1
  160. package/build-module/components/add-new-template/index.js +3 -2
  161. package/build-module/components/add-new-template/index.js.map +1 -1
  162. package/build-module/components/add-new-template/new-template.js +6 -1
  163. package/build-module/components/add-new-template/new-template.js.map +1 -1
  164. package/build-module/components/add-new-template/utils.js +6 -1
  165. package/build-module/components/add-new-template/utils.js.map +1 -1
  166. package/build-module/components/app/index.js +2 -7
  167. package/build-module/components/app/index.js.map +1 -1
  168. package/build-module/components/block-editor/back-button.js +3 -2
  169. package/build-module/components/block-editor/back-button.js.map +1 -1
  170. package/build-module/components/block-editor/editor-canvas.js +21 -17
  171. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  172. package/build-module/components/block-editor/site-editor-canvas.js +3 -5
  173. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  174. package/build-module/components/block-editor/use-site-editor-settings.js +8 -4
  175. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  176. package/build-module/components/canvas-loader/index.js +18 -1
  177. package/build-module/components/canvas-loader/index.js.map +1 -1
  178. package/build-module/components/editor/index.js +3 -8
  179. package/build-module/components/editor/index.js.map +1 -1
  180. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  181. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  182. package/build-module/components/global-styles/font-families.js +58 -0
  183. package/build-module/components/global-styles/font-families.js.map +1 -0
  184. package/build-module/components/global-styles/font-family-item.js +40 -0
  185. package/build-module/components/global-styles/font-family-item.js.map +1 -0
  186. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +23 -0
  187. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -0
  188. package/build-module/components/global-styles/font-library-modal/context.js +276 -0
  189. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -0
  190. package/build-module/components/global-styles/font-library-modal/font-card.js +49 -0
  191. package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -0
  192. package/build-module/components/global-styles/font-library-modal/font-demo.js +62 -0
  193. package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -0
  194. package/build-module/components/global-styles/font-library-modal/font-variant.js +42 -0
  195. package/build-module/components/global-styles/font-library-modal/font-variant.js.map +1 -0
  196. package/build-module/components/global-styles/font-library-modal/fonts-grid.js +47 -0
  197. package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +1 -0
  198. package/build-module/components/global-styles/font-library-modal/index.js +38 -0
  199. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -0
  200. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +120 -0
  201. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -0
  202. package/build-module/components/global-styles/font-library-modal/library-font-card.js +36 -0
  203. package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -0
  204. package/build-module/components/global-styles/font-library-modal/library-font-details.js +34 -0
  205. package/build-module/components/global-styles/font-library-modal/library-font-details.js.map +1 -0
  206. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +50 -0
  207. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -0
  208. package/build-module/components/global-styles/font-library-modal/local-fonts.js +135 -0
  209. package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -0
  210. package/build-module/components/global-styles/font-library-modal/resolvers.js +28 -0
  211. package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -0
  212. package/build-module/components/global-styles/font-library-modal/tab-layout.js +37 -0
  213. package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +1 -0
  214. package/build-module/components/global-styles/font-library-modal/utils/constants.js +26 -0
  215. package/build-module/components/global-styles/font-library-modal/utils/constants.js.map +1 -0
  216. package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +52 -0
  217. package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -0
  218. package/build-module/components/global-styles/font-library-modal/utils/index.js +190 -0
  219. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -0
  220. package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +16 -0
  221. package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -0
  222. package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js +86 -0
  223. package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js.map +1 -0
  224. package/build-module/components/global-styles/global-styles-provider.js +7 -12
  225. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  226. package/build-module/components/global-styles/screen-block.js +34 -21
  227. package/build-module/components/global-styles/screen-block.js.map +1 -1
  228. package/build-module/components/global-styles/screen-revisions/index.js +1 -3
  229. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  230. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +0 -1
  231. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  232. package/build-module/components/global-styles/screen-typography.js +6 -74
  233. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  234. package/build-module/components/global-styles/style-variations-container.js +3 -5
  235. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  236. package/build-module/components/global-styles/typogrphy-elements.js +87 -0
  237. package/build-module/components/global-styles/typogrphy-elements.js.map +1 -0
  238. package/build-module/components/page-patterns/duplicate-menu-item.js +51 -16
  239. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
  240. package/build-module/components/page-patterns/grid-item.js +47 -21
  241. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  242. package/build-module/components/page-patterns/header.js +3 -7
  243. package/build-module/components/page-patterns/header.js.map +1 -1
  244. package/build-module/components/page-patterns/index.js +3 -3
  245. package/build-module/components/page-patterns/index.js.map +1 -1
  246. package/build-module/components/page-patterns/patterns-list.js +7 -7
  247. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  248. package/build-module/components/page-patterns/rename-menu-item.js +6 -5
  249. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
  250. package/build-module/components/page-patterns/search-items.js +8 -2
  251. package/build-module/components/page-patterns/search-items.js.map +1 -1
  252. package/build-module/components/page-patterns/use-patterns.js +54 -28
  253. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  254. package/build-module/components/page-patterns/utils.js +0 -11
  255. package/build-module/components/page-patterns/utils.js.map +1 -1
  256. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +34 -27
  257. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  258. package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +54 -0
  259. package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -0
  260. package/build-module/components/sidebar-edit-mode/page-panels/index.js +1 -4
  261. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  262. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
  263. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  264. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +49 -0
  265. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -0
  266. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +85 -0
  267. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -0
  268. package/build-module/components/sidebar-edit-mode/template-panel/index.js +12 -10
  269. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  270. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +8 -6
  271. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
  272. package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +202 -0
  273. package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +1 -0
  274. package/build-module/components/sidebar-navigation-screen/index.js +6 -4
  275. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  276. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +32 -5
  277. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  278. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +4 -2
  279. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  280. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +6 -33
  281. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  282. package/build-module/components/sidebar-navigation-screen-page/index.js +3 -3
  283. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  284. package/build-module/components/sidebar-navigation-screen-pattern/index.js +19 -9
  285. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  286. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +34 -5
  287. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  288. package/build-module/components/sidebar-navigation-screen-patterns/index.js +10 -38
  289. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  290. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +38 -4
  291. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  292. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +3 -2
  293. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-template/index.js +2 -2
  295. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -1
  297. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  298. package/build-module/components/template-actions/index.js +7 -4
  299. package/build-module/components/template-actions/index.js.map +1 -1
  300. package/build-module/components/template-actions/rename-menu-item.js +3 -2
  301. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  302. package/build-module/components/welcome-guide/styles.js +2 -2
  303. package/build-module/components/welcome-guide/styles.js.map +1 -1
  304. package/build-module/hooks/push-changes-to-global-styles/index.js +5 -37
  305. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  306. package/build-module/store/actions.js +30 -7
  307. package/build-module/store/actions.js.map +1 -1
  308. package/build-module/utils/constants.js +35 -1
  309. package/build-module/utils/constants.js.map +1 -1
  310. package/build-module/utils/is-template-removable.js +6 -1
  311. package/build-module/utils/is-template-removable.js.map +1 -1
  312. package/build-module/utils/is-template-revertable.js +6 -1
  313. package/build-module/utils/is-template-revertable.js.map +1 -1
  314. package/build-style/style-rtl.css +244 -37
  315. package/build-style/style.css +244 -37
  316. package/lib/inflate.js +4082 -0
  317. package/lib/lib-font.browser.js +3831 -0
  318. package/lib/unbrotli.js +2679 -0
  319. package/package.json +40 -40
  320. package/src/components/add-new-pattern/index.js +83 -5
  321. package/src/components/add-new-template/index.js +3 -2
  322. package/src/components/add-new-template/new-template.js +6 -1
  323. package/src/components/add-new-template/utils.js +12 -3
  324. package/src/components/app/index.js +9 -12
  325. package/src/components/block-editor/back-button.js +6 -2
  326. package/src/components/block-editor/editor-canvas.js +31 -19
  327. package/src/components/block-editor/site-editor-canvas.js +2 -10
  328. package/src/components/block-editor/style.scss +88 -1
  329. package/src/components/block-editor/use-site-editor-settings.js +26 -19
  330. package/src/components/canvas-loader/index.js +12 -1
  331. package/src/components/canvas-loader/style.scss +1 -1
  332. package/src/components/editor/index.js +3 -8
  333. package/src/components/global-styles/dimensions-panel.js +8 -4
  334. package/src/components/global-styles/font-families.js +71 -0
  335. package/src/components/global-styles/font-family-item.js +44 -0
  336. package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +33 -0
  337. package/src/components/global-styles/font-library-modal/context.js +347 -0
  338. package/src/components/global-styles/font-library-modal/font-card.js +70 -0
  339. package/src/components/global-styles/font-library-modal/font-demo.js +57 -0
  340. package/src/components/global-styles/font-library-modal/font-variant.js +53 -0
  341. package/src/components/global-styles/font-library-modal/fonts-grid.js +55 -0
  342. package/src/components/global-styles/font-library-modal/index.js +42 -0
  343. package/src/components/global-styles/font-library-modal/installed-fonts.js +174 -0
  344. package/src/components/global-styles/font-library-modal/library-font-card.js +40 -0
  345. package/src/components/global-styles/font-library-modal/library-font-details.js +46 -0
  346. package/src/components/global-styles/font-library-modal/library-font-variant.js +54 -0
  347. package/src/components/global-styles/font-library-modal/local-fonts.js +160 -0
  348. package/src/components/global-styles/font-library-modal/resolvers.js +29 -0
  349. package/src/components/global-styles/font-library-modal/style.scss +113 -0
  350. package/src/components/global-styles/font-library-modal/tab-layout.js +50 -0
  351. package/src/components/global-styles/font-library-modal/utils/constants.js +31 -0
  352. package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +58 -0
  353. package/src/components/global-styles/font-library-modal/utils/index.js +213 -0
  354. package/src/components/global-styles/font-library-modal/utils/make-families-from-faces.js +15 -0
  355. package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +53 -0
  356. package/src/components/global-styles/font-library-modal/utils/test/getFontFaceVariantName.spec.js +30 -0
  357. package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +240 -0
  358. package/src/components/global-styles/font-library-modal/utils/test/getPreviewStyle.spec.js +121 -0
  359. package/src/components/global-styles/font-library-modal/utils/test/isUrlEncoded.spec.js +31 -0
  360. package/src/components/global-styles/font-library-modal/utils/test/makeFamiliesFromFaces.spec.js +57 -0
  361. package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamilies.spec.js +62 -0
  362. package/src/components/global-styles/font-library-modal/utils/test/mergeFontFaces.spec.js +56 -0
  363. package/src/components/global-styles/font-library-modal/utils/test/mergeFontFamilies.spec.js +108 -0
  364. package/src/components/global-styles/font-library-modal/utils/test/setUIValuesNeeded.spec.js +41 -0
  365. package/src/components/global-styles/font-library-modal/utils/test/toggleFont.spec.js +141 -0
  366. package/src/components/global-styles/font-library-modal/utils/toggleFont.js +90 -0
  367. package/src/components/global-styles/global-styles-provider.js +2 -7
  368. package/src/components/global-styles/screen-block.js +42 -20
  369. package/src/components/global-styles/screen-revisions/index.js +0 -2
  370. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +0 -1
  371. package/src/components/global-styles/screen-typography.js +7 -95
  372. package/src/components/global-styles/style-variations-container.js +0 -2
  373. package/src/components/global-styles/typogrphy-elements.js +110 -0
  374. package/src/components/list/style.scss +2 -0
  375. package/src/components/page-patterns/duplicate-menu-item.js +63 -20
  376. package/src/components/page-patterns/grid-item.js +77 -30
  377. package/src/components/page-patterns/header.js +3 -12
  378. package/src/components/page-patterns/index.js +3 -3
  379. package/src/components/page-patterns/patterns-list.js +7 -7
  380. package/src/components/page-patterns/rename-menu-item.js +18 -7
  381. package/src/components/page-patterns/search-items.js +14 -2
  382. package/src/components/page-patterns/style.scss +1 -5
  383. package/src/components/page-patterns/use-patterns.js +67 -33
  384. package/src/components/page-patterns/utils.js +0 -19
  385. package/src/components/sidebar-edit-mode/page-panels/edit-template.js +47 -33
  386. package/src/components/sidebar-edit-mode/page-panels/hooks.js +83 -0
  387. package/src/components/sidebar-edit-mode/page-panels/index.js +0 -4
  388. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
  389. package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +44 -0
  390. package/src/components/sidebar-edit-mode/page-panels/style.scss +41 -10
  391. package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +82 -0
  392. package/src/components/sidebar-edit-mode/template-panel/index.js +28 -24
  393. package/src/components/sidebar-edit-mode/template-panel/last-revision.js +19 -15
  394. package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +270 -0
  395. package/src/components/sidebar-navigation-screen/index.js +4 -9
  396. package/src/components/sidebar-navigation-screen/style.scss +7 -1
  397. package/src/components/sidebar-navigation-screen-details-footer/index.js +38 -10
  398. package/src/components/sidebar-navigation-screen-details-footer/style.scss +10 -3
  399. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -0
  400. package/src/components/sidebar-navigation-screen-global-styles/index.js +6 -44
  401. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
  402. package/src/components/sidebar-navigation-screen-page/index.js +3 -3
  403. package/src/components/sidebar-navigation-screen-pattern/index.js +20 -7
  404. package/src/components/sidebar-navigation-screen-pattern/style.scss +0 -3
  405. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +46 -13
  406. package/src/components/sidebar-navigation-screen-patterns/index.js +14 -49
  407. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +48 -6
  408. package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +3 -5
  409. package/src/components/sidebar-navigation-screen-template/index.js +2 -4
  410. package/src/components/sidebar-navigation-screen-templates/index.js +1 -1
  411. package/src/components/template-actions/index.js +14 -8
  412. package/src/components/template-actions/rename-menu-item.js +15 -4
  413. package/src/components/welcome-guide/styles.js +2 -2
  414. package/src/hooks/push-changes-to-global-styles/index.js +6 -49
  415. package/src/store/actions.js +39 -13
  416. package/src/store/test/actions.js +0 -1
  417. package/src/store/test/reducer.js +0 -1
  418. package/src/style.scss +1 -1
  419. package/src/utils/constants.js +38 -3
  420. package/src/utils/is-template-removable.js +8 -1
  421. package/src/utils/is-template-revertable.js +8 -1
  422. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -30
  423. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +0 -1
  424. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -23
  425. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +0 -1
  426. package/src/components/sidebar-navigation-screen-global-styles/style.scss +0 -12
  427. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -24
@@ -0,0 +1,202 @@
1
+ import { createElement } from "@wordpress/element";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { __, _x, sprintf } from '@wordpress/i18n';
6
+ import { useEffect, useMemo, useState } from '@wordpress/element';
7
+ import { FormTokenField, PanelRow } from '@wordpress/components';
8
+ import { useSelect, useDispatch } from '@wordpress/data';
9
+ import { store as coreStore } from '@wordpress/core-data';
10
+ import { useDebounce } from '@wordpress/compose';
11
+ import { store as noticesStore } from '@wordpress/notices';
12
+ import { decodeEntities } from '@wordpress/html-entities';
13
+ export const unescapeString = arg => {
14
+ return decodeEntities(arg);
15
+ };
16
+
17
+ /**
18
+ * Returns a term object with name unescaped.
19
+ *
20
+ * @param {Object} term The term object to unescape.
21
+ *
22
+ * @return {Object} Term object with name property unescaped.
23
+ */
24
+ export const unescapeTerm = term => {
25
+ return {
26
+ ...term,
27
+ name: unescapeString(term.name)
28
+ };
29
+ };
30
+
31
+ /**
32
+ * Shared reference to an empty array for cases where it is important to avoid
33
+ * returning a new array reference on every invocation.
34
+ *
35
+ * @type {Array<any>}
36
+ */
37
+ const EMPTY_ARRAY = [];
38
+
39
+ /**
40
+ * Module constants
41
+ */
42
+ const MAX_TERMS_SUGGESTIONS = 20;
43
+ const DEFAULT_QUERY = {
44
+ per_page: MAX_TERMS_SUGGESTIONS,
45
+ _fields: 'id,name',
46
+ context: 'view'
47
+ };
48
+ const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
49
+ const termNamesToIds = (names, terms) => {
50
+ return names.map(termName => terms.find(term => isSameTermName(term.name, termName)).id);
51
+ };
52
+ export default function PatternCategories({
53
+ post
54
+ }) {
55
+ var _taxonomy$labels$sing;
56
+ const slug = 'wp_pattern_category';
57
+ const [values, setValues] = useState([]);
58
+ const [search, setSearch] = useState('');
59
+ const debouncedSearch = useDebounce(setSearch, 500);
60
+ const {
61
+ terms,
62
+ taxonomy,
63
+ hasAssignAction,
64
+ hasCreateAction,
65
+ hasResolvedTerms
66
+ } = useSelect(select => {
67
+ var _post$_links, _post$_links2;
68
+ const {
69
+ getEntityRecords,
70
+ getTaxonomy,
71
+ hasFinishedResolution
72
+ } = select(coreStore);
73
+ const _taxonomy = getTaxonomy(slug);
74
+ const _termIds = post?.wp_pattern_category?.length > 0 ? post?.wp_pattern_category : EMPTY_ARRAY;
75
+ const query = {
76
+ ...DEFAULT_QUERY,
77
+ include: _termIds?.join(','),
78
+ per_page: -1
79
+ };
80
+ return {
81
+ hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false,
82
+ hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
83
+ taxonomy: _taxonomy,
84
+ termIds: _termIds,
85
+ terms: _termIds?.length ? getEntityRecords('taxonomy', slug, query) : EMPTY_ARRAY,
86
+ hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
87
+ };
88
+ }, [slug, post]);
89
+ const {
90
+ searchResults
91
+ } = useSelect(select => {
92
+ const {
93
+ getEntityRecords
94
+ } = select(coreStore);
95
+ return {
96
+ searchResults: !!search ? getEntityRecords('taxonomy', slug, {
97
+ ...DEFAULT_QUERY,
98
+ search
99
+ }) : EMPTY_ARRAY
100
+ };
101
+ }, [search, slug]);
102
+
103
+ // Update terms state only after the selectors are resolved.
104
+ // We're using this to avoid terms temporarily disappearing on slow networks
105
+ // while core data makes REST API requests.
106
+ useEffect(() => {
107
+ if (hasResolvedTerms) {
108
+ const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name));
109
+ setValues(newValues);
110
+ }
111
+ }, [terms, hasResolvedTerms]);
112
+ const suggestions = useMemo(() => {
113
+ return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name));
114
+ }, [searchResults]);
115
+ const {
116
+ saveEntityRecord,
117
+ editEntityRecord
118
+ } = useDispatch(coreStore);
119
+ const {
120
+ createErrorNotice
121
+ } = useDispatch(noticesStore);
122
+ if (!hasAssignAction) {
123
+ return null;
124
+ }
125
+ async function findOrCreateTerm(term) {
126
+ try {
127
+ const newTerm = await saveEntityRecord('taxonomy', slug, term, {
128
+ throwOnError: true
129
+ });
130
+ return unescapeTerm(newTerm);
131
+ } catch (error) {
132
+ if (error.code !== 'term_exists') {
133
+ throw error;
134
+ }
135
+ return {
136
+ id: error.data.term_id,
137
+ name: term.name
138
+ };
139
+ }
140
+ }
141
+ function onUpdateTerms(newTermIds) {
142
+ editEntityRecord('postType', 'wp_block', post.id, {
143
+ wp_pattern_category: newTermIds
144
+ });
145
+ }
146
+ function onChange(termNames) {
147
+ const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
148
+ const uniqueTerms = termNames.reduce((acc, name) => {
149
+ if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) {
150
+ acc.push(name);
151
+ }
152
+ return acc;
153
+ }, []);
154
+ const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName)));
155
+
156
+ // Optimistically update term values.
157
+ // The selector will always re-fetch terms later.
158
+ setValues(uniqueTerms);
159
+ if (newTermNames.length === 0) {
160
+ return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
161
+ }
162
+ if (!hasCreateAction) {
163
+ return;
164
+ }
165
+ Promise.all(newTermNames.map(termName => findOrCreateTerm({
166
+ name: termName
167
+ }))).then(newTerms => {
168
+ const newAvailableTerms = availableTerms.concat(newTerms);
169
+ return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
170
+ }).catch(error => {
171
+ createErrorNotice(error.message, {
172
+ type: 'snackbar'
173
+ });
174
+ });
175
+ }
176
+ const singularName = (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : slug === 'post_tag' ? __('Tag') : __('Term');
177
+ const termAddedLabel = sprintf( /* translators: %s: term name. */
178
+ _x('%s added', 'term'), singularName);
179
+ const termRemovedLabel = sprintf( /* translators: %s: term name. */
180
+ _x('%s removed', 'term'), singularName);
181
+ const removeTermLabel = sprintf( /* translators: %s: term name. */
182
+ _x('Remove %s', 'term'), singularName);
183
+ return createElement(PanelRow, {
184
+ initialOpen: true,
185
+ title: __('Categories')
186
+ }, createElement(FormTokenField, {
187
+ __next40pxDefaultSize: true,
188
+ value: values,
189
+ suggestions: suggestions,
190
+ onChange: onChange,
191
+ onInputChange: debouncedSearch,
192
+ maxSuggestions: MAX_TERMS_SUGGESTIONS,
193
+ label: __('Pattern categories'),
194
+ messages: {
195
+ added: termAddedLabel,
196
+ removed: termRemovedLabel,
197
+ remove: removeTermLabel
198
+ },
199
+ tokenizeOnBlur: true
200
+ }));
201
+ }
202
+ //# sourceMappingURL=pattern-categories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","_x","sprintf","useEffect","useMemo","useState","FormTokenField","PanelRow","useSelect","useDispatch","store","coreStore","useDebounce","noticesStore","decodeEntities","unescapeString","arg","unescapeTerm","term","name","EMPTY_ARRAY","MAX_TERMS_SUGGESTIONS","DEFAULT_QUERY","per_page","_fields","context","isSameTermName","termA","termB","toLowerCase","termNamesToIds","names","terms","map","termName","find","id","PatternCategories","post","_taxonomy$labels$sing","slug","values","setValues","search","setSearch","debouncedSearch","taxonomy","hasAssignAction","hasCreateAction","hasResolvedTerms","select","_post$_links","_post$_links2","getEntityRecords","getTaxonomy","hasFinishedResolution","_taxonomy","_termIds","wp_pattern_category","length","query","include","join","_links","rest_base","termIds","searchResults","newValues","suggestions","saveEntityRecord","editEntityRecord","createErrorNotice","findOrCreateTerm","newTerm","throwOnError","error","code","data","term_id","onUpdateTerms","newTermIds","onChange","termNames","availableTerms","uniqueTerms","reduce","acc","some","n","push","newTermNames","filter","Promise","all","then","newTerms","newAvailableTerms","concat","catch","message","type","singularName","labels","singular_name","termAddedLabel","termRemovedLabel","removeTermLabel","createElement","initialOpen","title","__next40pxDefaultSize","value","onInputChange","maxSuggestions","label","messages","added","removed","remove","tokenizeOnBlur"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { FormTokenField, PanelRow } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Module constants\n */\nconst MAX_TERMS_SUGGESTIONS = 20;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_TERMS_SUGGESTIONS,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nconst isSameTermName = ( termA, termB ) =>\n\tunescapeString( termA ).toLowerCase() ===\n\tunescapeString( termB ).toLowerCase();\n\nconst termNamesToIds = ( names, terms ) => {\n\treturn names.map(\n\t\t( termName ) =>\n\t\t\tterms.find( ( term ) => isSameTermName( term.name, termName ) ).id\n\t);\n};\n\nexport default function PatternCategories( { post } ) {\n\tconst slug = 'wp_pattern_category';\n\tconst [ values, setValues ] = useState( [] );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst debouncedSearch = useDebounce( setSearch, 500 );\n\n\tconst {\n\t\tterms,\n\t\ttaxonomy,\n\t\thasAssignAction,\n\t\thasCreateAction,\n\t\thasResolvedTerms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst _termIds =\n\t\t\t\tpost?.wp_pattern_category?.length > 0\n\t\t\t\t\t? post?.wp_pattern_category\n\t\t\t\t\t: EMPTY_ARRAY;\n\t\t\tconst query = {\n\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\tinclude: _termIds?.join( ',' ),\n\t\t\t\tper_page: -1,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t\ttermIds: _termIds,\n\t\t\t\tterms: _termIds?.length\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, query )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\thasResolvedTerms: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ slug, post ]\n\t);\n\n\tconst { searchResults } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tsearchResults: !! search\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, {\n\t\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ search, slug ]\n\t);\n\n\t// Update terms state only after the selectors are resolved.\n\t// We're using this to avoid terms temporarily disappearing on slow networks\n\t// while core data makes REST API requests.\n\tuseEffect( () => {\n\t\tif ( hasResolvedTerms ) {\n\t\t\tconst newValues = ( terms ?? [] ).map( ( term ) =>\n\t\t\t\tunescapeString( term.name )\n\t\t\t);\n\n\t\t\tsetValues( newValues );\n\t\t}\n\t}, [ terms, hasResolvedTerms ] );\n\n\tconst suggestions = useMemo( () => {\n\t\treturn ( searchResults ?? [] ).map( ( term ) =>\n\t\t\tunescapeString( term.name )\n\t\t);\n\t}, [ searchResults ] );\n\n\tconst { saveEntityRecord, editEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\tasync function findOrCreateTerm( term ) {\n\t\ttry {\n\t\t\tconst newTerm = await saveEntityRecord( 'taxonomy', slug, term, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\treturn unescapeTerm( newTerm );\n\t\t} catch ( error ) {\n\t\t\tif ( error.code !== 'term_exists' ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tid: error.data.term_id,\n\t\t\t\tname: term.name,\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction onUpdateTerms( newTermIds ) {\n\t\teditEntityRecord( 'postType', 'wp_block', post.id, {\n\t\t\twp_pattern_category: newTermIds,\n\t\t} );\n\t}\n\n\tfunction onChange( termNames ) {\n\t\tconst availableTerms = [\n\t\t\t...( terms ?? [] ),\n\t\t\t...( searchResults ?? [] ),\n\t\t];\n\t\tconst uniqueTerms = termNames.reduce( ( acc, name ) => {\n\t\t\tif (\n\t\t\t\t! acc.some( ( n ) => n.toLowerCase() === name.toLowerCase() )\n\t\t\t) {\n\t\t\t\tacc.push( name );\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] );\n\n\t\tconst newTermNames = uniqueTerms.filter(\n\t\t\t( termName ) =>\n\t\t\t\t! availableTerms.find( ( term ) =>\n\t\t\t\t\tisSameTermName( term.name, termName )\n\t\t\t\t)\n\t\t);\n\n\t\t// Optimistically update term values.\n\t\t// The selector will always re-fetch terms later.\n\t\tsetValues( uniqueTerms );\n\n\t\tif ( newTermNames.length === 0 ) {\n\t\t\treturn onUpdateTerms(\n\t\t\t\ttermNamesToIds( uniqueTerms, availableTerms )\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasCreateAction ) {\n\t\t\treturn;\n\t\t}\n\n\t\tPromise.all(\n\t\t\tnewTermNames.map( ( termName ) =>\n\t\t\t\tfindOrCreateTerm( { name: termName } )\n\t\t\t)\n\t\t)\n\t\t\t.then( ( newTerms ) => {\n\t\t\t\tconst newAvailableTerms = availableTerms.concat( newTerms );\n\t\t\t\treturn onUpdateTerms(\n\t\t\t\t\ttermNamesToIds( uniqueTerms, newAvailableTerms )\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t} );\n\t}\n\n\tconst singularName =\n\t\ttaxonomy?.labels?.singular_name ??\n\t\t( slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' ) );\n\tconst termAddedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s added', 'term' ),\n\t\tsingularName\n\t);\n\tconst termRemovedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s removed', 'term' ),\n\t\tsingularName\n\t);\n\tconst removeTermLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( 'Remove %s', 'term' ),\n\t\tsingularName\n\t);\n\n\treturn (\n\t\t<PanelRow initialOpen={ true } title={ __( 'Categories' ) }>\n\t\t\t<FormTokenField\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvalue={ values }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tmaxSuggestions={ MAX_TERMS_SUGGESTIONS }\n\t\t\t\tlabel={ __( 'Pattern categories' ) }\n\t\t\t\tmessages={ {\n\t\t\t\t\tadded: termAddedLabel,\n\t\t\t\t\tremoved: termRemovedLabel,\n\t\t\t\t\tremove: removeTermLabel,\n\t\t\t\t} }\n\t\t\t\ttokenizeOnBlur\n\t\t\t/>\n\t\t</PanelRow>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACjE,SAASC,cAAc,EAAEC,QAAQ,QAAQ,uBAAuB;AAChE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASF,KAAK,IAAIG,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,OAAO,MAAMC,cAAc,GAAKC,GAAG,IAAM;EACxC,OAAOF,cAAc,CAAEE,GAAI,CAAC;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAKC,IAAI,IAAM;EACvC,OAAO;IACN,GAAGA,IAAI;IACPC,IAAI,EAAEJ,cAAc,CAAEG,IAAI,CAACC,IAAK;EACjC,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA,MAAMC,qBAAqB,GAAG,EAAE;AAChC,MAAMC,aAAa,GAAG;EACrBC,QAAQ,EAAEF,qBAAqB;EAC/BG,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAEC,KAAK,EAAEC,KAAK,KACpCb,cAAc,CAAEY,KAAM,CAAC,CAACE,WAAW,CAAC,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CAACwB,OAAO,EAAE;QACjCC,IAAI,EAAE;MACP,CAAE,CAAC;IACJ,CAAE,CAAC;EACL;EAEA,MAAMC,YAAY,IAAA9D,qBAAA,GACjBO,QAAQ,EAAEwD,MAAM,EAAEC,aAAa,cAAAhE,qBAAA,cAAAA,qBAAA,GAC7BC,IAAI,KAAK,UAAU,GAAGxC,EAAE,CAAE,KAAM,CAAC,GAAGA,EAAE,CAAE,MAAO,CAAG;EACrD,MAAMwG,cAAc,GAAGtG,OAAO,EAC7B;EACAD,EAAE,CAAE,UAAU,EAAE,MAAO,CAAC,EACxBoG,YACD,CAAC;EACD,MAAMI,gBAAgB,GAAGvG,OAAO,EAC/B;EACAD,EAAE,CAAE,YAAY,EAAE,MAAO,CAAC,EAC1BoG,YACD,CAAC;EACD,MAAMK,eAAe,GAAGxG,OAAO,EAC9B;EACAD,EAAE,CAAE,WAAW,EAAE,MAAO,CAAC,EACzBoG,YACD,CAAC;EAED,OACCM,aAAA,CAACpG,QAAQ;IAACqG,WAAW,EAAG,IAAM;IAACC,KAAK,EAAG7G,EAAE,CAAE,YAAa;EAAG,GAC1D2G,aAAA,CAACrG,cAAc;IACdwG,qBAAqB;IACrBC,KAAK,EAAGtE,MAAQ;IAChB2B,WAAW,EAAGA,WAAa;IAC3Ba,QAAQ,EAAGA,QAAU;IACrB+B,aAAa,EAAGnE,eAAiB;IACjCoE,cAAc,EAAG5F,qBAAuB;IACxC6F,KAAK,EAAGlH,EAAE,CAAE,oBAAqB,CAAG;IACpCmH,QAAQ,EAAG;MACVC,KAAK,EAAEZ,cAAc;MACrBa,OAAO,EAAEZ,gBAAgB;MACzBa,MAAM,EAAEZ;IACT,CAAG;IACHa,cAAc;EAAA,CACd,CACQ,CAAC;AAEb"}
@@ -35,13 +35,15 @@ export default function SidebarNavigationScreen({
35
35
  backPath: backPathProp
36
36
  }) {
37
37
  const {
38
- dashboardLink
38
+ dashboardLink,
39
+ dashboardLinkText
39
40
  } = useSelect(select => {
40
41
  const {
41
42
  getSettings
42
43
  } = unlock(select(editSiteStore));
43
44
  return {
44
- dashboardLink: getSettings().__experimentalDashboardLink
45
+ dashboardLink: getSettings().__experimentalDashboardLink,
46
+ dashboardLinkText: getSettings().__experimentalDashboardLinkText
45
47
  };
46
48
  }, []);
47
49
  const {
@@ -77,8 +79,8 @@ export default function SidebarNavigationScreen({
77
79
  showTooltip: false
78
80
  }), isRoot && createElement(SidebarButton, {
79
81
  icon: icon,
80
- label: !isPreviewingTheme() ? __('Go to the Dashboard') : __('Go back to the theme showcase'),
81
- href: !isPreviewingTheme() ? dashboardLink || 'index.php' : 'themes.php'
82
+ label: dashboardLinkText || __('Go to the Dashboard'),
83
+ href: dashboardLink || 'index.php'
82
84
  }), createElement(Heading, {
83
85
  className: "edit-site-sidebar-navigation-screen__title",
84
86
  color: '#e0e0e0' /* $gray-200 */,
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__experimentalHStack","HStack","__experimentalHeading","Heading","__experimentalUseNavigator","useNavigator","__experimentalVStack","VStack","isRTL","__","sprintf","chevronRight","chevronLeft","store","coreStore","useSelect","privateApis","routerPrivateApis","editSiteStore","unlock","SidebarButton","isPreviewingTheme","currentlyPreviewingTheme","useLocation","SidebarNavigationScreen","isRoot","title","actions","meta","content","footer","description","backPath","backPathProp","dashboardLink","select","getSettings","__experimentalDashboardLink","getTheme","location","navigator","theme","icon","createElement","Fragment","className","spacing","justify","alignment","onClick","state","goTo","isBack","goToParent","label","showTooltip","href","color","level","size","name","rendered"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport SidebarButton from '../sidebar-button';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tmeta,\n\tcontent,\n\tfooter,\n\tdescription,\n\tbackPath: backPathProp,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\tconst { getTheme } = useSelect( coreStore );\n\tconst location = useLocation();\n\tconst navigator = useNavigator();\n\tconst theme = getTheme( currentlyPreviewingTheme() );\n\tconst icon = isRTL() ? chevronRight : chevronLeft;\n\n\treturn (\n\t\t<>\n\t\t\t<VStack\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-sidebar-navigation-screen__main',\n\t\t\t\t\t{\n\t\t\t\t\t\t'has-footer': !! footer,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tspacing={ 0 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\talignment=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ ! isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst backPath =\n\t\t\t\t\t\t\t\t\tbackPathProp ?? location.state?.backPath;\n\t\t\t\t\t\t\t\tif ( backPath ) {\n\t\t\t\t\t\t\t\t\tnavigator.goTo( backPath, {\n\t\t\t\t\t\t\t\t\t\tisBack: true,\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\tnavigator.goToParent();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\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{ isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t! isPreviewingTheme()\n\t\t\t\t\t\t\t\t\t? __( 'Go to the Dashboard' )\n\t\t\t\t\t\t\t\t\t: __( 'Go back to the theme showcase' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t! isPreviewingTheme()\n\t\t\t\t\t\t\t\t\t? dashboardLink || 'index.php'\n\t\t\t\t\t\t\t\t\t: 'themes.php'\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<Heading\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title\"\n\t\t\t\t\t\tcolor={ '#e0e0e0' /* $gray-200 */ }\n\t\t\t\t\t\tlevel={ 1 }\n\t\t\t\t\t\tsize={ 20 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isPreviewingTheme()\n\t\t\t\t\t\t\t? title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t'Previewing %1$s: %2$s',\n\t\t\t\t\t\t\t\t\ttheme?.name?.rendered,\n\t\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ actions && (\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__actions\">\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ meta && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__meta\">\n\t\t\t\t\t\t\t{ meta }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<p className=\"edit-site-sidebar-navigation-screen__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ content }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t\t{ footer && (\n\t\t\t\t<footer className=\"edit-site-sidebar-navigation-screen__footer\">\n\t\t\t\t\t{ footer }\n\t\t\t\t</footer>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,qBAAqB,IAAIC,OAAO,EAChCC,0BAA0B,IAAIC,YAAY,EAC1CC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACpD,SAASC,YAAY,EAAEC,WAAW,QAAQ,kBAAkB;AAC5D,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SACCC,iBAAiB,EACjBC,wBAAwB,QAClB,i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AAQE,SAAS,EAAC;EAA6C,GAC5Df,MACK,CAER,CAAC;AAEL"}
1
+ {"version":3,"names":["classnames","__experimentalHStack","HStack","__experimentalHeading","Heading","__experimentalUseNavigator","useNavigator","__experimentalVStack","VStack","isRTL","__","sprintf","chevronRight","chevronLeft","store","coreStore","useSelect","privateApis","routerPrivateApis","editSiteStore","unlock","SidebarButton","isPreviewingTheme","currentlyPreviewingTheme","useLocation","SidebarNavigationScreen","isRoot","title","actions","meta","content","footer","description","backPath","backPathProp","dashboardLink","dashboardLinkText","select","getSettings","__experimentalDashboardLink","__experimentalDashboardLinkText","getTheme","location","navigator","theme","icon","createElement","Fragment","className","spacing","justify","alignment","onClick","state","goTo","isBack","goToParent","label","showTooltip","href","color","level","size","name","rendered"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport SidebarButton from '../sidebar-button';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tmeta,\n\tcontent,\n\tfooter,\n\tdescription,\n\tbackPath: backPathProp,\n} ) {\n\tconst { dashboardLink, dashboardLinkText } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t\tdashboardLinkText: getSettings().__experimentalDashboardLinkText,\n\t\t};\n\t}, [] );\n\tconst { getTheme } = useSelect( coreStore );\n\tconst location = useLocation();\n\tconst navigator = useNavigator();\n\tconst theme = getTheme( currentlyPreviewingTheme() );\n\tconst icon = isRTL() ? chevronRight : chevronLeft;\n\n\treturn (\n\t\t<>\n\t\t\t<VStack\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-sidebar-navigation-screen__main',\n\t\t\t\t\t{\n\t\t\t\t\t\t'has-footer': !! footer,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tspacing={ 0 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\talignment=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ ! isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst backPath =\n\t\t\t\t\t\t\t\t\tbackPathProp ?? location.state?.backPath;\n\t\t\t\t\t\t\t\tif ( backPath ) {\n\t\t\t\t\t\t\t\t\tnavigator.goTo( backPath, {\n\t\t\t\t\t\t\t\t\t\tisBack: true,\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\tnavigator.goToParent();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\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{ isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tdashboardLinkText || __( 'Go to the Dashboard' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title\"\n\t\t\t\t\t\tcolor={ '#e0e0e0' /* $gray-200 */ }\n\t\t\t\t\t\tlevel={ 1 }\n\t\t\t\t\t\tsize={ 20 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isPreviewingTheme()\n\t\t\t\t\t\t\t? title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t'Previewing %1$s: %2$s',\n\t\t\t\t\t\t\t\t\ttheme?.name?.rendered,\n\t\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ actions && (\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__actions\">\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ meta && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__meta\">\n\t\t\t\t\t\t\t{ meta }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<p className=\"edit-site-sidebar-navigation-screen__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ content }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t\t{ footer && (\n\t\t\t\t<footer className=\"edit-site-sidebar-navigation-screen__footer\">\n\t\t\t\t\t{ footer }\n\t\t\t\t</footer>\n\t\t\t) }\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aAAA,CAAC1C,OAAO;IACP4C,SAAS,EAAC,4CAA4C;IACtDY,KAAK,EAAG,SAAS,CAAC,eAAiB;IACnCC,KAAK,EAAG,CAAG;IACXC,IAAI,EAAG;EAAI,GAET,CAAExC,iBAAiB,CAAC,CAAC,GACpBK,KAAK,GACLhB,OAAO,CACP,uBAAuB,EACvBiC,KAAK,EAAEmB,IAAI,EAAEC,QAAQ,EACrBrC,KACA,CACK,CAAC,EACRC,OAAO,IACRkB,aAAA;IAAKE,SAAS,EAAC;EAA8C,GAC1DpB,OACE,CAEC,CAAC,EACPC,IAAI,IACLiB,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAA2C,GACvDnB,IACE,CACJ,CACF,EAEDiB,aAAA;IAAKE,SAAS,EAAC;EAA8C,GAC1DhB,WAAW,IACZc,aAAA;IAAGE,SAAS,EAAC;EAAkD,GAC5DhB,WACA,CACH,EACCF,OACE,CACE,CAAC,EACPC,MAAM,IACPe,aAAA;IAAQE,SAAS,EAAC;EAA6C,GAC5DjB,MACK,CAER,CAAC;AAEL"}
@@ -1,25 +1,52 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement } from "@wordpress/element";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
6
  import { humanTimeDiff } from '@wordpress/date';
7
7
  import { createInterpolateElement } from '@wordpress/element';
8
+ import { addQueryArgs } from '@wordpress/url';
9
+ import { Icon, __experimentalItemGroup as ItemGroup } from '@wordpress/components';
10
+ import { backup } from '@wordpress/icons';
8
11
 
9
12
  /**
10
13
  * Internal dependencies
11
14
  */
12
15
  import { SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
16
+ import SidebarNavigationItem from '../sidebar-navigation-item';
13
17
  export default function SidebarNavigationScreenDetailsFooter({
14
- lastModifiedDateTime
18
+ record,
19
+ ...otherProps
15
20
  }) {
16
- return createElement(Fragment, null, lastModifiedDateTime && createElement(SidebarNavigationScreenDetailsPanelRow, {
21
+ /*
22
+ * There might be other items in the future,
23
+ * but for now it's just modified date.
24
+ * Later we might render a list of items and isolate
25
+ * the following logic.
26
+ */
27
+ const hrefProps = {};
28
+ if (record?._links?.['predecessor-version']?.[0]?.id) {
29
+ hrefProps.href = addQueryArgs('revision.php', {
30
+ revision: record?._links['predecessor-version'][0].id
31
+ });
32
+ hrefProps.as = 'a';
33
+ }
34
+ return createElement(ItemGroup, {
17
35
  className: "edit-site-sidebar-navigation-screen-details-footer"
36
+ }, createElement(SidebarNavigationItem, {
37
+ label: __('Revisions'),
38
+ ...hrefProps,
39
+ ...otherProps
40
+ }, createElement(SidebarNavigationScreenDetailsPanelRow, {
41
+ justify: "space-between"
18
42
  }, createElement(SidebarNavigationScreenDetailsPanelLabel, null, __('Last modified')), createElement(SidebarNavigationScreenDetailsPanelValue, null, createInterpolateElement(sprintf( /* translators: %s: is the relative time when the post was last modified. */
19
- __('<time>%s</time>'), humanTimeDiff(lastModifiedDateTime)), {
43
+ __('<time>%s</time>'), humanTimeDiff(record.modified)), {
20
44
  time: createElement("time", {
21
- dateTime: lastModifiedDateTime
45
+ dateTime: record.modified
22
46
  })
47
+ })), createElement(Icon, {
48
+ className: "edit-site-sidebar-navigation-screen-details-footer__icon",
49
+ icon: backup
23
50
  }))));
24
51
  }
25
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","humanTimeDiff","createInterpolateElement","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","SidebarNavigationScreenDetailsFooter","lastModifiedDateTime","createElement","Fragment","className","time","dateTime"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\nexport default function SidebarNavigationScreenDetailsFooter( {\n\tlastModifiedDateTime,\n} ) {\n\treturn (\n\t\t<>\n\t\t\t{ lastModifiedDateTime && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow className=\"edit-site-sidebar-navigation-screen-details-footer\">\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ __( 'Last modified' ) }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was last modified. */\n\t\t\t\t\t\t\t\t__( '<time>%s</time>' ),\n\t\t\t\t\t\t\t\thumanTimeDiff( lastModifiedDateTime )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttime: (\n\t\t\t\t\t\t\t\t\t<time dateTime={ lastModifiedDateTime } />\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</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,wBAAwB,QAAQ,oBAAoB;;AAE7D;AACA;AACA;AACA,SACCC,sCAAsC,EACtCC,wCAAwC,EACxCC,wCAAwC,QAClC,4CAA4C;AAEnD,eAAe,SAASC,oCAAoCA,CAAE;EAC7DC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAAAC,QAAA,QACGF,oBAAoB,IACrBC,aAAA,CAACL,sCAAsC;IAACO,SAAS,EAAC;EAAoD,GACrGF,aAAA,CAACJ,wCAAwC,QACtCL,EAAE,CAAE,eAAgB,CACmB,CAAC,EAC3CS,aAAA,CAACH,wCAAwC,QACtCH,wBAAwB,CACzBF,OAAO,EACN;EACAD,EAAE,CAAE,iBAAkB,CAAC,EACvBE,aAAa,CAAEM,oBAAqB,CACrC,CAAC,EACD;IACCI,IAAI,EACHH,aAAA;MAAMI,QAAQ,EAAGL;IAAsB,CAAE;EAE3C,CACD,CACyC,CACH,CAExC,CAAC;AAEL"}
1
+ {"version":3,"names":["__","sprintf","humanTimeDiff","createInterpolateElement","addQueryArgs","Icon","__experimentalItemGroup","ItemGroup","backup","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","SidebarNavigationItem","SidebarNavigationScreenDetailsFooter","record","otherProps","hrefProps","_links","id","href","revision","as","createElement","className","label","justify","modified","time","dateTime","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\nimport {\n\tIcon,\n\t__experimentalItemGroup as ItemGroup,\n} from '@wordpress/components';\nimport { backup } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenDetailsFooter( {\n\trecord,\n\t...otherProps\n} ) {\n\t/*\n\t * There might be other items in the future,\n\t * but for now it's just modified date.\n\t * Later we might render a list of items and isolate\n\t * the following logic.\n\t */\n\tconst hrefProps = {};\n\tif ( record?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ) {\n\t\threfProps.href = addQueryArgs( 'revision.php', {\n\t\t\trevision: record?._links[ 'predecessor-version' ][ 0 ].id,\n\t\t} );\n\t\threfProps.as = 'a';\n\t}\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-details-footer\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tlabel={ __( 'Revisions' ) }\n\t\t\t\t{ ...hrefProps }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow justify=\"space-between\">\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ __( 'Last modified' ) }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was last modified. */\n\t\t\t\t\t\t\t\t__( '<time>%s</time>' ),\n\t\t\t\t\t\t\t\thumanTimeDiff( record.modified )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttime: <time dateTime={ record.modified } />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-details-footer__icon\"\n\t\t\t\t\t\ticon={ backup }\n\t\t\t\t\t/>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;A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CAChC,CAAC,EACD;IACCC,IAAI,EAAEL,aAAA;MAAMM,QAAQ,EAAGd,MAAM,CAACY;IAAU,CAAE;EAC3C,CACD,CACyC,CAAC,EAC3CJ,aAAA,CAACjB,IAAI;IACJkB,SAAS,EAAC,0DAA0D;IACpEM,IAAI,EAAGrB;EAAQ,CACf,CACsC,CAClB,CACb,CAAC;AAEd"}
@@ -11,13 +11,15 @@ import { __experimentalHStack as HStack } from '@wordpress/components';
11
11
  export default function SidebarNavigationScreenDetailsPanelRow({
12
12
  label,
13
13
  children,
14
- className
14
+ className,
15
+ ...extraProps
15
16
  }) {
16
17
  return createElement(HStack, {
17
18
  key: label,
18
19
  spacing: 5,
19
20
  alignment: "left",
20
- className: classnames('edit-site-sidebar-navigation-details-screen-panel__row', className)
21
+ className: classnames('edit-site-sidebar-navigation-details-screen-panel__row', className),
22
+ ...extraProps
21
23
  }, children);
22
24
  }
23
25
  //# sourceMappingURL=sidebar-navigation-screen-details-panel-row.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__experimentalHStack","HStack","SidebarNavigationScreenDetailsPanelRow","label","children","className","createElement","key","spacing","alignment"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\nexport default function SidebarNavigationScreenDetailsPanelRow( {\n\tlabel,\n\tchildren,\n\tclassName,\n} ) {\n\treturn (\n\t\t<HStack\n\t\t\tkey={ label }\n\t\t\tspacing={ 5 }\n\t\t\talignment=\"left\"\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-details-screen-panel__row',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t{ children }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AAEtE,eAAe,SAASC,sCAAsCA,CAAE;EAC/DC,KAAK;EACLC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAACL,MAAM;IACNM,GAAG,EAAGJ,KAAO;IACbK,OAAO,EAAG,CAAG;IACbC,SAAS,EAAC,MAAM;IAChBJ,SAAS,EAAGN,UAAU,CACrB,wDAAwD,EACxDM,SACD;EAAG,GAEDD,QACK,CAAC;AAEX"}
1
+ {"version":3,"names":["classnames","__experimentalHStack","HStack","SidebarNavigationScreenDetailsPanelRow","label","children","className","extraProps","createElement","key","spacing","alignment"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\nexport default function SidebarNavigationScreenDetailsPanelRow( {\n\tlabel,\n\tchildren,\n\tclassName,\n\t...extraProps\n} ) {\n\treturn (\n\t\t<HStack\n\t\t\tkey={ label }\n\t\t\tspacing={ 5 }\n\t\t\talignment=\"left\"\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-details-screen-panel__row',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...extraProps }\n\t\t>\n\t\t\t{ children }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AAEtE,eAAe,SAASC,sCAAsCA,CAAE;EAC/DC,KAAK;EACLC,QAAQ;EACRC,SAAS;EACT,GAAGC;AACJ,CAAC,EAAG;EACH,OACCC,aAAA,CAACN,MAAM;IACNO,GAAG,EAAGL,KAAO;IACbM,OAAO,EAAG,CAAG;IACbC,SAAS,EAAC,MAAM;IAChBL,SAAS,EAAGN,UAAU,CACrB,wDAAwD,EACxDM,SACD,CAAG;IAAA,GACEC;EAAU,GAEbF,QACK,CAAC;AAEX"}
@@ -3,13 +3,12 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  * WordPress dependencies
4
4
  */
5
5
  import { __ } from '@wordpress/i18n';
6
- import { backup, edit, seen } from '@wordpress/icons';
6
+ import { edit, seen } from '@wordpress/icons';
7
7
  import { useSelect, useDispatch } from '@wordpress/data';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
- import { Icon, __experimentalNavigatorButton as NavigatorButton, __experimentalVStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
9
+ import { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';
10
10
  import { useViewportMatch } from '@wordpress/compose';
11
11
  import { BlockEditorProvider } from '@wordpress/block-editor';
12
- import { humanTimeDiff } from '@wordpress/date';
13
12
  import { useCallback } from '@wordpress/element';
14
13
 
15
14
  /**
@@ -23,6 +22,7 @@ import SidebarButton from '../sidebar-button';
23
22
  import SidebarNavigationItem from '../sidebar-navigation-item';
24
23
  import StyleBook from '../style-book';
25
24
  import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
25
+ import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
26
26
  const noop = () => {};
27
27
  export function SidebarNavigationItemGlobalStyles(props) {
28
28
  const {
@@ -72,33 +72,6 @@ function SidebarNavigationScreenGlobalStylesContent() {
72
72
  onInput: noop
73
73
  }, createElement(StyleVariationsContainer, null));
74
74
  }
75
- function SidebarNavigationScreenGlobalStylesFooter({
76
- modifiedDateTime,
77
- onClickRevisions
78
- }) {
79
- return createElement(VStack, {
80
- className: "edit-site-sidebar-navigation-screen-global-styles__footer"
81
- }, createElement(SidebarNavigationItem, {
82
- className: "edit-site-sidebar-navigation-screen-global-styles__revisions",
83
- label: __('Revisions'),
84
- onClick: onClickRevisions
85
- }, createElement(HStack, {
86
- as: "span",
87
- alignment: "center",
88
- spacing: 5,
89
- direction: "row",
90
- justify: "space-between"
91
- }, createElement("span", {
92
- className: "edit-site-sidebar-navigation-screen-global-styles__revisions__label"
93
- }, __('Last modified')), createElement("span", null, createElement("time", {
94
- dateTime: modifiedDateTime
95
- }, humanTimeDiff(modifiedDateTime))), createElement(Icon, {
96
- icon: backup,
97
- style: {
98
- fill: 'currentcolor'
99
- }
100
- }))));
101
- }
102
75
  export default function SidebarNavigationScreenGlobalStyles() {
103
76
  const {
104
77
  revisions,
@@ -163,9 +136,9 @@ export default function SidebarNavigationScreenGlobalStyles() {
163
136
  title: __('Styles'),
164
137
  description: __('Choose a different style combination for the theme styles.'),
165
138
  content: createElement(SidebarNavigationScreenGlobalStylesContent, null),
166
- footer: shouldShowGlobalStylesFooter && createElement(SidebarNavigationScreenGlobalStylesFooter, {
167
- modifiedDateTime: modifiedDateTime,
168
- onClickRevisions: openRevisions
139
+ footer: shouldShowGlobalStylesFooter && createElement(SidebarNavigationScreenDetailsFooter, {
140
+ record: revisions?.[0],
141
+ onClick: openRevisions
169
142
  }),
170
143
  actions: createElement(Fragment, null, !isMobileViewport && createElement(SidebarButton, {
171
144
  icon: seen,
@@ -1 +1 @@
1
- {"version":3,"names":["__","backup","edit","seen","useSelect","useDispatch","store","coreStore","Icon","__experimentalNavigatorButton","NavigatorButton","__experimentalVStack","HStack","VStack","useViewportMatch","BlockEditorProvider","humanTimeDiff","useCallback","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","settings","onChange","onInput","SidebarNavigationScreenGlobalStylesFooter","modifiedDateTime","onClickRevisions","className","label","alignment","spacing","direction","justify","dateTime","icon","style","fill","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","actions","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { backup, edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesFooter( {\n\tmodifiedDateTime,\n\tonClickRevisions,\n} ) {\n\treturn (\n\t\t<VStack className=\"edit-site-sidebar-navigation-screen-global-styles__footer\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-global-styles__revisions\"\n\t\t\t\tlabel={ __( 'Revisions' ) }\n\t\t\t\tonClick={ onClickRevisions }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tas=\"span\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-global-styles__revisions__label\">\n\t\t\t\t\t\t{ __( 'Last modified' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<time dateTime={ modifiedDateTime }>\n\t\t\t\t\t\t\t{ humanTimeDiff( modifiedDateTime ) }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</span>\n\t\t\t\t\t<Icon icon={ backup } style={ { fill: 'currentcolor' } } />\n\t\t\t\t</HStack>\n\t\t\t</SidebarNavigationItem>\n\t\t</VStack>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenGlobalStylesFooter\n\t\t\t\t\t\t\tmodifiedDateTime={ modifiedDateTime }\n\t\t\t\t\t\t\tonClickRevisions={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\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\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;A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IACDS,OAAO,EACNxD,aAAA,CAAAmD,QAAA,QACG,CAAEvB,gBAAgB,IACnB5B,aAAA,CAACb,aAAa;MACbiC,IAAI,EAAGpD,IAAM;MACb8C,KAAK,EAAGjD,EAAE,CAAE,YAAa,CAAG;MAC5BsC,OAAO,EAAGA,CAAA,KACT0B,4BAA4B,CAC3B,CAAEE,iBAAiB,GAChB,YAAY,GACZS,SACJ,CACA;MACDiB,SAAS,EAAG1B;IAAmB,CAC/B,CACD,EACD/B,aAAA,CAACb,aAAa;MACbiC,IAAI,EAAGrD,IAAM;MACb+C,KAAK,EAAGjD,EAAE,CAAE,aAAc,CAAG;MAC7BsC,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAMwC,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAZ,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,IACtD9B,aAAA,CAACX,SAAS;IACTqE,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BxD,OAAO,EAAG2C,aAAe;IACzBc,QAAQ,EAAGd,aAAe;IAC1Be,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
1
+ {"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","useViewportMatch","BlockEditorProvider","useCallback","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","settings","onChange","onInput","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","record","actions","icon","label","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\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\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\t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AAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,IACtDjB,aAAA,CAACZ,SAAS;IACT6D,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1B/C,OAAO,EAAG8B,aAAe;IACzBkB,QAAQ,EAAGlB,aAAe;IAC1BmB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
@@ -84,9 +84,9 @@ export default function SidebarNavigationScreenPage() {
84
84
  }, stripHTML(record.excerpt.rendered)), createElement(PageDetails, {
85
85
  id: postId
86
86
  })),
87
- footer: createElement(SidebarNavigationScreenDetailsFooter, {
88
- lastModifiedDateTime: record?.modified
89
- })
87
+ footer: record?.modified ? createElement(SidebarNavigationScreenDetailsFooter, {
88
+ record: record
89
+ }) : null
90
90
  }) : null;
91
91
  }
92
92
  //# sourceMappingURL=index.js.map