@wordpress/edit-site 5.15.0 → 5.17.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 (1027) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-page/index.js +3 -13
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +12 -24
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +1 -11
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/add-custom-template-modal-content.js +9 -28
  9. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  10. package/build/components/add-new-template/index.js +3 -10
  11. package/build/components/add-new-template/index.js.map +1 -1
  12. package/build/components/add-new-template/new-template.js +19 -49
  13. package/build/components/add-new-template/new-template.js.map +1 -1
  14. package/build/components/add-new-template/template-actions-loading-screen.js +1 -3
  15. package/build/components/add-new-template/template-actions-loading-screen.js.map +1 -1
  16. package/build/components/add-new-template/utils.js +52 -102
  17. package/build/components/add-new-template/utils.js.map +1 -1
  18. package/build/components/app/index.js +2 -19
  19. package/build/components/app/index.js.map +1 -1
  20. package/build/components/block-editor/back-button.js +1 -11
  21. package/build/components/block-editor/back-button.js.map +1 -1
  22. package/build/components/block-editor/block-inspector-button.js +3 -14
  23. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  24. package/build/components/block-editor/constants.js.map +1 -1
  25. package/build/components/block-editor/editor-canvas.js +5 -14
  26. package/build/components/block-editor/editor-canvas.js.map +1 -1
  27. package/build/components/block-editor/get-block-editor-provider.js +0 -7
  28. package/build/components/block-editor/get-block-editor-provider.js.map +1 -1
  29. package/build/components/block-editor/index.js +10 -15
  30. package/build/components/block-editor/index.js.map +1 -1
  31. package/build/components/block-editor/inserter-media-categories.js +30 -45
  32. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  33. package/build/components/block-editor/providers/default-block-editor-provider.js +1 -10
  34. package/build/components/block-editor/providers/default-block-editor-provider.js.map +1 -1
  35. package/build/components/block-editor/providers/navigation-block-editor-provider.js +10 -19
  36. package/build/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -1
  37. package/build/components/block-editor/resizable-editor.js +3 -8
  38. package/build/components/block-editor/resizable-editor.js.map +1 -1
  39. package/build/components/block-editor/resize-handle.js +1 -7
  40. package/build/components/block-editor/resize-handle.js.map +1 -1
  41. package/build/components/block-editor/site-editor-canvas.js +6 -22
  42. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  43. package/build/components/block-editor/use-site-editor-settings.js +35 -26
  44. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  45. package/build/components/canvas-spinner/index.js +31 -5
  46. package/build/components/canvas-spinner/index.js.map +1 -1
  47. package/build/components/code-editor/index.js +3 -18
  48. package/build/components/code-editor/index.js.map +1 -1
  49. package/build/components/create-template-part-modal/index.js +4 -19
  50. package/build/components/create-template-part-modal/index.js.map +1 -1
  51. package/build/components/editor/index.js +33 -49
  52. package/build/components/editor/index.js.map +1 -1
  53. package/build/components/editor-canvas-container/index.js +2 -28
  54. package/build/components/editor-canvas-container/index.js.map +1 -1
  55. package/build/components/error-boundary/index.js +1 -12
  56. package/build/components/error-boundary/index.js.map +1 -1
  57. package/build/components/error-boundary/warning.js +1 -7
  58. package/build/components/error-boundary/warning.js.map +1 -1
  59. package/build/components/global-styles/block-preview-panel.js +22 -13
  60. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  61. package/build/components/global-styles/color-indicator-wrapper.js +1 -6
  62. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  63. package/build/components/global-styles/color-palette-panel.js +1 -8
  64. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  65. package/build/components/global-styles/dimensions-panel.js +14 -16
  66. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  67. package/build/components/global-styles/global-styles-provider.js +13 -29
  68. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  69. package/build/components/global-styles/gradients-palette-panel.js +1 -11
  70. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  71. package/build/components/global-styles/header.js +3 -7
  72. package/build/components/global-styles/header.js.map +1 -1
  73. package/build/components/global-styles/hooks.js +26 -15
  74. package/build/components/global-styles/hooks.js.map +1 -1
  75. package/build/components/global-styles/icon-with-current-color.js +1 -5
  76. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  77. package/build/components/global-styles/index.js +0 -2
  78. package/build/components/global-styles/index.js.map +1 -1
  79. package/build/components/global-styles/navigation-button.js +3 -7
  80. package/build/components/global-styles/navigation-button.js.map +1 -1
  81. package/build/components/global-styles/palette.js +3 -15
  82. package/build/components/global-styles/palette.js.map +1 -1
  83. package/build/components/global-styles/preview.js +7 -18
  84. package/build/components/global-styles/preview.js.map +1 -1
  85. package/build/components/global-styles/root-menu.js +1 -10
  86. package/build/components/global-styles/root-menu.js.map +1 -1
  87. package/build/components/global-styles/screen-block-list.js +10 -32
  88. package/build/components/global-styles/screen-block-list.js.map +1 -1
  89. package/build/components/global-styles/screen-block.js +44 -49
  90. package/build/components/global-styles/screen-block.js.map +1 -1
  91. package/build/components/global-styles/screen-color-palette.js +1 -9
  92. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  93. package/build/components/global-styles/screen-colors.js +2 -14
  94. package/build/components/global-styles/screen-colors.js.map +1 -1
  95. package/build/components/global-styles/screen-css.js +1 -10
  96. package/build/components/global-styles/screen-css.js.map +1 -1
  97. package/build/components/global-styles/screen-layout.js +2 -13
  98. package/build/components/global-styles/screen-layout.js.map +1 -1
  99. package/build/components/global-styles/screen-revisions/index.js +17 -28
  100. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  101. package/build/components/global-styles/screen-revisions/revisions-buttons.js +23 -39
  102. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  103. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -43
  104. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  105. package/build/components/global-styles/screen-root.js +2 -20
  106. package/build/components/global-styles/screen-root.js.map +1 -1
  107. package/build/components/global-styles/screen-style-variations.js +6 -15
  108. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  109. package/build/components/global-styles/screen-typography-element.js +2 -12
  110. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  111. package/build/components/global-styles/screen-typography.js +4 -17
  112. package/build/components/global-styles/screen-typography.js.map +1 -1
  113. package/build/components/global-styles/style-variations-container.js +9 -28
  114. package/build/components/global-styles/style-variations-container.js.map +1 -1
  115. package/build/components/global-styles/subtitle.js +1 -4
  116. package/build/components/global-styles/subtitle.js.map +1 -1
  117. package/build/components/global-styles/typography-panel.js +1 -7
  118. package/build/components/global-styles/typography-panel.js.map +1 -1
  119. package/build/components/global-styles/typography-preview.js +1 -7
  120. package/build/components/global-styles/typography-preview.js.map +1 -1
  121. package/build/components/global-styles/ui.js +14 -62
  122. package/build/components/global-styles/ui.js.map +1 -1
  123. package/build/components/global-styles/utils.js +0 -2
  124. package/build/components/global-styles/utils.js.map +1 -1
  125. package/build/components/global-styles/variations-panel.js +1 -9
  126. package/build/components/global-styles/variations-panel.js.map +1 -1
  127. package/build/components/global-styles-renderer/index.js +3 -11
  128. package/build/components/global-styles-renderer/index.js.map +1 -1
  129. package/build/components/header-edit-mode/document-actions/index.js +14 -53
  130. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  131. package/build/components/header-edit-mode/index.js +8 -36
  132. package/build/components/header-edit-mode/index.js.map +1 -1
  133. package/build/components/header-edit-mode/mode-switcher/index.js +2 -11
  134. package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
  135. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +1 -14
  136. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -1
  137. package/build/components/header-edit-mode/more-menu/index.js +2 -24
  138. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  139. package/build/components/header-edit-mode/more-menu/site-export.js +1 -14
  140. package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  141. package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js +1 -6
  142. package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -1
  143. package/build/components/header-edit-mode/plugin-more-menu-item/index.js +0 -8
  144. package/build/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -1
  145. package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +3 -4
  146. package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
  147. package/build/components/header-edit-mode/tools-more-menu-group/index.js +1 -5
  148. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  149. package/build/components/header-edit-mode/undo-redo/redo.js +5 -12
  150. package/build/components/header-edit-mode/undo-redo/redo.js.map +1 -1
  151. package/build/components/header-edit-mode/undo-redo/undo.js +5 -12
  152. package/build/components/header-edit-mode/undo-redo/undo.js.map +1 -1
  153. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  154. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  155. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -8
  156. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  157. package/build/components/keyboard-shortcut-help-modal/index.js +4 -24
  158. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  159. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -5
  160. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  161. package/build/components/keyboard-shortcuts/edit-mode.js +10 -29
  162. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  163. package/build/components/keyboard-shortcuts/global.js +1 -9
  164. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  165. package/build/components/keyboard-shortcuts/register.js +1 -7
  166. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  167. package/build/components/layout/hooks.js +2 -9
  168. package/build/components/layout/hooks.js.map +1 -1
  169. package/build/components/layout/index.js +23 -49
  170. package/build/components/layout/index.js.map +1 -1
  171. package/build/components/list/added-by.js +10 -23
  172. package/build/components/list/added-by.js.map +1 -1
  173. package/build/components/list/header.js +1 -10
  174. package/build/components/list/header.js.map +1 -1
  175. package/build/components/list/index.js +8 -20
  176. package/build/components/list/index.js.map +1 -1
  177. package/build/components/list/table.js +5 -16
  178. package/build/components/list/table.js.map +1 -1
  179. package/build/components/list/use-register-shortcuts.js +1 -5
  180. package/build/components/list/use-register-shortcuts.js.map +1 -1
  181. package/build/components/page/header.js +1 -3
  182. package/build/components/page/header.js.map +1 -1
  183. package/build/components/page/index.js +4 -10
  184. package/build/components/page/index.js.map +1 -1
  185. package/build/components/page-actions/index.js +1 -7
  186. package/build/components/page-actions/index.js.map +1 -1
  187. package/build/components/page-actions/trash-page-menu-item.js +4 -13
  188. package/build/components/page-actions/trash-page-menu-item.js.map +1 -1
  189. package/build/components/page-content-focus-manager/back-to-page-notification.js +1 -9
  190. package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  191. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +8 -18
  192. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  193. package/build/components/page-content-focus-manager/edit-template-notification.js +0 -16
  194. package/build/components/page-content-focus-manager/edit-template-notification.js.map +1 -1
  195. package/build/components/page-content-focus-manager/index.js +1 -8
  196. package/build/components/page-content-focus-manager/index.js.map +1 -1
  197. package/build/components/page-main/index.js +1 -11
  198. package/build/components/page-main/index.js.map +1 -1
  199. package/build/components/page-patterns/duplicate-menu-item.js +22 -49
  200. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
  201. package/build/components/page-patterns/grid-item.js +12 -32
  202. package/build/components/page-patterns/grid-item.js.map +1 -1
  203. package/build/components/page-patterns/grid.js +1 -5
  204. package/build/components/page-patterns/grid.js.map +1 -1
  205. package/build/components/page-patterns/header.js +1 -11
  206. package/build/components/page-patterns/header.js.map +1 -1
  207. package/build/components/page-patterns/index.js +6 -15
  208. package/build/components/page-patterns/index.js.map +1 -1
  209. package/build/components/page-patterns/no-patterns.js +1 -3
  210. package/build/components/page-patterns/no-patterns.js.map +1 -1
  211. package/build/components/page-patterns/pagination.js +7 -7
  212. package/build/components/page-patterns/pagination.js.map +1 -1
  213. package/build/components/page-patterns/patterns-list.js +16 -24
  214. package/build/components/page-patterns/patterns-list.js.map +1 -1
  215. package/build/components/page-patterns/rename-menu-item.js +5 -14
  216. package/build/components/page-patterns/rename-menu-item.js.map +1 -1
  217. package/build/components/page-patterns/search-items.js +27 -38
  218. package/build/components/page-patterns/search-items.js.map +1 -1
  219. package/build/components/page-patterns/use-pattern-settings.js +5 -10
  220. package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
  221. package/build/components/page-patterns/use-patterns.js +28 -30
  222. package/build/components/page-patterns/use-patterns.js.map +1 -1
  223. package/build/components/page-patterns/utils.js +0 -2
  224. package/build/components/page-patterns/utils.js.map +1 -1
  225. package/build/components/page-template-parts/add-new-template-part.js +1 -13
  226. package/build/components/page-template-parts/add-new-template-part.js.map +1 -1
  227. package/build/components/page-template-parts/index.js +2 -15
  228. package/build/components/page-template-parts/index.js.map +1 -1
  229. package/build/components/page-templates/index.js +2 -29
  230. package/build/components/page-templates/index.js.map +1 -1
  231. package/build/components/plugin-template-setting-panel/index.js +2 -3
  232. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  233. package/build/components/preferences-modal/enable-feature.js +1 -7
  234. package/build/components/preferences-modal/enable-feature.js.map +1 -1
  235. package/build/components/preferences-modal/index.js +1 -16
  236. package/build/components/preferences-modal/index.js.map +1 -1
  237. package/build/components/resizable-frame/index.js +33 -61
  238. package/build/components/resizable-frame/index.js.map +1 -1
  239. package/build/components/revisions/index.js +5 -17
  240. package/build/components/revisions/index.js.map +1 -1
  241. package/build/components/routes/link.js +3 -14
  242. package/build/components/routes/link.js.map +1 -1
  243. package/build/components/routes/use-title.js +5 -16
  244. package/build/components/routes/use-title.js.map +1 -1
  245. package/build/components/save-button/index.js +7 -22
  246. package/build/components/save-button/index.js.map +1 -1
  247. package/build/components/save-hub/index.js +17 -33
  248. package/build/components/save-hub/index.js.map +1 -1
  249. package/build/components/save-panel/index.js +6 -28
  250. package/build/components/save-panel/index.js.map +1 -1
  251. package/build/components/secondary-sidebar/inserter-sidebar.js +1 -9
  252. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  253. package/build/components/secondary-sidebar/list-view-sidebar.js +21 -32
  254. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  255. package/build/components/sidebar/index.js +1 -25
  256. package/build/components/sidebar/index.js.map +1 -1
  257. package/build/components/sidebar-button/index.js +3 -6
  258. package/build/components/sidebar-button/index.js.map +1 -1
  259. package/build/components/sidebar-edit-mode/constants.js.map +1 -1
  260. package/build/components/sidebar-edit-mode/default-sidebar.js +2 -5
  261. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  262. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +1 -18
  263. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  264. package/build/components/sidebar-edit-mode/index.js +1 -24
  265. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  266. package/build/components/sidebar-edit-mode/page-panels/edit-template.js +11 -20
  267. package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  268. package/build/components/sidebar-edit-mode/page-panels/index.js +3 -18
  269. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  270. package/build/components/sidebar-edit-mode/page-panels/page-content.js +1 -6
  271. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  272. package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -20
  273. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  274. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +1 -6
  275. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  276. package/build/components/sidebar-edit-mode/page-panels/publish-date.js +3 -15
  277. package/build/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -1
  278. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -5
  279. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  280. package/build/components/sidebar-edit-mode/settings-header/index.js +14 -25
  281. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  282. package/build/components/sidebar-edit-mode/sidebar-card/index.js +1 -5
  283. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  284. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +1 -5
  285. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  286. package/build/components/sidebar-edit-mode/template-panel/index.js +14 -27
  287. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  288. package/build/components/sidebar-edit-mode/template-panel/last-revision.js +2 -17
  289. package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
  290. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +1 -11
  291. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
  292. package/build/components/sidebar-edit-mode/template-panel/template-areas.js +1 -15
  293. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -1
  294. package/build/components/sidebar-navigation-item/index.js +1 -7
  295. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  296. package/build/components/sidebar-navigation-screen/index.js +21 -28
  297. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  298. package/build/components/sidebar-navigation-screen-details-footer/index.js +2 -7
  299. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  300. package/build/components/sidebar-navigation-screen-details-panel/index.js +1 -7
  301. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
  302. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +1 -3
  303. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
  304. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +1 -5
  305. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  306. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +1 -3
  307. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
  308. package/build/components/sidebar-navigation-screen-global-styles/index.js +47 -82
  309. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  310. package/build/components/sidebar-navigation-screen-main/index.js +3 -14
  311. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  312. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +1 -10
  313. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  314. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -13
  315. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  316. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +3 -5
  317. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  318. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +3 -8
  319. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  320. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +5 -25
  321. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  322. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +5 -16
  323. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  324. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -13
  325. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  326. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -8
  327. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  328. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -10
  329. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  330. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +11 -32
  331. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  332. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +3 -6
  333. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  334. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  335. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +18 -39
  336. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  337. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +12 -18
  338. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  339. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +7 -15
  340. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  341. package/build/components/sidebar-navigation-screen-page/index.js +6 -23
  342. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  343. package/build/components/sidebar-navigation-screen-page/page-details.js +9 -32
  344. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  345. package/build/components/sidebar-navigation-screen-page/status-label.js +3 -17
  346. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  347. package/build/components/sidebar-navigation-screen-pages/index.js +8 -31
  348. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  349. package/build/components/sidebar-navigation-screen-pattern/index.js +11 -25
  350. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  351. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +1 -7
  352. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
  353. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +1 -5
  354. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -1
  355. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -8
  356. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  357. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +5 -10
  358. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  359. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -21
  360. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  361. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +46 -44
  362. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  363. package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -13
  364. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  365. package/build/components/sidebar-navigation-screen-patterns/index.js +4 -31
  366. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  367. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +1 -6
  368. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -1
  369. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +1 -5
  370. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  371. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -12
  372. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  373. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +6 -8
  374. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  375. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -8
  376. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  377. package/build/components/sidebar-navigation-screen-template/home-template-details.js +7 -31
  378. package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
  379. package/build/components/sidebar-navigation-screen-template/index.js +1 -20
  380. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  381. package/build/components/sidebar-navigation-screen-templates/index.js +5 -26
  382. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  383. package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -7
  384. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  385. package/build/components/site-hub/index.js +8 -22
  386. package/build/components/site-hub/index.js.map +1 -1
  387. package/build/components/site-icon/index.js +1 -12
  388. package/build/components/site-icon/index.js.map +1 -1
  389. package/build/components/start-template-options/index.js +3 -26
  390. package/build/components/start-template-options/index.js.map +1 -1
  391. package/build/components/style-book/index.js +23 -34
  392. package/build/components/style-book/index.js.map +1 -1
  393. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -25
  394. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  395. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -14
  396. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  397. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -19
  398. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  399. package/build/components/table/index.js +0 -2
  400. package/build/components/table/index.js.map +1 -1
  401. package/build/components/template-actions/index.js +2 -21
  402. package/build/components/template-actions/index.js.map +1 -1
  403. package/build/components/template-actions/rename-menu-item.js +7 -15
  404. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  405. package/build/components/template-part-converter/convert-to-regular.js +1 -8
  406. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  407. package/build/components/template-part-converter/convert-to-template-part.js +4 -15
  408. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  409. package/build/components/template-part-converter/index.js +3 -10
  410. package/build/components/template-part-converter/index.js.map +1 -1
  411. package/build/components/use-edited-entity-record/index.js +2 -15
  412. package/build/components/use-edited-entity-record/index.js.map +1 -1
  413. package/build/components/welcome-guide/editor.js +1 -10
  414. package/build/components/welcome-guide/editor.js.map +1 -1
  415. package/build/components/welcome-guide/image.js +0 -2
  416. package/build/components/welcome-guide/image.js.map +1 -1
  417. package/build/components/welcome-guide/index.js +1 -7
  418. package/build/components/welcome-guide/index.js.map +1 -1
  419. package/build/components/welcome-guide/page.js +1 -9
  420. package/build/components/welcome-guide/page.js.map +1 -1
  421. package/build/components/welcome-guide/styles.js +1 -12
  422. package/build/components/welcome-guide/styles.js.map +1 -1
  423. package/build/components/welcome-guide/template.js +1 -9
  424. package/build/components/welcome-guide/template.js.map +1 -1
  425. package/build/hooks/commands/use-common-commands.js +173 -133
  426. package/build/hooks/commands/use-common-commands.js.map +1 -1
  427. package/build/hooks/commands/use-edit-mode-commands.js +115 -54
  428. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  429. package/build/hooks/components.js +1 -2
  430. package/build/hooks/components.js.map +1 -1
  431. package/build/hooks/index.js +0 -3
  432. package/build/hooks/index.js.map +1 -1
  433. package/build/hooks/navigation-menu-edit.js +11 -24
  434. package/build/hooks/navigation-menu-edit.js.map +1 -1
  435. package/build/hooks/push-changes-to-global-styles/index.js +223 -96
  436. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  437. package/build/hooks/template-part-edit.js +7 -19
  438. package/build/hooks/template-part-edit.js.map +1 -1
  439. package/build/index.js +8 -31
  440. package/build/index.js.map +1 -1
  441. package/build/lock-unlock.js +1 -2
  442. package/build/lock-unlock.js.map +1 -1
  443. package/build/store/actions.js +33 -98
  444. package/build/store/actions.js.map +1 -1
  445. package/build/store/constants.js +0 -1
  446. package/build/store/constants.js.map +1 -1
  447. package/build/store/index.js +1 -12
  448. package/build/store/index.js.map +1 -1
  449. package/build/store/private-actions.js +7 -14
  450. package/build/store/private-actions.js.map +1 -1
  451. package/build/store/private-selectors.js +1 -3
  452. package/build/store/private-selectors.js.map +1 -1
  453. package/build/store/reducer.js +12 -38
  454. package/build/store/reducer.js.map +1 -1
  455. package/build/store/selectors.js +23 -60
  456. package/build/store/selectors.js.map +1 -1
  457. package/build/store/utils.js +13 -16
  458. package/build/store/utils.js.map +1 -1
  459. package/build/utils/get-is-list-page.js +2 -2
  460. package/build/utils/get-is-list-page.js.map +1 -1
  461. package/build/utils/is-previewing-theme.js +1 -4
  462. package/build/utils/is-previewing-theme.js.map +1 -1
  463. package/build/utils/is-template-removable.js +0 -2
  464. package/build/utils/is-template-removable.js.map +1 -1
  465. package/build/utils/is-template-revertable.js +0 -3
  466. package/build/utils/is-template-revertable.js.map +1 -1
  467. package/build/utils/template-part-create.js +3 -15
  468. package/build/utils/template-part-create.js.map +1 -1
  469. package/build/utils/use-activate-theme.js +2 -5
  470. package/build/utils/use-activate-theme.js.map +1 -1
  471. package/build/utils/use-debounced-input.js +6 -10
  472. package/build/utils/use-debounced-input.js.map +1 -1
  473. package/build-module/components/add-new-page/index.js +2 -7
  474. package/build-module/components/add-new-page/index.js.map +1 -1
  475. package/build-module/components/add-new-pattern/index.js +11 -11
  476. package/build-module/components/add-new-pattern/index.js.map +1 -1
  477. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -11
  478. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  479. package/build-module/components/add-new-template/add-custom-template-modal-content.js +9 -21
  480. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  481. package/build-module/components/add-new-template/index.js +3 -6
  482. package/build-module/components/add-new-template/index.js.map +1 -1
  483. package/build-module/components/add-new-template/new-template.js +20 -34
  484. package/build-module/components/add-new-template/new-template.js.map +1 -1
  485. package/build-module/components/add-new-template/template-actions-loading-screen.js +0 -1
  486. package/build-module/components/add-new-template/template-actions-loading-screen.js.map +1 -1
  487. package/build-module/components/add-new-template/utils.js +52 -82
  488. package/build-module/components/add-new-template/utils.js.map +1 -1
  489. package/build-module/components/app/index.js +2 -6
  490. package/build-module/components/app/index.js.map +1 -1
  491. package/build-module/components/block-editor/back-button.js +1 -6
  492. package/build-module/components/block-editor/back-button.js.map +1 -1
  493. package/build-module/components/block-editor/block-inspector-button.js +3 -5
  494. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  495. package/build-module/components/block-editor/constants.js.map +1 -1
  496. package/build-module/components/block-editor/editor-canvas.js +6 -8
  497. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  498. package/build-module/components/block-editor/get-block-editor-provider.js +1 -4
  499. package/build-module/components/block-editor/get-block-editor-provider.js.map +1 -1
  500. package/build-module/components/block-editor/index.js +10 -6
  501. package/build-module/components/block-editor/index.js.map +1 -1
  502. package/build-module/components/block-editor/inserter-media-categories.js +31 -41
  503. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  504. package/build-module/components/block-editor/providers/default-block-editor-provider.js +1 -2
  505. package/build-module/components/block-editor/providers/default-block-editor-provider.js.map +1 -1
  506. package/build-module/components/block-editor/providers/navigation-block-editor-provider.js +10 -11
  507. package/build-module/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -1
  508. package/build-module/components/block-editor/resizable-editor.js +5 -6
  509. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  510. package/build-module/components/block-editor/resize-handle.js +0 -3
  511. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  512. package/build-module/components/block-editor/site-editor-canvas.js +5 -8
  513. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  514. package/build-module/components/block-editor/use-site-editor-settings.js +34 -20
  515. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  516. package/build-module/components/canvas-spinner/index.js +31 -4
  517. package/build-module/components/canvas-spinner/index.js.map +1 -1
  518. package/build-module/components/code-editor/index.js +4 -9
  519. package/build-module/components/code-editor/index.js.map +1 -1
  520. package/build-module/components/create-template-part-modal/index.js +4 -8
  521. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  522. package/build-module/components/editor/index.js +34 -24
  523. package/build-module/components/editor/index.js.map +1 -1
  524. package/build-module/components/editor-canvas-container/index.js +4 -18
  525. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  526. package/build-module/components/error-boundary/index.js +1 -7
  527. package/build-module/components/error-boundary/index.js.map +1 -1
  528. package/build-module/components/error-boundary/warning.js +0 -3
  529. package/build-module/components/error-boundary/warning.js.map +1 -1
  530. package/build-module/components/global-styles/block-preview-panel.js +22 -10
  531. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  532. package/build-module/components/global-styles/color-indicator-wrapper.js +1 -4
  533. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  534. package/build-module/components/global-styles/color-palette-panel.js +1 -2
  535. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  536. package/build-module/components/global-styles/dimensions-panel.js +14 -13
  537. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  538. package/build-module/components/global-styles/global-styles-provider.js +14 -22
  539. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  540. package/build-module/components/global-styles/gradients-palette-panel.js +1 -4
  541. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  542. package/build-module/components/global-styles/header.js +2 -4
  543. package/build-module/components/global-styles/header.js.map +1 -1
  544. package/build-module/components/global-styles/hooks.js +26 -7
  545. package/build-module/components/global-styles/hooks.js.map +1 -1
  546. package/build-module/components/global-styles/icon-with-current-color.js +1 -2
  547. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  548. package/build-module/components/global-styles/index.js.map +1 -1
  549. package/build-module/components/global-styles/navigation-button.js +3 -7
  550. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  551. package/build-module/components/global-styles/palette.js +3 -5
  552. package/build-module/components/global-styles/palette.js.map +1 -1
  553. package/build-module/components/global-styles/preview.js +7 -14
  554. package/build-module/components/global-styles/preview.js.map +1 -1
  555. package/build-module/components/global-styles/root-menu.js +1 -4
  556. package/build-module/components/global-styles/root-menu.js.map +1 -1
  557. package/build-module/components/global-styles/screen-block-list.js +10 -20
  558. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  559. package/build-module/components/global-styles/screen-block.js +44 -38
  560. package/build-module/components/global-styles/screen-block.js.map +1 -1
  561. package/build-module/components/global-styles/screen-color-palette.js +1 -4
  562. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  563. package/build-module/components/global-styles/screen-colors.js +2 -6
  564. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  565. package/build-module/components/global-styles/screen-css.js +1 -5
  566. package/build-module/components/global-styles/screen-css.js.map +1 -1
  567. package/build-module/components/global-styles/screen-layout.js +2 -6
  568. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  569. package/build-module/components/global-styles/screen-revisions/index.js +18 -17
  570. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  571. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +25 -37
  572. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  573. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +39 -36
  574. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  575. package/build-module/components/global-styles/screen-root.js +2 -9
  576. package/build-module/components/global-styles/screen-root.js.map +1 -1
  577. package/build-module/components/global-styles/screen-style-variations.js +6 -9
  578. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  579. package/build-module/components/global-styles/screen-typography-element.js +2 -6
  580. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  581. package/build-module/components/global-styles/screen-typography.js +4 -8
  582. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  583. package/build-module/components/global-styles/style-variations-container.js +10 -18
  584. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  585. package/build-module/components/global-styles/subtitle.js +0 -3
  586. package/build-module/components/global-styles/subtitle.js.map +1 -1
  587. package/build-module/components/global-styles/typography-panel.js +1 -4
  588. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  589. package/build-module/components/global-styles/typography-preview.js +1 -4
  590. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  591. package/build-module/components/global-styles/ui.js +15 -37
  592. package/build-module/components/global-styles/ui.js.map +1 -1
  593. package/build-module/components/global-styles/utils.js +0 -1
  594. package/build-module/components/global-styles/utils.js.map +1 -1
  595. package/build-module/components/global-styles/variations-panel.js +0 -4
  596. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  597. package/build-module/components/global-styles-renderer/index.js +3 -6
  598. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  599. package/build-module/components/header-edit-mode/document-actions/index.js +17 -44
  600. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  601. package/build-module/components/header-edit-mode/index.js +9 -18
  602. package/build-module/components/header-edit-mode/index.js.map +1 -1
  603. package/build-module/components/header-edit-mode/mode-switcher/index.js +4 -7
  604. package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -1
  605. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +1 -6
  606. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -1
  607. package/build-module/components/header-edit-mode/more-menu/index.js +2 -6
  608. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  609. package/build-module/components/header-edit-mode/more-menu/site-export.js +1 -6
  610. package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  611. package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js +0 -1
  612. package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -1
  613. package/build-module/components/header-edit-mode/plugin-more-menu-item/index.js +1 -2
  614. package/build-module/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -1
  615. package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +3 -2
  616. package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
  617. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -3
  618. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  619. package/build-module/components/header-edit-mode/undo-redo/redo.js +4 -5
  620. package/build-module/components/header-edit-mode/undo-redo/redo.js.map +1 -1
  621. package/build-module/components/header-edit-mode/undo-redo/undo.js +4 -5
  622. package/build-module/components/header-edit-mode/undo-redo/undo.js.map +1 -1
  623. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  624. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -4
  625. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  626. package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -15
  627. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  628. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -4
  629. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  630. package/build-module/components/keyboard-shortcuts/edit-mode.js +10 -18
  631. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  632. package/build-module/components/keyboard-shortcuts/global.js +1 -6
  633. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  634. package/build-module/components/keyboard-shortcuts/register.js +0 -2
  635. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  636. package/build-module/components/layout/hooks.js +2 -4
  637. package/build-module/components/layout/hooks.js.map +1 -1
  638. package/build-module/components/layout/index.js +25 -19
  639. package/build-module/components/layout/index.js.map +1 -1
  640. package/build-module/components/list/added-by.js +12 -15
  641. package/build-module/components/list/added-by.js.map +1 -1
  642. package/build-module/components/list/header.js +1 -4
  643. package/build-module/components/list/header.js.map +1 -1
  644. package/build-module/components/list/index.js +8 -6
  645. package/build-module/components/list/index.js.map +1 -1
  646. package/build-module/components/list/table.js +5 -7
  647. package/build-module/components/list/table.js.map +1 -1
  648. package/build-module/components/list/use-register-shortcuts.js +1 -0
  649. package/build-module/components/list/use-register-shortcuts.js.map +1 -1
  650. package/build-module/components/page/header.js +1 -1
  651. package/build-module/components/page/header.js.map +1 -1
  652. package/build-module/components/page/index.js +5 -6
  653. package/build-module/components/page/index.js.map +1 -1
  654. package/build-module/components/page-actions/index.js +1 -2
  655. package/build-module/components/page-actions/index.js.map +1 -1
  656. package/build-module/components/page-actions/trash-page-menu-item.js +3 -6
  657. package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -1
  658. package/build-module/components/page-content-focus-manager/back-to-page-notification.js +3 -4
  659. package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  660. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +7 -10
  661. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  662. package/build-module/components/page-content-focus-manager/edit-template-notification.js +2 -12
  663. package/build-module/components/page-content-focus-manager/edit-template-notification.js.map +1 -1
  664. package/build-module/components/page-content-focus-manager/index.js +1 -2
  665. package/build-module/components/page-content-focus-manager/index.js.map +1 -1
  666. package/build-module/components/page-main/index.js +1 -4
  667. package/build-module/components/page-main/index.js.map +1 -1
  668. package/build-module/components/page-patterns/duplicate-menu-item.js +22 -40
  669. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
  670. package/build-module/components/page-patterns/grid-item.js +13 -18
  671. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  672. package/build-module/components/page-patterns/grid.js +0 -2
  673. package/build-module/components/page-patterns/grid.js.map +1 -1
  674. package/build-module/components/page-patterns/header.js +1 -4
  675. package/build-module/components/page-patterns/header.js.map +1 -1
  676. package/build-module/components/page-patterns/index.js +6 -5
  677. package/build-module/components/page-patterns/index.js.map +1 -1
  678. package/build-module/components/page-patterns/no-patterns.js +0 -1
  679. package/build-module/components/page-patterns/no-patterns.js.map +1 -1
  680. package/build-module/components/page-patterns/pagination.js +6 -4
  681. package/build-module/components/page-patterns/pagination.js.map +1 -1
  682. package/build-module/components/page-patterns/patterns-list.js +17 -9
  683. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  684. package/build-module/components/page-patterns/rename-menu-item.js +5 -8
  685. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
  686. package/build-module/components/page-patterns/search-items.js +28 -32
  687. package/build-module/components/page-patterns/search-items.js.map +1 -1
  688. package/build-module/components/page-patterns/use-pattern-settings.js +5 -4
  689. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
  690. package/build-module/components/page-patterns/use-patterns.js +28 -21
  691. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  692. package/build-module/components/page-patterns/utils.js.map +1 -1
  693. package/build-module/components/page-template-parts/add-new-template-part.js +1 -4
  694. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -1
  695. package/build-module/components/page-template-parts/index.js +2 -4
  696. package/build-module/components/page-template-parts/index.js.map +1 -1
  697. package/build-module/components/page-templates/index.js +3 -17
  698. package/build-module/components/page-templates/index.js.map +1 -1
  699. package/build-module/components/plugin-template-setting-panel/index.js +1 -1
  700. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  701. package/build-module/components/preferences-modal/enable-feature.js +0 -3
  702. package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
  703. package/build-module/components/preferences-modal/index.js +1 -8
  704. package/build-module/components/preferences-modal/index.js.map +1 -1
  705. package/build-module/components/resizable-frame/index.js +37 -56
  706. package/build-module/components/resizable-frame/index.js.map +1 -1
  707. package/build-module/components/revisions/index.js +5 -7
  708. package/build-module/components/revisions/index.js.map +1 -1
  709. package/build-module/components/routes/link.js +3 -8
  710. package/build-module/components/routes/link.js.map +1 -1
  711. package/build-module/components/routes/use-title.js +5 -7
  712. package/build-module/components/routes/use-title.js.map +1 -1
  713. package/build-module/components/save-button/index.js +7 -15
  714. package/build-module/components/save-button/index.js.map +1 -1
  715. package/build-module/components/save-hub/index.js +17 -20
  716. package/build-module/components/save-hub/index.js.map +1 -1
  717. package/build-module/components/save-panel/index.js +7 -17
  718. package/build-module/components/save-panel/index.js.map +1 -1
  719. package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
  720. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  721. package/build-module/components/secondary-sidebar/list-view-sidebar.js +21 -19
  722. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  723. package/build-module/components/sidebar/index.js +1 -5
  724. package/build-module/components/sidebar/index.js.map +1 -1
  725. package/build-module/components/sidebar-button/index.js +3 -3
  726. package/build-module/components/sidebar-button/index.js.map +1 -1
  727. package/build-module/components/sidebar-edit-mode/constants.js.map +1 -1
  728. package/build-module/components/sidebar-edit-mode/default-sidebar.js +2 -2
  729. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  730. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +1 -6
  731. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  732. package/build-module/components/sidebar-edit-mode/index.js +1 -7
  733. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  734. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +11 -13
  735. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  736. package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -5
  737. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  738. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +1 -2
  739. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  740. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +2 -11
  741. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  742. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -2
  743. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  744. package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js +2 -7
  745. package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -1
  746. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -3
  747. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  748. package/build-module/components/sidebar-edit-mode/settings-header/index.js +15 -17
  749. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  750. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +1 -2
  751. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  752. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +1 -2
  753. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  754. package/build-module/components/sidebar-edit-mode/template-panel/index.js +15 -15
  755. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  756. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +2 -11
  757. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
  758. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +1 -4
  759. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
  760. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +1 -10
  761. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -1
  762. package/build-module/components/sidebar-navigation-item/index.js +1 -2
  763. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  764. package/build-module/components/sidebar-navigation-screen/index.js +21 -18
  765. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  766. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +2 -4
  767. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  768. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +1 -4
  769. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
  770. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -1
  771. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
  772. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +1 -2
  773. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  774. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -1
  775. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
  776. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +47 -64
  777. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  778. package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
  779. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  780. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -4
  781. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  782. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -2
  783. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  784. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +2 -2
  785. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  786. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +2 -3
  787. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  788. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +5 -13
  789. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  790. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +5 -9
  791. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  792. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -7
  793. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  794. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -6
  795. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  796. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
  797. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  798. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +10 -27
  799. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  800. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
  801. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  802. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  803. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +20 -24
  804. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  805. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +12 -9
  806. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  807. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +8 -8
  808. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  809. package/build-module/components/sidebar-navigation-screen-page/index.js +6 -6
  810. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  811. package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -22
  812. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  813. package/build-module/components/sidebar-navigation-screen-page/status-label.js +3 -13
  814. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  815. package/build-module/components/sidebar-navigation-screen-pages/index.js +8 -17
  816. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  817. package/build-module/components/sidebar-navigation-screen-pattern/index.js +11 -12
  818. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  819. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +1 -2
  820. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
  821. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -2
  822. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -1
  823. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -3
  824. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  825. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +4 -5
  826. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  827. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +12 -18
  828. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  829. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +47 -34
  830. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  831. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -9
  832. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  833. package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -14
  834. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  835. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +1 -2
  836. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -1
  837. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -1
  838. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  839. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -7
  840. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  841. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +5 -5
  842. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  843. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -2
  844. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  845. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +7 -18
  846. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
  847. package/build-module/components/sidebar-navigation-screen-template/index.js +0 -6
  848. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  849. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -14
  850. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  851. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +8 -2
  852. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  853. package/build-module/components/site-hub/index.js +9 -9
  854. package/build-module/components/site-hub/index.js.map +1 -1
  855. package/build-module/components/site-icon/index.js +1 -6
  856. package/build-module/components/site-icon/index.js.map +1 -1
  857. package/build-module/components/start-template-options/index.js +3 -14
  858. package/build-module/components/start-template-options/index.js.map +1 -1
  859. package/build-module/components/style-book/index.js +24 -24
  860. package/build-module/components/style-book/index.js.map +1 -1
  861. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -15
  862. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  863. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -8
  864. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  865. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -14
  866. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  867. package/build-module/components/table/index.js.map +1 -1
  868. package/build-module/components/template-actions/index.js +2 -9
  869. package/build-module/components/template-actions/index.js.map +1 -1
  870. package/build-module/components/template-actions/rename-menu-item.js +6 -8
  871. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  872. package/build-module/components/template-part-converter/convert-to-regular.js +0 -3
  873. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  874. package/build-module/components/template-part-converter/convert-to-template-part.js +4 -5
  875. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  876. package/build-module/components/template-part-converter/index.js +3 -5
  877. package/build-module/components/template-part-converter/index.js.map +1 -1
  878. package/build-module/components/use-edited-entity-record/index.js +2 -7
  879. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  880. package/build-module/components/welcome-guide/editor.js +1 -4
  881. package/build-module/components/welcome-guide/editor.js.map +1 -1
  882. package/build-module/components/welcome-guide/image.js.map +1 -1
  883. package/build-module/components/welcome-guide/index.js +0 -1
  884. package/build-module/components/welcome-guide/index.js.map +1 -1
  885. package/build-module/components/welcome-guide/page.js +1 -5
  886. package/build-module/components/welcome-guide/page.js.map +1 -1
  887. package/build-module/components/welcome-guide/styles.js +1 -5
  888. package/build-module/components/welcome-guide/styles.js.map +1 -1
  889. package/build-module/components/welcome-guide/template.js +1 -5
  890. package/build-module/components/welcome-guide/template.js.map +1 -1
  891. package/build-module/hooks/commands/use-common-commands.js +174 -119
  892. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  893. package/build-module/hooks/commands/use-edit-mode-commands.js +117 -41
  894. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  895. package/build-module/hooks/components.js.map +1 -1
  896. package/build-module/hooks/index.js.map +1 -1
  897. package/build-module/hooks/navigation-menu-edit.js +11 -14
  898. package/build-module/hooks/navigation-menu-edit.js.map +1 -1
  899. package/build-module/hooks/push-changes-to-global-styles/index.js +223 -87
  900. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  901. package/build-module/hooks/template-part-edit.js +7 -9
  902. package/build-module/hooks/template-part-edit.js.map +1 -1
  903. package/build-module/index.js +10 -15
  904. package/build-module/index.js.map +1 -1
  905. package/build-module/lock-unlock.js.map +1 -1
  906. package/build-module/store/actions.js +35 -53
  907. package/build-module/store/actions.js.map +1 -1
  908. package/build-module/store/constants.js.map +1 -1
  909. package/build-module/store/index.js +1 -1
  910. package/build-module/store/index.js.map +1 -1
  911. package/build-module/store/private-actions.js +8 -9
  912. package/build-module/store/private-actions.js.map +1 -1
  913. package/build-module/store/private-selectors.js +1 -1
  914. package/build-module/store/private-selectors.js.map +1 -1
  915. package/build-module/store/reducer.js +13 -29
  916. package/build-module/store/reducer.js.map +1 -1
  917. package/build-module/store/selectors.js +26 -31
  918. package/build-module/store/selectors.js.map +1 -1
  919. package/build-module/store/utils.js +13 -13
  920. package/build-module/store/utils.js.map +1 -1
  921. package/build-module/utils/get-is-list-page.js +2 -1
  922. package/build-module/utils/get-is-list-page.js.map +1 -1
  923. package/build-module/utils/is-previewing-theme.js +0 -1
  924. package/build-module/utils/is-previewing-theme.js.map +1 -1
  925. package/build-module/utils/is-template-removable.js +0 -1
  926. package/build-module/utils/is-template-removable.js.map +1 -1
  927. package/build-module/utils/is-template-revertable.js +0 -2
  928. package/build-module/utils/is-template-revertable.js.map +1 -1
  929. package/build-module/utils/template-part-create.js +3 -7
  930. package/build-module/utils/template-part-create.js.map +1 -1
  931. package/build-module/utils/use-activate-theme.js +2 -2
  932. package/build-module/utils/use-activate-theme.js.map +1 -1
  933. package/build-module/utils/use-debounced-input.js +5 -7
  934. package/build-module/utils/use-debounced-input.js.map +1 -1
  935. package/build-style/style-rtl.css +102 -72
  936. package/build-style/style.css +102 -72
  937. package/package.json +41 -40
  938. package/src/components/add-new-pattern/index.js +6 -3
  939. package/src/components/block-editor/index.js +4 -3
  940. package/src/components/block-editor/providers/navigation-block-editor-provider.js +2 -3
  941. package/src/components/block-editor/use-site-editor-settings.js +22 -2
  942. package/src/components/canvas-spinner/index.js +21 -3
  943. package/src/components/canvas-spinner/style.scss +5 -2
  944. package/src/components/editor/index.js +18 -4
  945. package/src/components/global-styles/block-preview-panel.js +26 -15
  946. package/src/components/global-styles/global-styles-provider.js +7 -2
  947. package/src/components/global-styles/hooks.js +27 -1
  948. package/src/components/global-styles/preview.js +3 -13
  949. package/src/components/global-styles/screen-block.js +15 -0
  950. package/src/components/global-styles/screen-colors.js +0 -4
  951. package/src/components/global-styles/screen-layout.js +0 -2
  952. package/src/components/global-styles/screen-revisions/index.js +68 -60
  953. package/src/components/global-styles/screen-revisions/revisions-buttons.js +57 -46
  954. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +24 -1
  955. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +70 -48
  956. package/src/components/global-styles/screen-typography.js +0 -4
  957. package/src/components/global-styles/style-variations-container.js +2 -0
  958. package/src/components/global-styles/ui.js +1 -1
  959. package/src/components/header-edit-mode/document-actions/index.js +20 -29
  960. package/src/components/header-edit-mode/document-actions/style.scss +54 -28
  961. package/src/components/header-edit-mode/index.js +1 -1
  962. package/src/components/header-edit-mode/style.scss +0 -9
  963. package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
  964. package/src/components/layout/index.js +38 -22
  965. package/src/components/layout/style.scss +2 -2
  966. package/src/components/page/index.js +8 -8
  967. package/src/components/page/style.scss +8 -5
  968. package/src/components/page-actions/trash-page-menu-item.js +5 -1
  969. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +2 -5
  970. package/src/components/page-patterns/duplicate-menu-item.js +18 -39
  971. package/src/components/page-patterns/patterns-list.js +25 -12
  972. package/src/components/page-patterns/style.scss +9 -8
  973. package/src/components/page-patterns/use-patterns.js +28 -6
  974. package/src/components/page-template-parts/index.js +0 -1
  975. package/src/components/page-templates/index.js +6 -19
  976. package/src/components/resizable-frame/index.js +10 -25
  977. package/src/components/save-button/index.js +2 -0
  978. package/src/components/save-hub/index.js +6 -1
  979. package/src/components/save-hub/style.scss +1 -1
  980. package/src/components/sidebar-edit-mode/default-sidebar.js +1 -0
  981. package/src/components/sidebar-edit-mode/page-panels/edit-template.js +13 -5
  982. package/src/components/sidebar-edit-mode/template-panel/index.js +15 -11
  983. package/src/components/sidebar-navigation-screen/index.js +24 -16
  984. package/src/components/sidebar-navigation-screen/style.scss +4 -0
  985. package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
  986. package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
  987. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +3 -4
  988. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  989. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +38 -25
  990. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
  991. package/src/components/sidebar-navigation-screen-page/index.js +3 -3
  992. package/src/components/sidebar-navigation-screen-pages/index.js +10 -5
  993. package/src/components/sidebar-navigation-screen-pattern/index.js +2 -5
  994. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  995. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -1
  996. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +69 -44
  997. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
  998. package/src/components/sidebar-navigation-screen-patterns/index.js +1 -9
  999. package/src/components/sidebar-navigation-screen-template/home-template-details.js +4 -2
  1000. package/src/components/sidebar-navigation-screen-templates/index.js +2 -10
  1001. package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
  1002. package/src/components/site-hub/index.js +4 -2
  1003. package/src/components/site-hub/style.scss +1 -2
  1004. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -8
  1005. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
  1006. package/src/components/table/style.scss +1 -0
  1007. package/src/components/template-actions/index.js +1 -5
  1008. package/src/components/use-edited-entity-record/index.js +1 -6
  1009. package/src/hooks/commands/use-common-commands.js +206 -85
  1010. package/src/hooks/commands/use-edit-mode-commands.js +149 -36
  1011. package/src/hooks/navigation-menu-edit.js +1 -5
  1012. package/src/hooks/push-changes-to-global-styles/index.js +240 -68
  1013. package/src/store/private-actions.js +5 -1
  1014. package/src/style.scss +0 -1
  1015. package/src/utils/use-debounced-input.js +8 -7
  1016. package/build/components/create-pattern-modal/index.js +0 -129
  1017. package/build/components/create-pattern-modal/index.js.map +0 -1
  1018. package/build/utils/normalize-record-key.js +0 -19
  1019. package/build/utils/normalize-record-key.js.map +0 -1
  1020. package/build-module/components/create-pattern-modal/index.js +0 -116
  1021. package/build-module/components/create-pattern-modal/index.js.map +0 -1
  1022. package/build-module/utils/normalize-record-key.js +0 -12
  1023. package/build-module/utils/normalize-record-key.js.map +0 -1
  1024. package/src/components/create-pattern-modal/index.js +0 -136
  1025. package/src/components/create-pattern-modal/style.scss +0 -3
  1026. package/src/utils/normalize-record-key.js +0 -11
  1027. /package/src/components/global-styles/stories/{index.js → index.story.js} +0 -0
@@ -1,31 +1,44 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { addFilter } from '@wordpress/hooks';
7
6
  import { createHigherOrderComponent } from '@wordpress/compose';
8
- import { InspectorAdvancedControls, store as blockEditorStore, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
7
+ import { InspectorAdvancedControls, store as blockEditorStore, privateApis as blockEditorPrivateApis, useBlockEditingMode } from '@wordpress/block-editor';
9
8
  import { BaseControl, Button } from '@wordpress/components';
10
9
  import { __, sprintf } from '@wordpress/i18n';
11
- import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, getBlockType, hasBlockSupport } from '@wordpress/blocks';
10
+ import { __EXPERIMENTAL_STYLE_PROPERTY, getBlockType, hasBlockSupport } from '@wordpress/blocks';
12
11
  import { useContext, useMemo, useCallback } from '@wordpress/element';
13
12
  import { useDispatch } from '@wordpress/data';
14
13
  import { store as noticesStore } from '@wordpress/notices';
14
+
15
15
  /**
16
16
  * Internal dependencies
17
17
  */
18
-
19
18
  import { useSupportedStyles } from '../../components/global-styles/hooks';
20
19
  import { unlock } from '../../lock-unlock';
21
20
  const {
21
+ cleanEmptyObject,
22
22
  GlobalStylesContext,
23
- useBlockEditingMode
24
- } = unlock(blockEditorPrivateApis); // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
23
+ __experimentalUseGlobalBehaviors: useGlobalBehaviors,
24
+ __experimentalUseHasBehaviorsPanel: useHasBehaviorsPanel
25
+ } = unlock(blockEditorPrivateApis);
26
+
27
+ // Block Gap is a special case and isn't defined within the blocks
28
+ // style properties config. We'll add it here to allow it to be pushed
29
+ // to global styles as well.
30
+ const STYLE_PROPERTY = {
31
+ ...__EXPERIMENTAL_STYLE_PROPERTY,
32
+ blockGap: {
33
+ value: ['spacing', 'blockGap']
34
+ }
35
+ };
36
+
37
+ // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
25
38
  // removed by moving PushChangesToGlobalStylesControl to
26
39
  // @wordpress/block-editor.
27
-
28
40
  const STYLE_PATH_TO_CSS_VAR_INFIX = {
41
+ 'border.color': 'color',
29
42
  'color.background': 'color',
30
43
  'color.text': 'color',
31
44
  'elements.link.color.text': 'color',
@@ -67,13 +80,16 @@ const STYLE_PATH_TO_CSS_VAR_INFIX = {
67
80
  'elements.h6.typography.fontFamily': 'font-family',
68
81
  'elements.h6.color.gradient': 'gradient',
69
82
  'color.gradient': 'gradient',
83
+ blockGap: 'spacing',
70
84
  'typography.fontSize': 'font-size',
71
85
  'typography.fontFamily': 'font-family'
72
- }; // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
86
+ };
87
+
88
+ // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
73
89
  // removed by moving PushChangesToGlobalStylesControl to
74
90
  // @wordpress/block-editor.
75
-
76
91
  const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
92
+ 'border.color': 'borderColor',
77
93
  'color.background': 'backgroundColor',
78
94
  'color.text': 'textColor',
79
95
  'color.gradient': 'gradient',
@@ -81,7 +97,6 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
81
97
  'typography.fontFamily': 'fontFamily'
82
98
  };
83
99
  const SUPPORTED_STYLES = ['border', 'color', 'spacing', 'typography'];
84
-
85
100
  const getValueFromObjectPath = (object, path) => {
86
101
  let value = object;
87
102
  path.forEach(fieldName => {
@@ -89,26 +104,120 @@ const getValueFromObjectPath = (object, path) => {
89
104
  });
90
105
  return value;
91
106
  };
107
+ const flatBorderProperties = ['borderColor', 'borderWidth', 'borderStyle'];
108
+ const sides = ['top', 'right', 'bottom', 'left'];
109
+ function getBorderStyleChanges(border, presetColor, userStyle) {
110
+ if (!border && !presetColor) {
111
+ return [];
112
+ }
113
+ const changes = [...getFallbackBorderStyleChange('top', border, userStyle), ...getFallbackBorderStyleChange('right', border, userStyle), ...getFallbackBorderStyleChange('bottom', border, userStyle), ...getFallbackBorderStyleChange('left', border, userStyle)];
92
114
 
93
- function useChangesToPush(name, attributes) {
115
+ // Handle a flat border i.e. all sides the same, CSS shorthand.
116
+ const {
117
+ color: customColor,
118
+ style,
119
+ width
120
+ } = border || {};
121
+ const hasColorOrWidth = presetColor || customColor || width;
122
+ if (hasColorOrWidth && !style) {
123
+ // Global Styles need individual side configurations to overcome
124
+ // theme.json configurations which are per side as well.
125
+ sides.forEach(side => {
126
+ // Only add fallback border-style if global styles don't already
127
+ // have something set.
128
+ if (!userStyle?.[side]?.style) {
129
+ changes.push({
130
+ path: ['border', side, 'style'],
131
+ value: 'solid'
132
+ });
133
+ }
134
+ });
135
+ }
136
+ return changes;
137
+ }
138
+ function getFallbackBorderStyleChange(side, border, globalBorderStyle) {
139
+ if (!border?.[side] || globalBorderStyle?.[side]?.style) {
140
+ return [];
141
+ }
142
+ const {
143
+ color,
144
+ style,
145
+ width
146
+ } = border[side];
147
+ const hasColorOrWidth = color || width;
148
+ if (!hasColorOrWidth || style) {
149
+ return [];
150
+ }
151
+ return [{
152
+ path: ['border', side, 'style'],
153
+ value: 'solid'
154
+ }];
155
+ }
156
+ function useChangesToPush(name, attributes, userConfig) {
94
157
  const supports = useSupportedStyles(name);
95
- return useMemo(() => supports.flatMap(key => {
96
- if (!STYLE_PROPERTY[key]) {
97
- return [];
98
- }
158
+ const blockUserConfig = userConfig?.styles?.blocks?.[name];
159
+ return useMemo(() => {
160
+ const changes = supports.flatMap(key => {
161
+ if (!STYLE_PROPERTY[key]) {
162
+ return [];
163
+ }
164
+ const {
165
+ value: path
166
+ } = STYLE_PROPERTY[key];
167
+ const presetAttributeKey = path.join('.');
168
+ const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]];
169
+ const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : getValueFromObjectPath(attributes.style, path);
99
170
 
100
- const {
101
- value: path
102
- } = STYLE_PROPERTY[key];
103
- const presetAttributeKey = path.join('.');
104
- const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]];
105
- const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : getValueFromObjectPath(attributes.style, path);
106
- return value ? [{
107
- path,
108
- value
109
- }] : [];
110
- }), [supports, name, attributes]);
171
+ // Links only have a single support entry but have two element
172
+ // style properties, color and hover color. The following check
173
+ // will add the hover color to the changes if required.
174
+ if (key === 'linkColor') {
175
+ const linkChanges = value ? [{
176
+ path,
177
+ value
178
+ }] : [];
179
+ const hoverPath = ['elements', 'link', ':hover', 'color', 'text'];
180
+ const hoverValue = getValueFromObjectPath(attributes.style, hoverPath);
181
+ if (hoverValue) {
182
+ linkChanges.push({
183
+ path: hoverPath,
184
+ value: hoverValue
185
+ });
186
+ }
187
+ return linkChanges;
188
+ }
189
+
190
+ // The shorthand border styles can't be mapped directly as global
191
+ // styles requires longhand config.
192
+ if (flatBorderProperties.includes(key) && value) {
193
+ // The shorthand config path is included to clear the block attribute.
194
+ const borderChanges = [{
195
+ path,
196
+ value
197
+ }];
198
+ sides.forEach(side => {
199
+ const currentPath = [...path];
200
+ currentPath.splice(-1, 0, side);
201
+ borderChanges.push({
202
+ path: currentPath,
203
+ value
204
+ });
205
+ });
206
+ return borderChanges;
207
+ }
208
+ return value ? [{
209
+ path,
210
+ value
211
+ }] : [];
212
+ });
213
+
214
+ // To ensure display of a visible border, global styles require a
215
+ // default border style if a border color or width is present.
216
+ getBorderStyleChanges(attributes.style?.border, attributes.borderColor, blockUserConfig?.border).forEach(change => changes.push(change));
217
+ return changes;
218
+ }, [supports, attributes, blockUserConfig]);
111
219
  }
220
+
112
221
  /**
113
222
  * Sets the value at path of object.
114
223
  * If a portion of path doesn’t exist, it’s created.
@@ -127,13 +236,10 @@ function useChangesToPush(name, attributes) {
127
236
  * @param {Array} path Path of the property to set.
128
237
  * @param {*} value Value to set.
129
238
  */
130
-
131
-
132
239
  function setNestedValue(object, path, value) {
133
240
  if (!object || typeof object !== 'object') {
134
241
  return object;
135
242
  }
136
-
137
243
  path.reduce((acc, key, idx) => {
138
244
  if (acc[key] === undefined) {
139
245
  if (Number.isInteger(path[idx + 1])) {
@@ -142,103 +248,133 @@ function setNestedValue(object, path, value) {
142
248
  acc[key] = {};
143
249
  }
144
250
  }
145
-
146
251
  if (idx === path.length - 1) {
147
252
  acc[key] = value;
148
253
  }
149
-
150
254
  return acc[key];
151
255
  }, object);
152
256
  return object;
153
257
  }
154
-
155
258
  function cloneDeep(object) {
156
259
  return !object ? {} : JSON.parse(JSON.stringify(object));
157
260
  }
158
-
159
261
  function PushChangesToGlobalStylesControl({
160
262
  name,
161
263
  attributes,
162
264
  setAttributes
163
265
  }) {
164
- const changes = useChangesToPush(name, attributes);
266
+ const hasBehaviorsPanel = useHasBehaviorsPanel(attributes, name, {
267
+ blockSupportOnly: true
268
+ });
165
269
  const {
166
270
  user: userConfig,
167
271
  setUserConfig
168
272
  } = useContext(GlobalStylesContext);
273
+ const changes = useChangesToPush(name, attributes, userConfig);
169
274
  const {
170
275
  __unstableMarkNextChangeAsNotPersistent
171
276
  } = useDispatch(blockEditorStore);
172
277
  const {
173
278
  createSuccessNotice
174
279
  } = useDispatch(noticesStore);
280
+ const {
281
+ inheritedBehaviors,
282
+ setBehavior
283
+ } = useGlobalBehaviors(name);
284
+ const userHasEditedBehaviors = attributes.hasOwnProperty('behaviors') && hasBehaviorsPanel;
175
285
  const pushChanges = useCallback(() => {
176
- if (changes.length === 0) {
286
+ if (changes.length === 0 && !userHasEditedBehaviors) {
177
287
  return;
178
288
  }
289
+ if (changes.length > 0) {
290
+ const {
291
+ style: blockStyles
292
+ } = attributes;
293
+ const newBlockStyles = cloneDeep(blockStyles);
294
+ const newUserConfig = cloneDeep(userConfig);
295
+ for (const {
296
+ path,
297
+ value
298
+ } of changes) {
299
+ setNestedValue(newBlockStyles, path, undefined);
300
+ setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value);
301
+ }
302
+ const newBlockAttributes = {
303
+ borderColor: undefined,
304
+ backgroundColor: undefined,
305
+ textColor: undefined,
306
+ gradient: undefined,
307
+ fontSize: undefined,
308
+ fontFamily: undefined,
309
+ style: cleanEmptyObject(newBlockStyles)
310
+ };
179
311
 
180
- const {
181
- style: blockStyles
182
- } = attributes;
183
- const newBlockStyles = cloneDeep(blockStyles);
184
- const newUserConfig = cloneDeep(userConfig);
185
-
186
- for (const {
187
- path,
188
- value
189
- } of changes) {
190
- setNestedValue(newBlockStyles, path, undefined);
191
- setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value);
192
- } // @wordpress/core-data doesn't support editing multiple entity types in
193
- // a single undo level. So for now, we disable @wordpress/core-data undo
194
- // tracking and implement our own Undo button in the snackbar
195
- // notification.
196
-
197
-
198
- __unstableMarkNextChangeAsNotPersistent();
199
-
200
- setAttributes({
201
- style: newBlockStyles
202
- });
203
- setUserConfig(() => newUserConfig, {
204
- undoIgnore: true
205
- });
206
- createSuccessNotice(sprintf( // translators: %s: Title of the block e.g. 'Heading'.
207
- __('%s styles applied.'), getBlockType(name).title), {
208
- type: 'snackbar',
209
- actions: [{
210
- label: __('Undo'),
211
-
212
- onClick() {
213
- __unstableMarkNextChangeAsNotPersistent();
214
-
215
- setAttributes({
216
- style: blockStyles
217
- });
218
- setUserConfig(() => userConfig, {
219
- undoIgnore: true
220
- });
221
- }
222
-
223
- }]
224
- });
225
- }, [changes, attributes, userConfig, name]);
312
+ // @wordpress/core-data doesn't support editing multiple entity types in
313
+ // a single undo level. So for now, we disable @wordpress/core-data undo
314
+ // tracking and implement our own Undo button in the snackbar
315
+ // notification.
316
+ __unstableMarkNextChangeAsNotPersistent();
317
+ setAttributes(newBlockAttributes);
318
+ setUserConfig(() => newUserConfig, {
319
+ undoIgnore: true
320
+ });
321
+ createSuccessNotice(sprintf(
322
+ // translators: %s: Title of the block e.g. 'Heading'.
323
+ __('%s styles applied.'), getBlockType(name).title), {
324
+ type: 'snackbar',
325
+ actions: [{
326
+ label: __('Undo'),
327
+ onClick() {
328
+ __unstableMarkNextChangeAsNotPersistent();
329
+ setAttributes(attributes);
330
+ setUserConfig(() => userConfig, {
331
+ undoIgnore: true
332
+ });
333
+ }
334
+ }]
335
+ });
336
+ }
337
+ if (userHasEditedBehaviors) {
338
+ __unstableMarkNextChangeAsNotPersistent();
339
+ setAttributes({
340
+ behaviors: undefined
341
+ });
342
+ setBehavior(attributes.behaviors);
343
+ createSuccessNotice(sprintf(
344
+ // translators: %s: Title of the block e.g. 'Heading'.
345
+ __('%s behaviors applied.'), getBlockType(name).title), {
346
+ type: 'snackbar',
347
+ actions: [{
348
+ label: __('Undo'),
349
+ onClick() {
350
+ __unstableMarkNextChangeAsNotPersistent();
351
+ setBehavior(inheritedBehaviors);
352
+ setUserConfig(() => userConfig, {
353
+ undoIgnore: true
354
+ });
355
+ }
356
+ }]
357
+ });
358
+ }
359
+ }, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, inheritedBehaviors, name, setAttributes, setBehavior, setUserConfig, userConfig, userHasEditedBehaviors]);
226
360
  return createElement(BaseControl, {
227
361
  className: "edit-site-push-changes-to-global-styles-control",
228
- help: sprintf( // translators: %s: Title of the block e.g. 'Heading'.
229
- __('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), getBlockType(name).title)
362
+ help: sprintf(
363
+ // translators: %s: Title of the block e.g. 'Heading'.
364
+ __('Apply this block’s typography, spacing, dimensions, color styles, and behaviors to all %s blocks.'), getBlockType(name).title)
230
365
  }, createElement(BaseControl.VisualLabel, null, __('Styles')), createElement(Button, {
231
366
  variant: "primary",
232
- disabled: changes.length === 0,
367
+ disabled: changes.length === 0 && !userHasEditedBehaviors,
233
368
  onClick: pushChanges
234
369
  }, __('Apply globally')));
235
370
  }
236
-
237
371
  const withPushChangesToGlobalStyles = createHigherOrderComponent(BlockEdit => props => {
238
372
  const blockEditingMode = useBlockEditingMode();
239
373
  const supportsStyles = SUPPORTED_STYLES.some(feature => hasBlockSupport(props.name, feature));
240
- return createElement(Fragment, null, createElement(BlockEdit, { ...props
241
- }), blockEditingMode === 'default' && supportsStyles && createElement(InspectorAdvancedControls, null, createElement(PushChangesToGlobalStylesControl, { ...props
374
+ return createElement(Fragment, null, createElement(BlockEdit, {
375
+ ...props
376
+ }), blockEditingMode === 'default' && supportsStyles && createElement(InspectorAdvancedControls, null, createElement(PushChangesToGlobalStylesControl, {
377
+ ...props
242
378
  })));
243
379
  });
244
380
  addFilter('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","GlobalStylesContext","useBlockEditingMode","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","value","forEach","fieldName","useChangesToPush","name","attributes","supports","flatMap","key","presetAttributeKey","join","presetAttributeValue","style","setNestedValue","reduce","acc","idx","undefined","Number","isInteger","length","cloneDeep","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","blockStyles","newBlockStyles","newUserConfig","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode","supportsStyles","some","feature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASf,KAAK,IAAIgB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,sCAAnC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,mBAAF;AAAuBC,EAAAA;AAAvB,IAA+CF,MAAM,CAC1Df,sBAD0D,CAA3D,C,CAIA;AACA;AACA;;AACA,MAAMkB,2BAA2B,GAAG;AACnC,sBAAoB,OADe;AAEnC,gBAAc,OAFqB;AAGnC,8BAA4B,OAHO;AAInC,qCAAmC,OAJA;AAKnC,yCAAuC,aALJ;AAMnC,uCAAqC,WANF;AAOnC,gCAA8B,OAPK;AAQnC,sCAAoC,OARD;AASnC,2CAAyC,aATN;AAUnC,yCAAuC,WAVJ;AAWnC,iCAA+B,OAXI;AAYnC,4BAA0B,OAZS;AAanC,uCAAqC,OAbF;AAcnC,4CAA0C,aAdP;AA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,iDADX;AAEC,IAAA,IAAI,EAAGxB,OAAO,EACb;AACAD,IAAAA,EAAE,CACD,wFADC,CAFW,EAKbI,YAAY,CAAEqB,IAAF,CAAZ,CAAqBkC,KALR;AAFf,KAUC,cAAC,WAAD,CAAa,WAAb,QACG3D,EAAE,CAAE,QAAF,CADL,CAVD,EAaC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,QAAQ,EAAGgD,OAAO,CAACP,MAAR,KAAmB,CAF/B;AAGC,IAAA,OAAO,EAAGa;AAHX,KAKGtD,EAAE,CAAE,gBAAF,CALL,CAbD,CADD;AAuBA;;AAED,MAAMgE,6BAA6B,GAAGxE,0BAA0B,CAC7DyE,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAMC,gBAAgB,GAAGrD,mBAAmB,EAA5C;AACA,QAAMsD,cAAc,GAAGnD,gBAAgB,CAACoD,IAAjB,CAAyBC,OAAF,IAC7CjE,eAAe,CAAE6D,KAAK,CAACzC,IAAR,EAAc6C,OAAd,CADO,CAAvB;AAIA,SACC,8BACC,cAAC,SAAD,OAAgBJ;AAAhB,IADD,EAEGC,gBAAgB,KAAK,SAArB,IAAkCC,cAAlC,IACD,cAAC,yBAAD,QACC,cAAC,gCAAD,OAAuCF;AAAvC,IADD,CAHF,CADD;AAUA,CAjB8D,CAAhE;AAoBA3E,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRyE,6BAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, useBlockEditingMode } = unlock(\n\tblockEditorPrivateApis\n);\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\n/**\n * Sets the value at path of object.\n * If a portion of path doesn’t exist, it’s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.\n *\n * @param {Object} object Object to modify\n * @param {Array} path Path of the property to set.\n * @param {*} value Value to set.\n */\nfunction setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tpath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === path.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\tsetNestedValue(\n\t\t\t\tnewUserConfig,\n\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\tvalue\n\t\t\t);\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
1
+ {"version":3,"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","useBlockEditingMode","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","cleanEmptyObject","GlobalStylesContext","__experimentalUseGlobalBehaviors","useGlobalBehaviors","__experimentalUseHasBehaviorsPanel","useHasBehaviorsPanel","STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","blockUserConfig","styles","blocks","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","setNestedValue","reduce","acc","idx","undefined","Number","isInteger","length","cloneDeep","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","hasBehaviorsPanel","blockSupportOnly","user","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","inheritedBehaviors","setBehavior","userHasEditedBehaviors","hasOwnProperty","pushChanges","blockStyles","newBlockStyles","newUserConfig","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","title","type","actions","label","onClick","behaviors","createElement","className","help","VisualLabel","variant","disabled","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode","supportsStyles","some","feature","Fragment"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tcleanEmptyObject,\n\tGlobalStylesContext,\n\t__experimentalUseGlobalBehaviors: useGlobalBehaviors,\n\t__experimentalUseHasBehaviorsPanel: useHasBehaviorsPanel,\n} = unlock( blockEditorPrivateApis );\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\n/**\n * Sets the value at path of object.\n * If a portion of path doesn’t exist, it’s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.\n *\n * @param {Object} object Object to modify\n * @param {Array} path Path of the property to set.\n * @param {*} value Value to set.\n */\nfunction setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tpath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === path.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst hasBehaviorsPanel = useHasBehaviorsPanel( attributes, name, {\n\t\tblockSupportOnly: true,\n\t} );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst { inheritedBehaviors, setBehavior } = useGlobalBehaviors( name );\n\n\tconst userHasEditedBehaviors =\n\t\tattributes.hasOwnProperty( 'behaviors' ) && hasBehaviorsPanel;\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 && ! userHasEditedBehaviors ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tif ( userHasEditedBehaviors ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { behaviors: undefined } );\n\t\t\tsetBehavior( attributes.behaviors );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s behaviors applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetBehavior( inheritedBehaviors );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tinheritedBehaviors,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetBehavior,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t\tuserHasEditedBehaviors,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, color styles, and behaviors to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 && ! userHasEditedBehaviors }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SACCC,yBAAyB,EACzBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,EACrCC,mBAAmB,QACb,yBAAyB;AAChC,SAASC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,6BAA6B,EAC7BC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACrE,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASf,KAAK,IAAIgB,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,sCAAsC;AACzE,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EACLC,gBAAgB;EAChBC,mBAAmB;EACnBC,gCAAgC,EAAEC,kBAAkB;EACpDC,kCAAkC,EAAEC;AACrC,CAAC,GAAGN,MAAM,CAAEf,sBAAuB,CAAC;;AAEpC;AACA;AACA;AACA,MAAMsB,cAAc,GAAG;EACtB,GAAGhB,6BAA6B;EAChCiB,QAAQ,EAAE;IAAEC,KAAK,EAAE,CAAE,SAAS,EAAE,UAAU;EAAG;AAC9C,CAAC;;AAED;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG;EACnC,cAAc,EAAE,OA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ChB,CACI,CAAC;AAEhB;AAEA,MAAMkH,6BAA6B,GAAG3H,0BAA0B,CAC7D4H,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAMC,gBAAgB,GAAGxH,mBAAmB,CAAC,CAAC;EAC9C,MAAMyH,cAAc,GAAG/F,gBAAgB,CAACgG,IAAI,CAAIC,OAAO,IACtDpH,eAAe,CAAEgH,KAAK,CAACtE,IAAI,EAAE0E,OAAQ,CACtC,CAAC;EAED,OACCZ,aAAA,CAAAa,QAAA,QACCb,aAAA,CAACO,SAAS;IAAA,GAAMC;EAAK,CAAI,CAAC,EACxBC,gBAAgB,KAAK,SAAS,IAAIC,cAAc,IACjDV,aAAA,CAACpH,yBAAyB,QACzBoH,aAAA,CAAC7B,gCAAgC;IAAA,GAAMqC;EAAK,CAAI,CACtB,CAE3B,CAAC;AAEL,CACD,CAAC;AAED9H,SAAS,CACR,kBAAkB,EAClB,8CAA8C,EAC9C4H,6BACD,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -11,16 +10,15 @@ import { ToolbarButton } from '@wordpress/components';
11
10
  import { addFilter } from '@wordpress/hooks';
12
11
  import { createHigherOrderComponent } from '@wordpress/compose';
13
12
  import { privateApis as routerPrivateApis } from '@wordpress/router';
13
+
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
-
18
17
  import { useLink } from '../components/routes/link';
19
18
  import { unlock } from '../lock-unlock';
20
19
  const {
21
20
  useLocation
22
21
  } = unlock(routerPrivateApis);
23
-
24
22
  function EditTemplatePartMenuItem({
25
23
  attributes
26
24
  }) {
@@ -32,7 +30,8 @@ function EditTemplatePartMenuItem({
32
30
  params
33
31
  } = useLocation();
34
32
  const templatePart = useSelect(select => {
35
- return select(coreStore).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API.
33
+ return select(coreStore).getEntityRecord('postType', 'wp_template_part',
34
+ // Ideally this should be an official public API.
36
35
  `${theme}//${slug}`);
37
36
  }, [theme, slug]);
38
37
  const linkProps = useLink({
@@ -42,27 +41,26 @@ function EditTemplatePartMenuItem({
42
41
  }, {
43
42
  fromTemplateId: params.postId
44
43
  });
45
-
46
44
  if (!templatePart) {
47
45
  return null;
48
46
  }
49
-
50
47
  return createElement(BlockControls, {
51
48
  group: "other"
52
- }, createElement(ToolbarButton, { ...linkProps,
49
+ }, createElement(ToolbarButton, {
50
+ ...linkProps,
53
51
  onClick: event => {
54
52
  linkProps.onClick(event);
55
53
  }
56
54
  }, __('Edit')));
57
55
  }
58
-
59
56
  export const withEditBlockControls = createHigherOrderComponent(BlockEdit => props => {
60
57
  const {
61
58
  attributes,
62
59
  name
63
60
  } = props;
64
61
  const isDisplayed = name === 'core/template-part' && attributes.slug;
65
- return createElement(Fragment, null, createElement(BlockEdit, { ...props
62
+ return createElement(Fragment, null, createElement(BlockEdit, {
63
+ ...props
66
64
  }), isDisplayed && createElement(EditTemplatePartMenuItem, {
67
65
  attributes: attributes
68
66
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["__","useSelect","BlockControls","store","coreStore","ToolbarButton","addFilter","createHigherOrderComponent","privateApis","routerPrivateApis","useLink","unlock","useLocation","EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,m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Ad,MAAuBD,KAA7B;AACA,QAAME,WAAW,GAAGD,IAAI,KAAK,oBAAT,IAAiCnB,UAAU,CAACE,IAAhE;AAEA,SACC,8BACC,cAAC,SAAD,OAAgBgB;AAAhB,IADD,EAEGE,WAAW,IACZ,cAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGpB;AAAvC,IAHF,CADD;AAQA,CAb6D,EAc9D,uBAd8D,CAAxD;AAiBPR,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRwB,qBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../components/routes/link';\nimport { unlock } from '../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
1
+ {"version":3,"names":["__","useSelect","BlockControls","store","coreStore","ToolbarButton","addFilter","createHigherOrderComponent","privateApis","routerPrivateApis","useLink","unlock","useLocation","EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","createElement","group","onClick","event","withEditBlockControls","BlockEdit","props","name","isDisplayed","Fragment"],"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../components/routes/link';\nimport { unlock } from '../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,SAAS,QAA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