@wordpress/edit-site 3.0.7 → 3.0.11

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 (380) hide show
  1. package/build/components/add-new-template/index.js +49 -0
  2. package/build/components/add-new-template/index.js.map +1 -0
  3. package/build/components/add-new-template/new-template-part.js +78 -0
  4. package/build/components/add-new-template/new-template-part.js.map +1 -0
  5. package/build/components/add-new-template/new-template.js +114 -0
  6. package/build/components/add-new-template/new-template.js.map +1 -0
  7. package/build/components/block-editor/block-inspector-button.js +4 -3
  8. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  9. package/build/components/block-editor/index.js +12 -8
  10. package/build/components/block-editor/index.js.map +1 -1
  11. package/build/components/block-editor/resizable-editor.js +6 -5
  12. package/build/components/block-editor/resizable-editor.js.map +1 -1
  13. package/build/components/block-editor/resize-handle.js +6 -4
  14. package/build/components/block-editor/resize-handle.js.map +1 -1
  15. package/build/components/create-template-part-modal/index.js +115 -0
  16. package/build/components/create-template-part-modal/index.js.map +1 -0
  17. package/build/components/edit-template-part-menu-button/index.js +15 -11
  18. package/build/components/edit-template-part-menu-button/index.js.map +1 -1
  19. package/build/components/editor/index.js +25 -20
  20. package/build/components/editor/index.js.map +1 -1
  21. package/build/components/error-boundary/index.js +5 -4
  22. package/build/components/error-boundary/index.js.map +1 -1
  23. package/build/components/global-styles/border-panel.js +5 -4
  24. package/build/components/global-styles/border-panel.js.map +1 -1
  25. package/build/components/global-styles/color-palette-panel.js +33 -9
  26. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  27. package/build/components/global-styles/context-menu.js +5 -4
  28. package/build/components/global-styles/context-menu.js.map +1 -1
  29. package/build/components/global-styles/dimensions-panel.js +5 -4
  30. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  31. package/build/components/global-styles/global-styles-provider.js +11 -46
  32. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  33. package/build/components/global-styles/header.js +6 -5
  34. package/build/components/global-styles/header.js.map +1 -1
  35. package/build/components/global-styles/hooks.js +34 -30
  36. package/build/components/global-styles/hooks.js.map +1 -1
  37. package/build/components/global-styles/index.js +6 -6
  38. package/build/components/global-styles/navigation-button.js +8 -7
  39. package/build/components/global-styles/navigation-button.js.map +1 -1
  40. package/build/components/global-styles/palette.js +13 -9
  41. package/build/components/global-styles/palette.js.map +1 -1
  42. package/build/components/global-styles/screen-background-color.js +4 -3
  43. package/build/components/global-styles/screen-background-color.js.map +1 -1
  44. package/build/components/global-styles/screen-block-list.js +13 -4
  45. package/build/components/global-styles/screen-block-list.js.map +1 -1
  46. package/build/components/global-styles/screen-block.js +4 -3
  47. package/build/components/global-styles/screen-block.js.map +1 -1
  48. package/build/components/global-styles/screen-color-palette.js +4 -3
  49. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  50. package/build/components/global-styles/screen-colors.js +19 -15
  51. package/build/components/global-styles/screen-colors.js.map +1 -1
  52. package/build/components/global-styles/screen-layout.js +8 -5
  53. package/build/components/global-styles/screen-layout.js.map +1 -1
  54. package/build/components/global-styles/screen-link-color.js +4 -3
  55. package/build/components/global-styles/screen-link-color.js.map +1 -1
  56. package/build/components/global-styles/screen-text-color.js +4 -3
  57. package/build/components/global-styles/screen-text-color.js.map +1 -1
  58. package/build/components/global-styles/screen-typography.js +4 -3
  59. package/build/components/global-styles/screen-typography.js.map +1 -1
  60. package/build/components/global-styles/subtitle.js +4 -3
  61. package/build/components/global-styles/subtitle.js.map +1 -1
  62. package/build/components/global-styles/typography-panel.js +10 -8
  63. package/build/components/global-styles/typography-panel.js.map +1 -1
  64. package/build/components/global-styles/ui.js +4 -3
  65. package/build/components/global-styles/ui.js.map +1 -1
  66. package/build/components/global-styles/use-global-styles-output.js +61 -44
  67. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  68. package/build/components/global-styles/utils.js +4 -3
  69. package/build/components/global-styles/utils.js.map +1 -1
  70. package/build/components/header/document-actions/index.js +23 -19
  71. package/build/components/header/document-actions/index.js.map +1 -1
  72. package/build/components/header/feature-toggle/index.js +9 -7
  73. package/build/components/header/feature-toggle/index.js.map +1 -1
  74. package/build/components/header/index.js +15 -15
  75. package/build/components/header/index.js.map +1 -1
  76. package/build/components/header/more-menu/index.js +30 -27
  77. package/build/components/header/more-menu/index.js.map +1 -1
  78. package/build/components/header/tools-more-menu-group/index.js +10 -7
  79. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  80. package/build/components/keyboard-shortcuts/index.js +30 -3
  81. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  82. package/build/components/list/header.js +50 -0
  83. package/build/components/list/header.js.map +1 -0
  84. package/build/components/list/index.js +87 -0
  85. package/build/components/list/index.js.map +1 -0
  86. package/build/components/list/table.js +127 -0
  87. package/build/components/list/table.js.map +1 -0
  88. package/build/components/list/use-register-shortcuts.js +52 -0
  89. package/build/components/list/use-register-shortcuts.js.map +1 -0
  90. package/build/components/main-dashboard-button/index.js +4 -3
  91. package/build/components/main-dashboard-button/index.js.map +1 -1
  92. package/build/components/navigate-to-link/index.js +7 -6
  93. package/build/components/navigate-to-link/index.js.map +1 -1
  94. package/build/components/navigation-sidebar/index.js +25 -10
  95. package/build/components/navigation-sidebar/index.js.map +1 -1
  96. package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -1
  97. package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
  98. package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
  99. package/build/components/navigation-sidebar/navigation-panel/index.js +37 -55
  100. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  101. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
  102. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
  103. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
  104. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
  105. package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
  106. package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
  107. package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
  108. package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
  109. package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
  110. package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
  111. package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
  112. package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
  113. package/build/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
  114. package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
  115. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +8 -5
  116. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
  117. package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
  118. package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
  119. package/build/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
  120. package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
  121. package/build/components/navigation-sidebar/navigation-toggle/index.js +7 -27
  122. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  123. package/build/components/save-button/index.js +5 -4
  124. package/build/components/save-button/index.js.map +1 -1
  125. package/build/components/sidebar/constants.js +1 -1
  126. package/build/components/sidebar/default-sidebar.js +11 -10
  127. package/build/components/sidebar/default-sidebar.js.map +1 -1
  128. package/build/components/sidebar/plugin-sidebar/index.js +5 -4
  129. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  130. package/build/components/sidebar/settings-header/index.js +4 -3
  131. package/build/components/sidebar/settings-header/index.js.map +1 -1
  132. package/build/components/sidebar/template-card/template-areas.js +17 -13
  133. package/build/components/sidebar/template-card/template-areas.js.map +1 -1
  134. package/build/components/template-details/index.js +14 -9
  135. package/build/components/template-details/index.js.map +1 -1
  136. package/build/components/template-details/template-areas.js +38 -29
  137. package/build/components/template-details/template-areas.js.map +1 -1
  138. package/build/components/template-part-converter/convert-to-regular.js +15 -11
  139. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  140. package/build/components/template-part-converter/convert-to-template-part.js +29 -86
  141. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  142. package/build/components/welcome-guide/editor.js +58 -0
  143. package/build/components/welcome-guide/editor.js.map +1 -0
  144. package/build/components/welcome-guide/image.js +27 -0
  145. package/build/components/welcome-guide/image.js.map +1 -0
  146. package/build/components/welcome-guide/index.js +49 -0
  147. package/build/components/welcome-guide/index.js.map +1 -0
  148. package/build/components/welcome-guide/styles.js +83 -0
  149. package/build/components/welcome-guide/styles.js.map +1 -0
  150. package/build/index.js +40 -16
  151. package/build/index.js.map +1 -1
  152. package/build/plugins/index.js +4 -2
  153. package/build/plugins/index.js.map +1 -1
  154. package/build/plugins/welcome-guide-menu-item.js +39 -0
  155. package/build/plugins/welcome-guide-menu-item.js.map +1 -0
  156. package/build/store/actions.js +24 -24
  157. package/build/store/actions.js.map +1 -1
  158. package/build/store/constants.js +1 -1
  159. package/build/store/defaults.js +4 -1
  160. package/build/store/defaults.js.map +1 -1
  161. package/build/store/index.js +5 -3
  162. package/build/store/index.js.map +1 -1
  163. package/build/store/reducer.js +36 -14
  164. package/build/store/reducer.js.map +1 -1
  165. package/build/store/selectors.js +27 -19
  166. package/build/store/selectors.js.map +1 -1
  167. package/build/utils/is-template-removable.js +21 -0
  168. package/build/utils/is-template-removable.js.map +1 -0
  169. package/build-module/components/add-new-template/index.js +36 -0
  170. package/build-module/components/add-new-template/index.js.map +1 -0
  171. package/build-module/components/add-new-template/new-template-part.js +65 -0
  172. package/build-module/components/add-new-template/new-template-part.js.map +1 -0
  173. package/build-module/components/add-new-template/new-template.js +97 -0
  174. package/build-module/components/add-new-template/new-template.js.map +1 -0
  175. package/build-module/components/block-editor/block-inspector-button.js +4 -3
  176. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  177. package/build-module/components/block-editor/index.js +12 -8
  178. package/build-module/components/block-editor/index.js.map +1 -1
  179. package/build-module/components/block-editor/resizable-editor.js +6 -5
  180. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  181. package/build-module/components/block-editor/resize-handle.js +6 -4
  182. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  183. package/build-module/components/create-template-part-modal/index.js +102 -0
  184. package/build-module/components/create-template-part-modal/index.js.map +1 -0
  185. package/build-module/components/edit-template-part-menu-button/index.js +15 -11
  186. package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
  187. package/build-module/components/editor/index.js +24 -21
  188. package/build-module/components/editor/index.js.map +1 -1
  189. package/build-module/components/error-boundary/index.js +5 -4
  190. package/build-module/components/error-boundary/index.js.map +1 -1
  191. package/build-module/components/global-styles/border-panel.js +4 -3
  192. package/build-module/components/global-styles/border-panel.js.map +1 -1
  193. package/build-module/components/global-styles/color-palette-panel.js +33 -10
  194. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  195. package/build-module/components/global-styles/context-menu.js +5 -4
  196. package/build-module/components/global-styles/context-menu.js.map +1 -1
  197. package/build-module/components/global-styles/dimensions-panel.js +4 -3
  198. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  199. package/build-module/components/global-styles/global-styles-provider.js +12 -42
  200. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  201. package/build-module/components/global-styles/header.js +6 -5
  202. package/build-module/components/global-styles/header.js.map +1 -1
  203. package/build-module/components/global-styles/hooks.js +32 -28
  204. package/build-module/components/global-styles/hooks.js.map +1 -1
  205. package/build-module/components/global-styles/navigation-button.js +8 -7
  206. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  207. package/build-module/components/global-styles/palette.js +13 -9
  208. package/build-module/components/global-styles/palette.js.map +1 -1
  209. package/build-module/components/global-styles/screen-background-color.js +4 -3
  210. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  211. package/build-module/components/global-styles/screen-block-list.js +11 -4
  212. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  213. package/build-module/components/global-styles/screen-block.js +4 -3
  214. package/build-module/components/global-styles/screen-block.js.map +1 -1
  215. package/build-module/components/global-styles/screen-color-palette.js +4 -3
  216. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  217. package/build-module/components/global-styles/screen-colors.js +19 -15
  218. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  219. package/build-module/components/global-styles/screen-layout.js +4 -3
  220. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  221. package/build-module/components/global-styles/screen-link-color.js +4 -3
  222. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  223. package/build-module/components/global-styles/screen-text-color.js +4 -3
  224. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  225. package/build-module/components/global-styles/screen-typography.js +4 -3
  226. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  227. package/build-module/components/global-styles/subtitle.js +4 -3
  228. package/build-module/components/global-styles/subtitle.js.map +1 -1
  229. package/build-module/components/global-styles/typography-panel.js +9 -7
  230. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  231. package/build-module/components/global-styles/ui.js +4 -3
  232. package/build-module/components/global-styles/ui.js.map +1 -1
  233. package/build-module/components/global-styles/use-global-styles-output.js +60 -43
  234. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  235. package/build-module/components/global-styles/utils.js +3 -2
  236. package/build-module/components/global-styles/utils.js.map +1 -1
  237. package/build-module/components/header/document-actions/index.js +23 -19
  238. package/build-module/components/header/document-actions/index.js.map +1 -1
  239. package/build-module/components/header/feature-toggle/index.js +9 -7
  240. package/build-module/components/header/feature-toggle/index.js.map +1 -1
  241. package/build-module/components/header/index.js +15 -13
  242. package/build-module/components/header/index.js.map +1 -1
  243. package/build-module/components/header/more-menu/index.js +30 -27
  244. package/build-module/components/header/more-menu/index.js.map +1 -1
  245. package/build-module/components/header/tools-more-menu-group/index.js +10 -7
  246. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  247. package/build-module/components/keyboard-shortcuts/index.js +30 -3
  248. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  249. package/build-module/components/list/header.js +37 -0
  250. package/build-module/components/list/header.js.map +1 -0
  251. package/build-module/components/list/index.js +69 -0
  252. package/build-module/components/list/index.js.map +1 -0
  253. package/build-module/components/list/table.js +111 -0
  254. package/build-module/components/list/table.js.map +1 -0
  255. package/build-module/components/list/use-register-shortcuts.js +41 -0
  256. package/build-module/components/list/use-register-shortcuts.js.map +1 -0
  257. package/build-module/components/main-dashboard-button/index.js +4 -3
  258. package/build-module/components/main-dashboard-button/index.js.map +1 -1
  259. package/build-module/components/navigate-to-link/index.js +7 -6
  260. package/build-module/components/navigate-to-link/index.js.map +1 -1
  261. package/build-module/components/navigation-sidebar/index.js +25 -8
  262. package/build-module/components/navigation-sidebar/index.js.map +1 -1
  263. package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
  264. package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
  265. package/build-module/components/navigation-sidebar/navigation-panel/index.js +39 -55
  266. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  267. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
  268. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
  269. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
  270. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
  271. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
  272. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
  273. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
  274. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
  275. package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
  276. package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
  277. package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
  278. package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
  279. package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
  280. package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
  281. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +6 -3
  282. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
  283. package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
  284. package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
  285. package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
  286. package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
  287. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +8 -27
  288. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  289. package/build-module/components/save-button/index.js +5 -4
  290. package/build-module/components/save-button/index.js.map +1 -1
  291. package/build-module/components/sidebar/default-sidebar.js +11 -10
  292. package/build-module/components/sidebar/default-sidebar.js.map +1 -1
  293. package/build-module/components/sidebar/plugin-sidebar/index.js +5 -4
  294. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  295. package/build-module/components/sidebar/settings-header/index.js +4 -3
  296. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  297. package/build-module/components/sidebar/template-card/template-areas.js +17 -13
  298. package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
  299. package/build-module/components/template-details/index.js +14 -9
  300. package/build-module/components/template-details/index.js.map +1 -1
  301. package/build-module/components/template-details/template-areas.js +38 -29
  302. package/build-module/components/template-details/template-areas.js.map +1 -1
  303. package/build-module/components/template-part-converter/convert-to-regular.js +15 -11
  304. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  305. package/build-module/components/template-part-converter/convert-to-template-part.js +29 -86
  306. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  307. package/build-module/components/welcome-guide/editor.js +45 -0
  308. package/build-module/components/welcome-guide/editor.js.map +1 -0
  309. package/build-module/components/welcome-guide/image.js +19 -0
  310. package/build-module/components/welcome-guide/image.js.map +1 -0
  311. package/build-module/components/welcome-guide/index.js +35 -0
  312. package/build-module/components/welcome-guide/index.js.map +1 -0
  313. package/build-module/components/welcome-guide/styles.js +69 -0
  314. package/build-module/components/welcome-guide/styles.js.map +1 -0
  315. package/build-module/index.js +21 -1
  316. package/build-module/index.js.map +1 -1
  317. package/build-module/plugins/index.js +3 -2
  318. package/build-module/plugins/index.js.map +1 -1
  319. package/build-module/plugins/welcome-guide-menu-item.js +27 -0
  320. package/build-module/plugins/welcome-guide-menu-item.js.map +1 -0
  321. package/build-module/store/actions.js +11 -11
  322. package/build-module/store/actions.js.map +1 -1
  323. package/build-module/store/defaults.js +4 -1
  324. package/build-module/store/defaults.js.map +1 -1
  325. package/build-module/store/reducer.js +31 -10
  326. package/build-module/store/reducer.js.map +1 -1
  327. package/build-module/store/selectors.js +17 -10
  328. package/build-module/store/selectors.js.map +1 -1
  329. package/build-module/utils/is-template-removable.js +14 -0
  330. package/build-module/utils/is-template-removable.js.map +1 -0
  331. package/build-style/style-rtl.css +348 -32
  332. package/build-style/style.css +348 -32
  333. package/package.json +27 -27
  334. package/src/components/add-new-template/index.js +30 -0
  335. package/src/components/add-new-template/new-template-part.js +66 -0
  336. package/src/components/add-new-template/new-template.js +116 -0
  337. package/src/components/add-new-template/style.scss +11 -0
  338. package/src/components/create-template-part-modal/index.js +132 -0
  339. package/src/components/{template-part-converter → create-template-part-modal}/style.scss +9 -9
  340. package/src/components/editor/index.js +22 -15
  341. package/src/components/editor/style.scss +8 -0
  342. package/src/components/global-styles/color-palette-panel.js +64 -7
  343. package/src/components/global-styles/global-styles-provider.js +7 -36
  344. package/src/components/global-styles/hooks.js +58 -26
  345. package/src/components/global-styles/screen-block-list.js +11 -1
  346. package/src/components/global-styles/test/use-global-styles-output.js +2 -2
  347. package/src/components/global-styles/use-global-styles-output.js +2 -2
  348. package/src/components/global-styles/utils.js +1 -1
  349. package/src/components/header/index.js +0 -6
  350. package/src/components/keyboard-shortcuts/index.js +32 -0
  351. package/src/components/list/header.js +34 -0
  352. package/src/components/list/index.js +80 -0
  353. package/src/components/list/style.scss +113 -0
  354. package/src/components/list/table.js +132 -0
  355. package/src/components/list/use-register-shortcuts.js +45 -0
  356. package/src/components/navigation-sidebar/index.js +31 -8
  357. package/src/components/navigation-sidebar/navigation-panel/index.js +45 -55
  358. package/src/components/navigation-sidebar/navigation-panel/style.scss +4 -2
  359. package/src/components/navigation-sidebar/navigation-toggle/index.js +4 -28
  360. package/src/components/template-details/index.js +3 -2
  361. package/src/components/template-part-converter/convert-to-template-part.js +20 -140
  362. package/src/components/welcome-guide/editor.js +63 -0
  363. package/src/components/welcome-guide/image.js +11 -0
  364. package/src/components/welcome-guide/index.js +33 -0
  365. package/src/components/welcome-guide/style.scss +37 -0
  366. package/src/components/welcome-guide/styles.js +116 -0
  367. package/src/index.js +21 -1
  368. package/src/plugins/index.js +3 -1
  369. package/src/plugins/welcome-guide-menu-item.js +35 -0
  370. package/src/store/actions.js +11 -9
  371. package/src/store/defaults.js +4 -1
  372. package/src/store/test/actions.js +14 -20
  373. package/src/style.scss +9 -6
  374. package/src/utils/is-template-removable.js +13 -0
  375. package/build/components/header/navigation-link/index.js +0 -86
  376. package/build/components/header/navigation-link/index.js.map +0 -1
  377. package/build-module/components/header/navigation-link/index.js +0 -73
  378. package/build-module/components/header/navigation-link/index.js.map +0 -1
  379. package/src/components/header/navigation-link/index.js +0 -71
  380. package/src/components/header/navigation-link/style.scss +0 -69
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["preferences","features","state","PREFERENCES_DEFAULTS","action","type","feature","deviceType","settings","editedPost","id","templateId","page","templatePartId","slice","homeTemplateId","navigationPanel","menu","MENU_ROOT","isOpen","value","blockInserterPanel","listViewPanel"],"mappings":";;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,2BAAiB;AAC3CC,EAAAA,QAAQ,CAAEC,KAAK,GAAGC,+BAAqBF,QAA/B,EAAyCG,MAAzC,EAAkD;AACzD,YAASA,MAAM,CAACC,IAAhB;AACC,WAAK,gBAAL;AAAuB;AACtB,iBAAO,EACN,GAAGH,KADG;AAEN,aAAEE,MAAM,CAACE,OAAT,GAAoB,CAAEJ,KAAK,CAAEE,MAAM,CAACE,OAAT;AAFrB,WAAP;AAIA;;AACD;AACC,eAAOJ,KAAP;AARF;AAUA;;AAZ0C,CAAjB,CAApB;AAeP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASK,UAAT,CAAqBL,KAAK,GAAG,SAA7B,EAAwCE,MAAxC,EAAiD;AACvD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACG,UAAd;AAFF;;AAKA,SAAOL,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASM,QAAT,CAAmBN,KAAK,GAAG,EAA3B,EAA+BE,MAA/B,EAAwC;AAC9C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAO,EACN,GAAGH,KADG;AAEN,WAAGE,MAAM,CAACI;AAFJ,OAAP;AAFF;;AAQA,SAAON,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,UAAT,CAAqBP,KAAK,GAAG,EAA7B,EAAiCE,MAAjC,EAA0C;AAChD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,cAAL;AACA,SAAK,UAAL;AACC,aAAO,CACN;A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SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACC,aAAOD,MAAM,CAACe,MAAP,GAAgB,KAAhB,GAAwBjB,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOE,MAAM,CAACgB,KAAP,GAAe,KAAf,GAAuBlB,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOE,MAAM,CAACe,MAAd;AARF;;AAUA,SAAOjB,KAAP;AACA;;eAEc,2BAAiB;AAC/BF,EAAAA,WAD+B;AAE/BO,EAAAA,UAF+B;AAG/BC,EAAAA,QAH+B;AAI/BC,EAAAA,UAJ+B;AAK/BM,EAAAA,cAL+B;AAM/BC,EAAAA,eAN+B;AAO/BK,EAAAA,kBAP+B;AAQ/BC,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS } from './defaults';\nimport { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/constants';\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n * @return {Object} Updated state.\n */\nexport const preferences = combineReducers( {\n\tfeatures( state = PREFERENCES_DEFAULTS.features, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_FEATURE': {\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ action.feature ]: ! state[ action.feature ],\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn state;\n\t\t}\n\t},\n} );\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Array} state Current state history.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function editedPost( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE':\n\t\tcase 'SET_PAGE':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template',\n\t\t\t\t\tid: action.templateId,\n\t\t\t\t\tpage: action.page,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'SET_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'PUSH_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t...state,\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'GO_BACK':\n\t\t\treturn state.slice( 0, -1 );\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the site's homepage.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function homeTemplateId( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_HOME_TEMPLATE':\n\t\t\treturn action.homeTemplateId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the navigation panel, such as its active menu\n * and whether it should be opened or closed.\n *\n * Note: this reducer interacts with the inserter and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function navigationPanel(\n\tstate = { menu: MENU_ROOT, isOpen: false },\n\taction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_NAVIGATION_PANEL_ACTIVE_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisOpen: true,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: ! action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen ? false : state.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.value ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.value ? false : state.isOpen,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpreferences,\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\thomeTemplateId,\n\tnavigationPanel,\n\tblockInserterPanel,\n\tlistViewPanel,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["preferences","features","state","PREFERENCES_DEFAULTS","action","type","feature","deviceType","settings","editedPost","id","templateId","page","templatePartId","slice","homeTemplateId","navigationPanel","menu","MENU_ROOT","isOpen","value","blockInserterPanel","listViewPanel"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,2BAAiB;AAC3CC,EAAAA,QAAQ,GAAkD;AAAA,QAAhDC,KAAgD,uEAAxCC,+BAAqBF,QAAmB;AAAA,QAATG,MAAS;;AACzD,YAASA,MAAM,CAACC,IAAhB;AACC,WAAK,gBAAL;AAAuB;AACtB,iBAAO,EACN,GAAGH,KADG;AAEN,aAAEE,MAAM,CAACE,OAAT,GAAoB,CAAEJ,KAAK,CAAEE,MAAM,CAACE,OAAT;AAFrB,WA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eAN+B;AAO/BK,EAAAA,kBAP+B;AAQ/BC,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS } from './defaults';\nimport { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/constants';\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n * @return {Object} Updated state.\n */\nexport const preferences = combineReducers( {\n\tfeatures( state = PREFERENCES_DEFAULTS.features, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_FEATURE': {\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ action.feature ]: ! state[ action.feature ],\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn state;\n\t\t}\n\t},\n} );\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Array} state Current state history.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function editedPost( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE':\n\t\tcase 'SET_PAGE':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template',\n\t\t\t\t\tid: action.templateId,\n\t\t\t\t\tpage: action.page,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'SET_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'PUSH_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t...state,\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'GO_BACK':\n\t\t\treturn state.slice( 0, -1 );\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the site's homepage.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function homeTemplateId( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_HOME_TEMPLATE':\n\t\t\treturn action.homeTemplateId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the navigation panel, such as its active menu\n * and whether it should be opened or closed.\n *\n * Note: this reducer interacts with the inserter and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function navigationPanel(\n\tstate = { menu: MENU_ROOT, isOpen: false },\n\taction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_NAVIGATION_PANEL_ACTIVE_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisOpen: true,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: ! action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen ? false : state.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.value ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.value ? false : state.isOpen,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpreferences,\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\thomeTemplateId,\n\tnavigationPanel,\n\tblockInserterPanel,\n\tlistViewPanel,\n} );\n"]}
@@ -5,20 +5,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.isFeatureActive = isFeatureActive;
8
+ exports.__experimentalGetInsertionPoint = __experimentalGetInsertionPoint;
9
9
  exports.__experimentalGetPreviewDeviceType = __experimentalGetPreviewDeviceType;
10
- exports.getHomeTemplateId = getHomeTemplateId;
11
- exports.getEditedPostType = getEditedPostType;
10
+ exports.getCurrentTemplateTemplateParts = exports.getCurrentTemplateNavigationPanelSubMenu = exports.getCanUserCreateMedia = void 0;
12
11
  exports.getEditedPostId = getEditedPostId;
13
- exports.getPreviousEditedPostType = getPreviousEditedPostType;
14
- exports.getPreviousEditedPostId = getPreviousEditedPostId;
15
- exports.getPage = getPage;
12
+ exports.getEditedPostType = getEditedPostType;
13
+ exports.getHomeTemplateId = getHomeTemplateId;
16
14
  exports.getNavigationPanelActiveMenu = getNavigationPanelActiveMenu;
17
- exports.isNavigationOpened = isNavigationOpened;
15
+ exports.getPage = getPage;
16
+ exports.getPreviousEditedPostId = getPreviousEditedPostId;
17
+ exports.getPreviousEditedPostType = getPreviousEditedPostType;
18
+ exports.getSettings = void 0;
19
+ exports.isFeatureActive = isFeatureActive;
18
20
  exports.isInserterOpened = isInserterOpened;
19
- exports.__experimentalGetInsertionPoint = __experimentalGetInsertionPoint;
20
21
  exports.isListViewOpened = isListViewOpened;
21
- exports.getCurrentTemplateTemplateParts = exports.getCurrentTemplateNavigationPanelSubMenu = exports.getSettings = exports.getCanUserCreateMedia = void 0;
22
+ exports.isNavigationOpened = isNavigationOpened;
22
23
 
23
24
  var _lodash = require("lodash");
24
25
 
@@ -108,15 +109,19 @@ const getSettings = (0, _rememo.default)((state, setIsInserterOpen) => {
108
109
  return settings;
109
110
  }
110
111
 
111
- settings.mediaUpload = ({
112
- onError,
113
- ...rest
114
- }) => {
112
+ settings.mediaUpload = _ref => {
113
+ let {
114
+ onError,
115
+ ...rest
116
+ } = _ref;
115
117
  (0, _mediaUtils.uploadMedia)({
116
118
  wpAllowedMimeTypes: state.settings.allowedMimeTypes,
117
- onError: ({
118
- message
119
- }) => onError(message),
119
+ onError: _ref2 => {
120
+ let {
121
+ message
122
+ } = _ref2;
123
+ return onError(message);
124
+ },
120
125
  ...rest
121
126
  });
122
127
  };
@@ -337,9 +342,12 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
337
342
  templatePart,
338
343
  block
339
344
  };
340
- }).filter(({
341
- templatePart
342
- }) => !!templatePart);
345
+ }).filter(_ref3 => {
346
+ let {
347
+ templatePart
348
+ } = _ref3;
349
+ return !!templatePart;
350
+ });
343
351
  });
344
352
  exports.getCurrentTemplateTemplateParts = getCurrentTemplateTemplateParts;
345
353
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["isFeatureActive","state","feature","preferences","features","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","select","coreDataStore","canUser","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","__experimentalSetIsInserterOpened","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","length","getPreviousEditedPost","getEditedPostType","type","getEditedPostId","id","getPreviousEditedPostType","getPreviousEditedPostId","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","MENU_ROOT","find","submenu","area","MENU_TEMPLATE_PARTS","templates","getEntityRecords","showOnFront","getEditedEntityRecord","show_on_front","slug","MENU_TEMPLATES_UNUSED","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","map","attributes","theme","templatePartId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAMA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAYA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAT,CAA0BC,KAA1B,EAAiCC,OAAjC,EAA2C;AACjD,SAAO,iBAAKD,KAAK,CAACE,WAAN,CAAkBC,QAAvB,EAAiC,CAAEF,OAAF,CAAjC,EAA8C,KAA9C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,kCAAT,CAA6CJ,KAA7C,EAAqD;AAC3D,SAAOA,KAAK,CAACK,UAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,kCAA0BC,MAAF,IAAc,MAC1EA,MAAM,CAAEC,eAAF,CAAN,CAAwBC,OAAxB,CAAiC,QAAjC,EAA2C,OAA3C,CADoC,CAA9B;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,WAAW,GAAG,qBAC1B,CAAEV,KAAF,EAASW,iBAAT,KAAgC;AAC/B,QAAMC,QAAQ,GAAG,EAChB,GAAGZ,KAAK,CAACY,QADO;AAEhBC,IAAAA,WAAW,EAAE,IAFG;AAGhBC,IAAAA,SAAS,EAAEf,eAAe,CAAEC,KAAF,EAAS,WAAT,CAHV;AAIhBe,IAAAA,eAAe,EAAEhB,eAAe,CAAEC,KAAF,EAAS,cAAT,CAJhB;AAKhBgB,IAAAA,iCAAiC,EA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AAF,IAAgBP,KAAF,IAAa;AAAA;;AAC1B,QAAM0C,YAAY,GAAGZ,iBAAiB,CAAE9B,KAAF,CAAtC;AACA,QAAM2C,UAAU,GAAGX,eAAe,CAAEhC,KAAF,CAAlC;AACA,QAAM4C,QAAQ,GAAGrC,MAAM,CAAEC,eAAF,CAAN,CAAwB8C,qBAAxB,CAChB,UADgB,EAEhBZ,YAFgB,EAGhBC,UAHgB,CAAjB;AAMA,QAAM0B,aAAa,GAAG9D,MAAM,CAAEC,eAAF,CAAN,CAAwB4C,gBAAxB,CACrB,UADqB,EAErB,kBAFqB,CAAtB;AAIA,QAAMkB,iBAAiB,GAAG,mBACzBD,aADyB,EAEvBE,YAAF,IAAoBA,YAAY,CAACtC,EAFR,CAA1B;AAKA,SAAO,qBAAEW,QAAQ,CAAC4B,MAAX,+DAAqB,EAArB,EACLC,MADK,CACKC,KAAF,IAAa,4BAAgBA,KAAhB,CADhB,EAELC,GAFK,CAEED,KAAF,IAAa;AAClB,UAAM;AACLE,MAAAA,UAAU,EAAE;AAAEC,QAAAA,KAAF;AAASrB,QAAAA;AAAT;AADP,QAEFkB,KAFJ;AAGA,UAAMI,cAAc,GAAI,GAAGD,KAAO,KAAKrB,IAAM,EAA7C;AACA,UAAMe,YAAY,GAAGD,iBAAiB,CAAEQ,cAAF,CAAtC;AAEA,WAAO;AACNP,MAAAA,YADM;AAENG,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG,CAAE;AAAEF,IAAAA;AAAF,GAAF,KAAwB,CAAC,CAAEA,YAd9B,CAAP;AAeA,CAlC6C,CAAxC","sourcesContent":["/**\n * External dependencies\n */\nimport { get, map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, feature ) {\n\treturn get( state.preferences.features, [ feature ], false );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: isFeatureActive( state, 'focusMode' ),\n\t\t\thasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\tisFeatureActive( state, 'focusMode' ),\n\t\tisFeatureActive( state, 'fixedToolbar' ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 1 ] || {};\n}\n\nfunction getPreviousEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 2 ] || {};\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the previous edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getPreviousEditedPostType( state ) {\n\treturn getPreviousEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the previous edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getPreviousEditedPostId( state ) {\n\treturn getPreviousEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part'\n\t\t);\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["isFeatureActive","state","feature","preferences","features","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","select","coreDataStore","canUser","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","__experimentalSetIsInserterOpened","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","length","getPreviousEditedPost","getEditedPostType","type","getEditedPostId","id","getPreviousEditedPostType","getPreviousEditedPostId","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","MENU_ROOT","find","submenu","area","MENU_TEMPLATE_PARTS","templates","getEntityRecords","showOnFront","getEditedEntityRecord","show_on_front","slug","MENU_TEMPLATES_UNUSED","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","map","attributes","theme","templatePartId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAMA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAYA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAT,CAA0BC,KAA1B,EAAiCC,OAAjC,EAA2C;AACjD,SAAO,iBAAKD,KAAK,CAACE,WAAN,CAAkBC,QAAvB,EAAiC,CAAEF,OAAF,CAAjC,EAA8C,KAA9C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,kCAAT,CAA6CJ,KAA7C,EAAqD;AAC3D,SAAOA,KAAK,CAACK,UAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,kCAA0BC,MA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GD,KAAO,KAAKrB,IAAM,EAA7C;AACA,UAAMe,YAAY,GAAGD,iBAAiB,CAAEQ,cAAF,CAAtC;AAEA,WAAO;AACNP,MAAAA,YADM;AAENG,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEF,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAlC6C,CAAxC","sourcesContent":["/**\n * External dependencies\n */\nimport { get, map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, feature ) {\n\treturn get( state.preferences.features, [ feature ], false );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: isFeatureActive( state, 'focusMode' ),\n\t\t\thasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\tisFeatureActive( state, 'focusMode' ),\n\t\tisFeatureActive( state, 'fixedToolbar' ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 1 ] || {};\n}\n\nfunction getPreviousEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 2 ] || {};\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the previous edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getPreviousEditedPostType( state ) {\n\treturn getPreviousEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the previous edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getPreviousEditedPostId( state ) {\n\treturn getPreviousEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part'\n\t\t);\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n"]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = isTemplateRemovable;
7
+
8
+ /**
9
+ * Check if a template is removable.
10
+ *
11
+ * @param {Object} template The template entity to check.
12
+ * @return {boolean} Whether the template is revertable.
13
+ */
14
+ function isTemplateRemovable(template) {
15
+ if (!template) {
16
+ return false;
17
+ }
18
+
19
+ return template.source === 'custom' && !template.has_theme_file;
20
+ }
21
+ //# sourceMappingURL=is-template-removable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/utils/is-template-removable.js"],"names":["isTemplateRemovable","template","source","has_theme_file"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAT,CAA8BC,QAA9B,EAAyC;AACvD,MAAK,CAAEA,QAAP,EAAkB;AACjB,WAAO,KAAP;AACA;;AAED,SAAOA,QAAQ,CAACC,MAAT,KAAoB,QAApB,IAAgC,CAAED,QAAQ,CAACE,cAAlD;AACA","sourcesContent":["/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\n\treturn template.source === 'custom' && ! template.has_theme_file;\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { useSelect } from '@wordpress/data';
7
+ import { store as coreStore } from '@wordpress/core-data';
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+
12
+ import NewTemplate from './new-template';
13
+ import NewTemplatePart from './new-template-part';
14
+ export default function AddNewTemplate(_ref) {
15
+ let {
16
+ templateType = 'wp_template'
17
+ } = _ref;
18
+ const postType = useSelect(select => select(coreStore).getPostType(templateType), [templateType]);
19
+
20
+ if (!postType) {
21
+ return null;
22
+ }
23
+
24
+ if (templateType === 'wp_template') {
25
+ return createElement(NewTemplate, {
26
+ postType: postType
27
+ });
28
+ } else if (templateType === 'wp_template_part') {
29
+ return createElement(NewTemplatePart, {
30
+ postType: postType
31
+ });
32
+ }
33
+
34
+ return null;
35
+ }
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"names":["useSelect","store","coreStore","NewTemplate","NewTemplatePart","AddNewTemplate","templateType","postType","select","getPostType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AAEA,eAAe,SAASC,cAAT,OAA4D;AAAA,MAAnC;AAAEC,IAAAA,YAAY,GAAG;AAAjB,GAAmC;AAC1E,QAAMC,QAAQ,GAAGP,SAAS,CACvBQ,MAAF,IAAcA,MAAM,CAAEN,SAAF,CAAN,CAAoBO,WAApB,CAAiCH,YAAjC,CADW,EAEzB,CAAEA,YAAF,CAFyB,CAA1B;;AAKA,MAAK,CAAEC,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,MAAKD,YAAY,KAAK,aAAtB,EAAsC;AACrC,WAAO,cAAC,WAAD;AAAa,MAAA,QAAQ,EAAGC;AAAxB,MAAP;AACA,GAFD,MAEO,IAAKD,YAAY,KAAK,kBAAtB,EAA2C;AACjD,WAAO,cAAC,eAAD;AAAiB,MAAA,QAAQ,EAAGC;AAA5B,MAAP;AACA;;AAED,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport NewTemplate from './new-template';\nimport NewTemplatePart from './new-template-part';\n\nexport default function AddNewTemplate( { templateType = 'wp_template' } ) {\n\tconst postType = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( templateType ),\n\t\t[ templateType ]\n\t);\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\tif ( templateType === 'wp_template' ) {\n\t\treturn <NewTemplate postType={ postType } />;\n\t} else if ( templateType === 'wp_template_part' ) {\n\t\treturn <NewTemplatePart postType={ postType } />;\n\t}\n\n\treturn null;\n}\n"]}
@@ -0,0 +1,65 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { kebabCase } from 'lodash';
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+
11
+ import { useState } from '@wordpress/element';
12
+ import { Button } from '@wordpress/components';
13
+ import { addQueryArgs } from '@wordpress/url';
14
+ import apiFetch from '@wordpress/api-fetch';
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+
19
+ import CreateTemplatePartModal from '../create-template-part-modal';
20
+ export default function NewTemplatePart(_ref) {
21
+ let {
22
+ postType
23
+ } = _ref;
24
+ const [isModalOpen, setIsModalOpen] = useState(false);
25
+
26
+ async function createTemplatePart(_ref2) {
27
+ let {
28
+ title,
29
+ area
30
+ } = _ref2;
31
+
32
+ if (!title) {
33
+ return;
34
+ }
35
+
36
+ const templatePart = await apiFetch({
37
+ path: '/wp/v2/template-parts',
38
+ method: 'POST',
39
+ data: {
40
+ slug: kebabCase(title),
41
+ title,
42
+ content: '',
43
+ area
44
+ }
45
+ }); // Navigate to the created template part editor.
46
+
47
+ window.location.href = addQueryArgs(window.location.href, {
48
+ postId: templatePart.id,
49
+ postType: 'wp_template_part'
50
+ }); // Wait for async navigation to happen before closing the modal.
51
+
52
+ await new Promise(() => {});
53
+ }
54
+
55
+ return createElement(Fragment, null, createElement(Button, {
56
+ variant: "primary",
57
+ onClick: () => {
58
+ setIsModalOpen(true);
59
+ }
60
+ }, postType.labels.add_new), isModalOpen && createElement(CreateTemplatePartModal, {
61
+ closeModal: () => setIsModalOpen(false),
62
+ onCreate: createTemplatePart
63
+ }));
64
+ }
65
+ //# sourceMappingURL=new-template-part.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["kebabCase","useState","Button","addQueryArgs","apiFetch","CreateTemplatePartModal","NewTemplatePart","postType","isModalOpen","setIsModalOpen","createTemplatePart","title","area","templatePart","path","method","data","slug","content","window","location","href","postId","id","Promise","labels","add_new"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACvD,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCR,QAAQ,CAAE,KAAF,CAAhD;;AAEA,iBAAeS,kBAAf,QAAqD;AAAA,QAAlB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAkB;;AACpD,QAAK,CAAED,KAAP,EAAe;AACd;AACA;;AAED,UAAME,YAAY,GAAG,MAAMT,QAAQ,CAAE;AACpCU,MAAAA,IAAI,EAAE,uBAD8B;AAEpCC,MAAAA,MAAM,EAAE,MAF4B;AAGpCC,MAAAA,IAAI,EAAE;AACLC,QAAAA,IAAI,EAAEjB,SAAS,CAAEW,KAAF,CADV;AAELA,QAAAA,KAFK;AAGLO,QAAAA,OAAO,EAAE,EAHJ;AAILN,QAAAA;AAJK;AAH8B,KAAF,CAAnC,CALoD,CAgBpD;;AACAO,IAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuBlB,YAAY,CAAEgB,MAAM,CAACC,QAAP,CAAgBC,IAAlB,EAAwB;AAC1DC,MAAAA,MAAM,EAAET,YAAY,CAACU,EADqC;AAE1DhB,MAAAA,QAAQ,EAAE;AAFgD,KAAxB,CAAnC,CAjBoD,CAsBpD;;AACA,UAAM,IAAIiB,OAAJ,CAAa,MAAM,CAAE,CAArB,CAAN;AACA;;AAED,SACC,8BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACff,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMGF,QAAQ,CAACkB,MAAT,CAAgBC,OANnB,CADD,EASGlB,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAMC,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGC;AAFZ,IAVF,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function NewTemplatePart( { postType } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst templatePart = await apiFetch( {\n\t\t\tpath: '/wp/v2/template-parts',\n\t\t\tmethod: 'POST',\n\t\t\tdata: {\n\t\t\t\tslug: kebabCase( title ),\n\t\t\t\ttitle,\n\t\t\t\tcontent: '',\n\t\t\t\tarea,\n\t\t\t},\n\t\t} );\n\n\t\t// Navigate to the created template part editor.\n\t\twindow.location.href = addQueryArgs( window.location.href, {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: 'wp_template_part',\n\t\t} );\n\n\t\t// Wait for async navigation to happen before closing the modal.\n\t\tawait new Promise( () => {} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,97 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { filter, find, includes, map } from 'lodash';
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+
11
+ import { DropdownMenu, MenuGroup, MenuItem, NavigableMenu } from '@wordpress/components';
12
+ import { useSelect } from '@wordpress/data';
13
+ import { store as coreStore } from '@wordpress/core-data';
14
+ import { store as editorStore } from '@wordpress/editor';
15
+ import { addQueryArgs } from '@wordpress/url';
16
+ import apiFetch from '@wordpress/api-fetch';
17
+ const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'archive', 'search', '404', 'index'];
18
+ export default function NewTemplate(_ref) {
19
+ let {
20
+ postType
21
+ } = _ref;
22
+ const {
23
+ templates,
24
+ defaultTemplateTypes
25
+ } = useSelect(select => ({
26
+ templates: select(coreStore).getEntityRecords('postType', 'wp_template'),
27
+ defaultTemplateTypes: select(editorStore).__experimentalGetDefaultTemplateTypes()
28
+ }), []);
29
+
30
+ async function createTemplate(_ref2) {
31
+ let {
32
+ slug
33
+ } = _ref2;
34
+ const {
35
+ title,
36
+ description
37
+ } = find(defaultTemplateTypes, {
38
+ slug
39
+ });
40
+ const template = await apiFetch({
41
+ path: '/wp/v2/templates',
42
+ method: 'POST',
43
+ data: {
44
+ excerpt: description,
45
+ // Slugs need to be strings, so this is for template `404`
46
+ slug: slug.toString(),
47
+ status: 'publish',
48
+ title
49
+ }
50
+ }); // Navigate to the created template editor.
51
+
52
+ window.location.href = addQueryArgs(window.location.href, {
53
+ postId: template.id,
54
+ postType: 'wp_template'
55
+ });
56
+ }
57
+
58
+ const existingTemplateSlugs = map(templates, 'slug');
59
+ const missingTemplates = filter(defaultTemplateTypes, template => includes(DEFAULT_TEMPLATE_SLUGS, template.slug) && !includes(existingTemplateSlugs, template.slug));
60
+
61
+ if (!missingTemplates.length) {
62
+ return null;
63
+ }
64
+
65
+ return createElement(DropdownMenu, {
66
+ className: "edit-site-new-template-dropdown",
67
+ icon: null,
68
+ text: postType.labels.add_new,
69
+ label: postType.labels.add_new_item,
70
+ popoverProps: {
71
+ noArrow: false
72
+ },
73
+ toggleProps: {
74
+ variant: 'primary'
75
+ }
76
+ }, () => createElement(NavigableMenu, {
77
+ className: "edit-site-new-template-dropdown__popover"
78
+ }, createElement(MenuGroup, {
79
+ label: postType.labels.add_new_item
80
+ }, map(missingTemplates, _ref3 => {
81
+ let {
82
+ title,
83
+ description,
84
+ slug
85
+ } = _ref3;
86
+ return createElement(MenuItem, {
87
+ info: description,
88
+ key: slug,
89
+ onClick: () => {
90
+ createTemplate({
91
+ slug
92
+ }); // We will be navigated way so no need to close the dropdown.
93
+ }
94
+ }, title);
95
+ }))));
96
+ }
97
+ //# sourceMappingURL=new-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["filter","find","includes","map","DropdownMenu","MenuGroup","MenuItem","NavigableMenu","useSelect","store","coreStore","editorStore","addQueryArgs","apiFetch","DEFAULT_TEMPLATE_SLUGS","NewTemplate","postType","templates","defaultTemplateTypes","select","getEntityRecords","__experimentalGetDefaultTemplateTypes","createTemplate","slug","title","description","template","path","method","data","excerpt","toString","status","window","location","href","postId","id","existingTemplateSlugs","missingTemplates","length","labels","add_new","add_new_item","noArrow","variant"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,IAAjB,EAAuBC,QAAvB,EAAiCC,GAAjC,QAA4C,QAA5C;AAEA;AACA;AACA;;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,uBALP;AAMA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAEA,MAAMC,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,aAF8B,EAG9B,MAH8B,EAI9B,SAJ8B,EAK9B,QAL8B,EAM9B,KAN8B,EAO9B,OAP8B,CAA/B;AAUA,eAAe,SAASC,WAAT,OAAqC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAsCV,SAAS,CAClDW,MAAF,KAAgB;AACfF,IAAAA,SAAS,EAAEE,MAAM,CAAET,SAAF,CAAN,CAAoBU,gBAApB,CACV,UADU,EAEV,aAFU,CADI;AAKfF,IAAAA,oBAAoB,EAAEC,MAAM,CAC3BR,WAD2B,CAAN,C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AA,IAAI,EAAGxB,QAAQ,CAACyB,MAAT,CAAgBC,OAHxB;AAIC,IAAA,KAAK,EAAG1B,QAAQ,CAACyB,MAAT,CAAgBE,YAJzB;AAKC,IAAA,YAAY,EAAG;AACdC,MAAAA,OAAO,EAAE;AADK,KALhB;AAQC,IAAA,WAAW,EAAG;AACbC,MAAAA,OAAO,EAAE;AADI;AARf,KAYG,MACD,cAAC,aAAD;AAAe,IAAA,SAAS,EAAC;AAAzB,KACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAG7B,QAAQ,CAACyB,MAAT,CAAgBE;AAAnC,KACGxC,GAAG,CACJoC,gBADI,EAEJ;AAAA,QAAE;AAAEf,MAAAA,KAAF;AAASC,MAAAA,WAAT;AAAsBF,MAAAA;AAAtB,KAAF;AAAA,WACC,cAAC,QAAD;AACC,MAAA,IAAI,EAAGE,WADR;AAEC,MAAA,GAAG,EAAGF,IAFP;AAGC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,cAAc,CAAE;AAAEC,UAAAA;AAAF,SAAF,CAAd,CADe,CAEf;AACA;AANF,OAQGC,KARH,CADD;AAAA,GAFI,CADN,CADD,CAbF,CADD;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, find, includes, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'single-post',\n\t'page',\n\t'archive',\n\t'search',\n\t'404',\n\t'index',\n];\n\nexport default function NewTemplate( { postType } ) {\n\tconst { templates, defaultTemplateTypes } = useSelect(\n\t\t( select ) => ( {\n\t\t\ttemplates: select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template'\n\t\t\t),\n\t\t\tdefaultTemplateTypes: select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplateTypes(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tasync function createTemplate( { slug } ) {\n\t\tconst { title, description } = find( defaultTemplateTypes, { slug } );\n\n\t\tconst template = await apiFetch( {\n\t\t\tpath: '/wp/v2/templates',\n\t\t\tmethod: 'POST',\n\t\t\tdata: {\n\t\t\t\texcerpt: description,\n\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\tslug: slug.toString(),\n\t\t\t\tstatus: 'publish',\n\t\t\t\ttitle,\n\t\t\t},\n\t\t} );\n\n\t\t// Navigate to the created template editor.\n\t\twindow.location.href = addQueryArgs( window.location.href, {\n\t\t\tpostId: template.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t}\n\n\tconst existingTemplateSlugs = map( templates, 'slug' );\n\n\tconst missingTemplates = filter(\n\t\tdefaultTemplateTypes,\n\t\t( template ) =>\n\t\t\tincludes( DEFAULT_TEMPLATE_SLUGS, template.slug ) &&\n\t\t\t! includes( existingTemplateSlugs, template.slug )\n\t);\n\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\ticon={ null }\n\t\t\ttext={ postType.labels.add_new }\n\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\tpopoverProps={ {\n\t\t\t\tnoArrow: false,\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\tvariant: 'primary',\n\t\t\t} }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<NavigableMenu className=\"edit-site-new-template-dropdown__popover\">\n\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t{ map(\n\t\t\t\t\t\t\tmissingTemplates,\n\t\t\t\t\t\t\t( { title, description, slug } ) => (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tinfo={ description }\n\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tcreateTemplate( { slug } );\n\t\t\t\t\t\t\t\t\t\t// We will be navigated way so no need to close the dropdown.\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</NavigableMenu>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
@@ -16,9 +16,10 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
16
16
  import { store as editSiteStore } from '../../store';
17
17
  import { STORE_NAME } from '../../store/constants';
18
18
  import { SIDEBAR_BLOCK } from '../sidebar/constants';
19
- export default function BlockInspectorButton({
20
- onClick = () => {}
21
- }) {
19
+ export default function BlockInspectorButton(_ref) {
20
+ let {
21
+ onClick = () => {}
22
+ } = _ref;
22
23
  const {
23
24
  shortcut,
24
25
  isBlockInspectorOpen
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/block-inspector-button.js"],"names":["__","speak","MenuItem","useSelect","useDispatch","store","interfaceStore","keyboardShortcutsStore","editSiteStore","STORE_NAME","SIDEBAR_BLOCK","BlockInspectorButton","onClick","shortcut","isBlockInspectorOpen","select","getShortcutRepresentation","getActiveComplementaryArea","name","enableComplementaryArea","disableComplementaryArea","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAw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ependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { STORE_NAME } from '../../store/constants';\nimport { SIDEBAR_BLOCK } from '../sidebar/constants';\n\nexport default function BlockInspectorButton( { onClick = () => {} } ) {\n\tconst { shortcut, isBlockInspectorOpen } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-block-settings-sidebar'\n\t\t\t),\n\t\t\tisBlockInspectorOpen:\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditSiteStore.name\n\t\t\t\t) === SIDEBAR_BLOCK,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { enableComplementaryArea, disableComplementaryArea } = useDispatch(\n\t\tinterfaceStore\n\t);\n\n\tconst label = isBlockInspectorOpen\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isBlockInspectorOpen ) {\n\t\t\t\t\tdisableComplementaryArea( STORE_NAME );\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Close dropdown menu.\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/block-inspector-button.js"],"names":["__","speak","MenuItem","useSelect","useDispatch","store","interfaceStore","keyboardShortcutsStore","editSiteStore","STORE_NAME","SIDEBAR_BLOCK","BlockInspectorButton","onClick","shortcut","isBlockInspectorOpen","select","getShortcutRepresentation","getActiveComplementaryArea","name","enableComplementaryArea","disableComplementaryArea","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AACA,SAASC,UAAT,QAA2B,uBAA3B;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA,eAAe,SAASC,oBAAT,OAAwD;AAAA,MAAzB;AAAEC,IAAAA,OAAO,GAAG,MAAM,CAAE;AAApB,GAAyB;AACtE,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqCX,SAAS,CACjDY,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CACfR,sBADe,CAAN,CAERS,yBAFQ,CAGT,8CAHS,CADK;AAMfF,IAAAA,oBAAoB,EACnBC,MAAM,CAAET,cAAF,CAAN,CAAyBW,0BAAzB,CACCT,aAAa,CAACU,IADf,MAEMR;AATQ,GAAhB,CADmD,EAYnD,EAZmD,CAApD;AAcA,QAAM;AAAES,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MAAwDhB,WAAW,CACxEE,cADwE,CAAzE;AAIA,QAAMe,KAAK,GAAGP,oBAAoB,GAC/Bd,EAAE,CAAE,oBAAF,CAD6B,GAE/BA,EAAE,CAAE,oBAAF,CAFL;AAIA,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKc,oBAAL,EAA4B;AAC3BM,QAAAA,wBAAwB,CAAEX,UAAF,CAAxB;AACAR,QAAAA,KAAK,CAAED,EAAE,CAAE,uBAAF,CAAJ,CAAL;AACA,OAHD,MAGO;AACNmB,QAAAA,uBAAuB,CAAEV,UAAF,EAAcC,aAAd,CAAvB;AACAT,QAAAA,KAAK,CACJD,EAAE,CACD,4EADC,CADE,CAAL;AAKA,OAXc,CAYf;;;AACAY,MAAAA,OAAO;AACP,KAfF;AAgBC,IAAA,QAAQ,EAAGC;AAhBZ,KAkBGQ,KAlBH,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { STORE_NAME } from '../../store/constants';\nimport { SIDEBAR_BLOCK } from '../sidebar/constants';\n\nexport default function BlockInspectorButton( { onClick = () => {} } ) {\n\tconst { shortcut, isBlockInspectorOpen } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-block-settings-sidebar'\n\t\t\t),\n\t\t\tisBlockInspectorOpen:\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditSiteStore.name\n\t\t\t\t) === SIDEBAR_BLOCK,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { enableComplementaryArea, disableComplementaryArea } = useDispatch(\n\t\tinterfaceStore\n\t);\n\n\tconst label = isBlockInspectorOpen\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isBlockInspectorOpen ) {\n\t\t\t\t\tdisableComplementaryArea( STORE_NAME );\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Close dropdown menu.\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
@@ -31,9 +31,10 @@ const LAYOUT = {
31
31
  // At the root level of the site editor, no alignments should be allowed.
32
32
  alignments: []
33
33
  };
34
- export default function BlockEditor({
35
- setIsInserterOpen
36
- }) {
34
+ export default function BlockEditor(_ref) {
35
+ let {
36
+ setIsInserterOpen
37
+ } = _ref;
37
38
  const {
38
39
  settings,
39
40
  templateType,
@@ -94,10 +95,13 @@ export default function BlockEditor({
94
95
  }, createElement(BlockList, {
95
96
  className: "edit-site-block-editor__block-list wp-site-blocks",
96
97
  __experimentalLayout: LAYOUT
97
- })), createElement(__unstableBlockSettingsMenuFirstItem, null, ({
98
- onClose
99
- }) => createElement(BlockInspectorButton, {
100
- onClick: onClose
101
- }))));
98
+ })), createElement(__unstableBlockSettingsMenuFirstItem, null, _ref2 => {
99
+ let {
100
+ onClose
101
+ } = _ref2;
102
+ return createElement(BlockInspectorButton, {
103
+ onClick: onClose
104
+ });
105
+ })));
102
106
  }
103
107
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useRef","useEntityBlockEditor","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","store","blockEditorStore","useMergeRefs","useViewportMatch","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","EditTemplatePartMenuButton","BackButton","ResizableEditor","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","fillProps","event","target","currentTarget","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,yBAHD,EAICC,cAJD,EAKCC,UALD,EAMCC,oCAND,EAOCC,2BAA2B,IAAIC,iBAPhC,EAQCC,KAAK,IAAIC,gBARV,QASO,yBATP;AAUA,SAASC,YAAT,EAAuBC,gBAAvB,QAA+C,oBAA/C;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,aAAvC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,0BAAP,MAAuC,mCAAvC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;AAMA,eAAe,SAASC,WAAT,CAAsB;AAAEC,EAA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D,EAQC,cAAC,qBAAD,OARD,EASC,cAAC,yBAAD,CAA2B,UAA3B,QACGvC,WAAW,CACV8C,SAAF,IACC,cAAC,cAAD,eACMA,SADN;AAEC,IAAA,UAAU,EAAGf,IAFd;AAGC,IAAA,kBAAkB,EAAGS;AAHtB,KAFW,EAQZ,CAAET,IAAF,CARY,CADd,CATD,EAqBC,cAAC,oBAAD,QACC,cAAC,cAAD,OADD,CArBD,EAwBC,cAAC,UAAD;AACC,IAAA,SAAS,EAAGlC,UAAU,CAAE,yBAAF,EAA6B;AAClD,uBAAiBgD;AADiC,KAA7B,CADvB;AAIC,IAAA,oBAAoB,EAAGJ,UAJxB;AAKC,IAAA,OAAO,EAAKM,KAAF,IAAa;AACtB;AACA,UAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3CL,QAAAA,kBAAkB;AAClB;AACD;AAVF,KAYC,cAAC,UAAD,OAZD,EAcC,cAAC,eAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGd,UAFP;AAGC,IAAA,cAAc,EACbe,cAAc,IACd;AACA,KAAEF,gBANJ;AAQC,IAAA,QAAQ,EAAGf,QARZ;AASC,IAAA,UAAU,EAAGc;AATd,KAWC,cAAC,SAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAGnB;AAFxB,IAXD,CAdD,EA+BC,cAAC,oCAAD,QACG,CAAE;AAAE2B,IAAAA;AAAF,GAAF,KACD,cAAC,oBAAD;AAAsB,IAAA,OAAO,EAAGA;AAAhC,IAFF,CA/BD,CAxBD,CADD;AAgEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BackButton />\n\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useRef","useEntityBlockEditor","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","store","blockEditorStore","useMergeRefs","useViewportMatch","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","EditTemplatePartMenuButton","BackButton","ResizableEditor","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","fillProps","event","target","currentTarget","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,yBAHD,EAICC,cAJD,EAKCC,UALD,EAMCC,oCAND,EAOCC,2BAA2B,IAAIC,iBAPhC,EAQCC,KAAK,IAAIC,gBARV,QASO,yBATP;AAUA,SAASC,YAAT,EAAuBC,gBAAvB,QAA+C,oBAA/C;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,aAAvC;AACA,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A,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,CAxBD,CADD;AAgEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BackButton />\n\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
@@ -32,11 +32,12 @@ const HANDLE_STYLES_OVERRIDE = {
32
32
  left: undefined
33
33
  };
34
34
 
35
- function ResizableEditor({
36
- enableResizing,
37
- settings,
38
- ...props
39
- }) {
35
+ function ResizableEditor(_ref) {
36
+ let {
37
+ enableResizing,
38
+ settings,
39
+ ...props
40
+ } = _ref;
40
41
  const deviceType = useSelect(select => select(editSiteStore).__experimentalGetPreviewDeviceType(), []);
41
42
  const deviceStyles = useResizeCanvas(deviceType);
42
43
  const [width, setWidth] = useState(DEFAULT_STYLES.width);