@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
@@ -1,131 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createElement, Fragment } from "@wordpress/element";
3
-
4
- /**
5
- * External dependencies
6
- */
7
- import classnames from 'classnames';
8
- /**
9
- * WordPress dependencies
10
- */
11
-
12
- import { __experimentalNavigation as Navigation, __experimentalNavigationBackButton as NavigationBackButton, __experimentalNavigationGroup as NavigationGroup, __experimentalNavigationItem as NavigationItem, __experimentalNavigationMenu as NavigationMenu } from '@wordpress/components';
13
- import { store as coreDataStore } from '@wordpress/core-data';
14
- import { useSelect, useDispatch } from '@wordpress/data';
15
- import { __ } from '@wordpress/i18n';
16
- import { ESCAPE } from '@wordpress/keycodes';
17
- import { decodeEntities } from '@wordpress/html-entities';
18
- import { home as siteIcon, layout as templateIcon, symbolFilled as templatePartIcon } from '@wordpress/icons';
19
- /**
20
- * Internal dependencies
21
- */
22
-
23
- import { useLink } from '../../routes/link';
24
- import { store as editSiteStore } from '../../../store';
25
- const SITE_EDITOR_KEY = 'site-editor';
26
-
27
- function NavLink(_ref) {
28
- let {
29
- params,
30
- replace,
31
- ...props
32
- } = _ref;
33
- const linkProps = useLink(params, replace);
34
- return createElement(NavigationItem, _extends({}, linkProps, props));
35
- }
36
-
37
- const NavigationPanel = _ref2 => {
38
- let {
39
- activeItem
40
- } = _ref2;
41
- const {
42
- homeTemplate,
43
- isNavigationOpen,
44
- isTemplatePartsMode,
45
- siteTitle,
46
- dashboardLink
47
- } = useSelect(select => {
48
- const {
49
- getEntityRecord
50
- } = select(coreDataStore);
51
- const {
52
- getSettings,
53
- isNavigationOpened
54
- } = select(editSiteStore);
55
- const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
56
- const {
57
- supportsTemplatePartsMode,
58
- __unstableHomeTemplate,
59
- __experimentalDashboardLink
60
- } = getSettings();
61
- return {
62
- siteTitle: siteData.name,
63
- homeTemplate: __unstableHomeTemplate,
64
- dashboardLink: __experimentalDashboardLink,
65
- isNavigationOpen: isNavigationOpened(),
66
- isTemplatePartsMode: !!supportsTemplatePartsMode
67
- };
68
- }, []);
69
- const {
70
- setIsNavigationPanelOpened
71
- } = useDispatch(editSiteStore);
72
-
73
- const closeOnEscape = event => {
74
- if (event.keyCode === ESCAPE && !event.defaultPrevented) {
75
- event.preventDefault();
76
- setIsNavigationPanelOpened(false);
77
- }
78
- };
79
-
80
- return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
81
- createElement("div", {
82
- className: classnames(`edit-site-navigation-panel`, {
83
- 'is-open': isNavigationOpen
84
- }),
85
- onKeyDown: closeOnEscape
86
- }, createElement("div", {
87
- className: "edit-site-navigation-panel__inner"
88
- }, createElement("div", {
89
- className: "edit-site-navigation-panel__site-title-container"
90
- }, createElement("div", {
91
- className: "edit-site-navigation-panel__site-title"
92
- }, decodeEntities(siteTitle))), createElement("div", {
93
- className: "edit-site-navigation-panel__scroll-container"
94
- }, createElement(Navigation, {
95
- activeItem: activeItem
96
- }, createElement(NavigationBackButton, {
97
- backButtonLabel: __('Dashboard'),
98
- className: "edit-site-navigation-panel__back-to-dashboard",
99
- href: dashboardLink !== null && dashboardLink !== void 0 ? dashboardLink : 'index.php'
100
- }), createElement(NavigationMenu, null, createElement(NavigationGroup, {
101
- title: __('Editor')
102
- }, !isTemplatePartsMode && createElement(Fragment, null, createElement(NavLink, {
103
- icon: siteIcon,
104
- title: __('Site'),
105
- item: SITE_EDITOR_KEY,
106
- params: {
107
- postId: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postId,
108
- postType: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postType
109
- }
110
- }), createElement(NavLink, {
111
- icon: templateIcon,
112
- title: __('Templates'),
113
- item: "wp_template",
114
- params: {
115
- postId: undefined,
116
- postType: 'wp_template'
117
- }
118
- })), createElement(NavLink, {
119
- icon: templatePartIcon,
120
- title: __('Template Parts'),
121
- item: "wp_template_part",
122
- params: {
123
- postId: undefined,
124
- postType: 'wp_template_part'
125
- }
126
- })))))))
127
- );
128
- };
129
-
130
- export default NavigationPanel;
131
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["classnames","__experimentalNavigation","Navigation","__experimentalNavigationBackButton","NavigationBackButton","__experimentalNavigationGroup","NavigationGroup","__experimentalNavigationItem","NavigationItem","__experimentalNavigationMenu","NavigationMenu","store","coreDataStore","useSelect","useDispatch","__","ESCAPE","decodeEntities","home","siteIcon","layout","templateIcon","symbolFilled","templatePartIcon","useLink","editSiteStore","SITE_EDITOR_KEY","NavLink","params","replace","props","linkProps","NavigationPanel","activeItem","homeTemplate","isNavigationOpen","isTemplatePartsMode","siteTitle","dashboardLink","select","getEntityRecord","getSettings","isNavigationOpened","siteData","undefined","supportsTemplatePartsMode","__unstableHomeTemplate","__experimentalDashboardLink","name","setIsNavigationPanelOpened","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","postId","postType"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,4BAA4B,IAAIC,cAJjC,EAKCC,4BAA4B,IAAIC,cALjC,QAMO,uBANP;AAOA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SACCC,IAAI,IAAIC,QADT,EAECC,MAAM,IAAIC,YAFX,EAGCC,YAAY,IAAIC,gBAHjB,QAIO,kBAJP;AAMA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,mBAAxB;AACA,SAASb,KAAK,IAAIc,aAAlB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CAFX;AAGC,MAAA,IAAI,EAAC,aAHN;AAIC,MAAA,MAAM,EAAG;AACRwC,QAAAA,MAAM,EAAEX,SADA;AAERY,QAAAA,QAAQ,EAAE;AAFF;AAJV,MAXD,CAFF,EAwBC,cAAC,OAAD;AACC,MAAA,IAAI,EAAGjC,gBADR;AAEC,MAAA,KAAK,EAAGR,EAAE,CAAE,gBAAF,CAFX;AAGC,MAAA,IAAI,EAAC,kBAHN;AAIC,MAAA,MAAM,EAAG;AACRwC,QAAAA,MAAM,EAAEX,SADA;AAERY,QAAAA,QAAQ,EAAE;AAFF;AAJV,MAxBD,CADD,CAPD,CADD,CAND,CAND;AAFD;AA+DA,CAnGD;;AAqGA,eAAexB,eAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigation as Navigation,\n\t__experimentalNavigationBackButton as NavigationBackButton,\n\t__experimentalNavigationGroup as NavigationGroup,\n\t__experimentalNavigationItem as NavigationItem,\n\t__experimentalNavigationMenu as NavigationMenu,\n} from '@wordpress/components';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\thome as siteIcon,\n\tlayout as templateIcon,\n\tsymbolFilled as templatePartIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../../routes/link';\nimport { store as editSiteStore } from '../../../store';\n\nconst SITE_EDITOR_KEY = 'site-editor';\n\nfunction NavLink( { params, replace, ...props } ) {\n\tconst linkProps = useLink( params, replace );\n\n\treturn <NavigationItem { ...linkProps } { ...props } />;\n}\n\nconst NavigationPanel = ( { activeItem } ) => {\n\tconst {\n\t\thomeTemplate,\n\t\tisNavigationOpen,\n\t\tisTemplatePartsMode,\n\t\tsiteTitle,\n\t\tdashboardLink,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tconst { getSettings, isNavigationOpened } = select( editSiteStore );\n\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\t\tconst {\n\t\t\tsupportsTemplatePartsMode,\n\t\t\t__unstableHomeTemplate,\n\t\t\t__experimentalDashboardLink,\n\t\t} = getSettings();\n\n\t\treturn {\n\t\t\tsiteTitle: siteData.name,\n\t\t\thomeTemplate: __unstableHomeTemplate,\n\t\t\tdashboardLink: __experimentalDashboardLink,\n\t\t\tisNavigationOpen: isNavigationOpened(),\n\t\t\tisTemplatePartsMode: !! supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tconst closeOnEscape = ( event ) => {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsNavigationPanelOpened( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames( `edit-site-navigation-panel`, {\n\t\t\t\t'is-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-site-navigation-panel__inner\">\n\t\t\t\t<div className=\"edit-site-navigation-panel__site-title-container\">\n\t\t\t\t\t<div className=\"edit-site-navigation-panel__site-title\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-navigation-panel__scroll-container\">\n\t\t\t\t\t<Navigation activeItem={ activeItem }>\n\t\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\t\tbackButtonLabel={ __( 'Dashboard' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-navigation-panel__back-to-dashboard\"\n\t\t\t\t\t\t\thref={ dashboardLink ?? 'index.php' }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<NavigationMenu>\n\t\t\t\t\t\t\t<NavigationGroup title={ __( 'Editor' ) }>\n\t\t\t\t\t\t\t\t{ ! isTemplatePartsMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\t\t\ticon={ siteIcon }\n\t\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Site' ) }\n\t\t\t\t\t\t\t\t\t\t\titem={ SITE_EDITOR_KEY }\n\t\t\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: homeTemplate?.postId,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType:\n\t\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate?.postType,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\t\t\ticon={ templateIcon }\n\t\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Templates' ) }\n\t\t\t\t\t\t\t\t\t\t\titem=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ templatePartIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Template Parts' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template_part\"\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\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</NavigationGroup>\n\t\t\t\t\t\t</NavigationMenu>\n\t\t\t\t\t</Navigation>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default NavigationPanel;\n"]}
@@ -1,66 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { map } from 'lodash';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { MENU_TEMPLATES, MENU_TEMPLATES_GENERAL, MENU_TEMPLATES_PAGES, MENU_TEMPLATES_POSTS, TEMPLATE_OVERRIDES, TEMPLATES_GENERAL, TEMPLATES_PAGES_PREFIXES, TEMPLATES_POSTS_PREFIXES, TEMPLATES_TOP_LEVEL } from './constants';
10
- export function isTemplateSuperseded(slug, existingSlugs, showOnFront) {
11
- if (!TEMPLATE_OVERRIDES[slug]) {
12
- return false;
13
- } // `home` template is unused if it is superseded by `front-page`
14
- // or "show on front" is set to show a page rather than blog posts.
15
-
16
-
17
- if (slug === 'home' && showOnFront !== 'posts') {
18
- return true;
19
- }
20
-
21
- return TEMPLATE_OVERRIDES[slug].every(overrideSlug => existingSlugs.includes(overrideSlug) || isTemplateSuperseded(overrideSlug, existingSlugs, showOnFront));
22
- }
23
- export function getTemplateLocation(slug) {
24
- const isTopLevelTemplate = TEMPLATES_TOP_LEVEL.includes(slug);
25
-
26
- if (isTopLevelTemplate) {
27
- return MENU_TEMPLATES;
28
- }
29
-
30
- const isGeneralTemplate = TEMPLATES_GENERAL.includes(slug);
31
-
32
- if (isGeneralTemplate) {
33
- return MENU_TEMPLATES_GENERAL;
34
- }
35
-
36
- const isPostsTemplate = TEMPLATES_POSTS_PREFIXES.some(prefix => slug.startsWith(prefix));
37
-
38
- if (isPostsTemplate) {
39
- return MENU_TEMPLATES_POSTS;
40
- }
41
-
42
- const isPagesTemplate = TEMPLATES_PAGES_PREFIXES.some(prefix => slug.startsWith(prefix));
43
-
44
- if (isPagesTemplate) {
45
- return MENU_TEMPLATES_PAGES;
46
- }
47
-
48
- return MENU_TEMPLATES_GENERAL;
49
- }
50
- export function getUnusedTemplates(templates, showOnFront) {
51
- const templateSlugs = map(templates, 'slug');
52
- const supersededTemplates = templates.filter(_ref => {
53
- let {
54
- slug
55
- } = _ref;
56
- return isTemplateSuperseded(slug, templateSlugs, showOnFront);
57
- });
58
- return supersededTemplates;
59
- }
60
- export function getTemplatesLocationMap(templates) {
61
- return templates.reduce((obj, template) => {
62
- obj[template.slug] = getTemplateLocation(template.slug);
63
- return obj;
64
- }, {});
65
- }
66
- //# sourceMappingURL=template-hierarchy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js"],"names":["map","MENU_TEMPLATES","MENU_TEMPLATES_GENERAL","MENU_TEMPLATES_PAGES","MENU_TEMPLATES_POSTS","TEMPLATE_OVERRIDES","TEMPLATES_GENERAL","TEMPLATES_PAGES_PREFIXES","TEMPLATES_POSTS_PREFIXES","TEMPLATES_TOP_LEVEL","isTemplateSuperseded","slug","existingSlugs","showOnFront","every","overrideSlug","includes","getTemplateLocation","isTopLevelTemplate","isGeneralTemplate","isPostsTemplate","some","prefix","startsWith","isPagesTemplate","getUnusedTemplates","templates","templateSlugs","supersededTemplates","filter","getTemplatesLocationMap","reduce","obj","template"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,sBAFD,EAGCC,oBAHD,EAICC,oBAJD,EAKCC,kBALD,EAMCC,iBAND,EAOCC,wBAPD,EAQCC,wBARD,EASCC,mBATD,QAUO,aAVP;AAYA,OAAO,SAASC,oBAAT,CAA+BC,IAA/B,EAAqCC,aAArC,EAAoDC,WAApD,EAAkE;AACxE,MAAK,CAAER,kBAAkB,CAAEM,IAAF,CAAzB,EAAoC;AACnC,WAAO,KAAP;AACA,GAHuE,CAKxE;AACA;;;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AAvB,CADyB;AAAA,GAAlB,CAA5B;AAIA,SAAOe,mBAAP;AACA;AAED,OAAO,SAASE,uBAAT,CAAkCJ,SAAlC,EAA8C;AACpD,SAAOA,SAAS,CAACK,MAAV,CAAkB,CAAEC,GAAF,EAAOC,QAAP,KAAqB;AAC7CD,IAAAA,GAAG,CAAEC,QAAQ,CAACtB,IAAX,CAAH,GAAuBM,mBAAmB,CAAEgB,QAAQ,CAACtB,IAAX,CAA1C;AACA,WAAOqB,GAAP;AACA,GAHM,EAGJ,EAHI,CAAP;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_TEMPLATES,\n\tMENU_TEMPLATES_GENERAL,\n\tMENU_TEMPLATES_PAGES,\n\tMENU_TEMPLATES_POSTS,\n\tTEMPLATE_OVERRIDES,\n\tTEMPLATES_GENERAL,\n\tTEMPLATES_PAGES_PREFIXES,\n\tTEMPLATES_POSTS_PREFIXES,\n\tTEMPLATES_TOP_LEVEL,\n} from './constants';\n\nexport function isTemplateSuperseded( slug, existingSlugs, showOnFront ) {\n\tif ( ! TEMPLATE_OVERRIDES[ slug ] ) {\n\t\treturn false;\n\t}\n\n\t// `home` template is unused if it is superseded by `front-page`\n\t// or \"show on front\" is set to show a page rather than blog posts.\n\tif ( slug === 'home' && showOnFront !== 'posts' ) {\n\t\treturn true;\n\t}\n\n\treturn TEMPLATE_OVERRIDES[ slug ].every(\n\t\t( overrideSlug ) =>\n\t\t\texistingSlugs.includes( overrideSlug ) ||\n\t\t\tisTemplateSuperseded( overrideSlug, existingSlugs, showOnFront )\n\t);\n}\n\nexport function getTemplateLocation( slug ) {\n\tconst isTopLevelTemplate = TEMPLATES_TOP_LEVEL.includes( slug );\n\tif ( isTopLevelTemplate ) {\n\t\treturn MENU_TEMPLATES;\n\t}\n\n\tconst isGeneralTemplate = TEMPLATES_GENERAL.includes( slug );\n\tif ( isGeneralTemplate ) {\n\t\treturn MENU_TEMPLATES_GENERAL;\n\t}\n\n\tconst isPostsTemplate = TEMPLATES_POSTS_PREFIXES.some( ( prefix ) =>\n\t\tslug.startsWith( prefix )\n\t);\n\tif ( isPostsTemplate ) {\n\t\treturn MENU_TEMPLATES_POSTS;\n\t}\n\n\tconst isPagesTemplate = TEMPLATES_PAGES_PREFIXES.some( ( prefix ) =>\n\t\tslug.startsWith( prefix )\n\t);\n\tif ( isPagesTemplate ) {\n\t\treturn MENU_TEMPLATES_PAGES;\n\t}\n\n\treturn MENU_TEMPLATES_GENERAL;\n}\n\nexport function getUnusedTemplates( templates, showOnFront ) {\n\tconst templateSlugs = map( templates, 'slug' );\n\tconst supersededTemplates = templates.filter( ( { slug } ) =>\n\t\tisTemplateSuperseded( slug, templateSlugs, showOnFront )\n\t);\n\n\treturn supersededTemplates;\n}\n\nexport function getTemplatesLocationMap( templates ) {\n\treturn templates.reduce( ( obj, template ) => {\n\t\tobj[ template.slug ] = getTemplateLocation( template.slug );\n\t\treturn obj;\n\t}, {} );\n}\n"]}
@@ -1,108 +0,0 @@
1
- import { createElement } from "@wordpress/element";
2
-
3
- /**
4
- * External dependencies
5
- */
6
- import classnames from 'classnames';
7
- /**
8
- * WordPress dependencies
9
- */
10
-
11
- import { useSelect, useDispatch } from '@wordpress/data';
12
- import { useEffect, useRef } from '@wordpress/element';
13
- import { Button, Icon, __unstableMotion as motion } from '@wordpress/components';
14
- import { __ } from '@wordpress/i18n';
15
- import { wordpress } from '@wordpress/icons';
16
- import { store as coreDataStore } from '@wordpress/core-data';
17
- import { useReducedMotion } from '@wordpress/compose';
18
- /**
19
- * Internal dependencies
20
- */
21
-
22
- import { store as editSiteStore } from '../../../store';
23
-
24
- function NavigationToggle(_ref) {
25
- let {
26
- icon
27
- } = _ref;
28
- const {
29
- isNavigationOpen,
30
- isRequestingSiteIcon,
31
- siteIconUrl
32
- } = useSelect(select => {
33
- const {
34
- getEntityRecord,
35
- isResolving
36
- } = select(coreDataStore);
37
- const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
38
- return {
39
- isNavigationOpen: select(editSiteStore).isNavigationOpened(),
40
- isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
41
- siteIconUrl: siteData.site_icon_url
42
- };
43
- }, []);
44
- const {
45
- setIsNavigationPanelOpened
46
- } = useDispatch(editSiteStore);
47
- const disableMotion = useReducedMotion();
48
- const navigationToggleRef = useRef();
49
- useEffect(() => {
50
- // TODO: Remove this effect when alternative solution is merged.
51
- // See: https://github.com/WordPress/gutenberg/pull/37314
52
- if (!isNavigationOpen) {
53
- navigationToggleRef.current.focus();
54
- }
55
- }, [isNavigationOpen]);
56
-
57
- const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen);
58
-
59
- let buttonIcon = createElement(Icon, {
60
- size: "36px",
61
- icon: wordpress
62
- });
63
- const effect = {
64
- expand: {
65
- scale: 1.25,
66
- transition: {
67
- type: 'tween',
68
- duration: '0.3'
69
- }
70
- }
71
- };
72
-
73
- if (siteIconUrl) {
74
- buttonIcon = createElement(motion.img, {
75
- variants: !disableMotion && effect,
76
- alt: __('Site Icon'),
77
- className: "edit-site-navigation-toggle__site-icon",
78
- src: siteIconUrl
79
- });
80
- } else if (isRequestingSiteIcon) {
81
- buttonIcon = null;
82
- } else if (icon) {
83
- buttonIcon = createElement(Icon, {
84
- size: "36px",
85
- icon: icon
86
- });
87
- }
88
-
89
- const classes = classnames({
90
- 'edit-site-navigation-toggle__button': true,
91
- 'has-icon': siteIconUrl
92
- });
93
- return createElement(motion.div, {
94
- className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''),
95
- whileHover: "expand"
96
- }, createElement(Button, {
97
- className: classes,
98
- label: __('Toggle navigation'),
99
- ref: navigationToggleRef // isPressed will add unwanted styles.
100
- ,
101
- "aria-pressed": isNavigationOpen,
102
- onClick: toggleNavigationPanel,
103
- showTooltip: true
104
- }, buttonIcon));
105
- }
106
-
107
- export default NavigationToggle;
108
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-toggle/index.js"],"names":["classnames","useSelect","useDispatch","useEffect","useRef","Button","Icon","__unstableMotion","motion","__","wordpress","store","coreDataStore","useReducedMotion","editSiteStore","NavigationToggle","icon","isNavigationOpen","isRequestingSiteIcon","siteIconUrl","select","getEntityRecord","isResolving","siteData","undefined","isNavigationOpened","site_icon_url","setIsNavigationPanelOpened","disableMotion","navigationToggleRef","current","focus","toggleNavigationPanel","buttonIcon","effect","expand","scale","transition","type","duration","classes"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,gBAAgB,IAAIC,MAHrB,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,gBAAT,OAAsC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACrC,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA,oBAApB;AAA0CC,IAAAA;AAA1C,MAA0DlB,SAAS,CACtEmB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAER,aAAF,CAA/C;AACA,UAAMW,QAAQ,GACbF,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BG,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNP,MAAAA,gBAAgB,EAAEG,MAAM,C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,IAAKD,oBAAL,EAA4B;AAClCe,IAAAA,UAAU,GAAG,IAAb;AACA,GAFM,MAEA,IAAKjB,IAAL,EAAY;AAClBiB,IAAAA,UAAU,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,IAAI,EAAGjB;AAAzB,MAAb;AACA;;AAED,QAAMwB,OAAO,GAAGxC,UAAU,CAAE;AAC3B,2CAAuC,IADZ;AAE3B,gBAAYmB;AAFe,GAAF,CAA1B;AAKA,SACC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EACR,iCACEF,gBAAgB,GAAG,UAAH,GAAgB,EADlC,CAFF;AAKC,IAAA,UAAU,EAAC;AALZ,KAOC,cAAC,MAAD;AACC,IAAA,SAAS,EAAGuB,OADb;AAEC,IAAA,KAAK,EAAG/B,EAAE,CAAE,mBAAF,CAFX;AAGC,IAAA,GAAG,EAAGoB,mBAHP,CAIC;AAJD;AAKC,oBAAeZ,gBALhB;AAMC,IAAA,OAAO,EAAGe,qBANX;AAOC,IAAA,WAAW;AAPZ,KASGC,UATH,CAPD,CADD;AAqBA;;AAED,eAAelB,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { wordpress } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nfunction NavigationToggle( { icon } ) {\n\tconst { isNavigationOpen, isRequestingSiteIcon, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\t\treturn {\n\t\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tconst navigationToggleRef = useRef();\n\n\tuseEffect( () => {\n\t\t// TODO: Remove this effect when alternative solution is merged.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/37314\n\t\tif ( ! isNavigationOpen ) {\n\t\t\tnavigationToggleRef.current.focus();\n\t\t}\n\t}, [ isNavigationOpen ] );\n\n\tconst toggleNavigationPanel = () =>\n\t\tsetIsNavigationPanelOpened( ! isNavigationOpen );\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.25,\n\t\t\ttransition: { type: 'tween', duration: '0.3' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-site-navigation-toggle__site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t} else if ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t} else if ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\tconst classes = classnames( {\n\t\t'edit-site-navigation-toggle__button': true,\n\t\t'has-icon': siteIconUrl,\n\t} );\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={\n\t\t\t\t'edit-site-navigation-toggle' +\n\t\t\t\t( isNavigationOpen ? ' is-open' : '' )\n\t\t\t}\n\t\t\twhileHover=\"expand\"\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName={ classes }\n\t\t\t\tlabel={ __( 'Toggle navigation' ) }\n\t\t\t\tref={ navigationToggleRef }\n\t\t\t\t// isPressed will add unwanted styles.\n\t\t\t\taria-pressed={ isNavigationOpen }\n\t\t\t\tonClick={ toggleNavigationPanel }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default NavigationToggle;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useLocation","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","setPage","params","postId","postType","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MACLP,WAAW,CAAEG,aAAF,CADZ;AAEA,QAAM;AACLK,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEFT,WAAW,EAFf,CAH4C,CAO5C;;AACAF,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,WAAWW,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDH,MAAAA,OAAO,CAAE;AAAEI,QAAAA,OAAO,EAAE;AAAED,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCL,MAAAA,WAAW,CAAEI,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CJ,MAAAA,eAAe,CAAEG,MAAF,CAAf;AACA;AACD,GARQ,EAQN,CAAEA,MAAF,EAAUC,QAAV,CARM,CAAT;AAUA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, setPage } =\n\t\tuseDispatch( editSiteStore );\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t}\n\t}, [ postId, postType ] );\n\n\treturn null;\n}\n"]}
@@ -1,46 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useEffect } from '@wordpress/element';
5
- import { createSlotFill } from '@wordpress/components';
6
- import { useViewportMatch } from '@wordpress/compose';
7
- import { useDispatch } from '@wordpress/data';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import { store as editSiteStore } from '../../store';
13
- import NavigationPanel from './navigation-panel';
14
- import NavigationToggle from './navigation-toggle';
15
-
16
- export const {
17
- Fill: NavigationPanelPreviewFill,
18
- Slot: NavigationPanelPreviewSlot,
19
- } = createSlotFill( 'EditSiteNavigationPanelPreview' );
20
-
21
- const { Fill: NavigationSidebarFill, Slot: NavigationSidebarSlot } =
22
- createSlotFill( 'EditSiteNavigationSidebar' );
23
-
24
- function NavigationSidebar( { isDefaultOpen = false, activeTemplateType } ) {
25
- const isDesktopViewport = useViewportMatch( 'medium' );
26
- const { setIsNavigationPanelOpened } = useDispatch( editSiteStore );
27
-
28
- useEffect(
29
- function autoOpenNavigationPanelOnViewportChange() {
30
- setIsNavigationPanelOpened( isDefaultOpen && isDesktopViewport );
31
- },
32
- [ isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened ]
33
- );
34
-
35
- return (
36
- <NavigationSidebarFill>
37
- <NavigationToggle />
38
- <NavigationPanel activeItem={ activeTemplateType } />
39
- <NavigationPanelPreviewSlot />
40
- </NavigationSidebarFill>
41
- );
42
- }
43
-
44
- NavigationSidebar.Slot = NavigationSidebarSlot;
45
-
46
- export default NavigationSidebar;
@@ -1,94 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import {
10
- TEMPLATE_PART_AREA_HEADER,
11
- TEMPLATE_PART_AREA_FOOTER,
12
- TEMPLATE_PART_AREA_SIDEBAR,
13
- TEMPLATE_PART_AREA_GENERAL,
14
- } from '../../../store/constants';
15
-
16
- export const TEMPLATES_PRIMARY = [
17
- 'index',
18
- 'singular',
19
- 'archive',
20
- 'single',
21
- 'page',
22
- 'home',
23
- '404',
24
- 'search',
25
- ];
26
-
27
- export const TEMPLATES_SECONDARY = [
28
- 'author',
29
- 'category',
30
- 'taxonomy',
31
- 'date',
32
- 'tag',
33
- 'attachment',
34
- 'single',
35
- 'front-page',
36
- ];
37
-
38
- export const TEMPLATES_TOP_LEVEL = [
39
- ...TEMPLATES_PRIMARY,
40
- ...TEMPLATES_SECONDARY,
41
- ];
42
-
43
- export const TEMPLATES_GENERAL = [ 'page-home' ];
44
-
45
- export const TEMPLATES_POSTS_PREFIXES = [
46
- 'post-',
47
- 'author-',
48
- 'single-',
49
- 'tag-',
50
- ];
51
-
52
- export const TEMPLATES_PAGES_PREFIXES = [ 'page-' ];
53
-
54
- export const TEMPLATE_OVERRIDES = {
55
- singular: [ 'single', 'page' ],
56
- index: [ 'archive', '404', 'search', 'singular', 'home' ],
57
- home: [ 'front-page' ],
58
- };
59
-
60
- export const MENU_ROOT = 'root';
61
- export const MENU_TEMPLATE_PARTS = 'template-parts';
62
- export const MENU_TEMPLATES = 'templates';
63
- export const MENU_TEMPLATES_GENERAL = 'templates-general';
64
- export const MENU_TEMPLATES_PAGES = 'templates-pages';
65
- export const MENU_TEMPLATES_POSTS = 'templates-posts';
66
- export const MENU_TEMPLATES_UNUSED = 'templates-unused';
67
-
68
- export const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';
69
- export const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
70
- export const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';
71
- export const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';
72
-
73
- export const TEMPLATE_PARTS_SUB_MENUS = [
74
- {
75
- area: TEMPLATE_PART_AREA_HEADER,
76
- menu: MENU_TEMPLATE_PARTS_HEADERS,
77
- title: __( 'headers' ),
78
- },
79
- {
80
- area: TEMPLATE_PART_AREA_FOOTER,
81
- menu: MENU_TEMPLATE_PARTS_FOOTERS,
82
- title: __( 'footers' ),
83
- },
84
- {
85
- area: TEMPLATE_PART_AREA_SIDEBAR,
86
- menu: MENU_TEMPLATE_PARTS_SIDEBARS,
87
- title: __( 'sidebars' ),
88
- },
89
- {
90
- area: TEMPLATE_PART_AREA_GENERAL,
91
- menu: MENU_TEMPLATE_PARTS_GENERAL,
92
- title: __( 'general' ),
93
- },
94
- ];
@@ -1,142 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import {
10
- __experimentalNavigation as Navigation,
11
- __experimentalNavigationBackButton as NavigationBackButton,
12
- __experimentalNavigationGroup as NavigationGroup,
13
- __experimentalNavigationItem as NavigationItem,
14
- __experimentalNavigationMenu as NavigationMenu,
15
- } from '@wordpress/components';
16
- import { store as coreDataStore } from '@wordpress/core-data';
17
- import { useSelect, useDispatch } from '@wordpress/data';
18
- import { __ } from '@wordpress/i18n';
19
- import { ESCAPE } from '@wordpress/keycodes';
20
- import { decodeEntities } from '@wordpress/html-entities';
21
- import {
22
- home as siteIcon,
23
- layout as templateIcon,
24
- symbolFilled as templatePartIcon,
25
- } from '@wordpress/icons';
26
-
27
- /**
28
- * Internal dependencies
29
- */
30
- import { useLink } from '../../routes/link';
31
- import { store as editSiteStore } from '../../../store';
32
-
33
- const SITE_EDITOR_KEY = 'site-editor';
34
-
35
- function NavLink( { params, replace, ...props } ) {
36
- const linkProps = useLink( params, replace );
37
-
38
- return <NavigationItem { ...linkProps } { ...props } />;
39
- }
40
-
41
- const NavigationPanel = ( { activeItem } ) => {
42
- const {
43
- homeTemplate,
44
- isNavigationOpen,
45
- isTemplatePartsMode,
46
- siteTitle,
47
- dashboardLink,
48
- } = useSelect( ( select ) => {
49
- const { getEntityRecord } = select( coreDataStore );
50
- const { getSettings, isNavigationOpened } = select( editSiteStore );
51
-
52
- const siteData =
53
- getEntityRecord( 'root', '__unstableBase', undefined ) || {};
54
- const {
55
- supportsTemplatePartsMode,
56
- __unstableHomeTemplate,
57
- __experimentalDashboardLink,
58
- } = getSettings();
59
-
60
- return {
61
- siteTitle: siteData.name,
62
- homeTemplate: __unstableHomeTemplate,
63
- dashboardLink: __experimentalDashboardLink,
64
- isNavigationOpen: isNavigationOpened(),
65
- isTemplatePartsMode: !! supportsTemplatePartsMode,
66
- };
67
- }, [] );
68
- const { setIsNavigationPanelOpened } = useDispatch( editSiteStore );
69
-
70
- const closeOnEscape = ( event ) => {
71
- if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
72
- event.preventDefault();
73
- setIsNavigationPanelOpened( false );
74
- }
75
- };
76
-
77
- return (
78
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
79
- <div
80
- className={ classnames( `edit-site-navigation-panel`, {
81
- 'is-open': isNavigationOpen,
82
- } ) }
83
- onKeyDown={ closeOnEscape }
84
- >
85
- <div className="edit-site-navigation-panel__inner">
86
- <div className="edit-site-navigation-panel__site-title-container">
87
- <div className="edit-site-navigation-panel__site-title">
88
- { decodeEntities( siteTitle ) }
89
- </div>
90
- </div>
91
- <div className="edit-site-navigation-panel__scroll-container">
92
- <Navigation activeItem={ activeItem }>
93
- <NavigationBackButton
94
- backButtonLabel={ __( 'Dashboard' ) }
95
- className="edit-site-navigation-panel__back-to-dashboard"
96
- href={ dashboardLink ?? 'index.php' }
97
- />
98
-
99
- <NavigationMenu>
100
- <NavigationGroup title={ __( 'Editor' ) }>
101
- { ! isTemplatePartsMode && (
102
- <>
103
- <NavLink
104
- icon={ siteIcon }
105
- title={ __( 'Site' ) }
106
- item={ SITE_EDITOR_KEY }
107
- params={ {
108
- postId: homeTemplate?.postId,
109
- postType:
110
- homeTemplate?.postType,
111
- } }
112
- />
113
- <NavLink
114
- icon={ templateIcon }
115
- title={ __( 'Templates' ) }
116
- item="wp_template"
117
- params={ {
118
- postId: undefined,
119
- postType: 'wp_template',
120
- } }
121
- />
122
- </>
123
- ) }
124
- <NavLink
125
- icon={ templatePartIcon }
126
- title={ __( 'Template Parts' ) }
127
- item="wp_template_part"
128
- params={ {
129
- postId: undefined,
130
- postType: 'wp_template_part',
131
- } }
132
- />
133
- </NavigationGroup>
134
- </NavigationMenu>
135
- </Navigation>
136
- </div>
137
- </div>
138
- </div>
139
- );
140
- };
141
-
142
- export default NavigationPanel;