@wordpress/edit-site 5.3.2 → 5.3.4

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 (287) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/build/components/add-new-template/new-template-part.js +8 -5
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +8 -5
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/block-editor/editor-canvas.js +3 -3
  7. package/build/components/block-editor/editor-canvas.js.map +1 -1
  8. package/build/components/block-editor/index.js +3 -3
  9. package/build/components/block-editor/index.js.map +1 -1
  10. package/build/components/editor/index.js +25 -23
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/global-styles/border-panel.js +2 -2
  13. package/build/components/global-styles/border-panel.js.map +1 -1
  14. package/build/components/global-styles/color-palette-panel.js +2 -2
  15. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  16. package/build/components/global-styles/custom-css.js +2 -2
  17. package/build/components/global-styles/custom-css.js.map +1 -1
  18. package/build/components/global-styles/dimensions-panel.js +2 -2
  19. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  20. package/build/components/global-styles/global-styles-provider.js +2 -2
  21. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  22. package/build/components/global-styles/gradients-palette-panel.js +2 -2
  23. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  24. package/build/components/global-styles/header.js +1 -1
  25. package/build/components/global-styles/header.js.map +1 -1
  26. package/build/components/global-styles/hooks.js +2 -2
  27. package/build/components/global-styles/hooks.js.map +1 -1
  28. package/build/components/global-styles/navigation-button.js +1 -1
  29. package/build/components/global-styles/navigation-button.js.map +1 -1
  30. package/build/components/global-styles/palette.js +2 -2
  31. package/build/components/global-styles/palette.js.map +1 -1
  32. package/build/components/global-styles/preview.js +2 -2
  33. package/build/components/global-styles/preview.js.map +1 -1
  34. package/build/components/global-styles/screen-background-color.js +2 -2
  35. package/build/components/global-styles/screen-background-color.js.map +1 -1
  36. package/build/components/global-styles/screen-button-color.js +2 -2
  37. package/build/components/global-styles/screen-button-color.js.map +1 -1
  38. package/build/components/global-styles/screen-colors.js +2 -2
  39. package/build/components/global-styles/screen-colors.js.map +1 -1
  40. package/build/components/global-styles/screen-css.js +5 -5
  41. package/build/components/global-styles/screen-css.js.map +1 -1
  42. package/build/components/global-styles/screen-heading-color.js +2 -2
  43. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  44. package/build/components/global-styles/screen-link-color.js +2 -2
  45. package/build/components/global-styles/screen-link-color.js.map +1 -1
  46. package/build/components/global-styles/screen-root.js +2 -2
  47. package/build/components/global-styles/screen-root.js.map +1 -1
  48. package/build/components/global-styles/screen-style-variations.js +2 -2
  49. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  50. package/build/components/global-styles/screen-text-color.js +2 -2
  51. package/build/components/global-styles/screen-text-color.js.map +1 -1
  52. package/build/components/global-styles/screen-typography.js +2 -2
  53. package/build/components/global-styles/screen-typography.js.map +1 -1
  54. package/build/components/global-styles/shadow-panel.js +2 -2
  55. package/build/components/global-styles/shadow-panel.js.map +1 -1
  56. package/build/components/global-styles/typography-panel.js +2 -2
  57. package/build/components/global-styles/typography-panel.js.map +1 -1
  58. package/build/components/global-styles/typography-preview.js +2 -2
  59. package/build/components/global-styles/typography-preview.js.map +1 -1
  60. package/build/components/global-styles/ui.js +3 -10
  61. package/build/components/global-styles/ui.js.map +1 -1
  62. package/build/components/global-styles-renderer/index.js +2 -2
  63. package/build/components/global-styles-renderer/index.js.map +1 -1
  64. package/build/components/header-edit-mode/index.js +6 -3
  65. package/build/components/header-edit-mode/index.js.map +1 -1
  66. package/build/components/keyboard-shortcut-help-modal/config.js +1 -1
  67. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  68. package/build/components/layout/index.js +10 -23
  69. package/build/components/layout/index.js.map +1 -1
  70. package/build/components/list/actions/rename-menu-item.js +1 -1
  71. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  72. package/build/components/list/table.js +1 -0
  73. package/build/components/list/table.js.map +1 -1
  74. package/build/components/navigation-inspector/navigation-menu.js +2 -2
  75. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  76. package/build/components/save-panel/index.js +4 -3
  77. package/build/components/save-panel/index.js.map +1 -1
  78. package/build/components/sidebar/index.js +17 -3
  79. package/build/components/sidebar/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen/index.js +28 -7
  81. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-navigation-item/index.js +72 -0
  83. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
  84. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
  85. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  86. package/build/components/sidebar-navigation-screen-template/index.js +70 -0
  87. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -0
  88. package/build/components/sidebar-navigation-screen-templates/index.js +32 -82
  89. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  90. package/build/components/sidebar-navigation-screen-templates-browse/index.js +43 -0
  91. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
  92. package/build/components/site-hub/index.js +14 -49
  93. package/build/components/site-hub/index.js.map +1 -1
  94. package/build/components/style-book/index.js +10 -3
  95. package/build/components/style-book/index.js.map +1 -1
  96. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -20
  97. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  98. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -3
  99. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  100. package/build/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +12 -12
  101. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
  102. package/build/components/use-edited-entity-record/index.js +6 -2
  103. package/build/components/use-edited-entity-record/index.js.map +1 -1
  104. package/build/hooks/push-changes-to-global-styles/index.js +2 -2
  105. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  106. package/build/{experiments.js → private-apis.js} +3 -3
  107. package/build/private-apis.js.map +1 -0
  108. package/build/store/index.js +3 -3
  109. package/build/store/index.js.map +1 -1
  110. package/build/utils/get-is-list-page.js +5 -6
  111. package/build/utils/get-is-list-page.js.map +1 -1
  112. package/build-module/components/add-new-template/new-template-part.js +7 -4
  113. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  114. package/build-module/components/add-new-template/new-template.js +7 -4
  115. package/build-module/components/add-new-template/new-template.js.map +1 -1
  116. package/build-module/components/block-editor/editor-canvas.js +1 -1
  117. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  118. package/build-module/components/block-editor/index.js +3 -3
  119. package/build-module/components/block-editor/index.js.map +1 -1
  120. package/build-module/components/editor/index.js +25 -24
  121. package/build-module/components/editor/index.js.map +1 -1
  122. package/build-module/components/global-styles/border-panel.js +3 -3
  123. package/build-module/components/global-styles/border-panel.js.map +1 -1
  124. package/build-module/components/global-styles/color-palette-panel.js +3 -3
  125. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  126. package/build-module/components/global-styles/custom-css.js +3 -3
  127. package/build-module/components/global-styles/custom-css.js.map +1 -1
  128. package/build-module/components/global-styles/dimensions-panel.js +3 -3
  129. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  130. package/build-module/components/global-styles/global-styles-provider.js +3 -3
  131. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  132. package/build-module/components/global-styles/gradients-palette-panel.js +3 -3
  133. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  134. package/build-module/components/global-styles/header.js +2 -2
  135. package/build-module/components/global-styles/header.js.map +1 -1
  136. package/build-module/components/global-styles/hooks.js +3 -3
  137. package/build-module/components/global-styles/hooks.js.map +1 -1
  138. package/build-module/components/global-styles/navigation-button.js +2 -2
  139. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  140. package/build-module/components/global-styles/palette.js +3 -3
  141. package/build-module/components/global-styles/palette.js.map +1 -1
  142. package/build-module/components/global-styles/preview.js +3 -3
  143. package/build-module/components/global-styles/preview.js.map +1 -1
  144. package/build-module/components/global-styles/screen-background-color.js +3 -3
  145. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  146. package/build-module/components/global-styles/screen-button-color.js +3 -3
  147. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  148. package/build-module/components/global-styles/screen-colors.js +3 -3
  149. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  150. package/build-module/components/global-styles/screen-css.js +5 -5
  151. package/build-module/components/global-styles/screen-css.js.map +1 -1
  152. package/build-module/components/global-styles/screen-heading-color.js +3 -3
  153. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  154. package/build-module/components/global-styles/screen-link-color.js +3 -3
  155. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  156. package/build-module/components/global-styles/screen-root.js +3 -3
  157. package/build-module/components/global-styles/screen-root.js.map +1 -1
  158. package/build-module/components/global-styles/screen-style-variations.js +3 -3
  159. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  160. package/build-module/components/global-styles/screen-text-color.js +3 -3
  161. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  162. package/build-module/components/global-styles/screen-typography.js +3 -3
  163. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  164. package/build-module/components/global-styles/shadow-panel.js +3 -3
  165. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  166. package/build-module/components/global-styles/typography-panel.js +3 -3
  167. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  168. package/build-module/components/global-styles/typography-preview.js +3 -3
  169. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  170. package/build-module/components/global-styles/ui.js +4 -11
  171. package/build-module/components/global-styles/ui.js.map +1 -1
  172. package/build-module/components/global-styles-renderer/index.js +3 -3
  173. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  174. package/build-module/components/header-edit-mode/index.js +6 -3
  175. package/build-module/components/header-edit-mode/index.js.map +1 -1
  176. package/build-module/components/keyboard-shortcut-help-modal/config.js +1 -1
  177. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  178. package/build-module/components/layout/index.js +10 -23
  179. package/build-module/components/layout/index.js.map +1 -1
  180. package/build-module/components/list/actions/rename-menu-item.js +1 -1
  181. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  182. package/build-module/components/list/table.js +1 -0
  183. package/build-module/components/list/table.js.map +1 -1
  184. package/build-module/components/navigation-inspector/navigation-menu.js +3 -3
  185. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  186. package/build-module/components/save-panel/index.js +3 -2
  187. package/build-module/components/save-panel/index.js.map +1 -1
  188. package/build-module/components/sidebar/index.js +14 -3
  189. package/build-module/components/sidebar/index.js.map +1 -1
  190. package/build-module/components/sidebar-navigation-screen/index.js +27 -9
  191. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  192. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +55 -0
  193. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
  194. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
  195. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  196. package/build-module/components/sidebar-navigation-screen-template/index.js +53 -0
  197. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -0
  198. package/build-module/components/sidebar-navigation-screen-templates/index.js +34 -81
  199. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  200. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
  201. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
  202. package/build-module/components/site-hub/index.js +14 -46
  203. package/build-module/components/site-hub/index.js.map +1 -1
  204. package/build-module/components/style-book/index.js +11 -4
  205. package/build-module/components/style-book/index.js.map +1 -1
  206. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -21
  207. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  208. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  209. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  210. package/build-module/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +11 -11
  211. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
  212. package/build-module/components/use-edited-entity-record/index.js +6 -2
  213. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  214. package/build-module/hooks/push-changes-to-global-styles/index.js +3 -3
  215. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  216. package/build-module/{experiments.js → private-apis.js} +2 -2
  217. package/build-module/private-apis.js.map +1 -0
  218. package/build-module/store/index.js +1 -1
  219. package/build-module/store/index.js.map +1 -1
  220. package/build-module/utils/get-is-list-page.js +5 -6
  221. package/build-module/utils/get-is-list-page.js.map +1 -1
  222. package/build-style/style-rtl.css +18 -37
  223. package/build-style/style.css +18 -37
  224. package/package.json +20 -20
  225. package/src/components/add-new-template/new-template-part.js +7 -4
  226. package/src/components/add-new-template/new-template.js +8 -6
  227. package/src/components/block-editor/editor-canvas.js +1 -1
  228. package/src/components/block-editor/index.js +3 -3
  229. package/src/components/editor/index.js +29 -28
  230. package/src/components/global-styles/border-panel.js +3 -3
  231. package/src/components/global-styles/color-palette-panel.js +3 -3
  232. package/src/components/global-styles/custom-css.js +3 -3
  233. package/src/components/global-styles/dimensions-panel.js +3 -3
  234. package/src/components/global-styles/global-styles-provider.js +3 -3
  235. package/src/components/global-styles/gradients-palette-panel.js +3 -3
  236. package/src/components/global-styles/header.js +2 -2
  237. package/src/components/global-styles/hooks.js +3 -3
  238. package/src/components/global-styles/navigation-button.js +4 -2
  239. package/src/components/global-styles/palette.js +3 -3
  240. package/src/components/global-styles/preview.js +3 -3
  241. package/src/components/global-styles/screen-background-color.js +3 -3
  242. package/src/components/global-styles/screen-button-color.js +3 -3
  243. package/src/components/global-styles/screen-colors.js +3 -3
  244. package/src/components/global-styles/screen-css.js +14 -7
  245. package/src/components/global-styles/screen-heading-color.js +3 -3
  246. package/src/components/global-styles/screen-link-color.js +3 -3
  247. package/src/components/global-styles/screen-root.js +3 -3
  248. package/src/components/global-styles/screen-style-variations.js +3 -3
  249. package/src/components/global-styles/screen-text-color.js +3 -3
  250. package/src/components/global-styles/screen-typography.js +3 -3
  251. package/src/components/global-styles/shadow-panel.js +3 -3
  252. package/src/components/global-styles/style.scss +2 -1
  253. package/src/components/global-styles/typography-panel.js +3 -3
  254. package/src/components/global-styles/typography-preview.js +3 -3
  255. package/src/components/global-styles/ui.js +3 -8
  256. package/src/components/global-styles-renderer/index.js +3 -3
  257. package/src/components/header-edit-mode/index.js +6 -3
  258. package/src/components/keyboard-shortcut-help-modal/config.js +1 -1
  259. package/src/components/layout/index.js +35 -48
  260. package/src/components/layout/style.scss +11 -23
  261. package/src/components/list/actions/rename-menu-item.js +1 -1
  262. package/src/components/list/table.js +4 -0
  263. package/src/components/navigation-inspector/navigation-menu.js +3 -3
  264. package/src/components/save-panel/index.js +4 -1
  265. package/src/components/sidebar/index.js +10 -2
  266. package/src/components/sidebar-navigation-screen/index.js +27 -11
  267. package/src/components/sidebar-navigation-screen/style.scss +4 -6
  268. package/src/components/sidebar-navigation-screen-navigation-item/index.js +52 -0
  269. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +1 -1
  270. package/src/components/sidebar-navigation-screen-template/index.js +52 -0
  271. package/src/components/sidebar-navigation-screen-templates/index.js +49 -83
  272. package/src/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
  273. package/src/components/site-hub/index.js +67 -122
  274. package/src/components/site-hub/style.scss +1 -11
  275. package/src/components/style-book/index.js +11 -7
  276. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +48 -14
  277. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  278. package/src/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +10 -10
  279. package/src/components/use-edited-entity-record/index.js +6 -2
  280. package/src/hooks/push-changes-to-global-styles/index.js +3 -3
  281. package/src/{experiments.js → private-apis.js} +1 -1
  282. package/src/store/index.js +1 -1
  283. package/src/utils/get-is-list-page.js +5 -5
  284. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
  285. package/build/experiments.js.map +0 -1
  286. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
  287. package/build-module/experiments.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/navigation-menu.js"],"names":["experiments","blockEditorExperiments","store","blockEditorStore","useEffect","useDispatch","unlock","ALLOWED_BLOCKS","NavigationMenu","innerBlocks","onSelect","updateBlockListSettings","OffCanvasEditor","allowedBlocks","forEach","block","name","clientId"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAMC,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;AAuBA,eAAe,SAASC,cAAT,OAAqD;AAAA,MAA5B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAA4B;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAA8BN,WAAW,CAAEF,gBAAF,CAA/C;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAsBN,MAAM,CAAEL,sBAAF,CAAlC,CAHmE,CAKnE;AACA;;AACAG,EAAAA,SAAS,CAAE,MAAM;AAChBO,IAAAA,uBAAuB,CAAE,EAAF,EAAM;AAC5BE,MAAAA,aAAa,EAAEN,cAAc,CAAE,iBAAF;AADD,KAAN,CAAvB;AAGAE,IAAAA,WAAW,CAACK,OAAZ,CAAuBC,KAAF,IAAa;AACjC,UAAKR,cAAc,CAAEQ,KAAK,CAACC,IAAR,CAAnB,EAAoC;AACnCL,QAAAA,uBAAuB,CAAEI,KAAK,CAACE,QAAR,EAAkB;AACxCJ,UAAAA,aAAa,EAAEN,cAAc,CAAEQ,KAAK,CAACC,IAAR;AADW,SAAlB,CAAvB;AAGA;AACD,KAND;AAOA,GAXQ,EAWN,CAAEL,uBAAF,EAA2BF,WAA3B,CAXM,CAAT;AAaA,SAAO,cAAC,eAAD;AAAiB,IAAA,MAAM,EAAGA,WAA1B;AAAwC,IAAA,QAAQ,EAAGC;AAAnD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\texperiments as blockEditorExperiments,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../experiments';\n\nconst ALLOWED_BLOCKS = {\n\t'core/navigation': [\n\t\t'core/navigation-link',\n\t\t'core/search',\n\t\t'core/social-links',\n\t\t'core/page-list',\n\t\t'core/spacer',\n\t\t'core/home-link',\n\t\t'core/site-title',\n\t\t'core/site-logo',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/social-links': [ 'core/social-link' ],\n\t'core/navigation-submenu': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/navigation-link': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n};\n\nexport default function NavigationMenu( { innerBlocks, onSelect } ) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor } = unlock( blockEditorExperiments );\n\n\t//TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList\n\t//Think through a better way of doing this, possible with adding allowed blocks to block library metadata\n\tuseEffect( () => {\n\t\tupdateBlockListSettings( '', {\n\t\t\tallowedBlocks: ALLOWED_BLOCKS[ 'core/navigation' ],\n\t\t} );\n\t\tinnerBlocks.forEach( ( block ) => {\n\t\t\tif ( ALLOWED_BLOCKS[ block.name ] ) {\n\t\t\t\tupdateBlockListSettings( block.clientId, {\n\t\t\t\t\tallowedBlocks: ALLOWED_BLOCKS[ block.name ],\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [ updateBlockListSettings, innerBlocks ] );\n\n\treturn <OffCanvasEditor blocks={ innerBlocks } onSelect={ onSelect } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/navigation-menu.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","useEffect","useDispatch","unlock","ALLOWED_BLOCKS","NavigationMenu","innerBlocks","onSelect","updateBlockListSettings","OffCanvasEditor","allowedBlocks","forEach","block","name","clientId"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAMC,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;AAuBA,eAAe,SAASC,cAAT,OAAqD;AAAA,MAA5B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAA4B;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAA8BN,WAAW,CAAEF,gBAAF,CAA/C;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAsBN,MAAM,CAAEL,sBAAF,CAAlC,CAHmE,CAKnE;AACA;;AACAG,EAAAA,SAAS,CAAE,MAAM;AAChBO,IAAAA,uBAAuB,CAAE,EAAF,EAAM;AAC5BE,MAAAA,aAAa,EAAEN,cAAc,CAAE,iBAAF;AADD,KAAN,CAAvB;AAGAE,IAAAA,WAAW,CAACK,OAAZ,CAAuBC,KAAF,IAAa;AACjC,UAAKR,cAAc,CAAEQ,KAAK,CAACC,IAAR,CAAnB,EAAoC;AACnCL,QAAAA,uBAAuB,CAAEI,KAAK,CAACE,QAAR,EAAkB;AACxCJ,UAAAA,aAAa,EAAEN,cAAc,CAAEQ,KAAK,CAACC,IAAR;AADW,SAAlB,CAAvB;AAGA;AACD,KAND;AAOA,GAXQ,EAWN,CAAEL,uBAAF,EAA2BF,WAA3B,CAXM,CAAT;AAaA,SAAO,cAAC,eAAD;AAAiB,IAAA,MAAM,EAAGA,WAA1B;AAAwC,IAAA,QAAQ,EAAGC;AAAnD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst ALLOWED_BLOCKS = {\n\t'core/navigation': [\n\t\t'core/navigation-link',\n\t\t'core/search',\n\t\t'core/social-links',\n\t\t'core/page-list',\n\t\t'core/spacer',\n\t\t'core/home-link',\n\t\t'core/site-title',\n\t\t'core/site-logo',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/social-links': [ 'core/social-link' ],\n\t'core/navigation-submenu': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/navigation-link': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n};\n\nexport default function NavigationMenu( { innerBlocks, onSelect } ) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor } = unlock( blockEditorPrivateApis );\n\n\t//TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList\n\t//Think through a better way of doing this, possible with adding allowed blocks to block library metadata\n\tuseEffect( () => {\n\t\tupdateBlockListSettings( '', {\n\t\t\tallowedBlocks: ALLOWED_BLOCKS[ 'core/navigation' ],\n\t\t} );\n\t\tinnerBlocks.forEach( ( block ) => {\n\t\t\tif ( ALLOWED_BLOCKS[ block.name ] ) {\n\t\t\t\tupdateBlockListSettings( block.clientId, {\n\t\t\t\t\tallowedBlocks: ALLOWED_BLOCKS[ block.name ],\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [ updateBlockListSettings, innerBlocks ] );\n\n\treturn <OffCanvasEditor blocks={ innerBlocks } onSelect={ onSelect } />;\n}\n"]}
@@ -13,7 +13,7 @@ import { NavigableRegion } from '@wordpress/interface';
13
13
  */
14
14
 
15
15
  import { store as editSiteStore } from '../../store';
16
- import { unlock } from '../../experiments';
16
+ import { unlock } from '../../private-apis';
17
17
  export default function SavePanel() {
18
18
  const {
19
19
  isSaveViewOpen,
@@ -40,7 +40,8 @@ export default function SavePanel() {
40
40
  return isSaveViewOpen ? createElement(Modal, {
41
41
  className: "edit-site-save-panel__modal",
42
42
  onRequestClose: onClose,
43
- __experimentalHideHeader: true
43
+ __experimentalHideHeader: true,
44
+ contentLabel: __('Save site, content, and template changes')
44
45
  }, createElement(EntitiesSavedStates, {
45
46
  close: onClose
46
47
  })) : null;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"names":["Button","Modal","EntitiesSavedStates","useDispatch","useSelect","__","NavigableRegion","store","editSiteStore","unlock","SavePanel","isSaveViewOpen","canvasMode","select","isSaveViewOpened","getCanvasMode","setIsSaveViewOpened","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,KAAjB,QAA8B,uBAA9B;AACA,SAASC,mBAAT,QAAoC,mBAApC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,sBAAhC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAiCR,SAAS,CAAIS,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAAsCN,MAAM,CACjDI,MAAM,CAAEL,aAAF,CAD2C,CAAlD,CAD+D,CAK/D;AACA;;AACA,WAAO;AACNG,MAAAA,cAAc,EAAEG,gBAAgB,EAD1B;AAENF,MAAAA,UAAU,EAAEG,aAAa;AAFnB,KAAP;AAIA,GAX+C,EAW7C,EAX6C,CAAhD;AAYA,QAAM;AAAEC,IAAAA;AAAF,MAA0Bb,WAAW,CAAEK,aAAF,CAA3C;;AACA,QAAMS,OAAO,GAAG,MAAMD,mBAAmB,CAAE,KAAF,CAAzC;;AAEA,MAAKJ,UAAU,KAAK,MAApB,EAA6B;AAC5B,WAAOD,cAAc,GACpB,cAAC,KAAD;AACC,MAAA,SAAS,EAAC,6BADX;AAEC,MAAA,cAAc,EAAGM,OAFlB;AAGC,MAAA,wBAAwB;AAHzB,OAKC,cAAC,mBAAD;AAAqB,MAAA,KAAK,EAAGA;AAA7B,MALD,CADoB,GAQjB,IARJ;AASA;;AAED,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,2BADX;AAEC,IAAA,SAAS,EAAGZ,EAAE,CAAE,cAAF;AAFf,KAIGM,cAAc,GACf,cAAC,mBAAD;AAAqB,IAAA,KAAK,EAAGM;AAA7B,IADe,GAGf;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,SAAS,EAAC,4CAFX;AAGC,IAAA,OAAO,EAAG,MAAMD,mBAAmB,CAAE,IAAF,CAHpC;AAIC,qBAAgB;AAJjB,KAMGX,EAAE,CAAE,iBAAF,CANL,CADD,CAPF,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport { EntitiesSavedStates } from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { NavigableRegion } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../experiments';\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode } = useSelect( ( select ) => {\n\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t>\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName=\"edit-site-layout__actions\"\n\t\t\tariaLabel={ __( 'Save sidebar' ) }\n\t\t>\n\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"names":["Button","Modal","EntitiesSavedStates","useDispatch","useSelect","__","NavigableRegion","store","editSiteStore","unlock","SavePanel","isSaveViewOpen","canvasMode","select","isSaveViewOpened","getCanvasMode","setIsSaveViewOpened","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,KAAjB,QAA8B,uBAA9B;AACA,SAASC,mBAAT,QAAoC,mBAApC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,sBAAhC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAiCR,SAAS,CAAIS,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAAsCN,MAAM,CACjDI,MAAM,CAAEL,aAAF,CAD2C,CAAlD,CAD+D,CAK/D;AACA;;AACA,WAAO;AACNG,MAAAA,cAAc,EAAEG,gBAAgB,EAD1B;AAENF,MAAAA,UAAU,EAAEG,aAAa;AAFnB,KAAP;AAIA,GAX+C,EAW7C,EAX6C,CAAhD;AAYA,QAAM;AAAEC,IAAAA;AAAF,MAA0Bb,WAAW,CAAEK,aAAF,CAA3C;;AACA,QAAMS,OAAO,GAAG,MAAMD,mBAAmB,CAAE,KAAF,CAAzC;;AAEA,MAAKJ,UAAU,KAAK,MAApB,EAA6B;AAC5B,WAAOD,cAAc,GACpB,cAAC,KAAD;AACC,MAAA,SAAS,EAAC,6BADX;AAEC,MAAA,cAAc,EAAGM,OAFlB;AAGC,MAAA,wBAAwB,MAHzB;AAIC,MAAA,YAAY,EAAGZ,EAAE,CAChB,0CADgB;AAJlB,OAQC,cAAC,mBAAD;AAAqB,MAAA,KAAK,EAAGY;AAA7B,MARD,CADoB,GAWjB,IAXJ;AAYA;;AAED,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,2BADX;AAEC,IAAA,SAAS,EAAGZ,EAAE,CAAE,cAAF;AAFf,KAIGM,cAAc,GACf,cAAC,mBAAD;AAAqB,IAAA,KAAK,EAAGM;AAA7B,IADe,GAGf;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,SAAS,EAAC,4CAFX;AAGC,IAAA,OAAO,EAAG,MAAMD,mBAAmB,CAAE,IAAF,CAHpC;AAIC,qBAAgB;AAJjB,KAMGX,EAAE,CAAE,iBAAF,CANL,CADD,CAPF,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport { EntitiesSavedStates } from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { NavigableRegion } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode } = useSelect( ( select ) => {\n\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName=\"edit-site-layout__actions\"\n\t\t\tariaLabel={ __( 'Save sidebar' ) }\n\t\t>\n\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"]}
@@ -13,16 +13,27 @@ import { store as coreStore } from '@wordpress/core-data';
13
13
 
14
14
  import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
15
15
  import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
16
- import useSyncSidebarPathWithURL from '../sync-state-with-url/use-sync-sidebar-path-with-url';
16
+ import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
17
+ import useSyncPathWithURL from '../sync-state-with-url/use-sync-path-with-url';
17
18
  import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
19
+ import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
18
20
  import SaveButton from '../save-button';
21
+ import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';
19
22
 
20
23
  function SidebarScreens() {
21
- useSyncSidebarPathWithURL();
22
- return createElement(Fragment, null, createElement(SidebarNavigationScreenMain, null), createElement(SidebarNavigationScreenNavigationMenus, null), createElement(SidebarNavigationScreenTemplates, {
24
+ useSyncPathWithURL();
25
+ return createElement(Fragment, null, createElement(SidebarNavigationScreenMain, null), createElement(SidebarNavigationScreenNavigationMenus, null), createElement(SidebarNavigationScreenNavigationItem, null), createElement(SidebarNavigationScreenTemplates, {
23
26
  postType: "wp_template"
24
27
  }), createElement(SidebarNavigationScreenTemplates, {
25
28
  postType: "wp_template_part"
29
+ }), createElement(SidebarNavigationScreenTemplate, {
30
+ postType: "wp_template"
31
+ }), createElement(SidebarNavigationScreenTemplate, {
32
+ postType: "wp_template_part"
33
+ }), createElement(SidebarNavigationScreenTemplatesBrowse, {
34
+ postType: "wp_template"
35
+ }), createElement(SidebarNavigationScreenTemplatesBrowse, {
36
+ postType: "wp_template_part"
26
37
  }));
27
38
  }
28
39
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useSelect","__experimentalNavigatorProvider","NavigatorProvider","store","coreStore","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","useSyncSidebarPathWithURL","SidebarNavigationScreenNavigationMenus","SaveButton","SidebarScreens","Sidebar","isDirty","select","__experimentalGetDirtyEntityRecords","dirtyEntityRecords","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,oBAArB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,+BAA+B,IAAIC,iBAA5C,QAAqE,uBAArE;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,yBAAP,MAAsC,uDAAtC;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,UAAP,MAAuB,gBAAvB;;AAEA,SAASC,cAAT,GAA0B;AACzBH,EAAAA,yBAAyB;AAEzB,SACC,8BACC,cAAC,2BAAD,OADD,EAEC,cAAC,sCAAD,OAFD,EAGC,cAAC,gCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IAHD,EAIC,cAAC,gCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IAJD,CADD;AAQA;;AAED,SAASI,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA;AAAF,MAAcZ,SAAS,CAAIa,MAAF,IAAc;AAC5C,UAAM;AAAEC,MAAAA;AAAF,QAA0CD,MAAM,CAAET,SAAF,CAAtD;;AACA,UAAMW,kBAAkB,GAAGD,mCAAmC,EAA9D,CAF4C,CAG5C;AACA;;;AACA,WAAO;AACNF,MAAAA,OAAO,EAAEG,kBAAkB,CAACC,MAAnB,GAA4B;AAD/B,KAAP;AAGA,GAR4B,EAQ1B,EAR0B,CAA7B;AAUA,SACC,8BACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAC;AAFb,KAIC,cAAC,cAAD,OAJD,CADD,EAOGJ,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD,OADD,CARF,CADD;AAeA;;AAED,eAAeb,IAAI,CAAEY,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport useSyncSidebarPathWithURL from '../sync-state-with-url/use-sync-sidebar-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SaveButton from '../save-button';\n\nfunction SidebarScreens() {\n\tuseSyncSidebarPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreenMain />\n\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template\" />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template_part\" />\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { isDirty } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords } = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath=\"/\"\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t{ isDirty && (\n\t\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useSelect","__experimentalNavigatorProvider","NavigatorProvider","store","coreStore","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenTemplatesBrowse","SaveButton","SidebarNavigationScreenNavigationItem","SidebarScreens","Sidebar","isDirty","select","__experimentalGetDirtyEntityRecords","dirtyEntityRecords","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,oBAArB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,+BAA+B,IAAIC,iBAA5C,QAAqE,uBAArE;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,kBAAP,MAA+B,+CAA/B;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,qCAAP,MAAkD,8CAAlD;;AAEA,SAASC,cAAT,GAA0B;AACzBL,EAAAA,kBAAkB;AAElB,SACC,8BACC,cAAC,2BAAD,OADD,EAEC,cAAC,sCAAD,OAFD,EAGC,cAAC,qCAAD,OAHD,EAIC,cAAC,gCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IAJD,EAKC,cAAC,gCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IALD,EAMC,cAAC,+BAAD;AAAiC,IAAA,QAAQ,EAAC;AAA1C,IAND,EAOC,cAAC,+BAAD;AAAiC,IAAA,QAAQ,EAAC;AAA1C,IAPD,EAQC,cAAC,sCAAD;AAAwC,IAAA,QAAQ,EAAC;AAAjD,IARD,EASC,cAAC,sCAAD;AAAwC,IAAA,QAAQ,EAAC;AAAjD,IATD,CADD;AAaA;;AAED,SAASM,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA;AAAF,MAAcf,SAAS,CAAIgB,MAAF,IAAc;AAC5C,UAAM;AAAEC,MAAAA;AAAF,QAA0CD,MAAM,CAAEZ,SAAF,CAAtD;;AACA,UAAMc,kBAAkB,GAAGD,mCAAmC,EAA9D,CAF4C,CAG5C;AACA;;;AACA,WAAO;AACNF,MAAAA,OAAO,EAAEG,kBAAkB,CAACC,MAAnB,GAA4B;AAD/B,KAAP;AAGA,GAR4B,EAQ1B,EAR0B,CAA7B;AAUA,SACC,8BACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAC;AAFb,KAIC,cAAC,cAAD,OAJD,CADD,EAOGJ,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD,OADD,CARF,CADD;AAeA;;AAED,eAAehB,IAAI,CAAEe,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport useSyncPathWithURL from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveButton from '../save-button';\nimport SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreenMain />\n\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t<SidebarNavigationScreenNavigationItem />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template\" />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template_part\" />\n\t\t\t<SidebarNavigationScreenTemplate postType=\"wp_template\" />\n\t\t\t<SidebarNavigationScreenTemplate postType=\"wp_template_part\" />\n\t\t\t<SidebarNavigationScreenTemplatesBrowse postType=\"wp_template\" />\n\t\t\t<SidebarNavigationScreenTemplatesBrowse postType=\"wp_template_part\" />\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { isDirty } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords } = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath=\"/\"\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t{ isDirty && (\n\t\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
@@ -3,17 +3,33 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalNavigatorBackButton as NavigatorBackButton, __experimentalNavigatorScreen as NavigatorScreen } from '@wordpress/components';
7
- import { isRTL, __, sprintf } from '@wordpress/i18n';
6
+ import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalNavigatorToParentButton as NavigatorToParentButton, Button, __experimentalNavigatorScreen as NavigatorScreen } from '@wordpress/components';
7
+ import { isRTL, __ } from '@wordpress/i18n';
8
8
  import { chevronRight, chevronLeft } from '@wordpress/icons';
9
+ import { useSelect } from '@wordpress/data';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { store as editSiteStore } from '../../store';
15
+ import { unlock } from '../../private-apis';
9
16
  export default function SidebarNavigationScreen(_ref) {
10
17
  let {
11
18
  path,
12
- parentTitle,
13
19
  title,
14
20
  actions,
15
21
  content
16
22
  } = _ref;
23
+ const {
24
+ dashboardLink
25
+ } = useSelect(select => {
26
+ const {
27
+ getSettings
28
+ } = unlock(select(editSiteStore));
29
+ return {
30
+ dashboardLink: getSettings().__experimentalDashboardLink
31
+ };
32
+ }, []);
17
33
  return createElement(NavigatorScreen, {
18
34
  className: "edit-site-sidebar-navigation-screen",
19
35
  path: path
@@ -23,14 +39,16 @@ export default function SidebarNavigationScreen(_ref) {
23
39
  spacing: 4,
24
40
  justify: "flex-start",
25
41
  className: "edit-site-sidebar-navigation-screen__title-icon"
26
- }, parentTitle ? createElement(NavigatorBackButton, {
42
+ }, path !== '/' ? createElement(NavigatorToParentButton, {
43
+ className: "edit-site-sidebar-navigation-screen__back",
44
+ icon: isRTL() ? chevronRight : chevronLeft,
45
+ "aria-label": __('Back')
46
+ }) : createElement(Button, {
27
47
  className: "edit-site-sidebar-navigation-screen__back",
28
48
  icon: isRTL() ? chevronRight : chevronLeft,
29
- "aria-label": sprintf(
30
- /* translators: %s: previous page. */
31
- __('Navigate to the previous view: %s'), parentTitle)
32
- }) : createElement("div", {
33
- className: "edit-site-sidebar-navigation-screen__icon-placeholder"
49
+ "aria-label": __('Navigate to the Dashboard'),
50
+ href: dashboardLink || 'index.php',
51
+ label: __('Dashboard')
34
52
  }), createElement("h2", {
35
53
  className: "edit-site-sidebar-navigation-screen__title"
36
54
  }, title), actions), createElement("nav", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorBackButton","NavigatorBackButton","__experimentalNavigatorScreen","NavigatorScreen","isRTL","__","sprintf","chevronRight","chevronLeft","SidebarNavigationScreen","path","parentTitle","title","actions","content"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,iCAAiC,IAAIC,mBAHtC,EAICC,6BAA6B,IAAIC,eAJlC,QAKO,uBALP;AAMA,SAASC,KAAT,EAAgBC,EAAhB,EAAoBC,OAApB,QAAmC,iBAAnC;AACA,SAASC,YAAT,EAAuBC,WAAvB,QAA0C,kBAA1C;AAEA,eAAe,SAASC,uBAAT,OAMX;AAAA,MAN6C;AAChDC,IAAAA,IADgD;AAEhDC,IAAAA,WAFgD;AAGhDC,IAAAA,KAHgD;AAIhDC,IAAAA,OAJgD;AAKhDC,IAAAA;AALgD,GAM7C;AACH,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,IAAI,EAAGJ;AAFR,KAIC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGC,WAAW,GACZ,cAAC,mBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGP,KAAK,KAAKG,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,OAAO;AACnB;AACAD,IAAAA,EAAE,CAAE,mCAAF,CAFiB,EAGnBM,WAHmB;AAHrB,IADY,GAWZ;AAAK,IAAA,SAAS,EAAC;AAAf,IAhBF,EAkBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGC,KADH,CAlBD,EAqBGC,OArBH,CADD,EAyBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CAzBD,CAJD,CADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\n\nexport default function SidebarNavigationScreen( {\n\tpath,\n\tparentTitle,\n\ttitle,\n\tactions,\n\tcontent,\n} ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName=\"edit-site-sidebar-navigation-screen\"\n\t\t\tpath={ path }\n\t\t>\n\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ parentTitle ? (\n\t\t\t\t\t\t<NavigatorBackButton\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__back\"\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: previous page. */\n\t\t\t\t\t\t\t\t__( 'Navigate to the previous view: %s' ),\n\t\t\t\t\t\t\t\tparentTitle\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__icon-placeholder\" />\n\t\t\t\t\t) }\n\t\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</h2>\n\t\t\t\t\t{ actions }\n\t\t\t\t</HStack>\n\n\t\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ content }\n\t\t\t\t</nav>\n\t\t\t</VStack>\n\t\t</NavigatorScreen>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","Button","__experimentalNavigatorScreen","NavigatorScreen","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","SidebarNavigationScreen","path","title","actions","content","dashboardLink","select","getSettings","__experimentalDashboardLink"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,EAICC,MAJD,EAKCC,6BAA6B,IAAIC,eALlC,QAMO,uBANP;AAOA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,YAAT,EAAuBC,WAAvB,QAA0C,kBAA1C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,eAAe,SAASC,uBAAT,OAKX;AAAA,MAL6C;AAChDC,IAAAA,IADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBT,SAAS,CAAIU,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBR,MAAM,CAAEO,MAAM,CAAER,aAAF,CAAR,CAA9B;AACA,WAAO;AACNO,MAAAA,aAAa,EAAEE,WAAW,GAAGC;AADvB,KAAP;AAGA,GALkC,EAKhC,EALgC,CAAnC;AAOA,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,IAAI,EAAGP;AAFR,KAIC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGA,IAAI,KAAK,GAAT,GACD,cAAC,uBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGT,KAAK,KAAKE,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,EAAE,CAAE,MAAF;AAHhB,IADC,GAOD,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGD,KAAK,KAAKE,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,EAAE,CAAE,2BAAF,CAHhB;AAIC,IAAA,IAAI,EAAGY,aAAa,IAAI,WAJzB;AAKC,IAAA,KAAK,EAAGZ,EAAE,CAAE,WAAF;AALX,IAZF,EAoBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGS,KADH,CApBD,EAuBGC,OAvBH,CADD,EA2BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CA3BD,CAJD,CADD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n\tButton,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nexport default function SidebarNavigationScreen( {\n\tpath,\n\ttitle,\n\tactions,\n\tcontent,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName=\"edit-site-sidebar-navigation-screen\"\n\t\t\tpath={ path }\n\t\t>\n\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ path !== '/' ? (\n\t\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__back\"\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__back\"\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</h2>\n\t\t\t\t\t{ actions }\n\t\t\t\t</HStack>\n\n\t\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ content }\n\t\t\t\t</nav>\n\t\t\t</VStack>\n\t\t</NavigatorScreen>\n\t);\n}\n"]}
@@ -0,0 +1,55 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { useDispatch, useSelect } from '@wordpress/data';
8
+ import { Button } from '@wordpress/components';
9
+ import { store as coreStore } from '@wordpress/core-data';
10
+ import { decodeEntities } from '@wordpress/html-entities';
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
16
+ import { unlock } from '../../private-apis';
17
+ import { store as editSiteStore } from '../../store';
18
+ export default function SidebarNavigationScreenNavigationItem() {
19
+ var _post$title, _post$description;
20
+
21
+ const {
22
+ setCanvasMode
23
+ } = unlock(useDispatch(editSiteStore));
24
+ const {
25
+ post
26
+ } = useSelect(select => {
27
+ var _getEditedPostContext;
28
+
29
+ const {
30
+ getEditedPostContext
31
+ } = select(editSiteStore);
32
+ const {
33
+ getEntityRecord
34
+ } = select(coreStore);
35
+ const {
36
+ postType,
37
+ postId
38
+ } = (_getEditedPostContext = getEditedPostContext()) !== null && _getEditedPostContext !== void 0 ? _getEditedPostContext : {}; // The currently selected entity to display.
39
+ // Typically template or template part in the site editor.
40
+
41
+ return {
42
+ post: postId && postType ? getEntityRecord('postType', postType, postId) : null
43
+ };
44
+ }, []);
45
+ return createElement(SidebarNavigationScreen, {
46
+ path: "/navigation/single",
47
+ title: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$title = post.title) === null || _post$title === void 0 ? void 0 : _post$title.rendered) : null,
48
+ actions: createElement(Button, {
49
+ variant: "primary",
50
+ onClick: () => setCanvasMode('edit')
51
+ }, __('Edit')),
52
+ content: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$description = post.description) === null || _post$description === void 0 ? void 0 : _post$description.rendered) : null
53
+ });
54
+ }
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","Button","store","coreStore","decodeEntities","SidebarNavigationScreen","unlock","editSiteStore","SidebarNavigationScreenNavigationItem","setCanvasMode","post","select","getEditedPostContext","getEntityRecord","postType","postId","title","rendered","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBH,MAAM,CAAEP,WAAW,CAAEQ,aAAF,CAAb,CAAhC;AAEA,QAAM;AAAEG,IAAAA;AAAF,MAAWV,SAAS,CAAIW,MAAF,IAAc;AAAA;;AACzC,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,MAAM,CAAEJ,aAAF,CAAvC;AACA,UAAM;AAAEM,MAAAA;AAAF,QAAsBF,MAAM,CAAER,SAAF,CAAlC;AACA,UAAM;AAAEW,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,iCAAuBH,oBAAoB,EAA3C,yEAAiD,EAAvD,CAHyC,CAKzC;AACA;;AACA,WAAO;AACNF,MAAAA,IAAI,EACHK,MAAM,IAAID,QAAV,GACGD,eAAe,CAAE,UAAF,EAAcC,QAAd,EAAwBC,MAAxB,CADlB,GAEG;AAJE,KAAP;AAMA,GAbyB,EAavB,EAbuB,CAA1B;AAeA,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAC,oBADN;AAEC,IAAA,KAAK,EAAGL,IAAI,GAAGN,cAAc,CAAEM,IAAF,aAAEA,IAAF,sCAAEA,IAAI,CAAEM,KAAR,gDAAE,YAAaC,QAAf,CAAjB,GAA6C,IAF1D;AAGC,IAAA,OAAO,EACN,cAAC,MAAD;AACC,MAAA,OAAO,EAAC,SADT;AAEC,MAAA,OAAO,EAAG,MAAMR,aAAa,CAAE,MAAF;AAF9B,OAIGX,EAAE,CAAE,MAAF,CAJL,CAJF;AAWC,IAAA,OAAO,EACNY,IAAI,GAAGN,cAAc,CAAEM,IAAF,aAAEA,IAAF,4CAAEA,IAAI,CAAEQ,WAAR,sDAAE,kBAAmBD,QAArB,CAAjB,GAAmD;AAZzD,IADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst { post } = useSelect( ( select ) => {\n\t\tconst { getEditedPostContext } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst { postType, postId } = getEditedPostContext() ?? {};\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tpost:\n\t\t\t\tpostId && postType\n\t\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t\t: null,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation/single\"\n\t\t\ttitle={ post ? decodeEntities( post?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\tpost ? decodeEntities( post?.description?.rendered ) : null\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -22,13 +22,13 @@ export default function SidebarNavigationScreenNavigationMenus() {
22
22
  if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
23
23
  history.push({
24
24
  postType: attributes.type,
25
- postId: attributes.id
25
+ postId: attributes.id,
26
+ path: '/navigation/single'
26
27
  });
27
28
  }
28
29
  }, [history]);
29
30
  return createElement(SidebarNavigationScreen, {
30
31
  path: "/navigation",
31
- parentTitle: __('Design'),
32
32
  title: __('Navigation'),
33
33
  content: createElement("div", {
34
34
  className: "edit-site-sidebar-navigation-screen-navigation-menus"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,WAA3B;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAMG,QAAQ,GAAGN,WAAW,CACzBO,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE;AAFN,OAAd;AAIA;AACD,GAd0B,EAe3B,CAAEL,OAAF,CAf2B,CAA5B;AAiBA,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAC,aADN;AAEC,IAAA,WAAW,EAAGN,EAAE,CAAE,QAAF,CAFjB;AAGC,IAAA,KAAK,EAAGA,EAAE,CAAE,YAAF,CAHX;AAIC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAGO;AAAhC,MADD;AALF,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation\"\n\t\t\tparentTitle={ __( 'Design' ) }\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId","path"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,WAA3B;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAMG,QAAQ,GAAGN,WAAW,CACzBO,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE,EAFN;AAGbK,QAAAA,IAAI,EAAE;AAHO,OAAd;AAKA;AACD,GAf0B,EAgB3B,CAAEV,OAAF,CAhB2B,CAA5B;AAkBA,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAC,aADN;AAEC,IAAA,KAAK,EAAGN,EAAE,CAAE,YAAF,CAFX;AAGC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAGO;AAAhC,MADD;AAJF,IADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\tpath: '/navigation/single',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation\"\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -0,0 +1,53 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { useDispatch } from '@wordpress/data';
8
+ import { Button } from '@wordpress/components';
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+
13
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
14
+ import useEditedEntityRecord from '../use-edited-entity-record';
15
+ import { unlock } from '../../private-apis';
16
+ import { store as editSiteStore } from '../../store';
17
+ const config = {
18
+ wp_template: {
19
+ path: '/templates/single'
20
+ },
21
+ wp_template_part: {
22
+ path: '/template-parts/single'
23
+ }
24
+ };
25
+ export default function SidebarNavigationScreenTemplate(_ref) {
26
+ let {
27
+ postType = 'wp_template'
28
+ } = _ref;
29
+ const {
30
+ setCanvasMode
31
+ } = unlock(useDispatch(editSiteStore));
32
+ const {
33
+ getDescription,
34
+ getTitle,
35
+ record
36
+ } = useEditedEntityRecord();
37
+ let description = getDescription();
38
+
39
+ if (!description && record.is_custom) {
40
+ description = __('This is a custom template that can be applied manually to any Post or Page.');
41
+ }
42
+
43
+ return createElement(SidebarNavigationScreen, {
44
+ path: config[postType].path,
45
+ title: getTitle(),
46
+ actions: createElement(Button, {
47
+ variant: "primary",
48
+ onClick: () => setCanvasMode('edit')
49
+ }, __('Edit')),
50
+ content: description ? createElement("p", null, description) : undefined
51
+ });
52
+ }
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","useDispatch","Button","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","config","wp_template","path","wp_template_part","SidebarNavigationScreenTemplate","postType","setCanvasMode","getDescription","getTitle","record","description","is_custom","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,IAAI,EAAE;AADM,GADC;AAIdC,EAAAA,gBAAgB,EAAE;AACjBD,IAAAA,IAAI,EAAE;AADW;AAJJ,CAAf;AASA,eAAe,SAASE,+BAAT,OAEX;AAAA,MAFqD;AACxDC,IAAAA,QAAQ,GAAG;AAD6C,GAErD;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBT,MAAM,CAAEJ,WAAW,CAAEM,aAAF,CAAb,CAAhC;AACA,QAAM;AAAEQ,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCb,qBAAqB,EAAlE;AACA,MAAIc,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAF,IAAiBD,MAAM,CAACE,SAA7B,EAAyC;AACxCD,IAAAA,WAAW,GAAGlB,EAAE,CACf,6EADe,CAAhB;AAGA;;AAED,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAGQ,MAAM,CAAEK,QAAF,CAAN,CAAmBH,IAD3B;AAEC,IAAA,KAAK,EAAGM,QAAQ,EAFjB;AAGC,IAAA,OAAO,EACN,cAAC,MAAD;AACC,MAAA,OAAO,EAAC,SADT;AAEC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF;AAF9B,OAIGd,EAAE,CAAE,MAAF,CAJL,CAJF;AAWC,IAAA,OAAO,EAAGkB,WAAW,GAAG,yBAAKA,WAAL,CAAH,GAA4BE;AAXlD,IADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates/single',\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts/single',\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplate( {\n\tpostType = 'wp_template',\n} ) {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord();\n\tlet description = getDescription();\n\tif ( ! description && record.is_custom ) {\n\t\tdescription = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ getTitle() }\n\t\t\tactions={\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={ description ? <p>{ description }</p> : undefined }\n\t\t/>\n\t);\n}\n"]}
@@ -4,9 +4,8 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  /**
5
5
  * WordPress dependencies
6
6
  */
7
- import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
7
+ import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
8
8
  import { __ } from '@wordpress/i18n';
9
- import { useSelect } from '@wordpress/data';
10
9
  import { useEntityRecords } from '@wordpress/core-data';
11
10
  import { decodeEntities } from '@wordpress/html-entities';
12
11
  import { useViewportMatch } from '@wordpress/compose';
@@ -17,28 +16,7 @@ import { useViewportMatch } from '@wordpress/compose';
17
16
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
18
17
  import { useLink } from '../routes/link';
19
18
  import SidebarNavigationItem from '../sidebar-navigation-item';
20
- import { useLocation } from '../routes';
21
- import { store as editSiteStore } from '../../store';
22
19
  import AddNewTemplate from '../add-new-template';
23
-
24
- function omit(object, keys) {
25
- return Object.fromEntries(Object.entries(object).filter(_ref => {
26
- let [key] = _ref;
27
- return !keys.includes(key);
28
- }));
29
- }
30
-
31
- const Item = _ref2 => {
32
- let {
33
- item
34
- } = _ref2;
35
- const linkInfo = useLink(item.params);
36
- const props = item.params ? { ...omit(item, 'params'),
37
- ...linkInfo
38
- } : item;
39
- return createElement(SidebarNavigationItem, props);
40
- };
41
-
42
20
  const config = {
43
21
  wp_template: {
44
22
  path: '/templates',
@@ -59,65 +37,39 @@ const config = {
59
37
  }
60
38
  }
61
39
  };
62
- export default function SidebarNavigationScreenTemplates(_ref3) {
40
+
41
+ const TemplateItem = _ref => {
63
42
  let {
64
- postType = 'wp_template'
65
- } = _ref3;
66
- const {
67
- params
68
- } = useLocation();
69
- const isMobileViewport = useViewportMatch('medium', '<'); // Ideally the URL params would be enough.
70
- // Loading the editor should ideally redirect to the home page
71
- // instead of fetching the edited entity here.
43
+ postType,
44
+ postId,
45
+ ...props
46
+ } = _ref;
47
+ const linkInfo = useLink({
48
+ postType,
49
+ postId,
50
+ path: config[postType].path + '/single'
51
+ });
52
+ return createElement(SidebarNavigationItem, _extends({}, linkInfo, props));
53
+ };
72
54
 
73
- const {
74
- editedPostId,
75
- editedPostType
76
- } = useSelect(select => {
77
- const {
78
- getEditedPostType,
79
- getEditedPostId
80
- } = select(editSiteStore);
81
- return {
82
- editedPostId: getEditedPostId(),
83
- editedPostType: getEditedPostType()
84
- };
85
- }, []);
55
+ export default function SidebarNavigationScreenTemplates(_ref2) {
56
+ let {
57
+ postType = 'wp_template'
58
+ } = _ref2;
59
+ const isMobileViewport = useViewportMatch('medium', '<');
86
60
  const {
87
61
  records: templates,
88
62
  isResolving: isLoading
89
63
  } = useEntityRecords('postType', postType, {
90
64
  per_page: -1
91
65
  });
92
- let items = [];
93
-
94
- if (isLoading) {
95
- items = [{
96
- children: config[postType].labels.loading
97
- }];
98
- } else if (!templates && !isLoading) {
99
- items = [{
100
- children: config[postType].labels.notFound
101
- }];
102
- } else {
103
- items = templates === null || templates === void 0 ? void 0 : templates.map(template => {
104
- var _template$title;
105
-
106
- return {
107
- params: {
108
- postType,
109
- postId: template.id
110
- },
111
- children: decodeEntities(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug),
112
- 'aria-current': params.postType === postType && params.postId === template.id || // This is a special case for the home page.
113
- editedPostId === template.id && editedPostType === postType && !!params.postId ? 'page' : undefined
114
- };
115
- });
116
- }
117
-
66
+ const browseAllLink = useLink({
67
+ postType,
68
+ postId: undefined,
69
+ path: config[postType].path + '/all'
70
+ });
118
71
  return createElement(SidebarNavigationScreen, {
119
72
  path: config[postType].path,
120
- parentTitle: __('Design'),
121
73
  title: config[postType].labels.title,
122
74
  actions: !isMobileViewport && createElement(AddNewTemplate, {
123
75
  templateType: postType,
@@ -125,16 +77,17 @@ export default function SidebarNavigationScreenTemplates(_ref3) {
125
77
  className: 'edit-site-sidebar-navigation-screen-templates__add-button'
126
78
  }
127
79
  }),
128
- content: createElement(Fragment, null, createElement(ItemGroup, null, items.map((item, index) => createElement(Item, {
129
- item: item,
130
- key: index
131
- })), createElement(SidebarNavigationItem, _extends({
80
+ content: createElement(Fragment, null, isLoading && config[postType].labels.loading, !isLoading && createElement(ItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && createElement(Item, null, config[postType].labels.notFound), (templates !== null && templates !== void 0 ? templates : []).map(template => {
81
+ var _template$title;
82
+
83
+ return createElement(TemplateItem, {
84
+ postType: postType,
85
+ postId: template.id,
86
+ key: template.id
87
+ }, decodeEntities(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug));
88
+ }), !isMobileViewport && createElement(SidebarNavigationItem, _extends({
132
89
  className: "edit-site-sidebar-navigation-screen-templates__see-all"
133
- }, useLink({
134
- postType,
135
- postId: undefined
136
- }), {
137
- "aria-current": params.postType === postType && !params.postId ? 'page' : undefined,
90
+ }, browseAllLink, {
138
91
  children: config[postType].labels.manage
139
92
  }))))
140
93
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__","useSelect","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","useLocation","store","editSiteStore","AddNewTemplate","omit","object","keys","Object","fromEntries","entries","filter","key","includes","Item","item","linkInfo","params","props","config","wp_template","path","labels","title","loading","notFound","manage","wp_template_part","SidebarNavigationScreenTemplates","postType","isMobileViewport","editedPostId","editedPostType","select","getEditedPostType","getEditedPostId","records","templates","isResolving","isLoading","per_page","items","children","map","template","postId","id","rendered","slug","undefined","className","index"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\nimport AddNewTemplate from '../add-new-template';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst Item = ( { item } ) => {\n\tconst linkInfo = useLink( item.params );\n\tconst props = item.params\n\t\t? { ...omit( item, 'params' ), ...linkInfo }\n\t\t: item;\n\treturn <SidebarNavigationItem { ...props } />;\n};\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates',\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts',\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t},\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplates( {\n\tpostType = 'wp_template',\n} ) {\n\tconst { params } = useLocation();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\t// Ideally the URL params would be enough.\n\t// Loading the editor should ideally redirect to the home page\n\t// instead of fetching the edited entity here.\n\tconst { editedPostId, editedPostType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\treturn {\n\t\t\teditedPostId: getEditedPostId(),\n\t\t\teditedPostType: getEditedPostType(),\n\t\t};\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tlet items = [];\n\tif ( isLoading ) {\n\t\titems = [\n\t\t\t{\n\t\t\t\tchildren: config[ postType ].labels.loading,\n\t\t\t},\n\t\t];\n\t} else if ( ! templates && ! isLoading ) {\n\t\titems = [\n\t\t\t{\n\t\t\t\tchildren: config[ postType ].labels.notFound,\n\t\t\t},\n\t\t];\n\t} else {\n\t\titems = templates?.map( ( template ) => ( {\n\t\t\tparams: {\n\t\t\t\tpostType,\n\t\t\t\tpostId: template.id,\n\t\t\t},\n\t\t\tchildren: decodeEntities(\n\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t),\n\t\t\t'aria-current':\n\t\t\t\t( params.postType === postType &&\n\t\t\t\t\tparams.postId === template.id ) ||\n\t\t\t\t// This is a special case for the home page.\n\t\t\t\t( editedPostId === template.id &&\n\t\t\t\t\teditedPostType === postType &&\n\t\t\t\t\t!! params.postId )\n\t\t\t\t\t? 'page'\n\t\t\t\t\t: undefined,\n\t\t} ) );\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\tparentTitle={ __( 'Design' ) }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tactions={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t'edit-site-sidebar-navigation-screen-templates__add-button',\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\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t{ items.map( ( item, index ) => (\n\t\t\t\t\t\t\t<Item item={ item } key={ index } />\n\t\t\t\t\t\t) ) }\n\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t{ ...useLink( {\n\t\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\t\tparams.postType === postType && ! params.postId\n\t\t\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchildren={ config[ postType ].labels.manage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","config","wp_template","path","labels","title","loading","notFound","manage","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","isMobileViewport","records","templates","isResolving","isLoading","per_page","browseAllLink","undefined","className","length","map","template","id","rendered","slug"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates',\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts',\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t\tpath: config[ postType ].path + '/single',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates( {\n\tpostType = 'wp_template',\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst browseAllLink = useLink( {\n\t\tpostType,\n\t\tpostId: undefined,\n\t\tpath: config[ postType ].path + '/all',\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tactions={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t'edit-site-sidebar-navigation-screen-templates__add-button',\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\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( templates ?? [] ).map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+
11
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
+ const config = {
13
+ wp_template: {
14
+ path: '/templates/all',
15
+ title: __('All templates')
16
+ },
17
+ wp_template_part: {
18
+ path: '/template-parts/all',
19
+ title: __('All template parts')
20
+ }
21
+ };
22
+ export default function SidebarNavigationScreenTemplatesBrowse(_ref) {
23
+ let {
24
+ postType = 'wp_template'
25
+ } = _ref;
26
+ return createElement(SidebarNavigationScreen, {
27
+ path: config[postType].path,
28
+ title: config[postType].title
29
+ });
30
+ }
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","SidebarNavigationScreen","config","wp_template","path","title","wp_template_part","SidebarNavigationScreenTemplatesBrowse","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,IAAI,EAAE,gBADM;AAEZC,IAAAA,KAAK,EAAEL,EAAE,CAAE,eAAF;AAFG,GADC;AAKdM,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,IAAI,EAAE,qBADW;AAEjBC,IAAAA,KAAK,EAAEL,EAAE,CAAE,oBAAF;AAFQ;AALJ,CAAf;AAWA,eAAe,SAASO,sCAAT,OAEX;AAAA,MAF4D;AAC/DC,IAAAA,QAAQ,GAAG;AADoD,GAE5D;AACH,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAGN,MAAM,CAAEM,QAAF,CAAN,CAAmBJ,IAD3B;AAEC,IAAA,KAAK,EAAGF,MAAM,CAAEM,QAAF,CAAN,CAAmBH;AAF5B,IADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates/all',\n\t\ttitle: __( 'All templates' ),\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts/all',\n\t\ttitle: __( 'All template parts' ),\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse( {\n\tpostType = 'wp_template',\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ config[ postType ].title }\n\t\t/>\n\t);\n}\n"]}