@wordpress/edit-site 5.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
  4. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  5. package/build/components/add-new-template/add-custom-template-modal.js +0 -1
  6. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  7. package/build/components/add-new-template/new-template-part.js +5 -9
  8. package/build/components/add-new-template/new-template-part.js.map +1 -1
  9. package/build/components/app/index.js +2 -7
  10. package/build/components/app/index.js.map +1 -1
  11. package/build/components/block-editor/editor-canvas.js +0 -1
  12. package/build/components/block-editor/editor-canvas.js.map +1 -1
  13. package/build/components/block-editor/index.js +25 -59
  14. package/build/components/block-editor/index.js.map +1 -1
  15. package/build/components/block-editor/inserter-media-categories.js +237 -0
  16. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  17. package/build/components/block-editor/resize-handle.js +2 -1
  18. package/build/components/block-editor/resize-handle.js.map +1 -1
  19. package/build/components/canvas-spinner/index.js +20 -0
  20. package/build/components/canvas-spinner/index.js.map +1 -0
  21. package/build/components/create-template-part-modal/index.js +4 -2
  22. package/build/components/create-template-part-modal/index.js.map +1 -1
  23. package/build/components/editor/index.js +4 -2
  24. package/build/components/editor/index.js.map +1 -1
  25. package/build/components/error-boundary/index.js +2 -12
  26. package/build/components/error-boundary/index.js.map +1 -1
  27. package/build/components/error-boundary/warning.js +5 -28
  28. package/build/components/error-boundary/warning.js.map +1 -1
  29. package/build/components/global-styles/block-preview-panel.js +10 -4
  30. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  31. package/build/components/global-styles/border-panel.js +18 -9
  32. package/build/components/global-styles/border-panel.js.map +1 -1
  33. package/build/components/global-styles/color-palette-panel.js +13 -7
  34. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  35. package/build/components/global-styles/context-menu.js +47 -4
  36. package/build/components/global-styles/context-menu.js.map +1 -1
  37. package/build/components/global-styles/custom-css.js +65 -14
  38. package/build/components/global-styles/custom-css.js.map +1 -1
  39. package/build/components/global-styles/dimensions-panel.js +50 -27
  40. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  41. package/build/components/global-styles/global-styles-provider.js +13 -3
  42. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  43. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  44. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  45. package/build/components/global-styles/hooks.js +21 -142
  46. package/build/components/global-styles/hooks.js.map +1 -1
  47. package/build/components/global-styles/index.js +0 -28
  48. package/build/components/global-styles/index.js.map +1 -1
  49. package/build/components/global-styles/palette.js +11 -4
  50. package/build/components/global-styles/palette.js.map +1 -1
  51. package/build/components/global-styles/preview.js +18 -15
  52. package/build/components/global-styles/preview.js.map +1 -1
  53. package/build/components/global-styles/screen-background-color.js +28 -13
  54. package/build/components/global-styles/screen-background-color.js.map +1 -1
  55. package/build/components/global-styles/screen-block-list.js +4 -1
  56. package/build/components/global-styles/screen-block-list.js.map +1 -1
  57. package/build/components/global-styles/screen-border.js +16 -4
  58. package/build/components/global-styles/screen-border.js.map +1 -1
  59. package/build/components/global-styles/screen-button-color.js +17 -9
  60. package/build/components/global-styles/screen-button-color.js.map +1 -1
  61. package/build/components/global-styles/screen-colors.js +59 -26
  62. package/build/components/global-styles/screen-colors.js.map +1 -1
  63. package/build/components/global-styles/screen-css.js +20 -8
  64. package/build/components/global-styles/screen-css.js.map +1 -1
  65. package/build/components/global-styles/screen-heading-color.js +24 -16
  66. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  67. package/build/components/global-styles/screen-layout.js +9 -3
  68. package/build/components/global-styles/screen-layout.js.map +1 -1
  69. package/build/components/global-styles/screen-link-color.js +19 -11
  70. package/build/components/global-styles/screen-link-color.js.map +1 -1
  71. package/build/components/global-styles/screen-root.js +25 -9
  72. package/build/components/global-styles/screen-root.js.map +1 -1
  73. package/build/components/global-styles/screen-style-variations.js +8 -4
  74. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  75. package/build/components/global-styles/screen-text-color.js +15 -7
  76. package/build/components/global-styles/screen-text-color.js.map +1 -1
  77. package/build/components/global-styles/screen-typography.js +23 -11
  78. package/build/components/global-styles/screen-typography.js.map +1 -1
  79. package/build/components/global-styles/screen-variations.js +71 -0
  80. package/build/components/global-styles/screen-variations.js.map +1 -0
  81. package/build/components/global-styles/shadow-panel.js +196 -0
  82. package/build/components/global-styles/shadow-panel.js.map +1 -0
  83. package/build/components/global-styles/typography-panel.js +37 -22
  84. package/build/components/global-styles/typography-panel.js.map +1 -1
  85. package/build/components/global-styles/typography-preview.js +19 -9
  86. package/build/components/global-styles/typography-preview.js.map +1 -1
  87. package/build/components/global-styles/ui.js +139 -21
  88. package/build/components/global-styles/ui.js.map +1 -1
  89. package/build/components/global-styles/utils.js +8 -290
  90. package/build/components/global-styles/utils.js.map +1 -1
  91. package/build/components/global-styles/variations-panel.js +85 -0
  92. package/build/components/global-styles/variations-panel.js.map +1 -0
  93. package/build/components/global-styles-renderer/index.js +7 -5
  94. package/build/components/global-styles-renderer/index.js.map +1 -1
  95. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  96. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  97. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  98. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  99. package/build/components/layout/index.js +86 -15
  100. package/build/components/layout/index.js.map +1 -1
  101. package/build/components/list/actions/rename-menu-item.js +8 -11
  102. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  103. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
  104. package/build/components/navigation-inspector/index.js.map +1 -0
  105. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
  106. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  107. package/build/components/sidebar/index.js +3 -1
  108. package/build/components/sidebar/index.js.map +1 -1
  109. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  110. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  111. package/build/components/sidebar-edit-mode/index.js +1 -14
  112. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  113. package/build/components/sidebar-navigation-screen/index.js +3 -2
  114. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  115. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  116. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  117. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
  118. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  119. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  120. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  121. package/build/components/site-hub/index.js +11 -11
  122. package/build/components/site-hub/index.js.map +1 -1
  123. package/build/components/site-icon/index.js +1 -1
  124. package/build/components/site-icon/index.js.map +1 -1
  125. package/build/components/style-book/index.js +7 -4
  126. package/build/components/style-book/index.js.map +1 -1
  127. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
  128. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
  129. package/build/components/template-details/edit-template-title.js +1 -0
  130. package/build/components/template-details/edit-template-title.js.map +1 -1
  131. package/build/components/template-details/template-part-area-selector.js +1 -0
  132. package/build/components/template-details/template-part-area-selector.js.map +1 -1
  133. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  134. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  135. package/build/experiments.js +19 -0
  136. package/build/experiments.js.map +1 -0
  137. package/build/hooks/push-changes-to-global-styles/index.js +68 -9
  138. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  139. package/build/index.js +53 -60
  140. package/build/index.js.map +1 -1
  141. package/build/store/reducer.js +1 -1
  142. package/build/store/reducer.js.map +1 -1
  143. package/build/store/selectors.js +7 -27
  144. package/build/store/selectors.js.map +1 -1
  145. package/build/store/utils.js +77 -0
  146. package/build/store/utils.js.map +1 -0
  147. package/build/utils/template-part-create.js +71 -0
  148. package/build/utils/template-part-create.js.map +1 -0
  149. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  150. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  151. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  152. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  153. package/build-module/components/add-new-template/new-template-part.js +5 -9
  154. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  155. package/build-module/components/app/index.js +2 -7
  156. package/build-module/components/app/index.js.map +1 -1
  157. package/build-module/components/block-editor/editor-canvas.js +0 -1
  158. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  159. package/build-module/components/block-editor/index.js +27 -57
  160. package/build-module/components/block-editor/index.js.map +1 -1
  161. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  162. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  163. package/build-module/components/block-editor/resize-handle.js +2 -1
  164. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  165. package/build-module/components/canvas-spinner/index.js +12 -0
  166. package/build-module/components/canvas-spinner/index.js.map +1 -0
  167. package/build-module/components/create-template-part-modal/index.js +5 -3
  168. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  169. package/build-module/components/editor/index.js +3 -2
  170. package/build-module/components/editor/index.js.map +1 -1
  171. package/build-module/components/error-boundary/index.js +2 -12
  172. package/build-module/components/error-boundary/index.js.map +1 -1
  173. package/build-module/components/error-boundary/warning.js +5 -28
  174. package/build-module/components/error-boundary/warning.js.map +1 -1
  175. package/build-module/components/global-styles/block-preview-panel.js +10 -4
  176. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  177. package/build-module/components/global-styles/border-panel.js +18 -11
  178. package/build-module/components/global-styles/border-panel.js.map +1 -1
  179. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  180. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  181. package/build-module/components/global-styles/context-menu.js +46 -8
  182. package/build-module/components/global-styles/context-menu.js.map +1 -1
  183. package/build-module/components/global-styles/custom-css.js +61 -15
  184. package/build-module/components/global-styles/custom-css.js.map +1 -1
  185. package/build-module/components/global-styles/dimensions-panel.js +50 -28
  186. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  187. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  188. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  189. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  190. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  191. package/build-module/components/global-styles/hooks.js +23 -134
  192. package/build-module/components/global-styles/hooks.js.map +1 -1
  193. package/build-module/components/global-styles/index.js +0 -2
  194. package/build-module/components/global-styles/index.js.map +1 -1
  195. package/build-module/components/global-styles/palette.js +10 -5
  196. package/build-module/components/global-styles/palette.js.map +1 -1
  197. package/build-module/components/global-styles/preview.js +18 -14
  198. package/build-module/components/global-styles/preview.js.map +1 -1
  199. package/build-module/components/global-styles/screen-background-color.js +27 -15
  200. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  201. package/build-module/components/global-styles/screen-block-list.js +3 -1
  202. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  203. package/build-module/components/global-styles/screen-border.js +14 -4
  204. package/build-module/components/global-styles/screen-border.js.map +1 -1
  205. package/build-module/components/global-styles/screen-button-color.js +17 -11
  206. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  207. package/build-module/components/global-styles/screen-colors.js +56 -27
  208. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  209. package/build-module/components/global-styles/screen-css.js +21 -9
  210. package/build-module/components/global-styles/screen-css.js.map +1 -1
  211. package/build-module/components/global-styles/screen-heading-color.js +24 -18
  212. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  213. package/build-module/components/global-styles/screen-layout.js +8 -3
  214. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  215. package/build-module/components/global-styles/screen-link-color.js +19 -13
  216. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  217. package/build-module/components/global-styles/screen-root.js +23 -9
  218. package/build-module/components/global-styles/screen-root.js.map +1 -1
  219. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  220. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  221. package/build-module/components/global-styles/screen-text-color.js +15 -9
  222. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  223. package/build-module/components/global-styles/screen-typography.js +19 -10
  224. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  225. package/build-module/components/global-styles/screen-variations.js +54 -0
  226. package/build-module/components/global-styles/screen-variations.js.map +1 -0
  227. package/build-module/components/global-styles/shadow-panel.js +177 -0
  228. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  229. package/build-module/components/global-styles/typography-panel.js +37 -24
  230. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  231. package/build-module/components/global-styles/typography-preview.js +17 -9
  232. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  233. package/build-module/components/global-styles/ui.js +132 -22
  234. package/build-module/components/global-styles/ui.js.map +1 -1
  235. package/build-module/components/global-styles/utils.js +7 -277
  236. package/build-module/components/global-styles/utils.js.map +1 -1
  237. package/build-module/components/global-styles/variations-panel.js +68 -0
  238. package/build-module/components/global-styles/variations-panel.js.map +1 -0
  239. package/build-module/components/global-styles-renderer/index.js +5 -5
  240. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  241. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  242. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  243. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  244. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  245. package/build-module/components/layout/index.js +86 -17
  246. package/build-module/components/layout/index.js.map +1 -1
  247. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  248. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  249. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
  250. package/build-module/components/navigation-inspector/index.js.map +1 -0
  251. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
  252. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  253. package/build-module/components/sidebar/index.js +2 -1
  254. package/build-module/components/sidebar/index.js.map +1 -1
  255. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  256. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  257. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  258. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  259. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  260. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  261. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  262. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  263. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
  264. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  265. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  266. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  267. package/build-module/components/site-hub/index.js +12 -11
  268. package/build-module/components/site-hub/index.js.map +1 -1
  269. package/build-module/components/site-icon/index.js +1 -1
  270. package/build-module/components/site-icon/index.js.map +1 -1
  271. package/build-module/components/style-book/index.js +8 -5
  272. package/build-module/components/style-book/index.js.map +1 -1
  273. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
  274. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
  275. package/build-module/components/template-details/edit-template-title.js +1 -0
  276. package/build-module/components/template-details/edit-template-title.js.map +1 -1
  277. package/build-module/components/template-details/template-part-area-selector.js +1 -0
  278. package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
  279. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  280. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  281. package/build-module/experiments.js +9 -0
  282. package/build-module/experiments.js.map +1 -0
  283. package/build-module/hooks/push-changes-to-global-styles/index.js +65 -6
  284. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  285. package/build-module/index.js +52 -60
  286. package/build-module/index.js.map +1 -1
  287. package/build-module/store/reducer.js +1 -1
  288. package/build-module/store/reducer.js.map +1 -1
  289. package/build-module/store/selectors.js +6 -26
  290. package/build-module/store/selectors.js.map +1 -1
  291. package/build-module/store/utils.js +66 -0
  292. package/build-module/store/utils.js.map +1 -0
  293. package/build-module/utils/template-part-create.js +53 -0
  294. package/build-module/utils/template-part-create.js.map +1 -0
  295. package/build-style/style-rtl.css +448 -278
  296. package/build-style/style.css +448 -278
  297. package/package.json +32 -30
  298. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  299. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  300. package/src/components/add-new-template/new-template-part.js +12 -11
  301. package/src/components/add-new-template/style.scss +0 -4
  302. package/src/components/app/index.js +2 -2
  303. package/src/components/block-editor/editor-canvas.js +0 -1
  304. package/src/components/block-editor/index.js +21 -77
  305. package/src/components/block-editor/inserter-media-categories.js +247 -0
  306. package/src/components/block-editor/resize-handle.js +6 -2
  307. package/src/components/block-editor/style.scss +55 -7
  308. package/src/components/canvas-spinner/index.js +12 -0
  309. package/src/components/canvas-spinner/style.scss +7 -0
  310. package/src/components/create-template-part-modal/index.js +75 -67
  311. package/src/components/create-template-part-modal/style.scss +0 -10
  312. package/src/components/editor/index.js +5 -3
  313. package/src/components/error-boundary/index.js +2 -10
  314. package/src/components/error-boundary/warning.js +6 -35
  315. package/src/components/global-styles/README.md +1 -75
  316. package/src/components/global-styles/block-preview-panel.js +16 -4
  317. package/src/components/global-styles/border-panel.js +22 -16
  318. package/src/components/global-styles/color-palette-panel.js +10 -7
  319. package/src/components/global-styles/context-menu.js +117 -41
  320. package/src/components/global-styles/custom-css.js +76 -19
  321. package/src/components/global-styles/dimensions-panel.js +58 -31
  322. package/src/components/global-styles/global-styles-provider.js +6 -2
  323. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  324. package/src/components/global-styles/hooks.js +31 -155
  325. package/src/components/global-styles/index.js +0 -2
  326. package/src/components/global-styles/palette.js +9 -5
  327. package/src/components/global-styles/preview.js +19 -13
  328. package/src/components/global-styles/screen-background-color.js +42 -19
  329. package/src/components/global-styles/screen-block-list.js +6 -1
  330. package/src/components/global-styles/screen-border.js +13 -5
  331. package/src/components/global-styles/screen-button-color.js +21 -19
  332. package/src/components/global-styles/screen-colors.js +66 -22
  333. package/src/components/global-styles/screen-css.js +30 -14
  334. package/src/components/global-styles/screen-heading-color.js +32 -27
  335. package/src/components/global-styles/screen-layout.js +7 -4
  336. package/src/components/global-styles/screen-link-color.js +34 -22
  337. package/src/components/global-styles/screen-root.js +24 -9
  338. package/src/components/global-styles/screen-style-variations.js +7 -2
  339. package/src/components/global-styles/screen-text-color.js +15 -15
  340. package/src/components/global-styles/screen-typography.js +34 -12
  341. package/src/components/global-styles/screen-variations.js +47 -0
  342. package/src/components/global-styles/shadow-panel.js +174 -0
  343. package/src/components/global-styles/style.scss +94 -1
  344. package/src/components/global-styles/typography-panel.js +58 -23
  345. package/src/components/global-styles/typography-preview.js +28 -9
  346. package/src/components/global-styles/ui.js +130 -17
  347. package/src/components/global-styles/utils.js +7 -330
  348. package/src/components/global-styles/variations-panel.js +78 -0
  349. package/src/components/global-styles-renderer/index.js +3 -4
  350. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  351. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  352. package/src/components/layout/index.js +116 -21
  353. package/src/components/layout/style.scss +29 -5
  354. package/src/components/list/actions/rename-menu-item.js +14 -23
  355. package/src/components/list/style.scss +0 -4
  356. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -4
  357. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  358. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +4 -17
  359. package/src/components/sidebar/index.js +2 -0
  360. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  361. package/src/components/sidebar-edit-mode/index.js +0 -11
  362. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  363. package/src/components/sidebar-navigation-item/style.scss +28 -3
  364. package/src/components/sidebar-navigation-screen/index.js +4 -3
  365. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  366. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  367. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
  368. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  369. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  370. package/src/components/site-hub/index.js +120 -109
  371. package/src/components/site-hub/style.scss +7 -1
  372. package/src/components/site-icon/index.js +1 -1
  373. package/src/components/site-icon/style.scss +2 -2
  374. package/src/components/style-book/index.js +10 -5
  375. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
  376. package/src/components/template-details/edit-template-title.js +1 -0
  377. package/src/components/template-details/template-part-area-selector.js +1 -0
  378. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  379. package/src/experiments.js +10 -0
  380. package/src/hooks/push-changes-to-global-styles/index.js +66 -8
  381. package/src/index.js +51 -59
  382. package/src/store/reducer.js +1 -1
  383. package/src/store/selectors.js +6 -26
  384. package/src/store/test/utils.js +181 -0
  385. package/src/store/utils.js +69 -0
  386. package/src/style.scss +4 -2
  387. package/src/utils/template-part-create.js +62 -0
  388. package/src/utils/test/template-part-create.js +63 -0
  389. package/build/components/global-styles/context.js +0 -22
  390. package/build/components/global-styles/context.js.map +0 -1
  391. package/build/components/global-styles/typography-utils.js +0 -92
  392. package/build/components/global-styles/typography-utils.js.map +0 -1
  393. package/build/components/global-styles/use-global-styles-output.js +0 -857
  394. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  395. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  396. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  397. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  398. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  399. package/build-module/components/global-styles/context.js +0 -12
  400. package/build-module/components/global-styles/context.js.map +0 -1
  401. package/build-module/components/global-styles/typography-utils.js +0 -84
  402. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  403. package/build-module/components/global-styles/use-global-styles-output.js +0 -815
  404. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  405. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  406. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  407. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  408. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  409. package/src/components/global-styles/context.js +0 -15
  410. package/src/components/global-styles/test/typography-utils.js +0 -393
  411. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  412. package/src/components/global-styles/test/utils.js +0 -206
  413. package/src/components/global-styles/typography-utils.js +0 -87
  414. package/src/components/global-styles/use-global-styles-output.js +0 -936
  415. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
@@ -10,9 +10,13 @@ import { store as coreDataStore } from '@wordpress/core-data';
10
10
  import { createRegistrySelector } from '@wordpress/data';
11
11
  import deprecated from '@wordpress/deprecated';
12
12
  import { uploadMedia } from '@wordpress/media-utils';
13
- import { isTemplatePart } from '@wordpress/blocks';
14
13
  import { Platform } from '@wordpress/element';
15
14
  import { store as preferencesStore } from '@wordpress/preferences';
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+
19
+ import { getFilteredTemplatePartBlocks } from './utils';
16
20
  /**
17
21
  * @typedef {'template'|'template_type'} TemplateType Template type.
18
22
  */
@@ -242,37 +246,13 @@ export function isSaveViewOpened(state) {
242
246
  */
243
247
 
244
248
  export const getCurrentTemplateTemplateParts = createRegistrySelector(select => state => {
245
- var _template$blocks;
246
-
247
249
  const templateType = getEditedPostType(state);
248
250
  const templateId = getEditedPostId(state);
249
251
  const template = select(coreDataStore).getEditedEntityRecord('postType', templateType, templateId);
250
252
  const templateParts = select(coreDataStore).getEntityRecords('postType', 'wp_template_part', {
251
253
  per_page: -1
252
254
  });
253
- const templatePartsById = templateParts ? // Key template parts by their ID.
254
- templateParts.reduce((newTemplateParts, part) => ({ ...newTemplateParts,
255
- [part.id]: part
256
- }), {}) : {};
257
- return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => isTemplatePart(block)).map(block => {
258
- const {
259
- attributes: {
260
- theme,
261
- slug
262
- }
263
- } = block;
264
- const templatePartId = `${theme}//${slug}`;
265
- const templatePart = templatePartsById[templatePartId];
266
- return {
267
- templatePart,
268
- block
269
- };
270
- }).filter(_ref3 => {
271
- let {
272
- templatePart
273
- } = _ref3;
274
- return !!templatePart;
275
- });
255
+ return getFilteredTemplatePartBlocks(template.blocks, templateParts);
276
256
  });
277
257
  /**
278
258
  * Returns the current editing mode.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","isTemplatePart","Platform","preferencesStore","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateType","templateId","template","getEditedEntityRecord","templateParts","templatePartsById","reduce","newTemplateParts","part","blocks","filter","block","map","attributes","theme","slug","templatePartId","templatePart","getEditorMode","__unstableGetCanvasMode","canvasMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GAAGN,sBAAsB,CAC1DO,MAAF,IAAc,CAAEC,KAAF,EAASC,IAAT,KACbF,MAAM,CAAEF,gBAAF,CAAN,CAA2BK,GAA3B,CAAgC,gBAAhC,EAAkDD,IAAlD,CAF2D,CAAtD;AAKP;AACA;AACA;AACA;AACA;AAC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AAT;AADP,QAEFJ,KAFJ;AAGA,UAAMK,cAAc,GAAI,GAAGF,KAAO,KAAKC,IAAM,EAA7C;AACA,UAAME,YAAY,GAAGZ,iBAAiB,CAAEW,cAAF,CAAtC;AAEA,WAAO;AACNC,MAAAA,YADM;AAENN,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEO,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAzCmE,CAA9D;AA4CP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBzE,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS0E,uBAAT,CAAkC1E,KAAlC,EAA0C;AAChD,SAAOA,KAAK,CAAC2E,UAAb;AACA;AAED;AACA;AACA;;AACA,OAAO,SAASC,wCAAT,GAAoD;AAC1DnF,EAAAA,UAAU,CACT,uEADS,EAET;AACCY,IAAAA,KAAK,EAAE,KADR;AAEC+B,IAAAA,OAAO,EAAE;AAFV,GAFS,CAAV;AAOA;AAED;AACA;AACA;;AACA,OAAO,SAASyC,4BAAT,GAAwC;AAC9CpF,EAAAA,UAAU,CAAE,2DAAF,EAA+D;AACxEY,IAAAA,KAAK,EAAE,KADiE;AAExE+B,IAAAA,OAAO,EAAE;AAF+D,GAA/D,CAAV;AAIA;AAED;AACA;AACA;;AACA,OAAO,SAAS0C,kBAAT,GAA8B;AACpCrF,EAAAA,UAAU,CAAE,iDAAF,EAAqD;AAC9DY,IAAAA,KAAK,EAAE,KADuD;AAE9D+B,IAAAA,OAAO,EAAE;AAFqD,GAArD,CAAV;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\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(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\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: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\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\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\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 state.editedPost.postType;\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 state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\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 { rootClientId, insertionIndex, filterValue } =\n\t\tstate.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 current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\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\t{ per_page: -1 }\n\t\t);\n\t\tconst templatePartsById = templateParts\n\t\t\t? // Key template parts by their ID.\n\t\t\t templateParts.reduce(\n\t\t\t\t\t( newTemplateParts, part ) => ( {\n\t\t\t\t\t\t...newTemplateParts,\n\t\t\t\t\t\t[ part.id ]: part,\n\t\t\t\t\t} ),\n\t\t\t\t\t{}\n\t\t\t )\n\t\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\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * Returns the current canvas mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Canvas mode.\n */\nexport function __unstableGetCanvasMode( state ) {\n\treturn state.canvasMode;\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","Platform","preferencesStore","getFilteredTemplatePartBlocks","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateType","templateId","template","getEditedEntityRecord","templateParts","blocks","getEditorMode","__unstableGetCanvasMode","canvasMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBA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QAAQ,EAAE,CAAC;AAAb,GAHqB,CAAtB;AAMA,SAAOlB,6BAA6B,CAAE4D,QAAQ,CAACG,MAAX,EAAmBD,aAAnB,CAApC;AACA,CAjBmE,CAA9D;AAoBP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,CAAwB7D,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS8D,uBAAT,CAAkC9D,KAAlC,EAA0C;AAChD,SAAOA,KAAK,CAAC+D,UAAb;AACA;AAED;AACA;AACA;;AACA,OAAO,SAASC,wCAAT,GAAoD;AAC1DvE,EAAAA,UAAU,CACT,uEADS,EAET;AACCY,IAAAA,KAAK,EAAE,KADR;AAEC+B,IAAAA,OAAO,EAAE;AAFV,GAFS,CAAV;AAOA;AAED;AACA;AACA;;AACA,OAAO,SAAS6B,4BAAT,GAAwC;AAC9CxE,EAAAA,UAAU,CAAE,2DAAF,EAA+D;AACxEY,IAAAA,KAAK,EAAE,KADiE;AAExE+B,IAAAA,OAAO,EAAE;AAF+D,GAA/D,CAAV;AAIA;AAED;AACA;AACA;;AACA,OAAO,SAAS8B,kBAAT,GAA8B;AACpCzE,EAAAA,UAAU,CAAE,iDAAF,EAAqD;AAC9DY,IAAAA,KAAK,EAAE,KADuD;AAE9D+B,IAAAA,OAAO,EAAE;AAFqD,GAArD,CAAV;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\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(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\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: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\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\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\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 state.editedPost.postType;\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 state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\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 { rootClientId, insertionIndex, filterValue } =\n\t\tstate.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 current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\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\t{ per_page: -1 }\n\t\t);\n\n\t\treturn getFilteredTemplatePartBlocks( template.blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * Returns the current canvas mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Canvas mode.\n */\nexport function __unstableGetCanvasMode( state ) {\n\treturn state.canvasMode;\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n"]}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import memoize from 'memize';
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+
9
+ import { isTemplatePart } from '@wordpress/blocks';
10
+ const EMPTY_ARRAY = [];
11
+ /**
12
+ * Get a flattened and filtered list of template parts and the matching block for that template part.
13
+ *
14
+ * Takes a list of blocks defined within a template, and a list of template parts, and returns a
15
+ * flattened list of template parts and the matching block for that template part.
16
+ *
17
+ * @param {Array} blocks Blocks to flatten.
18
+ * @param {?Array} templateParts Available template parts.
19
+ * @return {Array} An array of template parts and their blocks.
20
+ */
21
+
22
+ function getFilteredTemplatePartBlocks() {
23
+ let blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EMPTY_ARRAY;
24
+ let templateParts = arguments.length > 1 ? arguments[1] : undefined;
25
+ const templatePartsById = templateParts ? // Key template parts by their ID.
26
+ templateParts.reduce((newTemplateParts, part) => ({ ...newTemplateParts,
27
+ [part.id]: part
28
+ }), {}) : {};
29
+ const result = []; // Iterate over all blocks, recursing into inner blocks.
30
+ // Output will be based on a depth-first traversal.
31
+
32
+ const stack = [...blocks];
33
+
34
+ while (stack.length) {
35
+ const {
36
+ innerBlocks,
37
+ ...block
38
+ } = stack.shift(); // Place inner blocks at the beginning of the stack to preserve order.
39
+
40
+ stack.unshift(...innerBlocks);
41
+
42
+ if (isTemplatePart(block)) {
43
+ const {
44
+ attributes: {
45
+ theme,
46
+ slug
47
+ }
48
+ } = block;
49
+ const templatePartId = `${theme}//${slug}`;
50
+ const templatePart = templatePartsById[templatePartId]; // Only add to output if the found template part block is in the list of available template parts.
51
+
52
+ if (templatePart) {
53
+ result.push({
54
+ templatePart,
55
+ block
56
+ });
57
+ }
58
+ }
59
+ }
60
+
61
+ return result;
62
+ }
63
+
64
+ const memoizedGetFilteredTemplatePartBlocks = memoize(getFilteredTemplatePartBlocks);
65
+ export { memoizedGetFilteredTemplatePartBlocks as getFilteredTemplatePartBlocks };
66
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/utils.js"],"names":["memoize","isTemplatePart","EMPTY_ARRAY","getFilteredTemplatePartBlocks","blocks","templateParts","templatePartsById","reduce","newTemplateParts","part","id","result","stack","length","innerBlocks","block","shift","unshift","attributes","theme","slug","templatePartId","templatePart","push","memoizedGetFilteredTemplatePartBlocks"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,OAAP,MAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,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Content":["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { isTemplatePart } from '@wordpress/blocks';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Get a flattened and filtered list of template parts and the matching block for that template part.\n *\n * Takes a list of blocks defined within a template, and a list of template parts, and returns a\n * flattened list of template parts and the matching block for that template part.\n *\n * @param {Array} blocks Blocks to flatten.\n * @param {?Array} templateParts Available template parts.\n * @return {Array} An array of template parts and their blocks.\n */\nfunction getFilteredTemplatePartBlocks( blocks = EMPTY_ARRAY, templateParts ) {\n\tconst templatePartsById = templateParts\n\t\t? // Key template parts by their ID.\n\t\t templateParts.reduce(\n\t\t\t\t( newTemplateParts, part ) => ( {\n\t\t\t\t\t...newTemplateParts,\n\t\t\t\t\t[ part.id ]: part,\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t )\n\t\t: {};\n\n\tconst result = [];\n\n\t// Iterate over all blocks, recursing into inner blocks.\n\t// Output will be based on a depth-first traversal.\n\tconst stack = [ ...blocks ];\n\twhile ( stack.length ) {\n\t\tconst { innerBlocks, ...block } = stack.shift();\n\t\t// Place inner blocks at the beginning of the stack to preserve order.\n\t\tstack.unshift( ...innerBlocks );\n\n\t\tif ( isTemplatePart( block ) ) {\n\t\t\tconst {\n\t\t\t\tattributes: { theme, slug },\n\t\t\t} = block;\n\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t// Only add to output if the found template part block is in the list of available template parts.\n\t\t\tif ( templatePart ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nconst memoizedGetFilteredTemplatePartBlocks = memoize(\n\tgetFilteredTemplatePartBlocks\n);\n\nexport { memoizedGetFilteredTemplatePartBlocks as getFilteredTemplatePartBlocks };\n"]}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { kebabCase } from 'lodash';
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+
9
+ import { useSelect } from '@wordpress/data';
10
+ import { store as coreStore } from '@wordpress/core-data';
11
+ export const useExistingTemplateParts = () => {
12
+ return useSelect(select => select(coreStore).getEntityRecords('postType', 'wp_template_part', {
13
+ per_page: -1
14
+ }), []);
15
+ };
16
+ /**
17
+ * Return a unique template part title based on
18
+ * the given title and existing template parts.
19
+ *
20
+ * @param {string} title The original template part title.
21
+ * @param {Object} templateParts The array of template part entities.
22
+ * @return {string} A unique template part title.
23
+ */
24
+
25
+ export const getUniqueTemplatePartTitle = (title, templateParts) => {
26
+ const lowercaseTitle = title.toLowerCase();
27
+ const existingTitles = templateParts.map(templatePart => templatePart.title.rendered.toLowerCase());
28
+
29
+ if (!existingTitles.includes(lowercaseTitle)) {
30
+ return title;
31
+ }
32
+
33
+ let suffix = 2;
34
+
35
+ while (existingTitles.includes(`${lowercaseTitle} ${suffix}`)) {
36
+ suffix++;
37
+ }
38
+
39
+ return `${title} ${suffix}`;
40
+ };
41
+ /**
42
+ * Get a valid slug for a template part.
43
+ * Currently template parts only allow latin chars.
44
+ * The fallback slug will receive suffix by default.
45
+ *
46
+ * @param {string} title The template part title.
47
+ * @return {string} A valid template part slug.
48
+ */
49
+
50
+ export const getCleanTemplatePartSlug = title => {
51
+ return kebabCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
52
+ };
53
+ //# sourceMappingURL=template-part-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/utils/template-part-create.js"],"names":["kebabCase","useSelect","store","coreStore","useExistingTemplateParts","select","getEntityRecords","per_page","getUniqueTemplatePartTitle","title","templateParts","lowercaseTitle","toLowerCase","existingTitles","map","templatePart","rendered","includes","suffix","getCleanTemplatePartSlug","replace"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA,OAAO,MAAMC,wBAAwB,GAAG,MAAM;AAC7C,SAAOH,SAAS,CACbI,MAAF,IACCA,MAAM,CAAEF,SAAF,CAAN,CAAoBG,gBAApB,CACC,UADD,EAEC,kBAFD,EAGC;AACCC,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAHD,CAFc,EASf,EATe,CAAhB;AAWA,CAZM;AAcP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,0BAA0B,GAAG,CAAEC,KAAF,EAASC,aAAT,KAA4B;AACrE,QAAMC,cAAc,GAAGF,KAAK,CAACG,WAAN,EAAvB;AACA,QAAMC,cAAc,GAAGH,aAAa,CAACI,GAAd,CAAqBC,YAAF,IACzCA,YAAY,CAACN,KAAb,CAAmBO,QAAnB,CAA4BJ,WAA5B,EADsB,CAAvB;;AAIA,MAAK,CAAEC,cAAc,CAACI,QAAf,CAAyBN,cAAzB,CAAP,EAAmD;AAClD,WAAOF,KAAP;AACA;;AAED,MAAIS,MAAM,GAAG,CAAb;;AACA,SAAQL,cAAc,CAACI,QAAf,CAA0B,GAAGN,cAAgB,IAAIO,MAAQ,EAAzD,CAAR,EAAuE;AACtEA,IAAAA,MAAM;AACN;;AAED,SAAQ,GAAGT,KAAO,IAAIS,MAAQ,EAA9B;AACA,CAhBM;AAkBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,wBAAwB,GAAKV,KAAF,IAAa;AACpD,SAAOT,SAAS,CAAES,KAAF,CAAT,CAAmBW,OAAnB,CAA4B,UAA5B,EAAwC,EAAxC,KAAgD,gBAAvD;AACA,CAFM","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport const useExistingTemplateParts = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t),\n\t\t[]\n\t);\n};\n\n/**\n * Return a unique template part title based on\n * the given title and existing template parts.\n *\n * @param {string} title The original template part title.\n * @param {Object} templateParts The array of template part entities.\n * @return {string} A unique template part title.\n */\nexport const getUniqueTemplatePartTitle = ( title, templateParts ) => {\n\tconst lowercaseTitle = title.toLowerCase();\n\tconst existingTitles = templateParts.map( ( templatePart ) =>\n\t\ttemplatePart.title.rendered.toLowerCase()\n\t);\n\n\tif ( ! existingTitles.includes( lowercaseTitle ) ) {\n\t\treturn title;\n\t}\n\n\tlet suffix = 2;\n\twhile ( existingTitles.includes( `${ lowercaseTitle } ${ suffix }` ) ) {\n\t\tsuffix++;\n\t}\n\n\treturn `${ title } ${ suffix }`;\n};\n\n/**\n * Get a valid slug for a template part.\n * Currently template parts only allow latin chars.\n * The fallback slug will receive suffix by default.\n *\n * @param {string} title The template part title.\n * @return {string} A valid template part slug.\n */\nexport const getCleanTemplatePartSlug = ( title ) => {\n\treturn kebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n};\n"]}