@wordpress/edit-site 4.19.0 → 5.0.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 (319) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +1 -0
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/index.js +8 -5
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +21 -6
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +12 -8
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/app/index.js +15 -30
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/editor-canvas.js +64 -0
  13. package/build/components/block-editor/editor-canvas.js.map +1 -0
  14. package/build/components/block-editor/index.js +61 -59
  15. package/build/components/block-editor/index.js.map +1 -1
  16. package/build/components/block-editor/resizable-editor.js +10 -44
  17. package/build/components/block-editor/resizable-editor.js.map +1 -1
  18. package/build/components/editor/index.js +80 -127
  19. package/build/components/editor/index.js.map +1 -1
  20. package/build/components/global-styles/block-preview-panel.js +42 -0
  21. package/build/components/global-styles/block-preview-panel.js.map +1 -0
  22. package/build/components/global-styles/context-menu.js +6 -2
  23. package/build/components/global-styles/context-menu.js.map +1 -1
  24. package/build/components/global-styles/custom-css.js +61 -0
  25. package/build/components/global-styles/custom-css.js.map +1 -0
  26. package/build/components/global-styles/dimensions-panel.js +2 -6
  27. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  28. package/build/components/global-styles/global-styles-provider.js +15 -2
  29. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  30. package/build/components/global-styles/hooks.js +5 -2
  31. package/build/components/global-styles/hooks.js.map +1 -1
  32. package/build/components/global-styles/palette.js +1 -1
  33. package/build/components/global-styles/palette.js.map +1 -1
  34. package/build/components/global-styles/screen-block-list.js +2 -1
  35. package/build/components/global-styles/screen-block-list.js.map +1 -1
  36. package/build/components/global-styles/screen-block.js +10 -2
  37. package/build/components/global-styles/screen-block.js.map +1 -1
  38. package/build/components/global-styles/screen-border.js +43 -0
  39. package/build/components/global-styles/screen-border.js.map +1 -0
  40. package/build/components/global-styles/screen-colors.js +1 -1
  41. package/build/components/global-styles/screen-colors.js.map +1 -1
  42. package/build/components/global-styles/screen-css.js +42 -0
  43. package/build/components/global-styles/screen-css.js.map +1 -0
  44. package/build/components/global-styles/screen-layout.js +0 -5
  45. package/build/components/global-styles/screen-layout.js.map +1 -1
  46. package/build/components/global-styles/screen-root.js +14 -1
  47. package/build/components/global-styles/screen-root.js.map +1 -1
  48. package/build/components/global-styles/screen-style-variations.js +3 -3
  49. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  50. package/build/components/global-styles/ui.js +50 -4
  51. package/build/components/global-styles/ui.js.map +1 -1
  52. package/build/components/global-styles/use-global-styles-output.js +5 -1
  53. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  54. package/build/components/global-styles/utils.js +3 -3
  55. package/build/components/global-styles/utils.js.map +1 -1
  56. package/build/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -8
  57. package/build/components/global-styles-renderer/index.js.map +1 -0
  58. package/build/components/header-edit-mode/document-actions/index.js +12 -5
  59. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  60. package/build/components/header-edit-mode/index.js +19 -12
  61. package/build/components/header-edit-mode/index.js.map +1 -1
  62. package/build/components/keyboard-shortcuts/index.js +11 -1
  63. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  64. package/build/components/layout/index.js +231 -0
  65. package/build/components/layout/index.js.map +1 -0
  66. package/build/components/list/header.js +5 -1
  67. package/build/components/list/header.js.map +1 -1
  68. package/build/components/list/index.js +4 -22
  69. package/build/components/list/index.js.map +1 -1
  70. package/build/components/navigate-to-link/index.js +1 -3
  71. package/build/components/navigate-to-link/index.js.map +1 -1
  72. package/build/components/routes/index.js +1 -1
  73. package/build/components/routes/index.js.map +1 -1
  74. package/build/components/sidebar/index.js +42 -0
  75. package/build/components/sidebar/index.js.map +1 -0
  76. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +24 -4
  77. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  78. package/build/components/sidebar-edit-mode/index.js +1 -1
  79. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-item/index.js +53 -0
  81. package/build/components/sidebar-navigation-item/index.js.map +1 -0
  82. package/build/components/sidebar-navigation-screen/index.js +49 -0
  83. package/build/components/sidebar-navigation-screen/index.js.map +1 -0
  84. package/build/components/sidebar-navigation-screen-main/index.js +76 -0
  85. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -0
  86. package/build/components/sidebar-navigation-screen-templates/index.js +188 -0
  87. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  88. package/build/components/site-icon/index.js +70 -0
  89. package/build/components/site-icon/index.js.map +1 -0
  90. package/build/components/site-title/index.js +55 -0
  91. package/build/components/site-title/index.js.map +1 -0
  92. package/build/components/style-book/index.js +173 -0
  93. package/build/components/style-book/index.js.map +1 -0
  94. package/build/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +5 -4
  95. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  96. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +53 -0
  97. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  98. package/build/index.js +2 -45
  99. package/build/index.js.map +1 -1
  100. package/build/store/actions.js +93 -43
  101. package/build/store/actions.js.map +1 -1
  102. package/build/store/reducer.js +35 -107
  103. package/build/store/reducer.js.map +1 -1
  104. package/build/store/selectors.js +69 -78
  105. package/build/store/selectors.js.map +1 -1
  106. package/build-module/components/add-new-template/add-custom-template-modal.js +1 -0
  107. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  108. package/build-module/components/add-new-template/index.js +7 -5
  109. package/build-module/components/add-new-template/index.js.map +1 -1
  110. package/build-module/components/add-new-template/new-template-part.js +18 -6
  111. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  112. package/build-module/components/add-new-template/new-template.js +13 -9
  113. package/build-module/components/add-new-template/new-template.js.map +1 -1
  114. package/build-module/components/app/index.js +15 -28
  115. package/build-module/components/app/index.js.map +1 -1
  116. package/build-module/components/block-editor/editor-canvas.js +51 -0
  117. package/build-module/components/block-editor/editor-canvas.js.map +1 -0
  118. package/build-module/components/block-editor/index.js +61 -60
  119. package/build-module/components/block-editor/index.js.map +1 -1
  120. package/build-module/components/block-editor/resizable-editor.js +11 -40
  121. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  122. package/build-module/components/editor/index.js +81 -124
  123. package/build-module/components/editor/index.js.map +1 -1
  124. package/build-module/components/global-styles/block-preview-panel.js +32 -0
  125. package/build-module/components/global-styles/block-preview-panel.js.map +1 -0
  126. package/build-module/components/global-styles/context-menu.js +7 -3
  127. package/build-module/components/global-styles/context-menu.js.map +1 -1
  128. package/build-module/components/global-styles/custom-css.js +51 -0
  129. package/build-module/components/global-styles/custom-css.js.map +1 -0
  130. package/build-module/components/global-styles/dimensions-panel.js +3 -7
  131. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  132. package/build-module/components/global-styles/global-styles-provider.js +15 -2
  133. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  134. package/build-module/components/global-styles/hooks.js +5 -3
  135. package/build-module/components/global-styles/hooks.js.map +1 -1
  136. package/build-module/components/global-styles/palette.js +1 -1
  137. package/build-module/components/global-styles/palette.js.map +1 -1
  138. package/build-module/components/global-styles/screen-block-list.js +2 -1
  139. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  140. package/build-module/components/global-styles/screen-block.js +8 -2
  141. package/build-module/components/global-styles/screen-block.js.map +1 -1
  142. package/build-module/components/global-styles/screen-border.js +27 -0
  143. package/build-module/components/global-styles/screen-border.js.map +1 -0
  144. package/build-module/components/global-styles/screen-colors.js +1 -1
  145. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  146. package/build-module/components/global-styles/screen-css.js +28 -0
  147. package/build-module/components/global-styles/screen-css.js.map +1 -0
  148. package/build-module/components/global-styles/screen-layout.js +0 -4
  149. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  150. package/build-module/components/global-styles/screen-root.js +14 -1
  151. package/build-module/components/global-styles/screen-root.js.map +1 -1
  152. package/build-module/components/global-styles/screen-style-variations.js +2 -2
  153. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  154. package/build-module/components/global-styles/ui.js +48 -5
  155. package/build-module/components/global-styles/ui.js.map +1 -1
  156. package/build-module/components/global-styles/use-global-styles-output.js +5 -1
  157. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  158. package/build-module/components/global-styles/utils.js +4 -4
  159. package/build-module/components/global-styles/utils.js.map +1 -1
  160. package/build-module/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -7
  161. package/build-module/components/global-styles-renderer/index.js.map +1 -0
  162. package/build-module/components/header-edit-mode/document-actions/index.js +13 -6
  163. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  164. package/build-module/components/header-edit-mode/index.js +16 -11
  165. package/build-module/components/header-edit-mode/index.js.map +1 -1
  166. package/build-module/components/keyboard-shortcuts/index.js +10 -1
  167. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  168. package/build-module/components/layout/index.js +203 -0
  169. package/build-module/components/layout/index.js.map +1 -0
  170. package/build-module/components/list/header.js +5 -1
  171. package/build-module/components/list/header.js.map +1 -1
  172. package/build-module/components/list/index.js +4 -19
  173. package/build-module/components/list/index.js.map +1 -1
  174. package/build-module/components/navigate-to-link/index.js +1 -3
  175. package/build-module/components/navigate-to-link/index.js.map +1 -1
  176. package/build-module/components/routes/index.js +1 -1
  177. package/build-module/components/routes/index.js.map +1 -1
  178. package/build-module/components/sidebar/index.js +30 -0
  179. package/build-module/components/sidebar/index.js.map +1 -0
  180. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +27 -7
  181. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  182. package/build-module/components/sidebar-edit-mode/index.js +3 -3
  183. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  184. package/build-module/components/sidebar-navigation-item/index.js +40 -0
  185. package/build-module/components/sidebar-navigation-item/index.js.map +1 -0
  186. package/build-module/components/sidebar-navigation-screen/index.js +39 -0
  187. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -0
  188. package/build-module/components/sidebar-navigation-screen-main/index.js +57 -0
  189. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -0
  190. package/build-module/components/sidebar-navigation-screen-templates/index.js +165 -0
  191. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  192. package/build-module/components/site-icon/index.js +55 -0
  193. package/build-module/components/site-icon/index.js.map +1 -0
  194. package/build-module/components/site-title/index.js +43 -0
  195. package/build-module/components/site-title/index.js.map +1 -0
  196. package/build-module/components/style-book/index.js +156 -0
  197. package/build-module/components/style-book/index.js.map +1 -0
  198. package/build-module/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +4 -3
  199. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  200. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +43 -0
  201. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  202. package/build-module/index.js +5 -36
  203. package/build-module/index.js.map +1 -1
  204. package/build-module/store/actions.js +87 -42
  205. package/build-module/store/actions.js.map +1 -1
  206. package/build-module/store/reducer.js +35 -102
  207. package/build-module/store/reducer.js.map +1 -1
  208. package/build-module/store/selectors.js +60 -72
  209. package/build-module/store/selectors.js.map +1 -1
  210. package/build-style/style-rtl.css +550 -346
  211. package/build-style/style.css +550 -346
  212. package/package.json +32 -31
  213. package/src/components/add-new-template/add-custom-template-modal.js +1 -0
  214. package/src/components/add-new-template/index.js +6 -3
  215. package/src/components/add-new-template/new-template-part.js +15 -3
  216. package/src/components/add-new-template/new-template.js +14 -7
  217. package/src/components/add-new-template/style.scss +0 -4
  218. package/src/components/app/index.js +14 -43
  219. package/src/components/block-editor/editor-canvas.js +69 -0
  220. package/src/components/block-editor/index.js +102 -87
  221. package/src/components/block-editor/resizable-editor.js +9 -64
  222. package/src/components/block-editor/style.scss +25 -1
  223. package/src/components/code-editor/style.scss +1 -1
  224. package/src/components/editor/index.js +170 -236
  225. package/src/components/editor/style.scss +0 -22
  226. package/src/components/global-styles/block-preview-panel.js +29 -0
  227. package/src/components/global-styles/context-menu.js +11 -2
  228. package/src/components/global-styles/custom-css.js +73 -0
  229. package/src/components/global-styles/dimensions-panel.js +2 -5
  230. package/src/components/global-styles/global-styles-provider.js +39 -17
  231. package/src/components/global-styles/hooks.js +8 -3
  232. package/src/components/global-styles/palette.js +1 -1
  233. package/src/components/global-styles/screen-block-list.js +2 -1
  234. package/src/components/global-styles/screen-block.js +9 -1
  235. package/src/components/global-styles/screen-border.js +23 -0
  236. package/src/components/global-styles/screen-colors.js +2 -1
  237. package/src/components/global-styles/screen-css.js +33 -0
  238. package/src/components/global-styles/screen-layout.js +0 -3
  239. package/src/components/global-styles/screen-root.js +30 -1
  240. package/src/components/global-styles/screen-style-variations.js +5 -2
  241. package/src/components/global-styles/style.scss +31 -2
  242. package/src/components/global-styles/ui.js +47 -4
  243. package/src/components/global-styles/use-global-styles-output.js +5 -0
  244. package/src/components/global-styles/utils.js +8 -5
  245. package/src/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +3 -9
  246. package/src/components/header-edit-mode/document-actions/index.js +14 -9
  247. package/src/components/header-edit-mode/document-actions/style.scss +8 -1
  248. package/src/components/header-edit-mode/index.js +96 -78
  249. package/src/components/header-edit-mode/style.scss +5 -33
  250. package/src/components/keyboard-shortcuts/index.js +13 -0
  251. package/src/components/layout/index.js +278 -0
  252. package/src/components/layout/style.scss +176 -0
  253. package/src/components/list/header.js +5 -1
  254. package/src/components/list/index.js +12 -31
  255. package/src/components/list/style.scss +10 -4
  256. package/src/components/navigate-to-link/index.js +2 -8
  257. package/src/components/routes/index.js +1 -1
  258. package/src/components/sidebar/index.js +34 -0
  259. package/src/components/sidebar/style.scss +8 -0
  260. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -7
  261. package/src/components/sidebar-edit-mode/index.js +3 -3
  262. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +21 -3
  263. package/src/components/sidebar-edit-mode/settings-header/style.scss +47 -34
  264. package/src/components/sidebar-edit-mode/style.scss +0 -13
  265. package/src/components/sidebar-navigation-item/index.js +51 -0
  266. package/src/components/sidebar-navigation-item/style.scss +17 -0
  267. package/src/components/sidebar-navigation-screen/index.js +55 -0
  268. package/src/components/sidebar-navigation-screen/style.scss +41 -0
  269. package/src/components/sidebar-navigation-screen-main/index.js +72 -0
  270. package/src/components/sidebar-navigation-screen-templates/index.js +181 -0
  271. package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
  272. package/src/components/site-icon/index.js +56 -0
  273. package/src/components/site-icon/style.scss +10 -0
  274. package/src/components/site-title/index.js +39 -0
  275. package/src/components/style-book/index.js +193 -0
  276. package/src/components/style-book/style.scss +78 -0
  277. package/src/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +3 -3
  278. package/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +36 -0
  279. package/src/components/template-details/style.scss +4 -0
  280. package/src/index.js +3 -53
  281. package/src/store/actions.js +93 -48
  282. package/src/store/reducer.js +29 -91
  283. package/src/store/selectors.js +61 -101
  284. package/src/store/test/actions.js +3 -15
  285. package/src/store/test/reducer.js +8 -192
  286. package/src/store/test/selectors.js +3 -42
  287. package/src/style.scss +19 -3
  288. package/build/components/editor/global-styles-renderer.js.map +0 -1
  289. package/build/components/navigation-sidebar/index.js +0 -62
  290. package/build/components/navigation-sidebar/index.js.map +0 -1
  291. package/build/components/navigation-sidebar/navigation-panel/constants.js +0 -77
  292. package/build/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  293. package/build/components/navigation-sidebar/navigation-panel/index.js +0 -152
  294. package/build/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  295. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  296. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  297. package/build/components/navigation-sidebar/navigation-toggle/index.js +0 -124
  298. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  299. package/build/components/url-query-controller/index.js.map +0 -1
  300. package/build-module/components/editor/global-styles-renderer.js.map +0 -1
  301. package/build-module/components/navigation-sidebar/index.js +0 -45
  302. package/build-module/components/navigation-sidebar/index.js.map +0 -1
  303. package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -49
  304. package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  305. package/build-module/components/navigation-sidebar/navigation-panel/index.js +0 -131
  306. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  307. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -66
  308. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  309. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +0 -108
  310. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  311. package/build-module/components/url-query-controller/index.js.map +0 -1
  312. package/src/components/navigation-sidebar/index.js +0 -46
  313. package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -94
  314. package/src/components/navigation-sidebar/navigation-panel/index.js +0 -142
  315. package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -152
  316. package/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  317. package/src/components/navigation-sidebar/navigation-toggle/index.js +0 -114
  318. package/src/components/navigation-sidebar/navigation-toggle/style.scss +0 -71
  319. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +0 -65
@@ -14,14 +14,12 @@ export default function NavigateToLink(_ref) {
14
14
  let {
15
15
  type,
16
16
  id,
17
- activePage,
18
17
  onActivePageChange
19
18
  } = _ref;
20
19
  const post = useSelect(select => type && id && type !== 'URL' && select(coreStore).getEntityRecord('postType', type, id), [type, id]);
21
20
  const onClick = useMemo(() => {
22
21
  if (!(post !== null && post !== void 0 && post.link)) return null;
23
22
  const path = getPathAndQueryString(post.link);
24
- if (path === (activePage === null || activePage === void 0 ? void 0 : activePage.path)) return null;
25
23
  return () => onActivePageChange({
26
24
  type,
27
25
  slug: post.slug,
@@ -31,7 +29,7 @@ export default function NavigateToLink(_ref) {
31
29
  postId: post.id
32
30
  }
33
31
  });
34
- }, [post, activePage === null || activePage === void 0 ? void 0 : activePage.path, onActivePageChange]);
32
+ }, [post, onActivePageChange]);
35
33
  return onClick && createElement(Button, {
36
34
  icon: edit,
37
35
  label: __('Edit Page Template'),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/navigate-to-link/index.js"],"names":["getPathAndQueryString","useMemo","useSelect","Button","edit","__","store","coreStore","NavigateToLink","type","id","activePage","onActivePageChange","post","select","getEntityRecord","onClick","link","path","slug","context","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,qBAAT,QAAsC,gBAAtC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA,eAAe,SAASC,cAAT,OAKX;AAAA,MALoC;AACvCC,IAAAA,IADuC;AAEvCC,IAAAA,EAFuC;AAGvCC,IAAAA,UAHuC;AAIvCC,IAAAA;AAJuC,GAKpC;AACH,QAAMC,IAAI,GAAGX,SAAS,CACnBY,MAAF,IACCL,IAAI,IACJC,EADA,IAEAD,IAAI,KAAK,KAFT,IAGAK,MAAM,CAAEP,SAAF,CAAN,CAAoBQ,eAApB,CAAqC,UAArC,EAAiDN,IAAjD,EAAuDC,EAAvD,CALoB,EAMrB,CAAED,IAAF,EAAQC,EAAR,CANqB,CAAtB;AASA,QAAMM,OAAO,GAAGf,OAAO,CAAE,MAAM;AAC9B,QAAK,EAAEY,IAAF,aAAEA,IAAF,eAAEA,IAAI,CAAEI,IAAR,CAAL,EAAoB,OAAO,IAAP;AACpB,UAAMC,IAAI,GAAGlB,qBAAqB,CAAEa,IAAI,CAACI,IAAP,CAAlC;AACA,QAAKC,IAAI,MAAKP,UAAL,aAAKA,UAAL,uBAAKA,UAAU,CAAEO,IAAjB,CAAT,EAAiC,OAAO,IAAP;AACjC,WAAO,MACNN,kBAAkB,CAAE;AACnBH,MAAAA,IADmB;AAEnBU,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAFQ;AAGnBD,MAAAA,IAHmB;AAInBE,MAAAA,OAAO,EAAE;AACRC,QAAAA,QAAQ,EAAER,IAAI,CAACJ,IADP;AAERa,QAAAA,MAAM,EAAET,IAAI,CAACH;AAFL;AAJU,KAAF,CADnB;AAUA,GAdsB,EAcpB,CAAEG,IAAF,EAAQF,UAAR,aAAQA,UAAR,uBAAQA,UAAU,CAAEO,IAApB,EAA0BN,kBAA1B,CAdoB,CAAvB;AAgBA,SACCI,OAAO,IACN,cAAC,MAAD;AACC,IAAA,IAAI,EAAGZ,IADR;AAEC,IAAA,KAAK,EAAGC,EAAE,CAAE,oBAAF,CAFX;AAGC,IAAA,OAAO,EAAGW;AAHX,IAFF;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getPathAndQueryString } from '@wordpress/url';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function NavigateToLink( {\n\ttype,\n\tid,\n\tactivePage,\n\tonActivePageChange,\n} ) {\n\tconst post = useSelect(\n\t\t( select ) =>\n\t\t\ttype &&\n\t\t\tid &&\n\t\t\ttype !== 'URL' &&\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', type, id ),\n\t\t[ type, id ]\n\t);\n\n\tconst onClick = useMemo( () => {\n\t\tif ( ! post?.link ) return null;\n\t\tconst path = getPathAndQueryString( post.link );\n\t\tif ( path === activePage?.path ) return null;\n\t\treturn () =>\n\t\t\tonActivePageChange( {\n\t\t\t\ttype,\n\t\t\t\tslug: post.slug,\n\t\t\t\tpath,\n\t\t\t\tcontext: {\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t},\n\t\t\t} );\n\t}, [ post, activePage?.path, onActivePageChange ] );\n\n\treturn (\n\t\tonClick && (\n\t\t\t<Button\n\t\t\t\ticon={ edit }\n\t\t\t\tlabel={ __( 'Edit Page Template' ) }\n\t\t\t\tonClick={ onClick }\n\t\t\t/>\n\t\t)\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/navigate-to-link/index.js"],"names":["getPathAndQueryString","useMemo","useSelect","Button","edit","__","store","coreStore","NavigateToLink","type","id","onActivePageChange","post","select","getEntityRecord","onClick","link","path","slug","context","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,qBAAT,QAAsC,gBAAtC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA,eAAe,SAASC,cAAT,OAA4D;AAAA,MAAnC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,EAAR;AAAYC,IAAAA;AAAZ,GAAmC;AAC1E,QAAMC,IAAI,GAAGV,SAAS,CACnBW,MAAF,IACCJ,IAAI,IACJC,EADA,IAEAD,IAAI,KAAK,KAFT,IAGAI,MAAM,CAAEN,SAAF,CAAN,CAAoBO,eAApB,CAAqC,UAArC,EAAiDL,IAAjD,EAAuDC,EAAvD,CALoB,EAMrB,CAAED,IAAF,EAAQC,EAAR,CANqB,CAAtB;AASA,QAAMK,OAAO,GAAGd,OAAO,CAAE,MAAM;AAC9B,QAAK,EAAEW,IAAF,aAAEA,IAAF,eAAEA,IAAI,CAAEI,IAAR,CAAL,EAAoB,OAAO,IAAP;AACpB,UAAMC,IAAI,GAAGjB,qBAAqB,CAAEY,IAAI,CAACI,IAAP,CAAlC;AACA,WAAO,MACNL,kBAAkB,CAAE;AACnBF,MAAAA,IADmB;AAEnBS,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAFQ;AAGnBD,MAAAA,IAHmB;AAInBE,MAAAA,OAAO,EAAE;AACRC,QAAAA,QAAQ,EAAER,IAAI,CAACH,IADP;AAERY,QAAAA,MAAM,EAAET,IAAI,CAACF;AAFL;AAJU,KAAF,CADnB;AAUA,GAbsB,EAapB,CAAEE,IAAF,EAAQD,kBAAR,CAboB,CAAvB;AAeA,SACCI,OAAO,IACN,cAAC,MAAD;AACC,IAAA,IAAI,EAAGX,IADR;AAEC,IAAA,KAAK,EAAGC,EAAE,CAAE,oBAAF,CAFX;AAGC,IAAA,OAAO,EAAGU;AAHX,IAFF;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getPathAndQueryString } from '@wordpress/url';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function NavigateToLink( { type, id, onActivePageChange } ) {\n\tconst post = useSelect(\n\t\t( select ) =>\n\t\t\ttype &&\n\t\t\tid &&\n\t\t\ttype !== 'URL' &&\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', type, id ),\n\t\t[ type, id ]\n\t);\n\n\tconst onClick = useMemo( () => {\n\t\tif ( ! post?.link ) return null;\n\t\tconst path = getPathAndQueryString( post.link );\n\t\treturn () =>\n\t\t\tonActivePageChange( {\n\t\t\t\ttype,\n\t\t\t\tslug: post.slug,\n\t\t\t\tpath,\n\t\t\t\tcontext: {\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t},\n\t\t\t} );\n\t}, [ post, onActivePageChange ] );\n\n\treturn (\n\t\tonClick && (\n\t\t\t<Button\n\t\t\t\ticon={ edit }\n\t\t\t\tlabel={ __( 'Edit Page Template' ) }\n\t\t\t\tonClick={ onClick }\n\t\t\t/>\n\t\t)\n\t);\n}\n"]}
@@ -42,6 +42,6 @@ export function Routes(_ref) {
42
42
  value: history
43
43
  }, createElement(RoutesContext.Provider, {
44
44
  value: location
45
- }, children(location)));
45
+ }, children));
46
46
  }
47
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/routes/index.js"],"names":["createContext","useState","useEffect","useContext","history","RoutesContext","HistoryContext","useLocation","useHistory","getLocationWithParams","location","searchParams","URLSearchParams","search","params","Object","fromEntries","entries","Routes","children","setLocation","listen","updatedLocation"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,QAFD,EAGCC,SAHD,EAICC,UAJD,QAKO,oBALP;AAOA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,qBAApB;AAEA,MAAMC,aAAa,GAAGL,aAAa,EAAnC;AACA,MAAMM,cAAc,GAAGN,aAAa,EAApC;AAEA,OAAO,SAASO,WAAT,GAAuB;AAC7B,SAAOJ,UAAU,CAAEE,aAAF,CAAjB;AACA;AAED,OAAO,SAASG,UAAT,GAAsB;AAC5B,SAAOL,UAAU,CAAEG,cAAF,CAAjB;AACA;;AAED,SAASG,qBAAT,CAAgCC,QAAhC,EAA2C;AAC1C,QAAMC,YAAY,GAAG,IAAIC,eAAJ,CAAqBF,QAAQ,CAACG,MAA9B,CAArB;AACA,SAAO,EACN,GAAGH,QADG;AAENI,IAAAA,MAAM,EAAEC,MAAM,CAACC,WAAP,CAAoBL,YAAY,CAACM,OAAb,EAApB;AAFF,GAAP;AAIA;;AAED,OAAO,SAASC,MAAT,OAAgC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACtC,QAAM,CAAET,QAAF,EAAYU,WAAZ,IAA4BnB,QAAQ,CAAE,MAC3CQ,qBAAqB,CAAEL,OAAO,CAACM,QAAV,CADoB,CAA1C;AAIAR,EAAAA,SAAS,CAAE,MAAM;AAChB,WAAOE,OAAO,CAACiB,MAAR,CAAgB,SAAqC;AAAA,UAAnC;AAAEX,QAAAA,QAAQ,EAAEY;AAAZ,OAAmC;AAC3DF,MAAAA,WAAW,CAAEX,qBAAqB,CAAEa,eAAF,CAAvB,CAAX;AACA,KAFM,CAAP;AAGA,GAJQ,EAIN,EAJM,CAAT;AAMA,SACC,cAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAGlB;AAAjC,KACC,cAAC,aAAD,CAAe,QAAf;AAAwB,IAAA,KAAK,EAAGM;AAAhC,KACGS,QAAQ,CAAET,QAAF,CADX,CADD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\n\nconst RoutesContext = createContext();\nconst HistoryContext = createContext();\n\nexport function useLocation() {\n\treturn useContext( RoutesContext );\n}\n\nexport function useHistory() {\n\treturn useContext( HistoryContext );\n}\n\nfunction getLocationWithParams( location ) {\n\tconst searchParams = new URLSearchParams( location.search );\n\treturn {\n\t\t...location,\n\t\tparams: Object.fromEntries( searchParams.entries() ),\n\t};\n}\n\nexport function Routes( { children } ) {\n\tconst [ location, setLocation ] = useState( () =>\n\t\tgetLocationWithParams( history.location )\n\t);\n\n\tuseEffect( () => {\n\t\treturn history.listen( ( { location: updatedLocation } ) => {\n\t\t\tsetLocation( getLocationWithParams( updatedLocation ) );\n\t\t} );\n\t}, [] );\n\n\treturn (\n\t\t<HistoryContext.Provider value={ history }>\n\t\t\t<RoutesContext.Provider value={ location }>\n\t\t\t\t{ children( location ) }\n\t\t\t</RoutesContext.Provider>\n\t\t</HistoryContext.Provider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/routes/index.js"],"names":["createContext","useState","useEffect","useContext","history","RoutesContext","HistoryContext","useLocation","useHistory","getLocationWithParams","location","searchParams","URLSearchParams","search","params","Object","fromEntries","entries","Routes","children","setLocation","listen","updatedLocation"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,QAFD,EAGCC,SAHD,EAICC,UAJD,QAKO,oBALP;AAOA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,qBAApB;AAEA,MAAMC,aAAa,GAAGL,aAAa,EAAnC;AACA,MAAMM,cAAc,GAAGN,aAAa,EAApC;AAEA,OAAO,SAASO,WAAT,GAAuB;AAC7B,SAAOJ,UAAU,CAAEE,aAAF,CAAjB;AACA;AAED,OAAO,SAASG,UAAT,GAAsB;AAC5B,SAAOL,UAAU,CAAEG,cAAF,CAAjB;AACA;;AAED,SAASG,qBAAT,CAAgCC,QAAhC,EAA2C;AAC1C,QAAMC,YAAY,GAAG,IAAIC,eAAJ,CAAqBF,QAAQ,CAACG,MAA9B,CAArB;AACA,SAAO,EACN,GAAGH,QADG;AAENI,IAAAA,MAAM,EAAEC,MAAM,CAACC,WAAP,CAAoBL,YAAY,CAACM,OAAb,EAApB;AAFF,GAAP;AAIA;;AAED,OAAO,SAASC,MAAT,OAAgC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACtC,QAAM,CAAET,QAAF,EAAYU,WAAZ,IAA4BnB,QAAQ,CAAE,MAC3CQ,qBAAqB,CAAEL,OAAO,CAACM,QAAV,CADoB,CAA1C;AAIAR,EAAAA,SAAS,CAAE,MAAM;AAChB,WAAOE,OAAO,CAACiB,MAAR,CAAgB,SAAqC;AAAA,UAAnC;AAAEX,QAAAA,QAAQ,EAAEY;AAAZ,OAAmC;AAC3DF,MAAAA,WAAW,CAAEX,qBAAqB,CAAEa,eAAF,CAAvB,CAAX;AACA,KAFM,CAAP;AAGA,GAJQ,EAIN,EAJM,CAAT;AAMA,SACC,cAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAGlB;AAAjC,KACC,cAAC,aAAD,CAAe,QAAf;AAAwB,IAAA,KAAK,EAAGM;AAAhC,KACGS,QADH,CADD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\n\nconst RoutesContext = createContext();\nconst HistoryContext = createContext();\n\nexport function useLocation() {\n\treturn useContext( RoutesContext );\n}\n\nexport function useHistory() {\n\treturn useContext( HistoryContext );\n}\n\nfunction getLocationWithParams( location ) {\n\tconst searchParams = new URLSearchParams( location.search );\n\treturn {\n\t\t...location,\n\t\tparams: Object.fromEntries( searchParams.entries() ),\n\t};\n}\n\nexport function Routes( { children } ) {\n\tconst [ location, setLocation ] = useState( () =>\n\t\tgetLocationWithParams( history.location )\n\t);\n\n\tuseEffect( () => {\n\t\treturn history.listen( ( { location: updatedLocation } ) => {\n\t\t\tsetLocation( getLocationWithParams( updatedLocation ) );\n\t\t} );\n\t}, [] );\n\n\treturn (\n\t\t<HistoryContext.Provider value={ history }>\n\t\t\t<RoutesContext.Provider value={ location }>\n\t\t\t\t{ children }\n\t\t\t</RoutesContext.Provider>\n\t\t</HistoryContext.Provider>\n\t);\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+
11
+ import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
12
+ import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
13
+ import useSyncSidebarPathWithURL from '../sync-state-with-url/use-sync-sidebar-path-with-url';
14
+
15
+ function SidebarScreens() {
16
+ useSyncSidebarPathWithURL();
17
+ return createElement(Fragment, null, createElement(SidebarNavigationScreenMain, null), createElement(SidebarNavigationScreenTemplates, {
18
+ postType: "wp_template"
19
+ }), createElement(SidebarNavigationScreenTemplates, {
20
+ postType: "wp_template_part"
21
+ }));
22
+ }
23
+
24
+ export function Sidebar() {
25
+ return createElement(NavigatorProvider, {
26
+ className: "edit-site-sidebar__content",
27
+ initialPath: "/"
28
+ }, createElement(SidebarScreens, null));
29
+ }
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["__experimentalNavigatorProvider","NavigatorProvider","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","useSyncSidebarPathWithURL","SidebarScreens","Sidebar"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,+BAA+B,IAAIC,iBAA5C,QAAqE,uBAArE;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,yBAAP,MAAsC,uDAAtC;;AAEA,SAASC,cAAT,GAA0B;AACzBD,EAAAA,yBAAyB;AAEzB,SACC,8BACC,cAAC,2BAAD,OADD,EAEC,cAAC,gCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IAFD,EAGC,cAAC,gCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IAHD,CADD;AAOA;;AAED,OAAO,SAASE,OAAT,GAAmB;AACzB,SACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAC;AAFb,KAIC,cAAC,cAAD,OAJD,CADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';\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';\n\nfunction SidebarScreens() {\n\tuseSyncSidebarPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreenMain />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template\" />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template_part\" />\n\t\t</>\n\t);\n}\n\nexport function Sidebar() {\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<SidebarScreens />\n\t\t</NavigatorProvider>\n\t);\n}\n"]}
@@ -3,32 +3,49 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { DropdownMenu, FlexItem, FlexBlock, Flex } from '@wordpress/components';
6
+ import { DropdownMenu, FlexItem, FlexBlock, Flex, Button } from '@wordpress/components';
7
7
  import { __ } from '@wordpress/i18n';
8
- import { styles, moreVertical } from '@wordpress/icons';
9
- import { useDispatch } from '@wordpress/data';
8
+ import { styles, moreVertical, seen } from '@wordpress/icons';
9
+ import { useDispatch, useSelect } from '@wordpress/data';
10
10
  import { store as preferencesStore } from '@wordpress/preferences';
11
+ import { useState, useEffect } from '@wordpress/element';
11
12
  /**
12
13
  * Internal dependencies
13
14
  */
14
15
 
15
16
  import DefaultSidebar from './default-sidebar';
16
17
  import { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';
18
+ import { store as editSiteStore } from '../../store';
17
19
  export default function GlobalStylesSidebar() {
18
20
  const [canReset, onReset] = useGlobalStylesReset();
19
21
  const {
20
22
  toggle
21
23
  } = useDispatch(preferencesStore);
24
+ const [isStyleBookOpened, setIsStyleBookOpened] = useState(false);
25
+ const editorMode = useSelect(select => select(editSiteStore).getEditorMode(), []);
26
+ useEffect(() => {
27
+ if (editorMode !== 'visual') {
28
+ setIsStyleBookOpened(false);
29
+ }
30
+ }, [editorMode]);
22
31
  return createElement(DefaultSidebar, {
23
32
  className: "edit-site-global-styles-sidebar",
24
33
  identifier: "edit-site/global-styles",
25
34
  title: __('Styles'),
26
35
  icon: styles,
27
- closeLabel: __('Close global styles sidebar'),
36
+ closeLabel: __('Close Styles sidebar'),
28
37
  panelClassName: "edit-site-global-styles-sidebar__panel",
29
- header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Styles'))), createElement(FlexItem, null, createElement(DropdownMenu, {
38
+ header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Styles'))), createElement(FlexItem, null, createElement(Button, {
39
+ icon: seen,
40
+ label: isStyleBookOpened ? __('Close Style Book') : __('Open Style Book'),
41
+ isPressed: isStyleBookOpened,
42
+ disabled: editorMode !== 'visual',
43
+ onClick: () => {
44
+ setIsStyleBookOpened(!isStyleBookOpened);
45
+ }
46
+ })), createElement(FlexItem, null, createElement(DropdownMenu, {
30
47
  icon: moreVertical,
31
- label: __('More Global Styles Actions'),
48
+ label: __('More Styles actions'),
32
49
  controls: [{
33
50
  title: __('Reset to defaults'),
34
51
  onClick: onReset,
@@ -38,6 +55,9 @@ export default function GlobalStylesSidebar() {
38
55
  onClick: () => toggle('core/edit-site', 'welcomeGuideStyles')
39
56
  }]
40
57
  })))
41
- }, createElement(GlobalStylesUI, null));
58
+ }, createElement(GlobalStylesUI, {
59
+ isStyleBookOpened: isStyleBookOpened,
60
+ onCloseStyleBook: () => setIsStyleBookOpened(false)
61
+ }));
42
62
  }
43
63
  //# sourceMappingURL=global-styles-sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["DropdownMenu","FlexItem","FlexBlock","Flex","__","styles","moreVertical","useDispatch","store","preferencesStore","DefaultSidebar","GlobalStylesUI","useGlobalStylesReset","GlobalStylesSidebar","canReset","onReset","toggle","title","onClick","isDisabled"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,EAA4CC,IAA5C,QAAwD,uBAAxD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,kBAArC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SAASC,cAAT,EAAyBC,oBAAzB,QAAqD,kBAArD;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,QAAF,EAAYC,OAAZ,IAAwBH,oBAAoB,EAAlD;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAaT,WAAW,CAAEE,gBAAF,CAA9B;AAEA,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAGL,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,IAAI,EAAGC,MAJR;AAKC,IAAA,UAAU,EAAGD,EAAE,CAAE,6BAAF,CALhB;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,cAAC,IAAD,QACC,cAAC,SAAD,QACC,8BAAUA,EAAE,CAAE,QAAF,CAAZ,CADD,CADD,EAIC,cAAC,QAAD,QACC,cAAC,YAAD;AACC,MAAA,IAAI,EAAGE,YADR;AAEC,MAAA,KAAK,EAAGF,EAAE,CAAE,4BAAF,CAFX;AAGC,MAAA,QAAQ,EAAG,CACV;AACCa,QAAAA,KAAK,EAAEb,EAAE,CAAE,mBAAF,CADV;AAECc,QAAAA,OAAO,EAAEH,OAFV;AAGCI,QAAAA,UAAU,EAAE,CAAEL;AAHf,OADU,EAMV;AACCG,QAAAA,KAAK,EAAEb,EAAE,CAAE,eAAF,CADV;AAECc,QAAAA,OAAO,EAAE,MACRF,MAAM,CACL,gBADK,EAEL,oBAFK;AAHR,OANU;AAHZ,MADD,CAJD;AARF,KAoCC,cAAC,cAAD,OApCD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, FlexItem, FlexBlock, Flex } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, moreVertical } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close global styles sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'More Global Styles Actions' ) }\n\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\t\t\t\tonClick: onReset,\n\t\t\t\t\t\t\t\t\tisDisabled: ! canReset,\n\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\t\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t\t\t\t\t\t'welcomeGuideStyles'\n\t\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/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["DropdownMenu","FlexItem","FlexBlock","Flex","Button","__","styles","moreVertical","seen","useDispatch","useSelect","store","preferencesStore","useState","useEffect","DefaultSidebar","GlobalStylesUI","useGlobalStylesReset","editSiteStore","GlobalStylesSidebar","canReset","onReset","toggle","isStyleBookOpened","setIsStyleBookOpened","editorMode","select","getEditorMode","title","onClick","isDisabled"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,YADD,EAECC,QAFD,EAGCC,SAHD,EAICC,IAJD,EAKCC,MALD,QAMO,uBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,IAA/B,QAA2C,kBAA3C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SAASC,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BAAoB,CAAE,CAAED,iBAAJ,CAApB;AACA;AAXF,MADD,CAJD,EAmBC,cAAC,QAAD,QACC,cAAC,YAAD;AACC,MAAA,IAAI,EAAGhB,YADR;AAEC,MAAA,KAAK,EAAGF,EAAE,CAAE,qBAAF,CAFX;AAGC,MAAA,QAAQ,EAAG,CACV;AACCuB,QAAAA,KAAK,EAAEvB,EAAE,CAAE,mBAAF,CADV;AAECwB,QAAAA,OAAO,EAAER,OAFV;AAGCS,QAAAA,UAAU,EAAE,CAAEV;AAHf,OADU,EAMV;AACCQ,QAAAA,KAAK,EAAEvB,EAAE,CAAE,eAAF,CADV;AAECwB,QAAAA,OAAO,EAAE,MACRP,MAAM,CACL,gBADK,EAEL,oBAFK;AAHR,OANU;AAHZ,MADD,CAnBD;AARF,KAmDC,cAAC,cAAD;AACC,IAAA,iBAAiB,EAAGC,iBADrB;AAEC,IAAA,gBAAgB,EAAG,MAAMC,oBAAoB,CAAE,KAAF;AAF9C,IAnDD,CADD;AA0DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tFlexItem,\n\tFlexBlock,\n\tFlex,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, moreVertical, seen } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );\n\tconst editorMode = useSelect(\n\t\t( select ) => select( editSiteStore ).getEditorMode(),\n\t\t[]\n\t);\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'visual' ) {\n\t\t\tsetIsStyleBookOpened( false );\n\t\t}\n\t}, [ editorMode ] );\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close Styles sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisStyleBookOpened\n\t\t\t\t\t\t\t\t\t? __( 'Close Style Book' )\n\t\t\t\t\t\t\t\t\t: __( 'Open Style Book' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\tdisabled={ editorMode !== 'visual' }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsStyleBookOpened( ! isStyleBookOpened );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'More Styles actions' ) }\n\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\t\t\t\tonClick: onReset,\n\t\t\t\t\t\t\t\t\tisDisabled: ! canReset,\n\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\t\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t\t\t\t\t\t'welcomeGuideStyles'\n\t\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/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI\n\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\tonCloseStyleBook={ () => setIsStyleBookOpened( false ) }\n\t\t\t/>\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
@@ -4,8 +4,8 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { createSlotFill, PanelBody } from '@wordpress/components';
7
- import { __ } from '@wordpress/i18n';
8
- import { cog } from '@wordpress/icons';
7
+ import { isRTL, __ } from '@wordpress/i18n';
8
+ import { drawerLeft, drawerRight } from '@wordpress/icons';
9
9
  import { useEffect, Fragment } from '@wordpress/element';
10
10
  import { useSelect, useDispatch } from '@wordpress/data';
11
11
  import { store as interfaceStore } from '@wordpress/interface';
@@ -76,7 +76,7 @@ export function SidebarComplementaryAreaFills() {
76
76
  return createElement(Fragment, null, createElement(DefaultSidebar, {
77
77
  identifier: sidebarName,
78
78
  title: __('Settings'),
79
- icon: cog,
79
+ icon: isRTL() ? drawerLeft : drawerRight,
80
80
  closeLabel: __('Close settings sidebar'),
81
81
  header: createElement(SettingsHeader, {
82
82
  sidebarName: sidebarName
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"names":["createSlotFill","PanelBody","__","cog","useEffect","Fragment","useSelect","useDispatch","store","interfaceStore","blockEditorStore","DefaultSidebar","GlobalStylesSidebar","NavigationMenuSidebar","STORE_NAME","SettingsHeader","TemplateCard","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","settings","getSettings","getBlockSelectionStart","supportsTemplatePartsMode","enableComplementaryArea","sidebarName","MaybeNavigationMenuSidebar","process","env","IS_GUTENBERG_PLUGIN"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,EAAyBC,SAAzB,QAA0C,uBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,GAAT,QAAoB,kBAApB;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,SAASC,UAAT,QAA2B,uBAA3B;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,aAAhD;AACA,SAASV,KAAK,IAAIW,aAAlB,QAAuC,aAAvC;AAEA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IAA+CvB,cAAc,CAClE,0BADkE,CAAnE;AAGA,OAAO,MAAMwB,oBAAoB,GAAGD,aAA7B;AAEP,OAAO,SAASE,6BAAT,GAAyC;AAC/C,QAAM;AACLC,IAAAA,OADK;AAELC,IAAAA,qBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA;AAJK,MAKFvB,SAAS,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AA,0BAA0B,GAAG5B,qBAA7B;AACA;;AAED,SACC,8BACC,cAAC,cAAD;AACC,IAAA,UAAU,EAAG2B,WADd;AAEC,IAAA,KAAK,EAAGtC,EAAE,CAAE,UAAF,CAFX;AAGC,IAAA,IAAI,EAAGC,GAHR;AAIC,IAAA,UAAU,EAAGD,EAAE,CAAE,wBAAF,CAJhB;AAKC,IAAA,MAAM,EAAG,cAAC,cAAD;AAAgB,MAAA,WAAW,EAAGsC;AAA9B,MALV;AAMC,IAAA,eAAe,EAAC;AANjB,KAQGA,WAAW,KAAKtB,gBAAhB,IACD,cAAC,SAAD,QACC,cAAC,YAAD,OADD,CATF,EAaGsB,WAAW,KAAKvB,aAAhB,IACD,cAAC,aAAD;AAAe,IAAA,gBAAgB;AAA/B,IAdF,CADD,EAkBGY,oBAAoB,IAAI,cAAC,mBAAD,OAlB3B,EAmBC,cAAC,0BAAD,OAnBD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cog } from '@wordpress/icons';\nimport { useEffect, Fragment } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport NavigationMenuSidebar from './navigation-menu-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport TemplateCard from './template-card';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles: ! settings?.supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened ) return;\n\t\tif ( hasBlockSelection ) {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavigationMenuSidebar = Fragment;\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavigationMenuSidebar = NavigationMenuSidebar;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ cog }\n\t\t\t\tcloseLabel={ __( 'Close settings sidebar' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<TemplateCard />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t<MaybeNavigationMenuSidebar />\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"names":["createSlotFill","PanelBody","isRTL","__","drawerLeft","drawerRight","useEffect","Fragment","useSelect","useDispatch","store","interfaceStore","blockEditorStore","DefaultSidebar","GlobalStylesSidebar","NavigationMenuSidebar","STORE_NAME","SettingsHeader","TemplateCard","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","settings","getSettings","getBlockSelectionStart","supportsTemplatePartsMode","enableComplementaryArea","sidebarName","MaybeNavigationMenuSidebar","process","env","IS_GUTENBERG_PLUGIN"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,EAAyBC,SAAzB,QAA0C,uBAA1C;AACA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,kBAAxC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAC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GY,oBAAoB,IAAI,cAAC,mBAAD,OAlB3B,EAmBC,cAAC,0BAAD,OAnBD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useEffect, Fragment } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport NavigationMenuSidebar from './navigation-menu-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport TemplateCard from './template-card';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles: ! settings?.supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened ) return;\n\t\tif ( hasBlockSelection ) {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavigationMenuSidebar = Fragment;\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavigationMenuSidebar = NavigationMenuSidebar;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close settings sidebar' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<TemplateCard />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t<MaybeNavigationMenuSidebar />\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,40 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { createElement } from "@wordpress/element";
3
+
4
+ /**
5
+ * External dependencies
6
+ */
7
+ import classnames from 'classnames';
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ import { __experimentalItem as Item, __experimentalHStack as HStack, FlexBlock } from '@wordpress/components';
13
+ import { chevronRight, Icon } from '@wordpress/icons';
14
+ export default function SidebarNavigationItem(_ref) {
15
+ let {
16
+ className,
17
+ icon,
18
+ withChevron = false,
19
+ children,
20
+ ...props
21
+ } = _ref;
22
+ return createElement(Item, _extends({
23
+ className: classnames('edit-site-sidebar-navigation-item', className)
24
+ }, props), icon && createElement(HStack, {
25
+ justify: "flex-start"
26
+ }, createElement(Icon, {
27
+ style: {
28
+ fill: 'currentcolor'
29
+ },
30
+ icon: icon,
31
+ size: 24
32
+ }), createElement(FlexBlock, null, children), withChevron && createElement(Icon, {
33
+ style: {
34
+ fill: 'currentcolor'
35
+ },
36
+ icon: chevronRight,
37
+ size: 24
38
+ })), !icon && children);
39
+ }
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-item/index.js"],"names":["classnames","__experimentalItem","Item","__experimentalHStack","HStack","FlexBlock","chevronRight","Icon","SidebarNavigationItem","className","icon","withChevron","children","props","fill"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,kBAAkB,IAAIC,IADvB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,SAHD,QAIO,uBAJP;AAKA,SAASC,YAAT,EAAuBC,IAAvB,QAAmC,kBAAnC;AAEA,eAAe,SAASC,qBAAT,OAMX;AAAA,MAN2C;AAC9CC,IAAAA,SAD8C;AAE9CC,IAAAA,IAF8C;AAG9CC,IAAAA,WAAW,GAAG,KAHgC;AAI9CC,IAAAA,QAJ8C;AAK9C,OAAGC;AAL2C,GAM3C;AACH,SACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAGb,UAAU,CACrB,mCADqB,EAErBS,SAFqB;AADvB,KAKMI,KALN,GAOGH,IAAI,IACL,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,IAAD;AACC,IAAA,KAAK,EAAG;AAAEI,MAAAA,IAAI,EAAE;AAAR,KADT;AAEC,IAAA,IAAI,EAAGJ,IAFR;AAGC,IAAA,IAAI,EAAG;AAHR,IADD,EAMC,cAAC,SAAD,QAAaE,QAAb,CAND,EAOGD,WAAW,IACZ,cAAC,IAAD;AACC,IAAA,KAAK,EAAG;AAAEG,MAAAA,IAAI,EAAE;AAAR,KADT;AAEC,IAAA,IAAI,EAAGR,YAFR;AAGC,IAAA,IAAI,EAAG;AAHR,IARF,CARF,EAwBG,CAAEI,IAAF,IAAUE,QAxBb,CADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n} from '@wordpress/components';\nimport { chevronRight, Icon } from '@wordpress/icons';\n\nexport default function SidebarNavigationItem( {\n\tclassName,\n\ticon,\n\twithChevron = false,\n\tchildren,\n\t...props\n} ) {\n\treturn (\n\t\t<Item\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-item',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tstyle={ { fill: 'currentcolor' } }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t\t\t\t{ withChevron && (\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tstyle={ { fill: 'currentcolor' } }\n\t\t\t\t\t\t\ticon={ chevronRight }\n\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! icon && children }\n\t\t</Item>\n\t);\n}\n"]}
@@ -0,0 +1,39 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
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';
8
+ import { chevronRight, chevronLeft } from '@wordpress/icons';
9
+ export default function SidebarNavigationScreen(_ref) {
10
+ let {
11
+ path,
12
+ parentTitle,
13
+ title,
14
+ content
15
+ } = _ref;
16
+ return createElement(NavigatorScreen, {
17
+ className: "edit-site-sidebar-navigation-screen",
18
+ path: path
19
+ }, createElement(VStack, {
20
+ spacing: 2
21
+ }, createElement(HStack, {
22
+ spacing: 4,
23
+ justify: "flex-start",
24
+ className: "edit-site-sidebar-navigation-screen__title-icon"
25
+ }, parentTitle ? createElement(NavigatorBackButton, {
26
+ className: "edit-site-sidebar-navigation-screen__back",
27
+ icon: isRTL() ? chevronRight : chevronLeft,
28
+ "aria-label": sprintf(
29
+ /* translators: %s: previous page. */
30
+ __('Navigate to the previous view: %s'), parentTitle)
31
+ }) : createElement("div", {
32
+ className: "edit-site-sidebar-navigation-screen__icon-placeholder"
33
+ }), createElement("div", {
34
+ className: "edit-site-sidebar-navigation-screen__title"
35
+ }, title)), createElement("nav", {
36
+ className: "edit-site-sidebar-navigation-screen__content"
37
+ }, content)));
38
+ }
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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","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,OAKX;AAAA,MAL6C;AAChDC,IAAAA,IADgD;AAEhDC,IAAAA,WAFgD;AAGhDC,IAAAA,KAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,IAAI,EAAGH;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,EAmBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,KADH,CAnBD,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\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\n\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</div>\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,57 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalNavigatorButton as NavigatorButton, Button } from '@wordpress/components';
7
+ import { __ } from '@wordpress/i18n';
8
+ import { layout, symbolFilled } from '@wordpress/icons';
9
+ import { useDispatch } from '@wordpress/data';
10
+ import { useViewportMatch } from '@wordpress/compose';
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
16
+ import SidebarNavigationItem from '../sidebar-navigation-item';
17
+ import { useLocation } from '../routes';
18
+ import { store as editSiteStore } from '../../store';
19
+ import getIsListPage from '../../utils/get-is-list-page';
20
+ export default function SidebarNavigationScreenMain() {
21
+ const {
22
+ params
23
+ } = useLocation();
24
+ const isListPage = getIsListPage(params);
25
+ const isEditorPage = !isListPage;
26
+ const {
27
+ __unstableSetCanvasMode
28
+ } = useDispatch(editSiteStore);
29
+ const isMobileViewport = useViewportMatch('medium', '<');
30
+ return createElement(SidebarNavigationScreen, {
31
+ path: "/",
32
+ title: createElement(HStack, {
33
+ justify: "space-between",
34
+ style: {
35
+ minHeight: 36
36
+ }
37
+ }, createElement("div", null, __('Design')), !isMobileViewport && isEditorPage && createElement(Button, {
38
+ className: "edit-site-layout__edit-button",
39
+ label: __('Open the editor'),
40
+ onClick: () => {
41
+ __unstableSetCanvasMode('edit');
42
+ }
43
+ }, __('Edit'))),
44
+ content: createElement(ItemGroup, null, createElement(NavigatorButton, {
45
+ as: SidebarNavigationItem,
46
+ path: "/templates",
47
+ withChevron: true,
48
+ icon: layout
49
+ }, __('Templates')), createElement(NavigatorButton, {
50
+ as: SidebarNavigationItem,
51
+ path: "/template-parts",
52
+ withChevron: true,
53
+ icon: symbolFilled
54
+ }, __('Template Parts')))
55
+ });
56
+ }
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalNavigatorButton","NavigatorButton","Button","__","layout","symbolFilled","useDispatch","useViewportMatch","SidebarNavigationScreen","SidebarNavigationItem","useLocation","store","editSiteStore","getIsListPage","SidebarNavigationScreenMain","params","isListPage","isEditorPage","__unstableSetCanvasMode","isMobileViewport","minHeight"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,MAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,kBAArC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,8BAA1B;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAaL,WAAW,EAA9B;AACA,QAAMM,UAAU,GAAGH,aAAa,CAAEE,MAAF,CAAhC;AACA,QAAME,YAAY,GAAG,CAAED,UAAvB;AACA,QAAM;AAAEE,IAAAA;AAAF,MAA8BZ,WAAW,CAAEM,aAAF,CAA/C;AACA,QAAMO,gBAAgB,GAAGZ,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAAzC;AAEA,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAC,GADN;AAEC,IAAA,KAAK,EACJ,cAAC,MAAD;AAAQ,MAAA,OAAO,EAAC,eAAhB;AAAgC,MAAA,KAAK,EAAG;AAAEa,QAAAA,SAAS,EAAE;AAAb;AAAxC,OACC,2BAAOjB,EAAE,CAAE,QAAF,CAAT,CADD,EAEG,CAAEgB,gBAAF,IAAsBF,YAAtB,IACD,cAAC,MAAD;AACC,MAAA,SAAS,EAAC,+BADX;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,iBAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAM;AACfe,QAAAA,uBAAuB,CAAE,MAAF,CAAvB;AACA;AALF,OAOGf,EAAE,CAAE,MAAF,CAPL,CAHF,CAHF;AAkBC,IAAA,OAAO,EACN,cAAC,SAAD,QACC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGM,qBADN;AAEC,MAAA,IAAI,EAAC,YAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CADD,EASC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGM,qBADN;AAEC,MAAA,IAAI,EAAC,iBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGJ;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CATD;AAnBF,IADD;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalNavigatorButton as NavigatorButton,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\nimport getIsListPage from '../../utils/get-is-list-page';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { params } = useLocation();\n\tconst isListPage = getIsListPage( params );\n\tconst isEditorPage = ! isListPage;\n\tconst { __unstableSetCanvasMode } = useDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/\"\n\t\t\ttitle={\n\t\t\t\t<HStack justify=\"space-between\" style={ { minHeight: 36 } }>\n\t\t\t\t\t<div>{ __( 'Design' ) }</div>\n\t\t\t\t\t{ ! isMobileViewport && isEditorPage && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__edit-button\"\n\t\t\t\t\t\t\tlabel={ __( 'Open the editor' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t__unstableSetCanvasMode( 'edit' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/templates\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/template-parts\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -0,0 +1,165 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { createElement, Fragment } from "@wordpress/element";
3
+
4
+ /**
5
+ * WordPress dependencies
6
+ */
7
+ import { __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, Button } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { useDispatch, useSelect } from '@wordpress/data';
10
+ import { useEntityRecords } from '@wordpress/core-data';
11
+ import { decodeEntities } from '@wordpress/html-entities';
12
+ import { useViewportMatch } from '@wordpress/compose';
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+
17
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
18
+ import { useLink } from '../routes/link';
19
+ import SidebarNavigationItem from '../sidebar-navigation-item';
20
+ import { useLocation } from '../routes';
21
+ import { store as editSiteStore } from '../../store';
22
+ import getIsListPage from '../../utils/get-is-list-page';
23
+ import AddNewTemplate from '../add-new-template';
24
+
25
+ function omit(object, keys) {
26
+ return Object.fromEntries(Object.entries(object).filter(_ref => {
27
+ let [key] = _ref;
28
+ return !keys.includes(key);
29
+ }));
30
+ }
31
+
32
+ const Item = _ref2 => {
33
+ let {
34
+ item
35
+ } = _ref2;
36
+ const linkInfo = useLink(item.params);
37
+ const props = item.params ? { ...omit(item, 'params'),
38
+ ...linkInfo
39
+ } : item;
40
+ return createElement(SidebarNavigationItem, props);
41
+ };
42
+
43
+ const config = {
44
+ wp_template: {
45
+ path: '/templates',
46
+ labels: {
47
+ title: __('Templates'),
48
+ loading: __('Loading templates'),
49
+ notFound: __('No templates found'),
50
+ manage: __('Manage all templates')
51
+ }
52
+ },
53
+ wp_template_part: {
54
+ path: '/template-parts',
55
+ labels: {
56
+ title: __('Template parts'),
57
+ loading: __('Loading template parts'),
58
+ notFound: __('No template parts found'),
59
+ manage: __('Manage all template parts')
60
+ }
61
+ }
62
+ };
63
+ export default function SidebarNavigationScreenTemplates(_ref3) {
64
+ let {
65
+ postType = 'wp_template'
66
+ } = _ref3;
67
+ const {
68
+ params
69
+ } = useLocation();
70
+ const {
71
+ __unstableSetCanvasMode
72
+ } = useDispatch(editSiteStore);
73
+ const isMobileViewport = useViewportMatch('medium', '<');
74
+ const isListPage = getIsListPage(params);
75
+ const isEditorPage = !isListPage; // Ideally the URL params would be enough.
76
+ // Loading the editor should ideally redirect to the home page
77
+ // instead of fetching the edited entity here.
78
+
79
+ const {
80
+ editedPostId,
81
+ editedPostType
82
+ } = useSelect(select => {
83
+ const {
84
+ getEditedPostType,
85
+ getEditedPostId
86
+ } = select(editSiteStore);
87
+ return {
88
+ editedPostId: getEditedPostId(),
89
+ editedPostType: getEditedPostType()
90
+ };
91
+ }, []);
92
+ const {
93
+ records: templates,
94
+ isResolving: isLoading
95
+ } = useEntityRecords('postType', postType, {
96
+ per_page: -1
97
+ });
98
+ let items = [];
99
+
100
+ if (isLoading) {
101
+ items = [{
102
+ children: config[postType].labels.loading
103
+ }];
104
+ } else if (!templates && !isLoading) {
105
+ items = [{
106
+ children: config[postType].labels.notFound
107
+ }];
108
+ } else {
109
+ items = templates === null || templates === void 0 ? void 0 : templates.map(template => {
110
+ var _template$title;
111
+
112
+ return {
113
+ params: {
114
+ postType,
115
+ postId: template.id
116
+ },
117
+ children: decodeEntities(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug),
118
+ 'aria-current': params.postType === postType && params.postId === template.id || // This is a special case for the home page.
119
+ editedPostId === template.id && editedPostType === postType && !!params.postId ? 'page' : undefined
120
+ };
121
+ });
122
+ }
123
+
124
+ return createElement(SidebarNavigationScreen, {
125
+ path: config[postType].path,
126
+ parentTitle: __('Design'),
127
+ title: createElement(HStack, {
128
+ style: {
129
+ minHeight: 36
130
+ },
131
+ justify: "space-between"
132
+ }, createElement("div", {
133
+ style: {
134
+ flexShrink: 0
135
+ }
136
+ }, config[postType].labels.title), !isMobileViewport && createElement(HStack, {
137
+ spacing: 2,
138
+ justify: "right"
139
+ }, createElement(AddNewTemplate, {
140
+ templateType: postType,
141
+ toggleProps: {
142
+ className: 'edit-site-sidebar-navigation-screen-templates__add-button'
143
+ }
144
+ }), isEditorPage && createElement(Button, {
145
+ className: "edit-site-layout__edit-button",
146
+ label: __('Open the editor'),
147
+ onClick: () => {
148
+ __unstableSetCanvasMode('edit');
149
+ }
150
+ }, __('Edit')))),
151
+ content: createElement(Fragment, null, createElement(ItemGroup, null, items.map((item, index) => createElement(Item, {
152
+ item: item,
153
+ key: index
154
+ })), createElement(SidebarNavigationItem, _extends({
155
+ className: "edit-site-sidebar-navigation-screen-templates__see-all"
156
+ }, useLink({
157
+ postType,
158
+ postId: undefined
159
+ }), {
160
+ "aria-current": params.postType === postType && !params.postId ? 'page' : undefined,
161
+ children: config[postType].labels.manage
162
+ }))))
163
+ });
164
+ }
165
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","Button","__","useDispatch","useSelect","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","useLocation","store","editSiteStore","getIsListPage","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","__unstableSetCanvasMode","isMobileViewport","isListPage","isEditorPage","editedPostId","editedPostType","select","getEditedPostType","getEditedPostId","records","templates","isResolving","isLoading","per_page","items","children","map","template","postId","id","rendered","slug","undefined","minHeight","flexShrink","className","index"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,MAHD,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASC,KAAK,IAAIC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AAF,IACD,cAAC,MAAD;AAAQ,MAAA,OAAO,EAAG,CAAlB;AAAsB,MAAA,OAAO,EAAC;AAA9B,OACC,cAAC,cAAD;AACC,MAAA,YAAY,EAAGF,QADhB;AAEC,MAAA,WAAW,EAAG;AACb0B,QAAAA,SAAS,EACR;AAFY;AAFf,MADD,EAQGtB,YAAY,IACb,cAAC,MAAD;AACC,MAAA,SAAS,EAAC,+BADX;AAEC,MAAA,KAAK,EAAG1C,EAAE,CAAE,iBAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAM;AACfuC,QAAAA,uBAAuB,CAAE,MAAF,CAAvB;AACA;AALF,OAOGvC,EAAE,CAAE,MAAF,CAPL,CATF,CALF,CAJF;AAgCC,IAAA,OAAO,EACN,8BACC,cAAC,SAAD,QACGqD,KAAK,CAACE,GAAN,CAAW,CAAE/B,IAAF,EAAQyC,KAAR,KACZ,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGzC,IAAb;AAAoB,MAAA,GAAG,EAAGyC;AAA1B,MADC,CADH,EAKC,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC;AADX,OAEM1D,OAAO,CAAE;AACb+B,MAAAA,QADa;AAEbmB,MAAAA,MAAM,EAAEI;AAFK,KAAF,CAFb;AAMC,sBACCnC,MAAM,CAACY,QAAP,KAAoBA,QAApB,IAAgC,CAAEZ,MAAM,CAAC+B,MAAzC,GACG,MADH,GAEGI,SATL;AAWC,MAAA,QAAQ,EAAGjC,MAAM,CAAEU,QAAF,CAAN,CAAmBP,MAAnB,CAA0BI;AAXtC,OALD,CADD;AAjCF,IADD;AA0DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, 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 getIsListPage from '../../utils/get-is-list-page';\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 { __unstableSetCanvasMode } = useDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isListPage = getIsListPage( params );\n\tconst isEditorPage = ! isListPage;\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={\n\t\t\t\t<HStack style={ { minHeight: 36 } } justify=\"space-between\">\n\t\t\t\t\t<div style={ { flexShrink: 0 } }>\n\t\t\t\t\t\t{ config[ postType ].labels.title }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"right\">\n\t\t\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t\t'edit-site-sidebar-navigation-screen-templates__add-button',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isEditorPage && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__edit-button\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Open the editor' ) }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t__unstableSetCanvasMode( 'edit' );\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\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\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"]}