@wordpress/edit-site 5.9.0 → 5.10.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 (426) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +21 -6
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/new-template-part.js +8 -2
  5. package/build/components/add-new-template/new-template-part.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +6 -3
  7. package/build/components/add-new-template/new-template.js.map +1 -1
  8. package/build/components/app/index.js +8 -2
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/back-button.js +10 -3
  11. package/build/components/block-editor/back-button.js.map +1 -1
  12. package/build/components/block-editor/editor-canvas.js +39 -6
  13. package/build/components/block-editor/editor-canvas.js.map +1 -1
  14. package/build/components/editor/index.js +43 -9
  15. package/build/components/editor/index.js.map +1 -1
  16. package/build/components/editor-canvas-container/index.js +18 -4
  17. package/build/components/editor-canvas-container/index.js.map +1 -1
  18. package/build/components/global-styles/block-preview-panel.js +1 -1
  19. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  20. package/build/components/global-styles/border-panel.js +3 -1
  21. package/build/components/global-styles/border-panel.js.map +1 -1
  22. package/build/components/global-styles/color-palette-panel.js +14 -3
  23. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  24. package/build/components/global-styles/dimensions-panel.js +17 -18
  25. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  26. package/build/components/global-styles/gradients-palette-panel.js +14 -3
  27. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  28. package/build/components/global-styles/root-menu.js +61 -0
  29. package/build/components/global-styles/root-menu.js.map +1 -0
  30. package/build/components/global-styles/screen-block-list.js +3 -1
  31. package/build/components/global-styles/screen-block-list.js.map +1 -1
  32. package/build/components/global-styles/screen-block.js +158 -7
  33. package/build/components/global-styles/screen-block.js.map +1 -1
  34. package/build/components/global-styles/screen-colors.js +9 -26
  35. package/build/components/global-styles/screen-colors.js.map +1 -1
  36. package/build/components/global-styles/screen-css.js +20 -15
  37. package/build/components/global-styles/screen-css.js.map +1 -1
  38. package/build/components/global-styles/screen-layout.js +4 -17
  39. package/build/components/global-styles/screen-layout.js.map +1 -1
  40. package/build/components/global-styles/screen-revisions/index.js +148 -0
  41. package/build/components/global-styles/screen-revisions/index.js.map +1 -0
  42. package/build/components/global-styles/screen-revisions/revisions-buttons.js +132 -0
  43. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  44. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +130 -0
  45. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  46. package/build/components/global-styles/screen-root.js +2 -2
  47. package/build/components/global-styles/screen-root.js.map +1 -1
  48. package/build/components/global-styles/screen-typography-element.js +0 -3
  49. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  50. package/build/components/global-styles/screen-typography.js +11 -39
  51. package/build/components/global-styles/screen-typography.js.map +1 -1
  52. package/build/components/global-styles/style-variations-container.js +3 -8
  53. package/build/components/global-styles/style-variations-container.js.map +1 -1
  54. package/build/components/global-styles/typography-panel.js +7 -11
  55. package/build/components/global-styles/typography-panel.js.map +1 -1
  56. package/build/components/global-styles/ui.js +61 -108
  57. package/build/components/global-styles/ui.js.map +1 -1
  58. package/build/components/global-styles/variations-panel.js +4 -28
  59. package/build/components/global-styles/variations-panel.js.map +1 -1
  60. package/build/components/header-edit-mode/index.js +1 -1
  61. package/build/components/header-edit-mode/index.js.map +1 -1
  62. package/build/components/keyboard-shortcuts/register.js +1 -1
  63. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  64. package/build/components/layout/index.js +13 -7
  65. package/build/components/layout/index.js.map +1 -1
  66. package/build/components/list/index.js +9 -3
  67. package/build/components/list/index.js.map +1 -1
  68. package/build/components/list/table.js +1 -1
  69. package/build/components/list/table.js.map +1 -1
  70. package/build/components/plugin-template-setting-panel/index.js +44 -0
  71. package/build/components/plugin-template-setting-panel/index.js.map +1 -0
  72. package/build/components/revisions/index.js +95 -0
  73. package/build/components/revisions/index.js.map +1 -0
  74. package/build/components/routes/link.js +17 -2
  75. package/build/components/routes/link.js.map +1 -1
  76. package/build/components/routes/use-title.js +8 -2
  77. package/build/components/routes/use-title.js.map +1 -1
  78. package/build/components/save-button/index.js +31 -6
  79. package/build/components/save-button/index.js.map +1 -1
  80. package/build/components/save-hub/index.js +14 -31
  81. package/build/components/save-hub/index.js.map +1 -1
  82. package/build/components/save-panel/index.js +20 -7
  83. package/build/components/save-panel/index.js.map +1 -1
  84. package/build/components/secondary-sidebar/list-view-sidebar.js +2 -7
  85. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  86. package/build/components/sidebar/index.js +16 -2
  87. package/build/components/sidebar/index.js.map +1 -1
  88. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  89. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  90. package/build/components/sidebar-edit-mode/index.js +9 -2
  91. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  92. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
  93. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  94. package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
  95. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  96. package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
  97. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  98. package/build/components/sidebar-navigation-item/index.js +5 -7
  99. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  100. package/build/components/sidebar-navigation-screen/index.js +14 -4
  101. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  102. package/build/components/sidebar-navigation-screen-main/index.js +24 -7
  103. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  105. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -5
  107. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  109. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-page/index.js +67 -0
  111. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
  112. package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
  113. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  114. package/build/components/sidebar-navigation-screen-templates/index.js +5 -3
  115. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  116. package/build/components/sidebar-navigation-subtitle/index.js +18 -0
  117. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
  118. package/build/components/site-hub/index.js +36 -6
  119. package/build/components/site-hub/index.js.map +1 -1
  120. package/build/components/start-template-options/index.js +12 -16
  121. package/build/components/start-template-options/index.js.map +1 -1
  122. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  123. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  124. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
  125. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  126. package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
  127. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  128. package/build/components/template-details/template-areas.js +9 -3
  129. package/build/components/template-details/template-areas.js.map +1 -1
  130. package/build/hooks/template-part-edit.js +8 -2
  131. package/build/hooks/template-part-edit.js.map +1 -1
  132. package/build/index.js +8 -0
  133. package/build/index.js.map +1 -1
  134. package/build/utils/is-previewing-theme.js +27 -0
  135. package/build/utils/is-previewing-theme.js.map +1 -0
  136. package/build/utils/use-activate-theme.js +46 -0
  137. package/build/utils/use-activate-theme.js.map +1 -0
  138. package/build-module/components/add-new-template/add-custom-template-modal.js +21 -6
  139. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  140. package/build-module/components/add-new-template/new-template-part.js +5 -1
  141. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  142. package/build-module/components/add-new-template/new-template.js +4 -1
  143. package/build-module/components/add-new-template/new-template.js.map +1 -1
  144. package/build-module/components/app/index.js +6 -2
  145. package/build-module/components/app/index.js.map +1 -1
  146. package/build-module/components/block-editor/back-button.js +6 -1
  147. package/build-module/components/block-editor/back-button.js.map +1 -1
  148. package/build-module/components/block-editor/editor-canvas.js +37 -6
  149. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  150. package/build-module/components/editor/index.js +45 -11
  151. package/build-module/components/editor/index.js.map +1 -1
  152. package/build-module/components/editor-canvas-container/index.js +21 -6
  153. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  154. package/build-module/components/global-styles/block-preview-panel.js +1 -1
  155. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  156. package/build-module/components/global-styles/border-panel.js +3 -1
  157. package/build-module/components/global-styles/border-panel.js.map +1 -1
  158. package/build-module/components/global-styles/color-palette-panel.js +13 -3
  159. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  160. package/build-module/components/global-styles/dimensions-panel.js +17 -18
  161. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  162. package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
  163. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  164. package/build-module/components/global-styles/root-menu.js +47 -0
  165. package/build-module/components/global-styles/root-menu.js.map +1 -0
  166. package/build-module/components/global-styles/screen-block-list.js +4 -2
  167. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  168. package/build-module/components/global-styles/screen-block.js +151 -7
  169. package/build-module/components/global-styles/screen-block.js.map +1 -1
  170. package/build-module/components/global-styles/screen-colors.js +9 -25
  171. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  172. package/build-module/components/global-styles/screen-css.js +20 -15
  173. package/build-module/components/global-styles/screen-css.js.map +1 -1
  174. package/build-module/components/global-styles/screen-layout.js +4 -16
  175. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  176. package/build-module/components/global-styles/screen-revisions/index.js +128 -0
  177. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
  178. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +121 -0
  179. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  180. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +116 -0
  181. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  182. package/build-module/components/global-styles/screen-root.js +2 -2
  183. package/build-module/components/global-styles/screen-root.js.map +1 -1
  184. package/build-module/components/global-styles/screen-typography-element.js +0 -3
  185. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  186. package/build-module/components/global-styles/screen-typography.js +11 -37
  187. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  188. package/build-module/components/global-styles/style-variations-container.js +3 -7
  189. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  190. package/build-module/components/global-styles/typography-panel.js +7 -11
  191. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  192. package/build-module/components/global-styles/ui.js +61 -105
  193. package/build-module/components/global-styles/ui.js.map +1 -1
  194. package/build-module/components/global-styles/variations-panel.js +3 -22
  195. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  196. package/build-module/components/header-edit-mode/index.js +2 -2
  197. package/build-module/components/header-edit-mode/index.js.map +1 -1
  198. package/build-module/components/keyboard-shortcuts/register.js +1 -1
  199. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  200. package/build-module/components/layout/index.js +9 -3
  201. package/build-module/components/layout/index.js.map +1 -1
  202. package/build-module/components/list/index.js +5 -1
  203. package/build-module/components/list/index.js.map +1 -1
  204. package/build-module/components/list/table.js +1 -1
  205. package/build-module/components/list/table.js.map +1 -1
  206. package/build-module/components/plugin-template-setting-panel/index.js +35 -0
  207. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
  208. package/build-module/components/revisions/index.js +77 -0
  209. package/build-module/components/revisions/index.js.map +1 -0
  210. package/build-module/components/routes/link.js +13 -1
  211. package/build-module/components/routes/link.js.map +1 -1
  212. package/build-module/components/routes/use-title.js +5 -1
  213. package/build-module/components/routes/use-title.js.map +1 -1
  214. package/build-module/components/save-button/index.js +28 -6
  215. package/build-module/components/save-button/index.js.map +1 -1
  216. package/build-module/components/save-hub/index.js +13 -32
  217. package/build-module/components/save-hub/index.js.map +1 -1
  218. package/build-module/components/save-panel/index.js +19 -7
  219. package/build-module/components/save-panel/index.js.map +1 -1
  220. package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -8
  221. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  222. package/build-module/components/sidebar/index.js +11 -1
  223. package/build-module/components/sidebar/index.js.map +1 -1
  224. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  225. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  226. package/build-module/components/sidebar-edit-mode/index.js +10 -5
  227. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  228. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
  229. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  230. package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
  231. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  232. package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
  233. package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  234. package/build-module/components/sidebar-navigation-item/index.js +6 -8
  235. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-screen/index.js +13 -5
  237. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen-main/index.js +25 -8
  239. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  240. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  241. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  242. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +13 -3
  243. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  244. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  245. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  246. package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
  247. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
  248. package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
  249. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  250. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -3
  251. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
  253. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
  254. package/build-module/components/site-hub/index.js +34 -6
  255. package/build-module/components/site-hub/index.js.map +1 -1
  256. package/build-module/components/start-template-options/index.js +13 -17
  257. package/build-module/components/start-template-options/index.js.map +1 -1
  258. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -1
  259. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  260. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
  261. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  262. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
  263. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  264. package/build-module/components/template-details/template-areas.js +5 -1
  265. package/build-module/components/template-details/template-areas.js.map +1 -1
  266. package/build-module/hooks/template-part-edit.js +5 -1
  267. package/build-module/hooks/template-part-edit.js.map +1 -1
  268. package/build-module/index.js +1 -0
  269. package/build-module/index.js.map +1 -1
  270. package/build-module/utils/is-previewing-theme.js +17 -0
  271. package/build-module/utils/is-previewing-theme.js.map +1 -0
  272. package/build-module/utils/use-activate-theme.js +36 -0
  273. package/build-module/utils/use-activate-theme.js.map +1 -0
  274. package/build-style/style-rtl.css +199 -78
  275. package/build-style/style.css +199 -78
  276. package/package.json +36 -34
  277. package/src/components/add-new-template/add-custom-template-modal.js +31 -8
  278. package/src/components/add-new-template/new-template-part.js +4 -1
  279. package/src/components/add-new-template/new-template.js +3 -1
  280. package/src/components/add-new-template/style.scss +52 -48
  281. package/src/components/app/index.js +6 -3
  282. package/src/components/block-editor/back-button.js +4 -1
  283. package/src/components/block-editor/editor-canvas.js +36 -8
  284. package/src/components/block-editor/style.scss +15 -8
  285. package/src/components/editor/index.js +48 -7
  286. package/src/components/editor-canvas-container/index.js +30 -17
  287. package/src/components/global-styles/block-preview-panel.js +1 -1
  288. package/src/components/global-styles/border-panel.js +3 -1
  289. package/src/components/global-styles/color-palette-panel.js +9 -0
  290. package/src/components/global-styles/dimensions-panel.js +15 -15
  291. package/src/components/global-styles/gradients-palette-panel.js +8 -0
  292. package/src/components/global-styles/root-menu.js +66 -0
  293. package/src/components/global-styles/screen-block-list.js +2 -2
  294. package/src/components/global-styles/screen-block.js +184 -7
  295. package/src/components/global-styles/screen-colors.js +9 -16
  296. package/src/components/global-styles/screen-css.js +21 -21
  297. package/src/components/global-styles/screen-layout.js +5 -9
  298. package/src/components/global-styles/screen-revisions/index.js +177 -0
  299. package/src/components/global-styles/screen-revisions/revisions-buttons.js +131 -0
  300. package/src/components/global-styles/screen-revisions/style.scss +99 -0
  301. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +125 -0
  302. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +103 -0
  303. package/src/components/global-styles/screen-root.js +2 -2
  304. package/src/components/global-styles/screen-typography-element.js +1 -3
  305. package/src/components/global-styles/screen-typography.js +44 -79
  306. package/src/components/global-styles/style-variations-container.js +4 -10
  307. package/src/components/global-styles/style.scss +1 -23
  308. package/src/components/global-styles/typography-panel.js +12 -13
  309. package/src/components/global-styles/ui.js +72 -101
  310. package/src/components/global-styles/variations-panel.js +3 -26
  311. package/src/components/header-edit-mode/index.js +5 -2
  312. package/src/components/keyboard-shortcuts/register.js +1 -1
  313. package/src/components/layout/index.js +7 -3
  314. package/src/components/layout/style.scss +2 -4
  315. package/src/components/list/index.js +4 -1
  316. package/src/components/list/style.scss +4 -0
  317. package/src/components/list/table.js +3 -1
  318. package/src/components/plugin-template-setting-panel/index.js +33 -0
  319. package/src/components/revisions/index.js +104 -0
  320. package/src/components/routes/link.js +16 -1
  321. package/src/components/routes/use-title.js +4 -1
  322. package/src/components/save-button/index.js +27 -6
  323. package/src/components/save-hub/index.js +17 -35
  324. package/src/components/save-panel/index.js +15 -3
  325. package/src/components/secondary-sidebar/list-view-sidebar.js +2 -6
  326. package/src/components/sidebar/index.js +12 -1
  327. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +9 -7
  328. package/src/components/sidebar-edit-mode/index.js +17 -6
  329. package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
  330. package/src/components/sidebar-edit-mode/style.scss +10 -0
  331. package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
  332. package/src/components/sidebar-navigation-item/index.js +13 -14
  333. package/src/components/sidebar-navigation-item/style.scss +8 -1
  334. package/src/components/sidebar-navigation-screen/index.js +26 -5
  335. package/src/components/sidebar-navigation-screen-main/index.js +43 -22
  336. package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
  337. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +13 -1
  338. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  339. package/src/components/sidebar-navigation-screen-page/index.js +59 -0
  340. package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
  341. package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
  342. package/src/components/sidebar-navigation-screen-templates/index.js +5 -1
  343. package/src/components/sidebar-navigation-subtitle/index.js +5 -0
  344. package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
  345. package/src/components/site-hub/index.js +89 -58
  346. package/src/components/site-hub/style.scss +8 -0
  347. package/src/components/start-template-options/index.js +19 -27
  348. package/src/components/start-template-options/style.scss +29 -21
  349. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
  350. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
  351. package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
  352. package/src/components/template-details/template-areas.js +4 -1
  353. package/src/hooks/template-part-edit.js +4 -1
  354. package/src/index.js +1 -0
  355. package/src/store/test/actions.js +6 -14
  356. package/src/style.scss +4 -1
  357. package/src/utils/is-previewing-theme.js +18 -0
  358. package/src/utils/use-activate-theme.js +38 -0
  359. package/build/components/global-styles/context-menu.js +0 -126
  360. package/build/components/global-styles/context-menu.js.map +0 -1
  361. package/build/components/global-styles/custom-css.js +0 -113
  362. package/build/components/global-styles/custom-css.js.map +0 -1
  363. package/build/components/global-styles/effects-panel.js +0 -53
  364. package/build/components/global-styles/effects-panel.js.map +0 -1
  365. package/build/components/global-styles/filters-panel.js +0 -50
  366. package/build/components/global-styles/filters-panel.js.map +0 -1
  367. package/build/components/global-styles/screen-border.js +0 -61
  368. package/build/components/global-styles/screen-border.js.map +0 -1
  369. package/build/components/global-styles/screen-effects.js +0 -61
  370. package/build/components/global-styles/screen-effects.js.map +0 -1
  371. package/build/components/global-styles/screen-filters.js +0 -46
  372. package/build/components/global-styles/screen-filters.js.map +0 -1
  373. package/build/components/global-styles/screen-variations.js +0 -71
  374. package/build/components/global-styles/screen-variations.js.map +0 -1
  375. package/build/components/routes/index.js +0 -60
  376. package/build/components/routes/index.js.map +0 -1
  377. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  378. package/build/hooks/commands/index.js +0 -19
  379. package/build/hooks/commands/index.js.map +0 -1
  380. package/build/hooks/commands/use-navigation-commands.js +0 -126
  381. package/build/hooks/commands/use-navigation-commands.js.map +0 -1
  382. package/build/hooks/commands/use-wp-admin-commands.js +0 -97
  383. package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
  384. package/build/utils/history.js +0 -41
  385. package/build/utils/history.js.map +0 -1
  386. package/build-module/components/global-styles/context-menu.js +0 -107
  387. package/build-module/components/global-styles/context-menu.js.map +0 -1
  388. package/build-module/components/global-styles/custom-css.js +0 -98
  389. package/build-module/components/global-styles/custom-css.js.map +0 -1
  390. package/build-module/components/global-styles/effects-panel.js +0 -43
  391. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  392. package/build-module/components/global-styles/filters-panel.js +0 -40
  393. package/build-module/components/global-styles/filters-panel.js.map +0 -1
  394. package/build-module/components/global-styles/screen-border.js +0 -44
  395. package/build-module/components/global-styles/screen-border.js.map +0 -1
  396. package/build-module/components/global-styles/screen-effects.js +0 -44
  397. package/build-module/components/global-styles/screen-effects.js.map +0 -1
  398. package/build-module/components/global-styles/screen-filters.js +0 -33
  399. package/build-module/components/global-styles/screen-filters.js.map +0 -1
  400. package/build-module/components/global-styles/screen-variations.js +0 -54
  401. package/build-module/components/global-styles/screen-variations.js.map +0 -1
  402. package/build-module/components/routes/index.js +0 -47
  403. package/build-module/components/routes/index.js.map +0 -1
  404. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  405. package/build-module/hooks/commands/index.js +0 -10
  406. package/build-module/hooks/commands/index.js.map +0 -1
  407. package/build-module/hooks/commands/use-navigation-commands.js +0 -109
  408. package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
  409. package/build-module/hooks/commands/use-wp-admin-commands.js +0 -81
  410. package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
  411. package/build-module/utils/history.js +0 -31
  412. package/build-module/utils/history.js.map +0 -1
  413. package/src/components/global-styles/context-menu.js +0 -175
  414. package/src/components/global-styles/custom-css.js +0 -131
  415. package/src/components/global-styles/effects-panel.js +0 -40
  416. package/src/components/global-styles/filters-panel.js +0 -39
  417. package/src/components/global-styles/screen-border.js +0 -35
  418. package/src/components/global-styles/screen-effects.js +0 -35
  419. package/src/components/global-styles/screen-filters.js +0 -27
  420. package/src/components/global-styles/screen-variations.js +0 -46
  421. package/src/components/routes/index.js +0 -53
  422. package/src/hooks/commands/index.js +0 -10
  423. package/src/hooks/commands/use-navigation-commands.js +0 -112
  424. package/src/hooks/commands/use-wp-admin-commands.js +0 -79
  425. package/src/utils/history.js +0 -39
  426. /package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-filters.js"],"names":["__","FiltersPanel","BlockPreviewPanel","ScreenHeader","ScreenFilters","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;;AAEA,SAASC,aAAT,OAAmC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAClC,SACC,8BACC,cAAC,YAAD;AAAc,IAAA,KAAK,EAAGL,EAAE,CAAE,SAAF;AAAxB,IADD,EAEC,cAAC,iBAAD;AAAmB,IAAA,IAAI,EAAGK;AAA1B,IAFD,EAGC,cAAC,YAAD;AAAc,IAAA,IAAI,EAAGA;AAArB,IAHD,CADD;AAOA;;AAED,eAAeD,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport FiltersPanel from './filters-panel';\nimport BlockPreviewPanel from './block-preview-panel';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\n\nfunction ScreenFilters( { name } ) {\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Filters' ) } />\n\t\t\t<BlockPreviewPanel name={ name } />\n\t\t\t<FiltersPanel name={ name } />\n\t\t</>\n\t);\n}\n\nexport default ScreenFilters;\n"]}
@@ -1,54 +0,0 @@
1
- import { createElement, Fragment } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { __ } from '@wordpress/i18n';
7
- import { __experimentalVStack as VStack } from '@wordpress/components';
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- import { VariationPanel, VariationsPanel, useHasVariationsPanel } from './variations-panel';
13
- import ScreenHeader from './header';
14
- import BlockPreviewPanel from './block-preview-panel';
15
- import Subtitle from './subtitle';
16
- export function ScreenVariations(_ref) {
17
- let {
18
- name,
19
- path = ''
20
- } = _ref;
21
- const hasVariationsPanel = useHasVariationsPanel(name, path);
22
-
23
- if (!hasVariationsPanel) {
24
- return null;
25
- }
26
-
27
- return createElement("div", {
28
- className: "edit-site-global-styles-screen-variations"
29
- }, createElement(VStack, {
30
- spacing: 3
31
- }, createElement(Subtitle, null, __('Style Variations')), createElement(VariationsPanel, {
32
- name: name
33
- })));
34
- }
35
- export function ScreenVariation(_ref2) {
36
- let {
37
- blockName,
38
- style
39
- } = _ref2;
40
- const {
41
- name: styleName,
42
- label: styleLabel
43
- } = style;
44
- return createElement(Fragment, null, createElement(ScreenHeader, {
45
- title: styleLabel
46
- }), createElement(BlockPreviewPanel, {
47
- name: blockName,
48
- variation: `is-style-${styleName}`
49
- }), createElement(VariationPanel, {
50
- blockName: blockName,
51
- styleName: styleName
52
- }));
53
- }
54
- //# sourceMappingURL=screen-variations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-variations.js"],"names":["__","__experimentalVStack","VStack","VariationPanel","VariationsPanel","useHasVariationsPanel","ScreenHeader","BlockPreviewPanel","Subtitle","ScreenVariations","name","path","hasVariationsPanel","ScreenVariation","blockName","style","styleName","label","styleLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,oBAAoB,IAAIC,MAAjC,QAA+C,uBAA/C;AACA;AACA;AACA;;AACA,SACCC,cADD,EAECC,eAFD,EAGCC,qBAHD,QAIO,oBAJP;AAKA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,QAAP,MAAqB,YAArB;AAEA,OAAO,SAASC,gBAAT,OAAiD;AAAA,MAAtB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAI,GAAG;AAAf,GAAsB;AACvD,QAAMC,kBAAkB,GAAGP,qBAAqB,CAAEK,IAAF,EAAQC,IAAR,CAAhD;;AAEA,MAAK,CAAEC,kBAAP,EAA4B;AAC3B,WAAO,IAAP;AACA;;AACD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,QAAD,QAAYZ,EAAE,CAAE,kBAAF,CAAd,CADD,EAEC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAGU;AAAxB,IAFD,CADD,CADD;AAQA;AAED,OAAO,SAASG,eAAT,QAAiD;AAAA,MAAvB;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAuB;AACvD,QAAM;AAAEL,IAAAA,IAAI,EAAEM,SAAR;AAAmBC,IAAAA,KAAK,EAAEC;AAA1B,MAAyCH,KAA/C;AACA,SACC,8BACC,cAAC,YAAD;AAAc,IAAA,KAAK,EAAGG;AAAtB,IADD,EAEC,cAAC,iBAAD;AACC,IAAA,IAAI,EAAGJ,SADR;AAEC,IAAA,SAAS,EAAI,YAAYE,SAAW;AAFrC,IAFD,EAMC,cAAC,cAAD;AAAgB,IAAA,SAAS,EAAGF,SAA5B;AAAwC,IAAA,SAAS,EAAGE;AAApD,IAND,CADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport {\n\tVariationPanel,\n\tVariationsPanel,\n\tuseHasVariationsPanel,\n} from './variations-panel';\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport Subtitle from './subtitle';\n\nexport function ScreenVariations( { name, path = '' } ) {\n\tconst hasVariationsPanel = useHasVariationsPanel( name, path );\n\n\tif ( ! hasVariationsPanel ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport function ScreenVariation( { blockName, style } ) {\n\tconst { name: styleName, label: styleLabel } = style;\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ styleLabel } />\n\t\t\t<BlockPreviewPanel\n\t\t\t\tname={ blockName }\n\t\t\t\tvariation={ `is-style-${ styleName }` }\n\t\t\t/>\n\t\t\t<VariationPanel blockName={ blockName } styleName={ styleName } />\n\t\t</>\n\t);\n}\n"]}
@@ -1,47 +0,0 @@
1
- import { createElement } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { createContext, useState, useEffect, useContext } from '@wordpress/element';
7
- /**
8
- * Internal dependencies
9
- */
10
-
11
- import history from '../../utils/history';
12
- const RoutesContext = createContext();
13
- const HistoryContext = createContext();
14
- export function useLocation() {
15
- return useContext(RoutesContext);
16
- }
17
- export function useHistory() {
18
- return useContext(HistoryContext);
19
- }
20
-
21
- function getLocationWithParams(location) {
22
- const searchParams = new URLSearchParams(location.search);
23
- return { ...location,
24
- params: Object.fromEntries(searchParams.entries())
25
- };
26
- }
27
-
28
- export function Routes(_ref) {
29
- let {
30
- children
31
- } = _ref;
32
- const [location, setLocation] = useState(() => getLocationWithParams(history.location));
33
- useEffect(() => {
34
- return history.listen(_ref2 => {
35
- let {
36
- location: updatedLocation
37
- } = _ref2;
38
- setLocation(getLocationWithParams(updatedLocation));
39
- });
40
- }, []);
41
- return createElement(HistoryContext.Provider, {
42
- value: history
43
- }, createElement(RoutesContext.Provider, {
44
- value: location
45
- }, children));
46
- }
47
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-card/last-revision.js"],"names":["Button","sprintf","_n","backup","addQueryArgs","PostTypeSupportCheck","useEditedEntityRecord","useRevisionData","record","currentTemplate","lastRevisionId","_links","id","revisionsCount","count","PostLastRevisionCheck","children","PostLastRevision","revision","gutenberg","LastRevision"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,oBAAT,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,gCAAlC;;AAEA,MAAMC,eAAe,GAAG,MAAM;AAAA;;AAC7B,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAA8BH,qBAAqB,EAAzD;AAEA,QAAMI,cAAc,4BACnBD,eADmB,aACnBA,eADmB,iDACnBA,eAAe,CAAEE,MADE,qFACnB,uBAA2B,qBAA3B,CADmB,qFACnB,uBAAsD,CAAtD,CADmB,2DACnB,uBAA2DC,EADxC,yEAC8C,IADlE;AAGA,QAAMC,cAAc,GACnB,2BAAEJ,eAAF,aAAEA,eAAF,iDAAEA,eAAe,CAAEE,MAAnB,qFAAE,uBAA2B,iBAA3B,CAAF,qFAAE,uBAAkD,CAAlD,CAAF,2DAAE,uBAAuDG,KAAzD,2EAAkE,CAAlE,IACA,CAFD;AAIA,SAAO;AACNL,IAAAA,eADM;AAENC,IAAAA,cAFM;AAGNG,IAAAA;AAHM,GAAP;AAKA,CAfD;;AAiBA,SAASE,qBAAT,OAA+C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC9C,QAAM;AAAEN,IAAAA,cAAF;AAAkBG,IAAAA;AAAlB,MAAqCN,eAAe,EAA1D;;AAEA,MAAK,CAAEG,cAAF,IAAoBG,cAAc,GAAG,CAA1C,EAA8C;AAC7C,WAAO,IAAP;AACA;;AAED,SACC,cAAC,oBAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGG,QADH,CADD;AAKA;;AAED,MAAMC,gBAAgB,GAAG,MAAM;AAC9B,QAAM;AAAEP,IAAAA,cAAF;AAAkBG,IAAAA;AAAlB,MAAqCN,eAAe,EAA1D;AAEA,SACC,cAAC,qBAAD,QACC,cAAC,MAAD;AACC,IAAA,IAAI,EAAGH,YAAY,CAAE,cAAF,EAAkB;AACpCc,MAAAA,QAAQ,EAAER,cAD0B;AAEpCS,MAAAA,SAAS,EAAE;AAFyB,KAAlB,CADpB;AAKC,IAAA,SAAS,EAAC,yCALX;AAMC,IAAA,IAAI,EAAGhB;AANR,KAQGF,OAAO;AACR;AACAC,EAAAA,EAAE,CAAE,aAAF,EAAiB,cAAjB,EAAiCW,cAAjC,CAFM,EAGRA,cAHQ,CARV,CADD,CADD;AAkBA,CArBD;;AAuBA,eAAe,SAASO,YAAT,GAAwB;AACtC,SACC,cAAC,qBAAD,QACC,cAAC,gBAAD,OADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { PostTypeSupportCheck } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useEditedEntityRecord from '../../use-edited-entity-record';\n\nconst useRevisionData = () => {\n\tconst { record: currentTemplate } = useEditedEntityRecord();\n\n\tconst lastRevisionId =\n\t\tcurrentTemplate?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\n\tconst revisionsCount =\n\t\t( currentTemplate?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0 ) +\n\t\t1;\n\n\treturn {\n\t\tcurrentTemplate,\n\t\tlastRevisionId,\n\t\trevisionsCount,\n\t};\n};\n\nfunction PostLastRevisionCheck( { children } ) {\n\tconst { lastRevisionId, revisionsCount } = useRevisionData();\n\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nconst PostLastRevision = () => {\n\tconst { lastRevisionId, revisionsCount } = useRevisionData();\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\tgutenberg: true,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"edit-site-template-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</PostLastRevisionCheck>\n\t);\n};\n\nexport default function LastRevision() {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostLastRevision />\n\t\t</PostLastRevisionCheck>\n\t);\n}\n"]}
@@ -1,10 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { useNavigationCommands } from './use-navigation-commands';
5
- import { useWPAdminCommands } from './use-wp-admin-commands';
6
- export function useCommands() {
7
- useWPAdminCommands();
8
- useNavigationCommands();
9
- }
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/index.js"],"names":["useNavigationCommands","useWPAdminCommands","useCommands"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,qBAAT,QAAsC,2BAAtC;AACA,SAASC,kBAAT,QAAmC,yBAAnC;AAEA,OAAO,SAASC,WAAT,GAAuB;AAC7BD,EAAAA,kBAAkB;AAClBD,EAAAA,qBAAqB;AACrB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useNavigationCommands } from './use-navigation-commands';\nimport { useWPAdminCommands } from './use-wp-admin-commands';\n\nexport function useCommands() {\n\tuseWPAdminCommands();\n\tuseNavigationCommands();\n}\n"]}
@@ -1,109 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { privateApis } from '@wordpress/commands';
5
- import { __ } from '@wordpress/i18n';
6
- import { useMemo } from '@wordpress/element';
7
- import { useSelect } from '@wordpress/data';
8
- import { store as coreStore } from '@wordpress/core-data';
9
- import { post, page, layout, symbolFilled } from '@wordpress/icons';
10
- /**
11
- * Internal dependencies
12
- */
13
-
14
- import { store as editSiteStore } from '../../store';
15
- import { unlock } from '../../private-apis';
16
- import { useHistory } from '../../components/routes';
17
- const {
18
- useCommandLoader
19
- } = unlock(privateApis);
20
- const icons = {
21
- post,
22
- page,
23
- wp_template: layout,
24
- wp_template_part: symbolFilled
25
- };
26
-
27
- const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader(_ref) {
28
- let {
29
- search
30
- } = _ref;
31
- const supportsSearch = !['wp_template', 'wp_template_part'].includes(postType);
32
- const deps = supportsSearch ? [search] : [];
33
- const history = useHistory();
34
- const {
35
- canvasMode,
36
- records,
37
- isLoading
38
- } = useSelect(select => {
39
- const {
40
- getEntityRecords
41
- } = select(coreStore);
42
- const query = supportsSearch ? {
43
- search: !!search ? search : undefined,
44
- per_page: 10,
45
- orderby: search ? 'relevance' : 'date'
46
- } : {
47
- per_page: -1
48
- };
49
- return {
50
- records: getEntityRecords('postType', postType, query),
51
- isLoading: !select(coreStore).hasFinishedResolution('getEntityRecords', ['postType', postType, query]),
52
- canvasMode: unlock(select(editSiteStore)).getCanvasMode()
53
- };
54
- }, deps);
55
- const commands = useMemo(() => {
56
- return (records !== null && records !== void 0 ? records : []).slice(0, 10).map(record => {
57
- var _record$title, _record$title2, _record$title3;
58
-
59
- return {
60
- name: ((_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) + ' ' + record.id,
61
- label: (_record$title2 = record.title) !== null && _record$title2 !== void 0 && _record$title2.rendered ? (_record$title3 = record.title) === null || _record$title3 === void 0 ? void 0 : _record$title3.rendered : __('(no title)'),
62
- icon: icons[postType],
63
- callback: _ref2 => {
64
- let {
65
- close
66
- } = _ref2;
67
- history.push({
68
- postType,
69
- postId: record.id,
70
- canvas: canvasMode === 'edit' ? canvasMode : undefined
71
- });
72
- close();
73
- }
74
- };
75
- });
76
- }, [records, history, canvasMode]);
77
- return {
78
- commands,
79
- isLoading
80
- };
81
- };
82
-
83
- const usePageNavigationCommandLoader = getNavigationCommandLoaderPerPostType('page');
84
- const usePostNavigationCommandLoader = getNavigationCommandLoaderPerPostType('post');
85
- const useTemplateNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template');
86
- const useTemplatePartNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template_part');
87
- export function useNavigationCommands() {
88
- useCommandLoader({
89
- name: 'core/edit-site/navigate-pages',
90
- group: __('Pages'),
91
- hook: usePageNavigationCommandLoader
92
- });
93
- useCommandLoader({
94
- name: 'core/edit-site/navigate-posts',
95
- group: __('Posts'),
96
- hook: usePostNavigationCommandLoader
97
- });
98
- useCommandLoader({
99
- name: 'core/edit-site/navigate-templates',
100
- group: __('Templates'),
101
- hook: useTemplateNavigationCommandLoader
102
- });
103
- useCommandLoader({
104
- name: 'core/edit-site/navigate-template-parts',
105
- group: __('Template Parts'),
106
- hook: useTemplatePartNavigationCommandLoader
107
- });
108
- }
109
- //# sourceMappingURL=use-navigation-commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-navigation-commands.js"],"names":["privateApis","__","useMemo","useSelect","store","coreStore","post","page","layout","symbolFilled","editSiteStore","unlock","useHistory","useCommandLoader","icons","wp_template","wp_template_part","getNavigationCommandLoaderPerPostType","postType","useNavigationCommandLoader","search","supportsSearch","includes","deps","history","canvasMode","records","isLoading","select","getEntityRecords","query","undefined","per_page","orderby","hasFinishedResolution","getCanvasMode","commands","slice","map","record","name","title","rendered","id","label","icon","callback","close","push","postId","canvas","usePageNavigationCommandLoader","usePostNavigationCommandLoader","useTemplateNavigationCommandLoader","useTemplatePartNavigationCommandLoader","useNavigationCommands","group","hook"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { post, page, layout, symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport { useHistory } from '../../components/routes';\n\nconst { useCommandLoader } = unlock( privateApis );\n\nconst icons = {\n\tpost,\n\tpage,\n\twp_template: layout,\n\twp_template_part: symbolFilled,\n};\n\nconst getNavigationCommandLoaderPerPostType = ( postType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst supportsSearch = ! [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t);\n\t\tconst deps = supportsSearch ? [ search ] : [];\n\t\tconst history = useHistory();\n\t\tconst { canvasMode, records, isLoading } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst query = supportsSearch\n\t\t\t\t? {\n\t\t\t\t\t\tsearch: !! search ? search : undefined,\n\t\t\t\t\t\tper_page: 10,\n\t\t\t\t\t\torderby: search ? 'relevance' : 'date',\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t };\n\t\t\treturn {\n\t\t\t\trecords: getEntityRecords( 'postType', postType, query ),\n\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'postType', postType, query ]\n\t\t\t\t),\n\t\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\t};\n\t\t}, deps );\n\n\t\tconst commands = useMemo( () => {\n\t\t\treturn ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {\n\t\t\t\treturn {\n\t\t\t\t\tname: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t? record.title?.rendered\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\ticon: icons[ postType ],\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\tpostId: record.id,\n\t\t\t\t\t\t\tcanvas:\n\t\t\t\t\t\t\t\tcanvasMode === 'edit' ? canvasMode : undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} );\n\t\t}, [ records, history, canvasMode ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst usePageNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'page' );\nconst usePostNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'post' );\nconst useTemplateNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'wp_template' );\nconst useTemplatePartNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'wp_template_part' );\n\nexport function useNavigationCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\tgroup: __( 'Pages' ),\n\t\thook: usePageNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\tgroup: __( 'Posts' ),\n\t\thook: usePostNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\tgroup: __( 'Templates' ),\n\t\thook: useTemplateNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\tgroup: __( 'Template Parts' ),\n\t\thook: useTemplatePartNavigationCommandLoader,\n\t} );\n}\n"]}
@@ -1,81 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { privateApis } from '@wordpress/commands';
5
- import { __, sprintf } from '@wordpress/i18n';
6
- import { useSelect } from '@wordpress/data';
7
- import { addQueryArgs } from '@wordpress/url';
8
- import { useMemo } from '@wordpress/element';
9
- import { plus } from '@wordpress/icons';
10
- /**
11
- * Internal dependencies
12
- */
13
-
14
- import { store as editSiteStore } from '../../store';
15
- import { unlock } from '../../private-apis';
16
- const {
17
- useCommandLoader
18
- } = unlock(privateApis);
19
-
20
- const getWPAdminAddCommandLoader = postType => function useAddCommandLoader(_ref) {
21
- let {
22
- search
23
- } = _ref;
24
- let label;
25
-
26
- if (postType === 'post') {
27
- label = __('Add a new post');
28
- } else if (postType === 'page') {
29
- label = __('Add a new page');
30
- } else {
31
- throw 'unsupported post type ' + postType;
32
- }
33
-
34
- const hasRecordTitle = !!search && !label.toLowerCase().includes(search.toLowerCase());
35
-
36
- if (postType === 'post' && hasRecordTitle) {
37
- /* translators: %s: Post title placeholder */
38
- label = sprintf(__('Add a new post "%s"'), search);
39
- } else if (postType === 'page' && hasRecordTitle) {
40
- /* translators: %s: Page title placeholder */
41
- label = sprintf(__('Add a new page "%s"'), search);
42
- }
43
-
44
- const newPostLink = useSelect(select => {
45
- var _getSettings$newPostL;
46
-
47
- const {
48
- getSettings
49
- } = unlock(select(editSiteStore));
50
- return (_getSettings$newPostL = getSettings().newPostLink) !== null && _getSettings$newPostL !== void 0 ? _getSettings$newPostL : 'post-new.php';
51
- }, []);
52
- const commands = useMemo(() => [{
53
- name: 'core/wp-admin/add-' + postType + '-' + search,
54
- label,
55
- icon: plus,
56
- callback: () => {
57
- document.location.href = addQueryArgs(newPostLink, {
58
- post_type: postType,
59
- post_title: hasRecordTitle ? search : undefined
60
- });
61
- }
62
- }], [newPostLink, hasRecordTitle, search, label]);
63
- return {
64
- isLoading: false,
65
- commands
66
- };
67
- };
68
-
69
- const useAddPostLoader = getWPAdminAddCommandLoader('post');
70
- const useAddPageLoader = getWPAdminAddCommandLoader('page');
71
- export function useWPAdminCommands() {
72
- useCommandLoader({
73
- name: 'core/wp-admin/add-post-loader',
74
- hook: useAddPostLoader
75
- });
76
- useCommandLoader({
77
- name: 'core/wp-admin/add-page-loader',
78
- hook: useAddPageLoader
79
- });
80
- }
81
- //# sourceMappingURL=use-wp-admin-commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-wp-admin-commands.js"],"names":["privateApis","__","sprintf","useSelect","addQueryArgs","useMemo","plus","store","editSiteStore","unlock","useCommandLoader","getWPAdminAddCommandLoader","postType","useAddCommandLoader","search","label","hasRecordTitle","toLowerCase","includes","newPostLink","select","getSettings","commands","name","icon","callback","document","location","href","post_type","post_title","undefined","isLoading","useAddPostLoader","useAddPageLoader","useWPAdminCommands","hook"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/commands';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useMemo } from '@wordpress/element';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useCommandLoader } = unlock( privateApis );\n\nconst getWPAdminAddCommandLoader = ( postType ) =>\n\tfunction useAddCommandLoader( { search } ) {\n\t\tlet label;\n\t\tif ( postType === 'post' ) {\n\t\t\tlabel = __( 'Add a new post' );\n\t\t} else if ( postType === 'page' ) {\n\t\t\tlabel = __( 'Add a new page' );\n\t\t} else {\n\t\t\tthrow 'unsupported post type ' + postType;\n\t\t}\n\t\tconst hasRecordTitle =\n\t\t\t!! search && ! label.toLowerCase().includes( search.toLowerCase() );\n\t\tif ( postType === 'post' && hasRecordTitle ) {\n\t\t\t/* translators: %s: Post title placeholder */\n\t\t\tlabel = sprintf( __( 'Add a new post \"%s\"' ), search );\n\t\t} else if ( postType === 'page' && hasRecordTitle ) {\n\t\t\t/* translators: %s: Page title placeholder */\n\t\t\tlabel = sprintf( __( 'Add a new page \"%s\"' ), search );\n\t\t}\n\n\t\tconst newPostLink = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\treturn getSettings().newPostLink ?? 'post-new.php';\n\t\t}, [] );\n\n\t\tconst commands = useMemo(\n\t\t\t() => [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/wp-admin/add-' + postType + '-' + search,\n\t\t\t\t\tlabel,\n\t\t\t\t\ticon: plus,\n\t\t\t\t\tcallback: () => {\n\t\t\t\t\t\tdocument.location.href = addQueryArgs( newPostLink, {\n\t\t\t\t\t\t\tpost_type: postType,\n\t\t\t\t\t\t\tpost_title: hasRecordTitle ? search : undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t[ newPostLink, hasRecordTitle, search, label ]\n\t\t);\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nconst useAddPostLoader = getWPAdminAddCommandLoader( 'post' );\nconst useAddPageLoader = getWPAdminAddCommandLoader( 'page' );\n\nexport function useWPAdminCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/wp-admin/add-post-loader',\n\t\thook: useAddPostLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/wp-admin/add-page-loader',\n\t\thook: useAddPageLoader,\n\t} );\n}\n"]}
@@ -1,31 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { createBrowserHistory } from 'history';
5
- /**
6
- * WordPress dependencies
7
- */
8
-
9
- import { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';
10
- const history = createBrowserHistory();
11
- const originalHistoryPush = history.push;
12
- const originalHistoryReplace = history.replace;
13
-
14
- function push(params, state) {
15
- const currentArgs = getQueryArgs(window.location.href);
16
- const currentUrlWithoutArgs = removeQueryArgs(window.location.href, ...Object.keys(currentArgs));
17
- const newUrl = addQueryArgs(currentUrlWithoutArgs, params);
18
- return originalHistoryPush.call(history, newUrl, state);
19
- }
20
-
21
- function replace(params, state) {
22
- const currentArgs = getQueryArgs(window.location.href);
23
- const currentUrlWithoutArgs = removeQueryArgs(window.location.href, ...Object.keys(currentArgs));
24
- const newUrl = addQueryArgs(currentUrlWithoutArgs, params);
25
- return originalHistoryReplace.call(history, newUrl, state);
26
- }
27
-
28
- history.push = push;
29
- history.replace = replace;
30
- export default history;
31
- //# sourceMappingURL=history.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/utils/history.js"],"names":["createBrowserHistory","addQueryArgs","getQueryArgs","removeQueryArgs","history","originalHistoryPush","push","originalHistoryReplace","replace","params","state","currentArgs","window","location","href","currentUrlWithoutArgs","Object","keys","newUrl","call"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,oBAAT,QAAqC,SAArC;AAEA;AACA;AACA;;AACA,SAASC,YAAT,EAAuBC,YAAvB,EAAqCC,eAArC,QAA4D,gBAA5D;AAEA,MAAMC,OAAO,GAAGJ,oBAAoB,EAApC;AAEA,MAAMK,mBAAmB,GAAGD,OAAO,CAACE,IAApC;AACA,MAAMC,sBAAsB,GAAGH,OAAO,CAACI,OAAvC;;AAEA,SAASF,IAAT,CAAeG,MAAf,EAAuBC,KAAvB,EAA+B;AAC9B,QAAMC,WAAW,GAAGT,YAAY,CAAEU,MAAM,CAACC,QAAP,CAAgBC,IAAlB,CAAhC;AACA,QAAMC,qBAAqB,GAAGZ,eAAe,CAC5CS,MAAM,CAACC,QAAP,CAAgBC,IAD4B,EAE5C,GAAGE,MAAM,CAACC,IAAP,CAAaN,WAAb,CAFyC,CAA7C;AAIA,QAAMO,MAAM,GAAGjB,YAAY,CAAEc,qBAAF,EAAyBN,MAAzB,CAA3B;AACA,SAAOJ,mBAAmB,CAACc,IAApB,CAA0Bf,OAA1B,EAAmCc,MAAnC,EAA2CR,KAA3C,CAAP;AACA;;AAED,SAASF,OAAT,CAAkBC,MAAlB,EAA0BC,KAA1B,EAAkC;AACjC,QAAMC,WAAW,GAAGT,YAAY,CAAEU,MAAM,CAACC,QAAP,CAAgBC,IAAlB,CAAhC;AACA,QAAMC,qBAAqB,GAAGZ,eAAe,CAC5CS,MAAM,CAACC,QAAP,CAAgBC,IAD4B,EAE5C,GAAGE,MAAM,CAACC,IAAP,CAAaN,WAAb,CAFyC,CAA7C;AAIA,QAAMO,MAAM,GAAGjB,YAAY,CAAEc,qBAAF,EAAyBN,MAAzB,CAA3B;AACA,SAAOF,sBAAsB,CAACY,IAAvB,CAA6Bf,OAA7B,EAAsCc,MAAtC,EAA8CR,KAA9C,CAAP;AACA;;AAEDN,OAAO,CAACE,IAAR,GAAeA,IAAf;AACAF,OAAO,CAACI,OAAR,GAAkBA,OAAlB;AAEA,eAAeJ,OAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { createBrowserHistory } from 'history';\n\n/**\n * WordPress dependencies\n */\nimport { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';\n\nconst history = createBrowserHistory();\n\nconst originalHistoryPush = history.push;\nconst originalHistoryReplace = history.replace;\n\nfunction push( params, state ) {\n\tconst currentArgs = getQueryArgs( window.location.href );\n\tconst currentUrlWithoutArgs = removeQueryArgs(\n\t\twindow.location.href,\n\t\t...Object.keys( currentArgs )\n\t);\n\tconst newUrl = addQueryArgs( currentUrlWithoutArgs, params );\n\treturn originalHistoryPush.call( history, newUrl, state );\n}\n\nfunction replace( params, state ) {\n\tconst currentArgs = getQueryArgs( window.location.href );\n\tconst currentUrlWithoutArgs = removeQueryArgs(\n\t\twindow.location.href,\n\t\t...Object.keys( currentArgs )\n\t);\n\tconst newUrl = addQueryArgs( currentUrlWithoutArgs, params );\n\treturn originalHistoryReplace.call( history, newUrl, state );\n}\n\nhistory.push = push;\nhistory.replace = replace;\n\nexport default history;\n"]}
@@ -1,175 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- __experimentalItemGroup as ItemGroup,
6
- __experimentalHStack as HStack,
7
- __experimentalSpacer as Spacer,
8
- FlexItem,
9
- CardBody,
10
- CardDivider,
11
- } from '@wordpress/components';
12
- import {
13
- typography,
14
- border,
15
- filter,
16
- shadow,
17
- color,
18
- layout,
19
- chevronLeft,
20
- chevronRight,
21
- } from '@wordpress/icons';
22
- import { isRTL, __ } from '@wordpress/i18n';
23
- import { useSelect } from '@wordpress/data';
24
- import { store as coreStore } from '@wordpress/core-data';
25
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
26
-
27
- /**
28
- * Internal dependencies
29
- */
30
- import { useHasVariationsPanel } from './variations-panel';
31
- import { NavigationButtonAsItem } from './navigation-button';
32
- import { IconWithCurrentColor } from './icon-with-current-color';
33
- import { ScreenVariations } from './screen-variations';
34
- import { unlock } from '../../private-apis';
35
-
36
- const {
37
- useHasDimensionsPanel,
38
- useHasTypographyPanel,
39
- useHasBorderPanel,
40
- useHasColorPanel,
41
- useHasEffectsPanel,
42
- useHasFiltersPanel,
43
- useGlobalSetting,
44
- useSettingsForBlockElement,
45
- } = unlock( blockEditorPrivateApis );
46
-
47
- function ContextMenu( { name, parentMenu = '' } ) {
48
- const [ rawSettings ] = useGlobalSetting( '', name );
49
- const settings = useSettingsForBlockElement( rawSettings, name );
50
- const hasTypographyPanel = useHasTypographyPanel( settings );
51
- const hasColorPanel = useHasColorPanel( settings );
52
- const hasBorderPanel = useHasBorderPanel( settings );
53
- const hasEffectsPanel = useHasEffectsPanel( settings );
54
- const hasFilterPanel = useHasFiltersPanel( settings );
55
- const hasDimensionsPanel = useHasDimensionsPanel( settings );
56
- const hasLayoutPanel = hasDimensionsPanel;
57
- const hasVariationsPanel = useHasVariationsPanel( name, parentMenu );
58
-
59
- const { canEditCSS } = useSelect( ( select ) => {
60
- const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
61
- select( coreStore );
62
-
63
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
64
- const globalStyles = globalStylesId
65
- ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
66
- : undefined;
67
-
68
- return {
69
- canEditCSS:
70
- !! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
71
- };
72
- }, [] );
73
-
74
- const isBlocksPanel =
75
- parentMenu.includes( 'blocks' ) &&
76
- ! parentMenu.includes( 'variations' );
77
-
78
- return (
79
- <>
80
- <ItemGroup>
81
- { hasTypographyPanel && (
82
- <NavigationButtonAsItem
83
- icon={ typography }
84
- path={ parentMenu + '/typography' }
85
- aria-label={ __( 'Typography styles' ) }
86
- >
87
- { __( 'Typography' ) }
88
- </NavigationButtonAsItem>
89
- ) }
90
- { hasColorPanel && (
91
- <NavigationButtonAsItem
92
- icon={ color }
93
- path={ parentMenu + '/colors' }
94
- aria-label={ __( 'Colors styles' ) }
95
- >
96
- { __( 'Colors' ) }
97
- </NavigationButtonAsItem>
98
- ) }
99
- { hasBorderPanel && (
100
- <NavigationButtonAsItem
101
- icon={ border }
102
- path={ parentMenu + '/border' }
103
- aria-label={ __( 'Border' ) }
104
- >
105
- { __( 'Border' ) }
106
- </NavigationButtonAsItem>
107
- ) }
108
- { hasEffectsPanel && (
109
- <NavigationButtonAsItem
110
- icon={ shadow }
111
- path={ parentMenu + '/effects' }
112
- aria-label={ __( 'Effects' ) }
113
- >
114
- { __( 'Effects' ) }
115
- </NavigationButtonAsItem>
116
- ) }
117
- { hasFilterPanel && (
118
- <NavigationButtonAsItem
119
- icon={ filter }
120
- path={ parentMenu + '/filters' }
121
- aria-label={ __( 'Filters styles' ) }
122
- >
123
- { __( 'Filters' ) }
124
- </NavigationButtonAsItem>
125
- ) }
126
- { hasLayoutPanel && (
127
- <NavigationButtonAsItem
128
- icon={ layout }
129
- path={ parentMenu + '/layout' }
130
- aria-label={ __( 'Layout styles' ) }
131
- >
132
- { __( 'Layout' ) }
133
- </NavigationButtonAsItem>
134
- ) }
135
- { hasVariationsPanel && (
136
- <ScreenVariations name={ name } path={ parentMenu } />
137
- ) }
138
- { isBlocksPanel && canEditCSS && (
139
- <>
140
- <CardDivider />
141
- <CardBody>
142
- <Spacer as="p" paddingTop={ 2 } marginBottom={ 4 }>
143
- { __(
144
- 'Add your own CSS to customize the block appearance.'
145
- ) }
146
- </Spacer>
147
- <ItemGroup>
148
- <NavigationButtonAsItem
149
- path={ parentMenu + '/css' }
150
- aria-label={ __( 'Additional block CSS' ) }
151
- >
152
- <HStack justify="space-between">
153
- <FlexItem>
154
- { __( 'Additional block CSS' ) }
155
- </FlexItem>
156
- <IconWithCurrentColor
157
- icon={
158
- isRTL()
159
- ? chevronLeft
160
- : chevronRight
161
- }
162
- />
163
- </HStack>
164
- </NavigationButtonAsItem>
165
- </ItemGroup>
166
- </CardBody>
167
- <CardDivider />
168
- </>
169
- ) }
170
- </ItemGroup>
171
- </>
172
- );
173
- }
174
-
175
- export default ContextMenu;