@wordpress/edit-site 6.11.0 → 6.12.1-next.082ed6819.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 (346) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/utils.js +1 -2
  3. package/build/components/add-new-template/utils.js.map +1 -1
  4. package/build/components/app/index.js +0 -5
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/block-editor/use-editor-iframe-props.js +6 -8
  7. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  8. package/build/components/block-editor/use-site-editor-settings.js +4 -12
  9. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  10. package/build/components/editor/index.js +23 -27
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/editor/use-editor-title.js +37 -12
  13. package/build/components/editor/use-editor-title.js.map +1 -1
  14. package/build/components/editor/use-resolve-edited-entity.js +133 -0
  15. package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
  16. package/build/components/editor-canvas-container/index.js +1 -1
  17. package/build/components/editor-canvas-container/index.js.map +1 -1
  18. package/build/components/global-styles/block-preview-panel.js +8 -10
  19. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  20. package/build/components/global-styles/screen-block.js +18 -5
  21. package/build/components/global-styles/screen-block.js.map +1 -1
  22. package/build/components/global-styles/screen-revisions/revisions-buttons.js +24 -22
  23. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  24. package/build/components/global-styles/screen-style-variations.js +11 -5
  25. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  26. package/build/components/global-styles/shadows-edit-panel.js +2 -3
  27. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  28. package/build/components/global-styles/ui.js +42 -2
  29. package/build/components/global-styles/ui.js.map +1 -1
  30. package/build/components/global-styles-renderer/index.js +6 -8
  31. package/build/components/global-styles-renderer/index.js.map +1 -1
  32. package/build/components/global-styles-sidebar/index.js +17 -1
  33. package/build/components/global-styles-sidebar/index.js.map +1 -1
  34. package/build/components/layout/hooks.js +1 -10
  35. package/build/components/layout/hooks.js.map +1 -1
  36. package/build/components/layout/index.js +1 -0
  37. package/build/components/layout/index.js.map +1 -1
  38. package/build/components/page-patterns/fields.js +3 -7
  39. package/build/components/page-patterns/fields.js.map +1 -1
  40. package/build/components/page-patterns/header.js +2 -2
  41. package/build/components/page-patterns/header.js.map +1 -1
  42. package/build/components/page-patterns/use-patterns.js +4 -8
  43. package/build/components/page-patterns/use-patterns.js.map +1 -1
  44. package/build/components/page-templates/fields.js +1 -2
  45. package/build/components/page-templates/fields.js.map +1 -1
  46. package/build/components/post-edit/index.js +15 -11
  47. package/build/components/post-edit/index.js.map +1 -1
  48. package/build/components/post-list/index.js +13 -3
  49. package/build/components/post-list/index.js.map +1 -1
  50. package/build/components/posts-app/index.js +3 -4
  51. package/build/components/posts-app/index.js.map +1 -1
  52. package/build/components/posts-app-routes/home.js +48 -0
  53. package/build/components/posts-app-routes/home.js.map +1 -0
  54. package/build/components/posts-app-routes/index.js +37 -0
  55. package/build/components/posts-app-routes/index.js.map +1 -0
  56. package/build/components/posts-app-routes/posts-edit.js +44 -0
  57. package/build/components/posts-app-routes/posts-edit.js.map +1 -0
  58. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
  59. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  60. package/build/components/posts-app-routes/posts-list-view.js +48 -0
  61. package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
  62. package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
  63. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  64. package/build/components/posts-app-routes/posts-view.js +41 -0
  65. package/build/components/posts-app-routes/posts-view.js.map +1 -0
  66. package/build/components/sidebar/index.js +11 -3
  67. package/build/components/sidebar/index.js.map +1 -1
  68. package/build/components/sidebar-global-styles-wrapper/index.js +129 -0
  69. package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -0
  70. package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
  71. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-global-styles/index.js +18 -90
  73. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  74. package/build/components/sidebar-navigation-screen-main/index.js +43 -42
  75. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  76. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  77. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  78. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
  79. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  80. package/build/components/site-editor-routes/index.js +1 -2
  81. package/build/components/site-editor-routes/index.js.map +1 -1
  82. package/build/components/site-editor-routes/styles-view.js +8 -2
  83. package/build/components/site-editor-routes/styles-view.js.map +1 -1
  84. package/build/components/site-hub/index.js +19 -6
  85. package/build/components/site-hub/index.js.map +1 -1
  86. package/build/components/style-book/constants.js +10 -3
  87. package/build/components/style-book/constants.js.map +1 -1
  88. package/build/components/style-book/examples.js +94 -2
  89. package/build/components/style-book/examples.js.map +1 -1
  90. package/build/components/style-book/index.js +70 -11
  91. package/build/components/style-book/index.js.map +1 -1
  92. package/build/components/welcome-guide/index.js +4 -2
  93. package/build/components/welcome-guide/index.js.map +1 -1
  94. package/build/components/welcome-guide/page.js +1 -9
  95. package/build/components/welcome-guide/page.js.map +1 -1
  96. package/build/components/welcome-guide/template.js +1 -12
  97. package/build/components/welcome-guide/template.js.map +1 -1
  98. package/build/hooks/commands/use-common-commands.js +15 -15
  99. package/build/hooks/commands/use-common-commands.js.map +1 -1
  100. package/build/index.js +1 -9
  101. package/build/index.js.map +1 -1
  102. package/build/posts.js +1 -0
  103. package/build/posts.js.map +1 -1
  104. package/build/store/actions.js +13 -0
  105. package/build/store/actions.js.map +1 -1
  106. package/build/store/selectors.js +21 -1
  107. package/build/store/selectors.js.map +1 -1
  108. package/build-module/components/add-new-template/utils.js +1 -2
  109. package/build-module/components/add-new-template/utils.js.map +1 -1
  110. package/build-module/components/app/index.js +0 -5
  111. package/build-module/components/app/index.js.map +1 -1
  112. package/build-module/components/block-editor/use-editor-iframe-props.js +6 -8
  113. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  114. package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
  115. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  116. package/build-module/components/editor/index.js +23 -27
  117. package/build-module/components/editor/index.js.map +1 -1
  118. package/build-module/components/editor/use-editor-title.js +37 -12
  119. package/build-module/components/editor/use-editor-title.js.map +1 -1
  120. package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
  121. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
  122. package/build-module/components/editor-canvas-container/index.js +1 -1
  123. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  124. package/build-module/components/global-styles/block-preview-panel.js +8 -10
  125. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  126. package/build-module/components/global-styles/screen-block.js +18 -5
  127. package/build-module/components/global-styles/screen-block.js.map +1 -1
  128. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +25 -23
  129. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  130. package/build-module/components/global-styles/screen-style-variations.js +11 -5
  131. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  132. package/build-module/components/global-styles/shadows-edit-panel.js +2 -3
  133. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  134. package/build-module/components/global-styles/ui.js +42 -2
  135. package/build-module/components/global-styles/ui.js.map +1 -1
  136. package/build-module/components/global-styles-renderer/index.js +6 -8
  137. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  138. package/build-module/components/global-styles-sidebar/index.js +18 -2
  139. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  140. package/build-module/components/layout/hooks.js +1 -9
  141. package/build-module/components/layout/hooks.js.map +1 -1
  142. package/build-module/components/layout/index.js +1 -0
  143. package/build-module/components/layout/index.js.map +1 -1
  144. package/build-module/components/page-patterns/fields.js +4 -8
  145. package/build-module/components/page-patterns/fields.js.map +1 -1
  146. package/build-module/components/page-patterns/header.js +2 -2
  147. package/build-module/components/page-patterns/header.js.map +1 -1
  148. package/build-module/components/page-patterns/use-patterns.js +4 -8
  149. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  150. package/build-module/components/page-templates/fields.js +1 -2
  151. package/build-module/components/page-templates/fields.js.map +1 -1
  152. package/build-module/components/post-edit/index.js +14 -10
  153. package/build-module/components/post-edit/index.js.map +1 -1
  154. package/build-module/components/post-list/index.js +13 -3
  155. package/build-module/components/post-list/index.js.map +1 -1
  156. package/build-module/components/posts-app/index.js +3 -4
  157. package/build-module/components/posts-app/index.js.map +1 -1
  158. package/build-module/components/posts-app-routes/home.js +40 -0
  159. package/build-module/components/posts-app-routes/home.js.map +1 -0
  160. package/build-module/components/posts-app-routes/index.js +30 -0
  161. package/build-module/components/posts-app-routes/index.js.map +1 -0
  162. package/build-module/components/posts-app-routes/posts-edit.js +36 -0
  163. package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
  164. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
  165. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  166. package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
  167. package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
  168. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
  169. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  170. package/build-module/components/posts-app-routes/posts-view.js +33 -0
  171. package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
  172. package/build-module/components/sidebar/index.js +11 -3
  173. package/build-module/components/sidebar/index.js.map +1 -1
  174. package/build-module/components/sidebar-global-styles-wrapper/index.js +121 -0
  175. package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -0
  176. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
  177. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  178. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -91
  179. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  180. package/build-module/components/sidebar-navigation-screen-main/index.js +43 -43
  181. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  182. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  183. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  184. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
  185. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  186. package/build-module/components/site-editor-routes/index.js +1 -2
  187. package/build-module/components/site-editor-routes/index.js.map +1 -1
  188. package/build-module/components/site-editor-routes/styles-view.js +8 -2
  189. package/build-module/components/site-editor-routes/styles-view.js.map +1 -1
  190. package/build-module/components/site-hub/index.js +19 -6
  191. package/build-module/components/site-hub/index.js.map +1 -1
  192. package/build-module/components/style-book/constants.js +10 -3
  193. package/build-module/components/style-book/constants.js.map +1 -1
  194. package/build-module/components/style-book/examples.js +94 -2
  195. package/build-module/components/style-book/examples.js.map +1 -1
  196. package/build-module/components/style-book/index.js +71 -12
  197. package/build-module/components/style-book/index.js.map +1 -1
  198. package/build-module/components/welcome-guide/index.js +4 -2
  199. package/build-module/components/welcome-guide/index.js.map +1 -1
  200. package/build-module/components/welcome-guide/page.js +1 -9
  201. package/build-module/components/welcome-guide/page.js.map +1 -1
  202. package/build-module/components/welcome-guide/template.js +1 -11
  203. package/build-module/components/welcome-guide/template.js.map +1 -1
  204. package/build-module/hooks/commands/use-common-commands.js +15 -15
  205. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  206. package/build-module/index.js +2 -10
  207. package/build-module/index.js.map +1 -1
  208. package/build-module/posts.js +1 -0
  209. package/build-module/posts.js.map +1 -1
  210. package/build-module/store/actions.js +13 -0
  211. package/build-module/store/actions.js.map +1 -1
  212. package/build-module/store/selectors.js +21 -1
  213. package/build-module/store/selectors.js.map +1 -1
  214. package/build-style/posts-rtl.css +106 -16
  215. package/build-style/posts.css +106 -16
  216. package/build-style/style-rtl.css +176 -78
  217. package/build-style/style.css +176 -78
  218. package/package.json +39 -40
  219. package/src/components/add-new-template/utils.js +2 -2
  220. package/src/components/app/index.js +0 -5
  221. package/src/components/block-editor/use-editor-iframe-props.js +2 -3
  222. package/src/components/block-editor/use-site-editor-settings.js +7 -21
  223. package/src/components/editor/index.js +31 -30
  224. package/src/components/editor/use-editor-title.js +50 -13
  225. package/src/components/editor/use-resolve-edited-entity.js +132 -0
  226. package/src/components/editor-canvas-container/index.js +1 -1
  227. package/src/components/editor-canvas-container/style.scss +0 -1
  228. package/src/components/global-styles/block-preview-panel.js +10 -10
  229. package/src/components/global-styles/screen-block.js +26 -8
  230. package/src/components/global-styles/screen-revisions/revisions-buttons.js +28 -31
  231. package/src/components/global-styles/screen-revisions/style.scss +11 -17
  232. package/src/components/global-styles/screen-style-variations.js +14 -5
  233. package/src/components/global-styles/shadows-edit-panel.js +4 -2
  234. package/src/components/global-styles/ui.js +41 -1
  235. package/src/components/global-styles-renderer/index.js +4 -10
  236. package/src/components/global-styles-sidebar/index.js +16 -2
  237. package/src/components/layout/hooks.js +1 -7
  238. package/src/components/layout/index.js +6 -1
  239. package/src/components/page-patterns/fields.js +6 -12
  240. package/src/components/page-patterns/header.js +3 -2
  241. package/src/components/page-patterns/style.scss +0 -5
  242. package/src/components/page-patterns/use-patterns.js +9 -7
  243. package/src/components/page-templates/fields.js +2 -3
  244. package/src/components/page-templates/style.scss +1 -0
  245. package/src/components/post-edit/index.js +37 -32
  246. package/src/components/post-edit/style.scss +7 -0
  247. package/src/components/post-list/index.js +10 -5
  248. package/src/components/post-list/style.scss +29 -3
  249. package/src/components/posts-app/index.js +3 -4
  250. package/src/components/posts-app-routes/home.js +36 -0
  251. package/src/components/posts-app-routes/index.js +36 -0
  252. package/src/components/posts-app-routes/posts-edit.js +31 -0
  253. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
  254. package/src/components/posts-app-routes/posts-list-view.js +40 -0
  255. package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
  256. package/src/components/posts-app-routes/posts-view.js +35 -0
  257. package/src/components/sidebar/index.js +23 -7
  258. package/src/components/sidebar-global-styles-wrapper/index.js +150 -0
  259. package/src/components/sidebar-global-styles-wrapper/style.scss +35 -0
  260. package/src/components/sidebar-navigation-item/style.scss +2 -2
  261. package/src/components/sidebar-navigation-screen/style.scss +7 -2
  262. package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
  263. package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
  264. package/src/components/sidebar-navigation-screen-global-styles/index.js +19 -103
  265. package/src/components/sidebar-navigation-screen-main/index.js +46 -45
  266. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
  267. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  268. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
  269. package/src/components/site-editor-routes/README.md +2 -2
  270. package/src/components/site-editor-routes/index.js +0 -2
  271. package/src/components/site-editor-routes/styles-view.js +11 -1
  272. package/src/components/site-hub/index.js +33 -16
  273. package/src/components/site-hub/style.scss +1 -1
  274. package/src/components/site-icon/style.scss +16 -0
  275. package/src/components/style-book/constants.ts +11 -3
  276. package/src/components/style-book/examples.tsx +128 -2
  277. package/src/components/style-book/index.js +86 -8
  278. package/src/components/welcome-guide/index.js +3 -3
  279. package/src/components/welcome-guide/page.js +1 -7
  280. package/src/components/welcome-guide/template.js +1 -8
  281. package/src/hooks/commands/use-common-commands.js +253 -246
  282. package/src/index.js +2 -13
  283. package/src/posts.js +1 -0
  284. package/src/store/actions.js +15 -0
  285. package/src/store/selectors.js +24 -1
  286. package/src/style.scss +2 -5
  287. package/build/components/async/index.js +0 -51
  288. package/build/components/async/index.js.map +0 -1
  289. package/build/components/post-fields/index.js +0 -290
  290. package/build/components/post-fields/index.js.map +0 -1
  291. package/build/components/posts-app/router.js +0 -85
  292. package/build/components/posts-app/router.js.map +0 -1
  293. package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
  294. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  295. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
  296. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  297. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
  298. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  299. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
  300. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  301. package/build/components/site-editor-routes/styles-edit.js +0 -28
  302. package/build/components/site-editor-routes/styles-edit.js.map +0 -1
  303. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
  304. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  305. package/build/components/use-edited-entity-record/index.js +0 -60
  306. package/build/components/use-edited-entity-record/index.js.map +0 -1
  307. package/build/hooks/commands/use-edit-mode-commands.js +0 -179
  308. package/build/hooks/commands/use-edit-mode-commands.js.map +0 -1
  309. package/build-module/components/async/index.js +0 -44
  310. package/build-module/components/async/index.js.map +0 -1
  311. package/build-module/components/post-fields/index.js +0 -283
  312. package/build-module/components/post-fields/index.js.map +0 -1
  313. package/build-module/components/posts-app/router.js +0 -77
  314. package/build-module/components/posts-app/router.js.map +0 -1
  315. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
  316. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  317. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  318. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  319. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
  320. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  321. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  322. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  323. package/build-module/components/site-editor-routes/styles-edit.js +0 -20
  324. package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
  325. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
  326. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  327. package/build-module/components/use-edited-entity-record/index.js +0 -53
  328. package/build-module/components/use-edited-entity-record/index.js.map +0 -1
  329. package/build-module/hooks/commands/use-edit-mode-commands.js +0 -171
  330. package/build-module/hooks/commands/use-edit-mode-commands.js.map +0 -1
  331. package/src/components/async/index.js +0 -43
  332. package/src/components/post-fields/index.js +0 -361
  333. package/src/components/post-fields/style.scss +0 -3
  334. package/src/components/posts-app/router.js +0 -69
  335. package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
  336. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  337. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
  338. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  339. package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
  340. package/src/components/site-editor-routes/styles-edit.js +0 -17
  341. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -267
  342. package/src/components/use-edited-entity-record/index.js +0 -58
  343. package/src/hooks/commands/use-edit-mode-commands.js +0 -168
  344. package/src/store/test/actions.js +0 -83
  345. package/src/store/test/reducer.js +0 -69
  346. package/src/store/test/selectors.js +0 -41
@@ -1,24 +1,22 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __, sprintf } from '@wordpress/i18n';
5
- import { humanTimeDiff } from '@wordpress/date';
6
- import { createInterpolateElement } from '@wordpress/element';
4
+ import { _n, sprintf } from '@wordpress/i18n';
7
5
  import { addQueryArgs } from '@wordpress/url';
8
- import { Icon, __experimentalItemGroup as ItemGroup } from '@wordpress/components';
6
+ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
9
7
  import { backup } from '@wordpress/icons';
10
8
 
11
9
  /**
12
10
  * Internal dependencies
13
11
  */
14
- import { SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
15
12
  import SidebarNavigationItem from '../sidebar-navigation-item';
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
17
14
  export default function SidebarNavigationScreenDetailsFooter({
18
15
  record,
16
+ revisionsCount,
19
17
  ...otherProps
20
18
  }) {
21
- var _record$_links$predec, _record$_links$versio;
19
+ var _record$_links$predec;
22
20
  /*
23
21
  * There might be other items in the future,
24
22
  * but for now it's just modified date.
@@ -27,8 +25,17 @@ export default function SidebarNavigationScreenDetailsFooter({
27
25
  */
28
26
  const hrefProps = {};
29
27
  const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null;
30
- const revisionsCount = (_record$_links$versio = record?._links?.['version-history']?.[0]?.count) !== null && _record$_links$versio !== void 0 ? _record$_links$versio : 0;
31
- // Enable the revisions link if there is a last revision and there are more than one revisions.
28
+
29
+ // Use incoming prop first, then the record's version history, if available.
30
+ revisionsCount = revisionsCount || record?._links?.['version-history']?.[0]?.count || 0;
31
+
32
+ /*
33
+ * Enable the revisions link if there is a last revision and there is more than one revision.
34
+ * This link is used for theme assets, e.g., templates, which have no database record until they're edited.
35
+ * For these files there's only a "revision" after they're edited twice,
36
+ * which means the revision.php page won't display a proper diff.
37
+ * See: https://github.com/WordPress/gutenberg/issues/49164.
38
+ */
32
39
  if (lastRevisionId && revisionsCount > 1) {
33
40
  hrefProps.href = addQueryArgs('revision.php', {
34
41
  revision: record?._links['predecessor-version'][0].id
@@ -36,27 +43,14 @@ export default function SidebarNavigationScreenDetailsFooter({
36
43
  hrefProps.as = 'a';
37
44
  }
38
45
  return /*#__PURE__*/_jsx(ItemGroup, {
46
+ size: "large",
39
47
  className: "edit-site-sidebar-navigation-screen-details-footer",
40
48
  children: /*#__PURE__*/_jsx(SidebarNavigationItem, {
41
- "aria-label": __('Revisions'),
49
+ icon: backup,
42
50
  ...hrefProps,
43
51
  ...otherProps,
44
- children: /*#__PURE__*/_jsxs(SidebarNavigationScreenDetailsPanelRow, {
45
- justify: "space-between",
46
- children: [/*#__PURE__*/_jsx(SidebarNavigationScreenDetailsPanelLabel, {
47
- children: __('Last modified')
48
- }), /*#__PURE__*/_jsx(SidebarNavigationScreenDetailsPanelValue, {
49
- children: createInterpolateElement(sprintf(/* translators: %s: is the relative time when the post was last modified. */
50
- __('<time>%s</time>'), humanTimeDiff(record.modified)), {
51
- time: /*#__PURE__*/_jsx("time", {
52
- dateTime: record.modified
53
- })
54
- })
55
- }), /*#__PURE__*/_jsx(Icon, {
56
- className: "edit-site-sidebar-navigation-screen-details-footer__icon",
57
- icon: backup
58
- })]
59
- })
52
+ children: sprintf(/* translators: %d: Number of Styles revisions. */
53
+ _n('%d Revision', '%d Revisions', revisionsCount), revisionsCount)
60
54
  })
61
55
  });
62
56
  }
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","humanTimeDiff","createInterpolateElement","addQueryArgs","Icon","__experimentalItemGroup","ItemGroup","backup","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","SidebarNavigationItem","jsx","_jsx","jsxs","_jsxs","SidebarNavigationScreenDetailsFooter","record","otherProps","_record$_links$predec","_record$_links$versio","hrefProps","lastRevisionId","_links","id","revisionsCount","count","href","revision","as","className","children","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\tconst lastRevisionId =\n\t\trecord?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\tconst revisionsCount =\n\t\trecord?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t// Enable the revisions link if there is a last revision and there are more than one revisions.\n\tif ( lastRevisionId && revisionsCount > 1 ) {\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\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-details-footer\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\taria-label={ __( '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;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SACCC,IAAI,EACJC,uBAAuB,IAAIC,SAAS,QAC9B,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,kBAAkB;;AAEzC;AACA;AACA;AACA,SACCC,sCAAsC,EACtCC,wCAAwC,EAC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IAAA,CAACH,wCAAwC;UAAAqB,QAAA,EACtC7B,wBAAwB,CACzBF,OAAO,CACN;UACAD,EAAE,CAAE,iBAAkB,CAAC,EACvBE,aAAa,CAAEgB,MAAM,CAACgB,QAAS,CAChC,CAAC,EACD;YACCC,IAAI,eAAErB,IAAA;cAAMsB,QAAQ,EAAGlB,MAAM,CAACgB;YAAU,CAAE;UAC3C,CACD;QAAC,CACwC,CAAC,eAC3CpB,IAAA,CAACT,IAAI;UACJ0B,SAAS,EAAC,0DAA0D;UACpEM,IAAI,EAAG7B;QAAQ,CACf,CAAC;MAAA,CACqC;IAAC,CACnB;EAAC,CACd,CAAC;AAEd","ignoreList":[]}
1
+ {"version":3,"names":["_n","sprintf","addQueryArgs","__experimentalItemGroup","ItemGroup","backup","SidebarNavigationItem","jsx","_jsx","SidebarNavigationScreenDetailsFooter","record","revisionsCount","otherProps","_record$_links$predec","hrefProps","lastRevisionId","_links","id","count","href","revision","as","size","className","children","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { backup } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenDetailsFooter( {\n\trecord,\n\trevisionsCount,\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\tconst lastRevisionId =\n\t\trecord?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\n\t// Use incoming prop first, then the record's version history, if available.\n\trevisionsCount =\n\t\trevisionsCount ||\n\t\trecord?._links?.[ 'version-history' ]?.[ 0 ]?.count ||\n\t\t0;\n\n\t/*\n\t * Enable the revisions link if there is a last revision and there is more than one revision.\n\t * This link is used for theme assets, e.g., templates, which have no database record until they're edited.\n\t * For these files there's only a \"revision\" after they're edited twice,\n\t * which means the revision.php page won't display a proper diff.\n\t * See: https://github.com/WordPress/gutenberg/issues/49164.\n\t */\n\tif ( lastRevisionId && revisionsCount > 1 ) {\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\treturn (\n\t\t<ItemGroup\n\t\t\tsize=\"large\"\n\t\t\tclassName=\"edit-site-sidebar-navigation-screen-details-footer\"\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ backup }\n\t\t\t\t{ ...hrefProps }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: Number of Styles revisions. */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,MAAM,QAAQ,kBAAkB;;AAEzC;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/D,eAAe,SAASC,oCAAoCA,CAAE;EAC7DC,MAAM;EACNC,cAAc;EACd,GAAGC;AACJ,CAAC,EAAG;EAAA,IAAAC,qBAAA;EACH;AACD;AACA;AACA;AACA;AACA;EACC,MAAMC,SAAS,GAAG,CAAC,CAAC;EACpB,MAAMC,cAAc,IAAAF,qBAAA,GACnBH,MAAM,EAAEM,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEC,EAAE,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,IAAI;;EAE7D;EACAF,cAAc,GACbA,cAAc,IACdD,MAAM,EAAEM,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEE,KAAK,IACnD,CAAC;;EAEF;AACD;AACA;AACA;AACA;AACA;AACA;EACC,IAAKH,cAAc,IAAIJ,cAAc,GAAG,CAAC,EAAG;IAC3CG,SAAS,CAACK,IAAI,GAAGjB,YAAY,CAAE,cAAc,EAAE;MAC9CkB,QAAQ,EAAEV,MAAM,EAAEM,MAAM,CAAE,qBAAqB,CAAE,CAAE,CAAC,CAAE,CAACC;IACxD,CAAE,CAAC;IACHH,SAAS,CAACO,EAAE,GAAG,GAAG;EACnB;EACA,oBACCb,IAAA,CAACJ,SAAS;IACTkB,IAAI,EAAC,OAAO;IACZC,SAAS,EAAC,oDAAoD;IAAAC,QAAA,eAE9DhB,IAAA,CAACF,qBAAqB;MACrBmB,IAAI,EAAGpB,MAAQ;MAAA,GACVS,SAAS;MAAA,GACTF,UAAU;MAAAY,QAAA,EAEbvB,OAAO,CACR;MACAD,EAAE,CAAE,aAAa,EAAE,cAAc,EAAEW,cAAe,CAAC,EACnDA,cACD;IAAC,CACqB;EAAC,CACd,CAAC;AAEd","ignoreList":[]}
@@ -2,12 +2,9 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { edit, seen } from '@wordpress/icons';
6
5
  import { useSelect, useDispatch } from '@wordpress/data';
7
6
  import { store as coreStore } from '@wordpress/core-data';
8
- import { useViewportMatch } from '@wordpress/compose';
9
7
  import { useCallback } from '@wordpress/element';
10
- import { store as editorStore } from '@wordpress/editor';
11
8
  import { store as preferencesStore } from '@wordpress/preferences';
12
9
  import { privateApis as routerPrivateApis } from '@wordpress/router';
13
10
 
@@ -17,22 +14,16 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
17
14
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
18
15
  import { unlock } from '../../lock-unlock';
19
16
  import { store as editSiteStore } from '../../store';
20
- import SidebarButton from '../sidebar-button';
21
17
  import SidebarNavigationItem from '../sidebar-navigation-item';
22
- import StyleBook from '../style-book';
23
18
  import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
24
19
  import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
25
- import SidebarNavigationScreenGlobalStylesContent from './content';
26
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
20
+ import { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';
21
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
27
22
  const {
28
23
  useLocation,
29
24
  useHistory
30
25
  } = unlock(routerPrivateApis);
31
26
  export function SidebarNavigationItemGlobalStyles(props) {
32
- const {
33
- openGeneralSidebar
34
- } = useDispatch(editSiteStore);
35
- const history = useHistory();
36
27
  const {
37
28
  params
38
29
  } = useLocation();
@@ -43,67 +34,30 @@ export function SidebarNavigationItemGlobalStyles(props) {
43
34
  params: {
44
35
  path: '/wp_global_styles'
45
36
  },
46
- uid: "global-styles-navigation-item"
37
+ uid: "global-styles-navigation-item",
38
+ "aria-current": params.path && params.path.startsWith('/wp_global_styles')
47
39
  });
48
40
  }
49
41
  return /*#__PURE__*/_jsx(SidebarNavigationItem, {
50
- ...props,
51
- onClick: () => {
52
- // Switch to edit mode.
53
- history.push({
54
- ...params,
55
- canvas: 'edit'
56
- }, undefined, {
57
- transition: 'canvas-mode-edit-transition'
58
- });
59
- // Open global styles sidebar.
60
- openGeneralSidebar('edit-site/global-styles');
61
- }
42
+ ...props
62
43
  });
63
44
  }
64
- export default function SidebarNavigationScreenGlobalStyles({
65
- backPath
66
- }) {
45
+ export default function SidebarNavigationScreenGlobalStyles() {
67
46
  const history = useHistory();
68
47
  const {
69
48
  params
70
49
  } = useLocation();
71
- const {
72
- canvas = 'view'
73
- } = params;
74
50
  const {
75
51
  revisions,
76
- isLoading: isLoadingRevisions
52
+ isLoading: isLoadingRevisions,
53
+ revisionsCount
77
54
  } = useGlobalStylesRevisions();
78
55
  const {
79
56
  openGeneralSidebar
80
57
  } = useDispatch(editSiteStore);
81
- const {
82
- setIsListViewOpened
83
- } = useDispatch(editorStore);
84
- const isMobileViewport = useViewportMatch('medium', '<');
85
58
  const {
86
59
  setEditorCanvasContainerView
87
60
  } = unlock(useDispatch(editSiteStore));
88
- const {
89
- isStyleBookOpened,
90
- revisionsCount
91
- } = useSelect(select => {
92
- var _globalStyles$_links$;
93
- const {
94
- getEditorCanvasContainerView
95
- } = unlock(select(editSiteStore));
96
- const {
97
- getEntityRecord,
98
- __experimentalGetCurrentGlobalStylesId
99
- } = select(coreStore);
100
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
101
- const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
102
- return {
103
- isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),
104
- revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
105
- };
106
- }, []);
107
61
  const {
108
62
  set: setPreference
109
63
  } = useDispatch(preferencesStore);
@@ -116,14 +70,6 @@ export default function SidebarNavigationScreenGlobalStyles({
116
70
  });
117
71
  return Promise.all([setPreference('core', 'distractionFree', false), openGeneralSidebar('edit-site/global-styles')]);
118
72
  }, [history, params, openGeneralSidebar, setPreference]);
119
- const openStyleBook = useCallback(async () => {
120
- await openGlobalStyles();
121
- // Open the Style Book once the canvas mode is set to edit,
122
- // and the global styles sidebar is open. This ensures that
123
- // the Style Book is not prematurely closed.
124
- setEditorCanvasContainerView('style-book');
125
- setIsListViewOpened(false);
126
- }, [openGlobalStyles, setEditorCanvasContainerView, setIsListViewOpened]);
127
73
  const openRevisions = useCallback(async () => {
128
74
  await openGlobalStyles();
129
75
  // Open the global styles revisions once the canvas mode is set to edit,
@@ -134,39 +80,21 @@ export default function SidebarNavigationScreenGlobalStyles({
134
80
  }, [openGlobalStyles, setEditorCanvasContainerView]);
135
81
 
136
82
  // If there are no revisions, do not render a footer.
137
- const hasRevisions = revisionsCount > 0;
138
- const modifiedDateTime = revisions?.[0]?.modified;
139
- const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
140
- return /*#__PURE__*/_jsxs(_Fragment, {
141
- children: [/*#__PURE__*/_jsx(SidebarNavigationScreen, {
142
- title: __('Styles'),
143
- description: __('Choose a different style combination for the theme styles.'),
144
- backPath: backPath,
145
- content: /*#__PURE__*/_jsx(SidebarNavigationScreenGlobalStylesContent, {}),
83
+ const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions;
84
+ return /*#__PURE__*/_jsx(_Fragment, {
85
+ children: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
86
+ title: __('Design'),
87
+ isRoot: true,
88
+ description: __('Customize the appearance of your website using the block editor.'),
89
+ content: /*#__PURE__*/_jsx(MainSidebarNavigationContent, {
90
+ activeItem: "styles-navigation-item"
91
+ }),
146
92
  footer: shouldShowGlobalStylesFooter && /*#__PURE__*/_jsx(SidebarNavigationScreenDetailsFooter, {
147
93
  record: revisions?.[0],
94
+ revisionsCount: revisionsCount,
148
95
  onClick: openRevisions
149
- }),
150
- actions: /*#__PURE__*/_jsxs(_Fragment, {
151
- children: [!isMobileViewport && /*#__PURE__*/_jsx(SidebarButton, {
152
- icon: seen,
153
- label: __('Style Book'),
154
- onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined),
155
- isPressed: isStyleBookOpened
156
- }), /*#__PURE__*/_jsx(SidebarButton, {
157
- icon: edit,
158
- label: __('Edit styles'),
159
- onClick: async () => await openGlobalStyles()
160
- })]
161
96
  })
162
- }), isStyleBookOpened && !isMobileViewport && canvas === 'view' && /*#__PURE__*/_jsx(StyleBook, {
163
- enableResizing: false,
164
- isSelected: () => false,
165
- onClick: openStyleBook,
166
- onSelect: openStyleBook,
167
- showCloseButton: false,
168
- showTabs: false
169
- })]
97
+ })
170
98
  });
171
99
  }
172
100
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","useViewportMatch","useCallback","editorStore","preferencesStore","privateApis","routerPrivateApis","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenGlobalStylesContent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLocation","useHistory","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","history","params","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","path","uid","onClick","push","canvas","undefined","transition","SidebarNavigationScreenGlobalStyles","backPath","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","count","set","setPreference","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","children","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 { useViewportMatch } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\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';\nimport SidebarNavigationScreenGlobalStylesContent from './content';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst { params } = useLocation();\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<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\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\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\t...params,\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\t{\n\t\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t\t}\n\t\t\t\t);\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\nexport default function SidebarNavigationScreenGlobalStyles( { backPath } ) {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isStyleBookOpened, revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tisStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),\n\t\t\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\thistory.push(\n\t\t\t{\n\t\t\t\t...params,\n\t\t\t\tcanvas: 'edit',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t}\n\t\t);\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ history, params, openGeneralSidebar, setPreference ] );\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\tbackPath={ backPath }\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 && canvas === 'view' && (\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,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASH,KAAK,IAAII,WAAW,QAAQ,mBAAmB;AACxD,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAAST,KAAK,IAAIU,aAAa,QAAQ,aAAa;AACpD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,O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E,QAAS,CAAG;MACxB6E,WAAW,EAAG7E,EAAE,CACf,4DACD,CAAG;MACH+C,QAAQ,EAAGA,QAAU;MACrB+B,OAAO,eAAGvD,IAAA,CAACF,0CAA0C,IAAE,CAAG;MAC1D0D,MAAM,EACLL,4BAA4B,iBAC3BnD,IAAA,CAACH,oCAAoC;QACpC4D,MAAM,EAAGhC,SAAS,GAAI,CAAC,CAAI;QAC3BP,OAAO,EAAG6B;MAAe,CACzB,CAEF;MACDW,OAAO,eACNtD,KAAA,CAAAF,SAAA;QAAAkD,QAAA,GACG,CAAEvB,gBAAgB,iBACnB7B,IAAA,CAACP,aAAa;UACbkE,IAAI,EAAGhF,IAAM;UACbiF,KAAK,EAAGnF,EAAE,CAAE,YAAa,CAAG;UAC5ByC,OAAO,EAAGA,CAAA,KACTY,4BAA4B,CAC3B,CAAEC,iBAAiB,GAChB,YAAY,GACZV,SACJ,CACA;UACDwC,SAAS,EAAG9B;QAAmB,CAC/B,CACD,eACD/B,IAAA,CAACP,aAAa;UACbkE,IAAI,EAAGjF,IAAM;UACbkF,KAAK,EAAGnF,EAAE,CAAE,aAAc,CAAG;UAC7ByC,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAMyB,gBAAgB,CAAC;QAAG,CAChD,CAAC;MAAA,CACD;IACF,CACD,CAAC,EACAZ,iBAAiB,IAAI,CAAEF,gBAAgB,IAAIT,MAAM,KAAK,MAAM,iBAC7DpB,IAAA,CAACL,SAAS;MACTmE,cAAc,EAAG,KAAO;MACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;MAC1B7C,OAAO,EAAG4B,aAAe;MACzBkB,QAAQ,EAAGlB,aAAe;MAC1BmB,eAAe,EAAG,KAAO;MACzBC,QAAQ,EAAG;IAAO,CAClB,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["__","useSelect","useDispatch","store","coreStore","useCallback","preferencesStore","privateApis","routerPrivateApis","SidebarNavigationScreen","unlock","editSiteStore","SidebarNavigationItem","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","MainSidebarNavigationContent","jsx","_jsx","Fragment","_Fragment","useLocation","useHistory","SidebarNavigationItemGlobalStyles","props","params","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","path","uid","startsWith","SidebarNavigationScreenGlobalStyles","history","revisions","isLoading","isLoadingRevisions","revisionsCount","openGeneralSidebar","setEditorCanvasContainerView","set","setPreference","openGlobalStyles","push","canvas","undefined","transition","Promise","all","openRevisions","shouldShowGlobalStylesFooter","children","title","isRoot","description","content","activeItem","footer","record","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCallback } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { params } = useLocation();\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<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\n\t\t\t\taria-current={\n\t\t\t\t\tparams.path && params.path.startsWith( '/wp_global_styles' )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\treturn <SidebarNavigationItem { ...props } />;\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst {\n\t\trevisions,\n\t\tisLoading: isLoadingRevisions,\n\t\trevisionsCount,\n\t} = useGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\thistory.push(\n\t\t\t{\n\t\t\t\t...params,\n\t\t\t\tcanvas: 'edit',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t}\n\t\t);\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ history, params, openGeneralSidebar, setPreference ] );\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 shouldShowGlobalStylesFooter =\n\t\t!! revisionsCount && ! isLoadingRevisions;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Design' ) }\n\t\t\t\tisRoot\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t\t) }\n\t\t\t\tcontent={\n\t\t\t\t\t<MainSidebarNavigationContent activeItem=\"styles-navigation-item\" />\n\t\t\t\t}\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\trevisionsCount={ revisionsCount }\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/>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASP,KAAK,IAAIQ,aAAa,QAAQ,aAAa;AACpD,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,wBAAwB,MAAM,+DAA+D;AACpG,OAAOC,oCAAoC,MAAM,6CAA6C;AAC9F,SAASC,4BAA4B,QAAQ,mCAAmC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAEjF,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGX,MAAM,CAAEF,iBAAkB,CAAC;AAE/D,OAAO,SAASc,iCAAiCA,CAAEC,KAAK,EAAG;EAC1D,MAAM;IAAEC;EAAO,CAAC,GAAGJ,WAAW,CAAC,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B,EAAE,KAAM,CAAC,EACjDH,kBAAkB,CAAE,yBAA0B,CAAC,CAC9C,CAAC;EACJ,CAAC,EAAE,CAAEL,OAAO,EAAET,MAAM,EAAEc,kBAAkB,EAAEG,aAAa,CAAG,CAAC;EAE3D,MAAMQ,aAAa,GAAG5C,WAAW,CAAE,YAAY;IAC9C,MAAMqC,gBAAgB,CAAC,CAAC;IACxB;IACA;IACA;IACA;IACAH,4BAA4B,CAAE,yBAA0B,CAAC;EAC1D,CAAC,EAAE,CAAEG,gBAAgB,EAAEH,4BAA4B,CAAG,CAAC;;EAEvD;EACA,MAAMW,4BAA4B,GACjC,CAAC,CAAEb,cAAc,IAAI,CAAED,kBAAkB;EAE1C,oBACCnB,IAAA,CAAAE,SAAA;IAAAgC,QAAA,eACClC,IAAA,CAACR,uBAAuB;MACvB2C,KAAK,EAAGpD,EAAE,CAAE,QAAS,CAAG;MACxBqD,MAAM;MACNC,WAAW,EAAGtD,EAAE,CACf,kEACD,CAAG;MACHuD,OAAO,eACNtC,IAAA,CAACF,4BAA4B;QAACyC,UAAU,EAAC;MAAwB,CAAE,CACnE;MACDC,MAAM,EACLP,4BAA4B,iBAC3BjC,IAAA,CAACH,oCAAoC;QACpC4C,MAAM,EAAGxB,SAAS,GAAI,CAAC,CAAI;QAC3BG,cAAc,EAAGA,cAAgB;QACjCsB,OAAO,EAAGV;MAAe,CACzB;IAEF,CACD;EAAC,CACD,CAAC;AAEL","ignoreList":[]}
@@ -16,7 +16,48 @@ import { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-
16
16
  import { unlock } from '../../lock-unlock';
17
17
  import { store as editSiteStore } from '../../store';
18
18
  import { NAVIGATION_POST_TYPE, TEMPLATE_POST_TYPE, PATTERN_TYPES } from '../../utils/constants';
19
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ export function MainSidebarNavigationContent() {
21
+ return /*#__PURE__*/_jsxs(ItemGroup, {
22
+ children: [/*#__PURE__*/_jsx(SidebarNavigationItem, {
23
+ uid: "navigation-navigation-item",
24
+ params: {
25
+ postType: NAVIGATION_POST_TYPE
26
+ },
27
+ withChevron: true,
28
+ icon: navigation,
29
+ children: __('Navigation')
30
+ }), /*#__PURE__*/_jsx(SidebarNavigationItemGlobalStyles, {
31
+ uid: "styles-navigation-item",
32
+ icon: styles,
33
+ children: __('Styles')
34
+ }), /*#__PURE__*/_jsx(SidebarNavigationItem, {
35
+ uid: "page-navigation-item",
36
+ params: {
37
+ postType: 'page'
38
+ },
39
+ withChevron: true,
40
+ icon: page,
41
+ children: __('Pages')
42
+ }), /*#__PURE__*/_jsx(SidebarNavigationItem, {
43
+ uid: "template-navigation-item",
44
+ params: {
45
+ postType: TEMPLATE_POST_TYPE
46
+ },
47
+ withChevron: true,
48
+ icon: layout,
49
+ children: __('Templates')
50
+ }), /*#__PURE__*/_jsx(SidebarNavigationItem, {
51
+ uid: "patterns-navigation-item",
52
+ params: {
53
+ postType: PATTERN_TYPES.user
54
+ },
55
+ withChevron: true,
56
+ icon: symbol,
57
+ children: __('Patterns')
58
+ })]
59
+ });
60
+ }
20
61
  export default function SidebarNavigationScreenMain() {
21
62
  const {
22
63
  setEditorCanvasContainerView
@@ -30,48 +71,7 @@ export default function SidebarNavigationScreenMain() {
30
71
  isRoot: true,
31
72
  title: __('Design'),
32
73
  description: __('Customize the appearance of your website using the block editor.'),
33
- content: /*#__PURE__*/_jsx(_Fragment, {
34
- children: /*#__PURE__*/_jsxs(ItemGroup, {
35
- children: [/*#__PURE__*/_jsx(SidebarNavigationItem, {
36
- uid: "navigation-navigation-item",
37
- params: {
38
- postType: NAVIGATION_POST_TYPE
39
- },
40
- withChevron: true,
41
- icon: navigation,
42
- children: __('Navigation')
43
- }), /*#__PURE__*/_jsx(SidebarNavigationItemGlobalStyles, {
44
- uid: "styles-navigation-item",
45
- withChevron: true,
46
- icon: styles,
47
- children: __('Styles')
48
- }), /*#__PURE__*/_jsx(SidebarNavigationItem, {
49
- uid: "page-navigation-item",
50
- params: {
51
- postType: 'page'
52
- },
53
- withChevron: true,
54
- icon: page,
55
- children: __('Pages')
56
- }), /*#__PURE__*/_jsx(SidebarNavigationItem, {
57
- uid: "template-navigation-item",
58
- params: {
59
- postType: TEMPLATE_POST_TYPE
60
- },
61
- withChevron: true,
62
- icon: layout,
63
- children: __('Templates')
64
- }), /*#__PURE__*/_jsx(SidebarNavigationItem, {
65
- uid: "patterns-navigation-item",
66
- params: {
67
- postType: PATTERN_TYPES.user
68
- },
69
- withChevron: true,
70
- icon: symbol,
71
- children: __('Patterns')
72
- })]
73
- })
74
- })
74
+ content: /*#__PURE__*/_jsx(MainSidebarNavigationContent, {})
75
75
  });
76
76
  }
77
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalItemGroup","ItemGroup","__","layout","symbol","navigation","styles","page","useDispatch","useEffect","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationItemGlobalStyles","unlock","store","editSiteStore","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_TYPES","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SidebarNavigationScreenMain","setEditorCanvasContainerView","undefined","isRoot","title","description","content","children","uid","params","postType","withChevron","icon","user"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tsetEditorCanvasContainerView( undefined );\n\t}, [ setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tuid=\"navigation-navigation-item\"\n\t\t\t\t\t\t\tparams={ { postType: NAVIGATION_POST_TYPE } }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\t\t\t\tuid=\"styles-navigation-item\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Styles' ) }\n\t\t\t\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tuid=\"page-navigation-item\"\n\t\t\t\t\t\t\tparams={ { postType: 'page' } }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ page }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Pages' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tuid=\"template-navigation-item\"\n\t\t\t\t\t\t\tparams={ { postType: TEMPLATE_POST_TYPE } }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tuid=\"patterns-navigation-item\"\n\t\t\t\t\t\t\tparams={ { postType: PATTERN_TYPES.user } }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,MAAM,EAAEC,IAAI,QAAQ,kBAAkB;AAC3E,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,iCAAiC,QAAQ,4CAA4C;AAC9F,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,SACCC,oBAAoB,EACpBC,kBAAkB,EAClBC,aAAa,QACP,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE/B,eAAe,SAASC,2BAA2BA,CAAA,EAAG;EACrD,MAAM;IAAEC;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AqB;UACrBsB,GAAG,EAAC,0BAA0B;UAC9BC,MAAM,EAAG;YAAEC,QAAQ,EAAEjB,aAAa,CAACoB;UAAK,CAAG;UAC3CF,WAAW;UACXC,IAAI,EAAGjC,MAAQ;UAAA4B,QAAA,EAEb9B,EAAE,CAAE,UAAW;QAAC,CACI,CAAC;MAAA,CACd;IAAC,CACX;EACF,CACD,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalItemGroup","ItemGroup","__","layout","symbol","navigation","styles","page","useDispatch","useEffect","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationItemGlobalStyles","unlock","store","editSiteStore","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_TYPES","jsx","_jsx","jsxs","_jsxs","MainSidebarNavigationContent","children","uid","params","postType","withChevron","icon","user","SidebarNavigationScreenMain","setEditorCanvasContainerView","undefined","isRoot","title","description","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nexport function MainSidebarNavigationContent() {\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"navigation-navigation-item\"\n\t\t\t\tparams={ { postType: NAVIGATION_POST_TYPE } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ navigation }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\tuid=\"styles-navigation-item\"\n\t\t\t\ticon={ styles }\n\t\t\t>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"page-navigation-item\"\n\t\t\t\tparams={ { postType: 'page' } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ page }\n\t\t\t>\n\t\t\t\t{ __( 'Pages' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"template-navigation-item\"\n\t\t\t\tparams={ { postType: TEMPLATE_POST_TYPE } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ layout }\n\t\t\t>\n\t\t\t\t{ __( 'Templates' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"patterns-navigation-item\"\n\t\t\t\tparams={ { postType: PATTERN_TYPES.user } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ symbol }\n\t\t\t>\n\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tsetEditorCanvasContainerView( undefined );\n\t}, [ setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={ <MainSidebarNavigationContent /> }\n\t\t/>\n\t);\n}\n"],"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,CACO,CAAC,eACxBkB,IAAA,CAACT,qBAAqB;MACrBc,GAAG,EAAC,0BAA0B;MAC9BC,MAAM,EAAG;QAAEC,QAAQ,EAAEV;MAAmB,CAAG;MAC3CW,WAAW;MACXC,IAAI,EAAG1B,MAAQ;MAAAqB,QAAA,EAEbtB,EAAE,CAAE,WAAY;IAAC,CACG,CAAC,eACxBkB,IAAA,CAACT,qBAAqB;MACrBc,GAAG,EAAC,0BAA0B;MAC9BC,MAAM,EAAG;QAAEC,QAAQ,EAAET,aAAa,CAACY;MAAK,CAAG;MAC3CF,WAAW;MACXC,IAAI,EAAGzB,MAAQ;MAAAoB,QAAA,EAEbtB,EAAE,CAAE,UAAW;IAAC,CACI,CAAC;EAAA,CACd,CAAC;AAEd;AAEA,eAAe,SAAS6B,2BAA2BA,CAAA,EAAG;EACrD,MAAM;IAAEC;EAA6B,CAAC,GAAGnB,MAAM,CAC9CL,WAAW,CAAEO,aAAc,CAC5B,CAAC;;EAED;EACAN,SAAS,CAAE,MAAM;IAChBuB,4BAA4B,CAAEC,SAAU,CAAC;EAC1C,CAAC,EAAE,CAAED,4BAA4B,CAAG,CAAC;EAErC,oBACCZ,IAAA,CAACV,uBAAuB;IACvBwB,MAAM;IACNC,KAAK,EAAGjC,EAAE,CAAE,QAAS,CAAG;IACxBkC,WAAW,EAAGlC,EAAE,CACf,kEACD,CAAG;IACHmC,OAAO,eAAGjB,IAAA,CAACG,4BAA4B,IAAE;EAAG,CAC5C,CAAC;AAEJ","ignoreList":[]}
@@ -66,7 +66,7 @@ export default function usePatternCategories() {
66
66
  }
67
67
  });
68
68
  // If the pattern has no categories, add it to uncategorized.
69
- if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category.some(catId => userPatternCategories.find(cat => cat.id === catId))) {
69
+ if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))) {
70
70
  categoryMap.uncategorized.count += 1;
71
71
  }
72
72
  });
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","__","useDefaultPatternCategories","useThemePatterns","usePatterns","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","usePatternCategories","defaultCategories","push","name","label","themePatterns","patterns","userPatterns","categories","userPatternCategories","user","patternCategories","categoryMap","categoriesWithCounts","forEach","category","count","pattern","length","uncategorized","wp_pattern_category","catId","find","cat","id","some","sortedCategories","sort","a","b","localeCompare","unshift","description","hasPatterns"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\nimport usePatterns from '../page-patterns/use-patterns';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tdefaultCategories.push( {\n\t\tname: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\t\tlabel: __( 'Uncategorized' ),\n\t} );\n\tconst themePatterns = useThemePatterns();\n\tconst { patterns: userPatterns, categories: userPatternCategories } =\n\t\tusePatterns( PATTERN_TYPES.user );\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\t\tuserPatternCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif ( ! pattern.categories?.length ) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect user registered patterns.\n\t\tuserPatterns.forEach( ( pattern ) => {\n\t\t\tpattern.wp_pattern_category?.forEach( ( catId ) => {\n\t\t\t\tconst category = userPatternCategories.find(\n\t\t\t\t\t( cat ) => cat.id === catId\n\t\t\t\t)?.name;\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif (\n\t\t\t\t! pattern.wp_pattern_category?.length ||\n\t\t\t\t! pattern.wp_pattern_category.some( ( catId ) =>\n\t\t\t\t\tuserPatternCategories.find( ( cat ) => cat.id === catId )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Filter categories so we only have those containing patterns.\n\t\t[ ...defaultCategories, ...userPatternCategories ].forEach(\n\t\t\t( category ) => {\n\t\t\t\tif (\n\t\t\t\t\tcategoryMap[ category.name ].count &&\n\t\t\t\t\t! categoriesWithCounts.find(\n\t\t\t\t\t\t( cat ) => cat.name === category.name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcategoriesWithCounts.push( categoryMap[ category.name ] );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tconst sortedCategories = categoriesWithCounts.sort( ( a, b ) =>\n\t\t\ta.label.localeCompare( b.label )\n\t\t);\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_USER_CATEGORY,\n\t\t\tlabel: __( 'My patterns' ),\n\t\t\tcount: userPatterns.length,\n\t\t} );\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_DEFAULT_CATEGORY,\n\t\t\tlabel: __( 'All patterns' ),\n\t\t\tdescription: __( 'A list of all patterns from all sources.' ),\n\t\t\tcount: themePatterns.length + userPatterns.length,\n\t\t} );\n\n\t\treturn sortedCategories;\n\t}, [\n\t\tdefaultCategories,\n\t\tthemePatterns,\n\t\tuserPatternCategories,\n\t\tuserPatterns,\n\t] );\n\n\treturn { patternCategories, hasPatterns: !! patternCategories.length };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,kCAAkC;AAC1E,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,WAAW,MAAM,+BAA+B;AACvD,SACCC,aAAa,EACbC,wBAAwB,EACxBC,qBAAqB,EACrBC,mCAAmC,QAC7B,uBAAuB;AAE9B,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAGR,2BAA2B,CAAC,CAAC;EACvDQ,iBAAiB,CAACC,IAAI,CAAE;IACvBC,IAAI,EAAEJ,mCAAmC;IACzCK,KAAK,EAAEZ,EAAE,CAAE,eAAgB;EAC5B,CAAE,CAAC;EACH,MAAMa,aAAa,GAAGX,gBAAgB,CAAC,CAAC;EACxC,MAAM;IAAEY,QAAQ,EAAEC,YAAY;IAAEC,UAAU,EAAEC;EAAsB,CAAC,GAClEd,WAAW,CAAEC,aAAa,CAACc,IAAK,CAAC;EAElC,MAAMC,iBAAiB,GAAGpB,OAAO,CAAE,MAAM;IACxC,MAAMqB,WAAW,GAAG,CAAC,CAA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AE,CAAC;IAEH,OAAOQ,gBAAgB;EACxB,CAAC,EAAE,CACFzB,iBAAiB,EACjBI,aAAa,EACbI,qBAAqB,EACrBF,YAAY,CACX,CAAC;EAEH,OAAO;IAAEI,iBAAiB;IAAEsB,WAAW,EAAE,CAAC,CAAEtB,iBAAiB,CAACO;EAAO,CAAC;AACvE","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","__","useDefaultPatternCategories","useThemePatterns","usePatterns","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","usePatternCategories","defaultCategories","push","name","label","themePatterns","patterns","userPatterns","categories","userPatternCategories","user","patternCategories","categoryMap","categoriesWithCounts","forEach","category","count","pattern","length","uncategorized","wp_pattern_category","catId","find","cat","id","some","sortedCategories","sort","a","b","localeCompare","unshift","description","hasPatterns"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\nimport usePatterns from '../page-patterns/use-patterns';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tdefaultCategories.push( {\n\t\tname: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\t\tlabel: __( 'Uncategorized' ),\n\t} );\n\tconst themePatterns = useThemePatterns();\n\tconst { patterns: userPatterns, categories: userPatternCategories } =\n\t\tusePatterns( PATTERN_TYPES.user );\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\t\tuserPatternCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif ( ! pattern.categories?.length ) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect user registered patterns.\n\t\tuserPatterns.forEach( ( pattern ) => {\n\t\t\tpattern.wp_pattern_category?.forEach( ( catId ) => {\n\t\t\t\tconst category = userPatternCategories.find(\n\t\t\t\t\t( cat ) => cat.id === catId\n\t\t\t\t)?.name;\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif (\n\t\t\t\t! pattern.wp_pattern_category?.length ||\n\t\t\t\t! pattern.wp_pattern_category?.some( ( catId ) =>\n\t\t\t\t\tuserPatternCategories.find( ( cat ) => cat.id === catId )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Filter categories so we only have those containing patterns.\n\t\t[ ...defaultCategories, ...userPatternCategories ].forEach(\n\t\t\t( category ) => {\n\t\t\t\tif (\n\t\t\t\t\tcategoryMap[ category.name ].count &&\n\t\t\t\t\t! categoriesWithCounts.find(\n\t\t\t\t\t\t( cat ) => cat.name === category.name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcategoriesWithCounts.push( categoryMap[ category.name ] );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tconst sortedCategories = categoriesWithCounts.sort( ( a, b ) =>\n\t\t\ta.label.localeCompare( b.label )\n\t\t);\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_USER_CATEGORY,\n\t\t\tlabel: __( 'My patterns' ),\n\t\t\tcount: userPatterns.length,\n\t\t} );\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_DEFAULT_CATEGORY,\n\t\t\tlabel: __( 'All patterns' ),\n\t\t\tdescription: __( 'A list of all patterns from all sources.' ),\n\t\t\tcount: themePatterns.length + userPatterns.length,\n\t\t} );\n\n\t\treturn sortedCategories;\n\t}, [\n\t\tdefaultCategories,\n\t\tthemePatterns,\n\t\tuserPatternCategories,\n\t\tuserPatterns,\n\t] );\n\n\treturn { patternCategories, hasPatterns: !! patternCategories.length };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,kCAAkC;AAC1E,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,WAAW,MAAM,+BAA+B;AACvD,SACCC,aAAa,EACbC,wBAAwB,EACxBC,qBAAqB,EACrBC,mCAAmC,QAC7B,uBAAuB;AAE9B,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAGR,2BAA2B,CAAC,CAAC;EACvDQ,iBAAiB,CAACC,IAAI,CAAE;IACvBC,IAAI,EAAEJ,mCAAmC;IACzCK,KAAK,EAAEZ,EAAE,CAAE,eAAgB;EAC5B,CAAE,CAAC;EACH,MAAMa,aAAa,GAAGX,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,gBAAgB,CAACK,OAAO,CAAE;MACzB5B,IAAI,EAAEN,wBAAwB;MAC9BO,KAAK,EAAEZ,EAAE,CAAE,cAAe,CAAC;MAC3BwC,WAAW,EAAExC,EAAE,CAAE,0CAA2C,CAAC;MAC7DwB,KAAK,EAAEX,aAAa,CAACa,MAAM,GAAGX,YAAY,CAACW;IAC5C,CAAE,CAAC;IAEH,OAAOQ,gBAAgB;EACxB,CAAC,EAAE,CACFzB,iBAAiB,EACjBI,aAAa,EACbI,qBAAqB,EACrBF,YAAY,CACX,CAAC;EAEH,OAAO;IAAEI,iBAAiB;IAAEsB,WAAW,EAAE,CAAC,CAAEtB,iBAAiB,CAACO;EAAO,CAAC;AACvE","ignoreList":[]}
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useEntityRecords } from '@wordpress/core-data';
4
+ import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
5
5
  import { useSelect } from '@wordpress/data';
6
- import { store as editorStore } from '@wordpress/editor';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
@@ -11,7 +10,7 @@ import { store as editorStore } from '@wordpress/editor';
11
10
  import { TEMPLATE_PART_AREA_DEFAULT_CATEGORY, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
12
11
  const useTemplatePartsGroupedByArea = items => {
13
12
  const allItems = items || [];
14
- const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []);
13
+ const templatePartAreas = useSelect(select => select(coreStore).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [], []);
15
14
 
16
15
  // Create map of template areas ensuring that default areas are displayed before
17
16
  // any custom registered template part areas.
@@ -27,7 +26,7 @@ const useTemplatePartsGroupedByArea = items => {
27
26
  });
28
27
  const groupedByArea = allItems.reduce((accumulator, item) => {
29
28
  const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
30
- accumulator[key].templateParts.push(item);
29
+ accumulator[key]?.templateParts?.push(item);
31
30
  return accumulator;
32
31
  }, knownAreas);
33
32
  return groupedByArea;
@@ -1 +1 @@
1
- {"version":3,"names":["useEntityRecords","useSelect","store","editorStore","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","knownAreas","header","footer","sidebar","uncategorized","forEach","templatePartArea","area","templateParts","groupedByArea","reduce","accumulator","item","key","push","useTemplatePartAreas","records","isResolving","isLoading","per_page","hasTemplateParts","length"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst useTemplatePartsGroupedByArea = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\t// Create map of template areas ensuring that default areas are displayed before\n\t// any custom registered template part areas.\n\tconst knownAreas = {\n\t\theader: {},\n\t\tfooter: {},\n\t\tsidebar: {},\n\t\tuncategorized: {},\n\t};\n\n\ttemplatePartAreas.forEach(\n\t\t( templatePartArea ) =>\n\t\t\t( knownAreas[ templatePartArea.area ] = {\n\t\t\t\t...templatePartArea,\n\t\t\t\ttemplateParts: [],\n\t\t\t} )\n\t);\n\n\tconst groupedByArea = allItems.reduce( ( accumulator, item ) => {\n\t\tconst key = accumulator[ item.area ]\n\t\t\t? item.area\n\t\t\t: TEMPLATE_PART_AREA_DEFAULT_CATEGORY;\n\t\taccumulator[ key ].templateParts.push( item );\n\t\treturn accumulator;\n\t}, knownAreas );\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: useTemplatePartsGroupedByArea( templateParts ),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SACCC,mCAAmC,EACnCC,uBAAuB,QACjB,uBAAuB;AAE9B,MAAMC,6BAA6B,GAAKC,KAAK,IAAM;EAClD,MAAMC,QAAQ,GAAGD,KAAK,IAAI,EAAE;EAE5B,MAAME,iBAAiB,GAAGR,SAAS,CAChCS,MAAM,IACPA,MAAM,CAAEP,WAAY,CAAC,CAACQ,yCAAyC,CAAC,CAAC,EAClE,EACD,CAAC;;EAED;EACA;EACA,MAAMC,UAAU,GAAG;IAClBC,MAAM,EAAE,CAAC,CAAC;IACVC,MAAM,EAAE,CAAC,CAAC;IACVC,OAAO,EAAE,CAAC,CAAC;IACXC,aAAa,EAAE,CAAC;EACjB,CAAC;EAEDP,iBAAiB,CAACQ,OAAO,CACtBC,gBAAgB,IACfN,UAAU,CAAEM,gBAAgB,CAACC,IAAI,CAAE,GAAG;IACvC,GAAGD,gBAAgB;IACnBE,aAAa,EAAE;EAChB,CACF,CAAC;EAED,MAAMC,aAAa,GAAGb,QAAQ,CAACc,MAAM,CAAE,CAAEC,WAAW,EAAEC,IAAI,KAAM;IAC/D,MAAMC,GAAG,GAAGF,WAAW,CAAEC,IAAI,CAACL,IAAI,CAAE,GACjCK,IAAI,CAACL,IAAI,GACTf,mCAAmC;IACtCmB,WAAW,CAAEE,GAAG,CAAE,CAACL,aAAa,CAACM,IAAI,CAAEF,IAAK,CAAC;IAC7C,OAAOD,WAAW;EACnB,CAAC,EAAEX,UAAW,CAAC;EAEf,OAAOS,aAAa;AACrB,CAAC;AAED,eAAe,SAASM,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,OAAO,EAAER,aAAa;IAAES,WAAW,EAAEC;EAAU,CAAC,GAAG9B,gBAAgB,CAC1E,UAAU,EACVK,uBAAuB,EACvB;IAAE0B,QAAQ,EAAE,CAAC;EAAE,CAChB,CAAC;EAED,OAAO;IACNC,gBAAgB,EAAEZ,aAAa,GAAG,CAAC,CAAEA,aAAa,CAACa,MAAM,GAAG,KAAK;IACjEH,SAAS;IACTrB,iBAAiB,EAAEH,6BAA6B,CAAEc,aAAc;EACjE,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useEntityRecords","store","coreStore","useSelect","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","select","getEntityRecord","default_template_part_areas","knownAreas","header","footer","sidebar","uncategorized","forEach","templatePartArea","area","templateParts","groupedByArea","reduce","accumulator","item","key","push","useTemplatePartAreas","records","isResolving","isLoading","per_page","hasTemplateParts","length"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst useTemplatePartsGroupedByArea = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\t// Create map of template areas ensuring that default areas are displayed before\n\t// any custom registered template part areas.\n\tconst knownAreas = {\n\t\theader: {},\n\t\tfooter: {},\n\t\tsidebar: {},\n\t\tuncategorized: {},\n\t};\n\n\ttemplatePartAreas.forEach(\n\t\t( templatePartArea ) =>\n\t\t\t( knownAreas[ templatePartArea.area ] = {\n\t\t\t\t...templatePartArea,\n\t\t\t\ttemplateParts: [],\n\t\t\t} )\n\t);\n\n\tconst groupedByArea = allItems.reduce( ( accumulator, item ) => {\n\t\tconst key = accumulator[ item.area ]\n\t\t\t? item.area\n\t\t\t: TEMPLATE_PART_AREA_DEFAULT_CATEGORY;\n\t\taccumulator[ key ]?.templateParts?.push( item );\n\t\treturn accumulator;\n\t}, knownAreas );\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: useTemplatePartsGroupedByArea( templateParts ),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC3E,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SACCC,mCAAmC,EACnCC,uBAAuB,QACjB,uBAAuB;AAE9B,MAAMC,6BAA6B,GAAKC,KAAK,IAAM;EAClD,MAAMC,QAAQ,GAAGD,KAAK,IAAI,EAAE;EAE5B,MAAME,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IACPA,MAAM,CAAER,SAAU,CAAC,CAACS,eAAe,CAAE,MAAM,EAAE,gBAAiB,CAAC,EAC5DC,2BAA2B,IAAI,EAAE,EACrC,EACD,CAAC;;EAED;EACA;EACA,MAAMC,UAAU,GAAG;IAClBC,MAAM,EAAE,CAAC,CAAC;IACVC,MAAM,EAAE,CAAC,CAAC;IACVC,OAAO,EAAE,CAAC,CAAC;IACXC,aAAa,EAAE,CAAC;EACjB,CAAC;EAEDR,iBAAiB,CAACS,OAAO,CACtBC,gBAAgB,IACfN,UAAU,CAAEM,gBAAgB,CAACC,IAAI,CAAE,GAAG;IACvC,GAAGD,gBAAgB;IACnBE,aAAa,EAAE;EAChB,CACF,CAAC;EAED,MAAMC,aAAa,GAAGd,QAAQ,CAACe,MAAM,CAAE,CAAEC,WAAW,EAAEC,IAAI,KAAM;IAC/D,MAAMC,GAAG,GAAGF,WAAW,CAAEC,IAAI,CAACL,IAAI,CAAE,GACjCK,IAAI,CAACL,IAAI,GACThB,mCAAmC;IACtCoB,WAAW,CAAEE,GAAG,CAAE,EAAEL,aAAa,EAAEM,IAAI,CAAEF,IAAK,CAAC;IAC/C,OAAOD,WAAW;EACnB,CAAC,EAAEX,UAAW,CAAC;EAEf,OAAOS,aAAa;AACrB,CAAC;AAED,eAAe,SAASM,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,OAAO,EAAER,aAAa;IAAES,WAAW,EAAEC;EAAU,CAAC,GAAG/B,gBAAgB,CAC1E,UAAU,EACVK,uBAAuB,EACvB;IAAE2B,QAAQ,EAAE,CAAC;EAAE,CAChB,CAAC;EAED,OAAO;IACNC,gBAAgB,EAAEZ,aAAa,GAAG,CAAC,CAAEA,aAAa,CAACa,MAAM,GAAG,KAAK;IACjEH,SAAS;IACTtB,iBAAiB,EAAEH,6BAA6B,CAAEe,aAAc;EACjE,CAAC;AACF","ignoreList":[]}
@@ -15,7 +15,6 @@ import { navigationViewRoute } from './navigation-view';
15
15
  import { navigationEditRoute } from './navigation-edit';
16
16
  import { navigationItemEditRoute } from './navigation-item-edit';
17
17
  import { navigationItemViewRoute } from './navigation-item-view';
18
- import { stylesEditRoute } from './styles-edit';
19
18
  import { stylesViewRoute } from './styles-view';
20
19
  import { patternsEditRoute } from './patterns-edit';
21
20
  import { patternsViewRoute } from './patterns-view';
@@ -27,7 +26,7 @@ import { pagesEditRoute } from './pages-edit';
27
26
  import { pagesListViewRoute } from './pages-list-view';
28
27
  import { pagesListViewQuickEditRoute } from './pages-list-view-quick-edit';
29
28
  import { pagesViewQuickEditRoute } from './pages-view-quick-edit';
30
- const routes = [pagesListViewQuickEditRoute, pagesListViewRoute, pagesViewQuickEditRoute, pagesViewRoute, pagesEditRoute, templatesEditRoute, templatesListViewRoute, templatesViewRoute, patternsViewRoute, patternsEditRoute, stylesViewRoute, stylesEditRoute, navigationItemViewRoute, navigationItemEditRoute, navigationViewRoute, navigationEditRoute, homeViewRoute, homeEditRoute];
29
+ const routes = [pagesListViewQuickEditRoute, pagesListViewRoute, pagesViewQuickEditRoute, pagesViewRoute, pagesEditRoute, templatesEditRoute, templatesListViewRoute, templatesViewRoute, patternsViewRoute, patternsEditRoute, stylesViewRoute, navigationItemViewRoute, navigationItemEditRoute, navigationViewRoute, navigationEditRoute, homeViewRoute, homeEditRoute];
31
30
  export function useRegisterSiteEditorRoutes() {
32
31
  const registry = useRegistry();
33
32
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["useRegistry","useDispatch","useEffect","unlock","store","siteEditorStore","homeViewRoute","homeEditRoute","navigationViewRoute","navigationEditRoute","navigationItemEditRoute","navigationItemViewRoute","stylesEditRoute","stylesViewRoute","patternsEditRoute","patternsViewRoute","templatesEditRoute","templatesListViewRoute","templatesViewRoute","pagesViewRoute","pagesEditRoute","pagesListViewRoute","pagesListViewQuickEditRoute","pagesViewQuickEditRoute","routes","useRegisterSiteEditorRoutes","registry","registerRoute","batch","forEach"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { homeViewRoute } from './home-view';\nimport { homeEditRoute } from './home-edit';\nimport { navigationViewRoute } from './navigation-view';\nimport { navigationEditRoute } from './navigation-edit';\nimport { navigationItemEditRoute } from './navigation-item-edit';\nimport { navigationItemViewRoute } from './navigation-item-view';\nimport { stylesEditRoute } from './styles-edit';\nimport { stylesViewRoute } from './styles-view';\nimport { patternsEditRoute } from './patterns-edit';\nimport { patternsViewRoute } from './patterns-view';\nimport { templatesEditRoute } from './templates-edit';\nimport { templatesListViewRoute } from './templates-list-view';\nimport { templatesViewRoute } from './templates-view';\nimport { pagesViewRoute } from './pages-view';\nimport { pagesEditRoute } from './pages-edit';\nimport { pagesListViewRoute } from './pages-list-view';\nimport { pagesListViewQuickEditRoute } from './pages-list-view-quick-edit';\nimport { pagesViewQuickEditRoute } from './pages-view-quick-edit';\n\nconst routes = [\n\tpagesListViewQuickEditRoute,\n\tpagesListViewRoute,\n\tpagesViewQuickEditRoute,\n\tpagesViewRoute,\n\tpagesEditRoute,\n\ttemplatesEditRoute,\n\ttemplatesListViewRoute,\n\ttemplatesViewRoute,\n\tpatternsViewRoute,\n\tpatternsEditRoute,\n\tstylesViewRoute,\n\tstylesEditRoute,\n\tnavigationItemViewRoute,\n\tnavigationItemEditRoute,\n\tnavigationViewRoute,\n\tnavigationEditRoute,\n\thomeViewRoute,\n\thomeEditRoute,\n];\n\nexport function useRegisterSiteEditorRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,eAAe,QAAQ,aAAa;AACtD,SAASC,aAA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CAAED,QAAQ,EAAEC,aAAa,CAAG,CAAC;AACjC","ignoreList":[]}
1
+ {"version":3,"names":["useRegistry","useDispatch","useEffect","unlock","store","siteEditorStore","homeViewRoute","homeEditRoute","navigationViewRoute","navigationEditRoute","navigationItemEditRoute","navigationItemViewRoute","stylesViewRoute","patternsEditRoute","patternsViewRoute","templatesEditRoute","templatesListViewRoute","templatesViewRoute","pagesViewRoute","pagesEditRoute","pagesListViewRoute","pagesListViewQuickEditRoute","pagesViewQuickEditRoute","routes","useRegisterSiteEditorRoutes","registry","registerRoute","batch","forEach"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { homeViewRoute } from './home-view';\nimport { homeEditRoute } from './home-edit';\nimport { navigationViewRoute } from './navigation-view';\nimport { navigationEditRoute } from './navigation-edit';\nimport { navigationItemEditRoute } from './navigation-item-edit';\nimport { navigationItemViewRoute } from './navigation-item-view';\nimport { stylesViewRoute } from './styles-view';\nimport { patternsEditRoute } from './patterns-edit';\nimport { patternsViewRoute } from './patterns-view';\nimport { templatesEditRoute } from './templates-edit';\nimport { templatesListViewRoute } from './templates-list-view';\nimport { templatesViewRoute } from './templates-view';\nimport { pagesViewRoute } from './pages-view';\nimport { pagesEditRoute } from './pages-edit';\nimport { pagesListViewRoute } from './pages-list-view';\nimport { pagesListViewQuickEditRoute } from './pages-list-view-quick-edit';\nimport { pagesViewQuickEditRoute } from './pages-view-quick-edit';\n\nconst routes = [\n\tpagesListViewQuickEditRoute,\n\tpagesListViewRoute,\n\tpagesViewQuickEditRoute,\n\tpagesViewRoute,\n\tpagesEditRoute,\n\ttemplatesEditRoute,\n\ttemplatesListViewRoute,\n\ttemplatesViewRoute,\n\tpatternsViewRoute,\n\tpatternsEditRoute,\n\tstylesViewRoute,\n\tnavigationItemViewRoute,\n\tnavigationItemEditRoute,\n\tnavigationViewRoute,\n\tnavigationEditRoute,\n\thomeViewRoute,\n\thomeEditRoute,\n];\n\nexport function useRegisterSiteEditorRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,eAAe,QAAQ,aAAa;AACtD,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,uBAAuB,QAAQ,wBAAwB;AAChE,SAASC,uBAAuB,QAAQ,wBAAwB;AAChE,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SAASC,sBAAsB,QAAQ,uBAAuB;AAC9D,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SAASC,cAAc,QAAQ,cAAc;AAC7C,SAASC,cAAc,QAAQ,cAAc;AAC7C,SAASC,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,2BAA2B,QAAQ,8BAA8B;AAC1E,SAASC,uBAAuB,QAAQ,yBAAyB;AAEjE,MAAMC,MAAM,GAAG,CACdF,2BAA2B,EAC3BD,kBAAkB,EAClBE,uBAAuB,EACvBJ,cAAc,EACdC,cAAc,EACdJ,kBAAkB,EAClBC,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