@wordpress/edit-site 5.33.0 → 5.35.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 (543) hide show
  1. package/CHANGELOG.md +11 -3
  2. package/build/components/add-new-page/index.js +3 -0
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +8 -7
  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 +3 -0
  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 +3 -1
  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 +2 -2
  11. package/build/components/add-new-template/index.js.map +1 -1
  12. package/build/components/app/index.js +4 -2
  13. package/build/components/app/index.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +4 -18
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/resize-handle.js +20 -5
  17. package/build/components/block-editor/resize-handle.js.map +1 -1
  18. package/build/components/block-editor/site-editor-canvas.js +2 -2
  19. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  20. package/build/components/create-template-part-modal/index.js +3 -0
  21. package/build/components/create-template-part-modal/index.js.map +1 -1
  22. package/build/components/dataviews-actions/index.js +46 -0
  23. package/build/components/dataviews-actions/index.js.map +1 -0
  24. package/build/components/editor/index.js +95 -16
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/global-styles/background-panel.js +13 -1
  27. package/build/components/global-styles/background-panel.js.map +1 -1
  28. package/build/components/global-styles/color-indicator-wrapper.js +2 -2
  29. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  30. package/build/components/global-styles/color-palette-panel.js +5 -2
  31. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/font-library-modal/context.js +9 -3
  33. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  34. package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
  35. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  36. package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  37. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  38. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  39. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  40. package/build/components/global-styles/gradients-palette-panel.js +1 -2
  41. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  42. package/build/components/global-styles/hooks.js +5 -2
  43. package/build/components/global-styles/hooks.js.map +1 -1
  44. package/build/components/global-styles/icon-with-current-color.js +2 -2
  45. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  46. package/build/components/global-styles/preset-colors.js +29 -0
  47. package/build/components/global-styles/preset-colors.js.map +1 -0
  48. package/build/components/global-styles/preview-colors.js +3 -7
  49. package/build/components/global-styles/preview-colors.js.map +1 -1
  50. package/build/components/global-styles/screen-color-palette.js +5 -5
  51. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  52. package/build/components/global-styles/screen-colors.js +1 -4
  53. package/build/components/global-styles/screen-colors.js.map +1 -1
  54. package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  55. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +8 -2
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-example.js +5 -2
  59. package/build/components/global-styles/typography-example.js.map +1 -1
  60. package/build/components/global-styles/ui.js +4 -1
  61. package/build/components/global-styles/ui.js.map +1 -1
  62. package/build/components/global-styles/variations/variation.js +12 -6
  63. package/build/components/global-styles/variations/variation.js.map +1 -1
  64. package/build/components/global-styles/variations/variations-color.js +5 -5
  65. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  66. package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  67. package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
  68. package/build/components/global-styles-sidebar/index.js.map +1 -0
  69. package/build/components/header-edit-mode/index.js +21 -137
  70. package/build/components/header-edit-mode/index.js.map +1 -1
  71. package/build/components/header-edit-mode/more-menu/index.js +3 -97
  72. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  73. package/build/components/keyboard-shortcuts/register.js +0 -49
  74. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  75. package/build/components/layout/index.js +9 -9
  76. package/build/components/layout/index.js.map +1 -1
  77. package/build/components/layout/router.js +70 -44
  78. package/build/components/layout/router.js.map +1 -1
  79. package/build/components/page/index.js +2 -2
  80. package/build/components/page/index.js.map +1 -1
  81. package/build/components/page-pages/index.js +4 -14
  82. package/build/components/page-pages/index.js.map +1 -1
  83. package/build/components/page-patterns/dataviews-pattern-actions.js +15 -87
  84. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  85. package/build/components/page-patterns/header.js +3 -1
  86. package/build/components/page-patterns/header.js.map +1 -1
  87. package/build/components/page-patterns/index.js +28 -68
  88. package/build/components/page-patterns/index.js.map +1 -1
  89. package/build/components/page-patterns/use-patterns.js +1 -0
  90. package/build/components/page-patterns/use-patterns.js.map +1 -1
  91. package/build/components/page-templates/hooks.js.map +1 -0
  92. package/build/components/{page-templates-template-parts → page-templates}/index.js +73 -94
  93. package/build/components/page-templates/index.js.map +1 -0
  94. package/build/components/pagination/index.js +2 -2
  95. package/build/components/pagination/index.js.map +1 -1
  96. package/build/components/pattern-modal/duplicate.js +7 -5
  97. package/build/components/pattern-modal/duplicate.js.map +1 -1
  98. package/build/components/plugin-template-setting-panel/index.js +9 -0
  99. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  100. package/build/components/resizable-frame/index.js +20 -9
  101. package/build/components/resizable-frame/index.js.map +1 -1
  102. package/build/components/revisions/index.js +5 -2
  103. package/build/components/revisions/index.js.map +1 -1
  104. package/build/components/save-panel/index.js +4 -4
  105. package/build/components/save-panel/index.js.map +1 -1
  106. package/build/components/sidebar/index.js +61 -31
  107. package/build/components/sidebar/index.js.map +1 -1
  108. package/build/components/sidebar-button/index.js +2 -2
  109. package/build/components/sidebar-button/index.js.map +1 -1
  110. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  111. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  112. package/build/components/sidebar-navigation-item/index.js +5 -3
  113. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen/index.js +6 -32
  115. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  116. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  117. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  118. package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -1
  119. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
  121. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  122. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
  123. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  124. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  125. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  126. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
  127. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  128. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
  129. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-page/index.js +39 -8
  131. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-page/status-label.js +2 -2
  133. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  134. package/build/components/sidebar-navigation-screen-pattern/index.js +3 -15
  135. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  136. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  137. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  139. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  141. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-patterns/index.js +25 -29
  143. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  144. package/build/components/sidebar-navigation-screen-template/index.js +5 -2
  145. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  146. package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  147. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  148. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -33
  149. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  150. package/build/components/site-hub/index.js +3 -3
  151. package/build/components/site-hub/index.js.map +1 -1
  152. package/build/components/site-icon/index.js +2 -2
  153. package/build/components/site-icon/index.js.map +1 -1
  154. package/build/components/style-book/index.js +10 -7
  155. package/build/components/style-book/index.js.map +1 -1
  156. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  157. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  158. package/build/components/template-actions/index.js +1 -1
  159. package/build/components/template-actions/index.js.map +1 -1
  160. package/build/components/template-part-converter/index.js +18 -1
  161. package/build/components/template-part-converter/index.js.map +1 -1
  162. package/build/deprecated.js +55 -0
  163. package/build/deprecated.js.map +1 -0
  164. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +40 -6
  165. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  166. package/build/index.js +18 -18
  167. package/build/index.js.map +1 -1
  168. package/build/utils/constants.js +1 -2
  169. package/build/utils/constants.js.map +1 -1
  170. package/build/utils/get-is-list-page.js +1 -1
  171. package/build/utils/get-is-list-page.js.map +1 -1
  172. package/build/utils/use-activate-theme.js +9 -6
  173. package/build/utils/use-activate-theme.js.map +1 -1
  174. package/build-module/components/add-new-page/index.js +3 -0
  175. package/build-module/components/add-new-page/index.js.map +1 -1
  176. package/build-module/components/add-new-pattern/index.js +8 -7
  177. package/build-module/components/add-new-pattern/index.js.map +1 -1
  178. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  179. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  180. package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
  181. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  182. package/build-module/components/add-new-template/index.js +2 -2
  183. package/build-module/components/add-new-template/index.js.map +1 -1
  184. package/build-module/components/app/index.js +4 -2
  185. package/build-module/components/app/index.js.map +1 -1
  186. package/build-module/components/block-editor/editor-canvas.js +4 -18
  187. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  188. package/build-module/components/block-editor/resize-handle.js +21 -6
  189. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  190. package/build-module/components/block-editor/site-editor-canvas.js +2 -2
  191. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  192. package/build-module/components/create-template-part-modal/index.js +3 -0
  193. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  194. package/build-module/components/dataviews-actions/index.js +38 -0
  195. package/build-module/components/dataviews-actions/index.js.map +1 -0
  196. package/build-module/components/editor/index.js +96 -17
  197. package/build-module/components/editor/index.js.map +1 -1
  198. package/build-module/components/global-styles/background-panel.js +12 -1
  199. package/build-module/components/global-styles/background-panel.js.map +1 -1
  200. package/build-module/components/global-styles/color-indicator-wrapper.js +2 -2
  201. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  202. package/build-module/components/global-styles/color-palette-panel.js +4 -2
  203. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  204. package/build-module/components/global-styles/font-library-modal/context.js +9 -3
  205. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  206. package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
  207. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  208. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  209. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  210. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  211. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  212. package/build-module/components/global-styles/gradients-palette-panel.js +1 -2
  213. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  214. package/build-module/components/global-styles/hooks.js +4 -1
  215. package/build-module/components/global-styles/hooks.js.map +1 -1
  216. package/build-module/components/global-styles/icon-with-current-color.js +2 -2
  217. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  218. package/build-module/components/global-styles/preset-colors.js +22 -0
  219. package/build-module/components/global-styles/preset-colors.js.map +1 -0
  220. package/build-module/components/global-styles/preview-colors.js +3 -7
  221. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  222. package/build-module/components/global-styles/screen-color-palette.js +5 -5
  223. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  224. package/build-module/components/global-styles/screen-colors.js +1 -4
  225. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  226. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  227. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  228. package/build-module/components/global-styles/style-variations-container.js +8 -2
  229. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  230. package/build-module/components/global-styles/typography-example.js +4 -1
  231. package/build-module/components/global-styles/typography-example.js.map +1 -1
  232. package/build-module/components/global-styles/ui.js +4 -1
  233. package/build-module/components/global-styles/ui.js.map +1 -1
  234. package/build-module/components/global-styles/variations/variation.js +11 -5
  235. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  236. package/build-module/components/global-styles/variations/variations-color.js +6 -6
  237. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  238. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  239. package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
  240. package/build-module/components/global-styles-sidebar/index.js.map +1 -0
  241. package/build-module/components/header-edit-mode/index.js +22 -138
  242. package/build-module/components/header-edit-mode/index.js.map +1 -1
  243. package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
  244. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  245. package/build-module/components/keyboard-shortcuts/register.js +0 -49
  246. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  247. package/build-module/components/layout/index.js +9 -9
  248. package/build-module/components/layout/index.js.map +1 -1
  249. package/build-module/components/layout/router.js +70 -45
  250. package/build-module/components/layout/router.js.map +1 -1
  251. package/build-module/components/page/index.js +2 -2
  252. package/build-module/components/page/index.js.map +1 -1
  253. package/build-module/components/page-pages/index.js +5 -15
  254. package/build-module/components/page-pages/index.js.map +1 -1
  255. package/build-module/components/page-patterns/dataviews-pattern-actions.js +15 -87
  256. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  257. package/build-module/components/page-patterns/header.js +3 -1
  258. package/build-module/components/page-patterns/header.js.map +1 -1
  259. package/build-module/components/page-patterns/index.js +31 -71
  260. package/build-module/components/page-patterns/index.js.map +1 -1
  261. package/build-module/components/page-patterns/use-patterns.js +1 -0
  262. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  263. package/build-module/components/page-templates/hooks.js.map +1 -0
  264. package/build-module/components/{page-templates-template-parts → page-templates}/index.js +73 -94
  265. package/build-module/components/page-templates/index.js.map +1 -0
  266. package/build-module/components/pagination/index.js +2 -2
  267. package/build-module/components/pagination/index.js.map +1 -1
  268. package/build-module/components/pattern-modal/duplicate.js +7 -5
  269. package/build-module/components/pattern-modal/duplicate.js.map +1 -1
  270. package/build-module/components/plugin-template-setting-panel/index.js +8 -0
  271. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  272. package/build-module/components/resizable-frame/index.js +21 -10
  273. package/build-module/components/resizable-frame/index.js.map +1 -1
  274. package/build-module/components/revisions/index.js +4 -1
  275. package/build-module/components/revisions/index.js.map +1 -1
  276. package/build-module/components/save-panel/index.js +4 -4
  277. package/build-module/components/save-panel/index.js.map +1 -1
  278. package/build-module/components/sidebar/index.js +62 -32
  279. package/build-module/components/sidebar/index.js.map +1 -1
  280. package/build-module/components/sidebar-button/index.js +2 -2
  281. package/build-module/components/sidebar-button/index.js.map +1 -1
  282. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  283. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  284. package/build-module/components/sidebar-navigation-item/index.js +5 -3
  285. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  286. package/build-module/components/sidebar-navigation-screen/index.js +6 -32
  287. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  288. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  289. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  290. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -1
  291. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  292. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
  293. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
  295. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  297. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  298. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
  299. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  300. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
  301. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
  303. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  304. package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -2
  305. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  306. package/build-module/components/sidebar-navigation-screen-pattern/index.js +3 -15
  307. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  308. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  309. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  310. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  311. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  312. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  313. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  314. package/build-module/components/sidebar-navigation-screen-patterns/index.js +26 -30
  315. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  316. package/build-module/components/sidebar-navigation-screen-template/index.js +5 -2
  317. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  318. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  319. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  320. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -33
  321. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  322. package/build-module/components/site-hub/index.js +3 -3
  323. package/build-module/components/site-hub/index.js.map +1 -1
  324. package/build-module/components/site-icon/index.js +2 -2
  325. package/build-module/components/site-icon/index.js.map +1 -1
  326. package/build-module/components/style-book/index.js +9 -6
  327. package/build-module/components/style-book/index.js.map +1 -1
  328. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  329. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  330. package/build-module/components/template-actions/index.js +1 -1
  331. package/build-module/components/template-actions/index.js.map +1 -1
  332. package/build-module/components/template-part-converter/index.js +18 -1
  333. package/build-module/components/template-part-converter/index.js.map +1 -1
  334. package/build-module/deprecated.js +45 -0
  335. package/build-module/deprecated.js.map +1 -0
  336. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +38 -5
  337. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  338. package/build-module/index.js +2 -4
  339. package/build-module/index.js.map +1 -1
  340. package/build-module/utils/constants.js +0 -1
  341. package/build-module/utils/constants.js.map +1 -1
  342. package/build-module/utils/get-is-list-page.js +1 -1
  343. package/build-module/utils/get-is-list-page.js.map +1 -1
  344. package/build-module/utils/use-activate-theme.js +9 -6
  345. package/build-module/utils/use-activate-theme.js.map +1 -1
  346. package/build-style/style-rtl.css +208 -484
  347. package/build-style/style.css +208 -484
  348. package/package.json +43 -45
  349. package/src/components/add-new-page/index.js +7 -1
  350. package/src/components/add-new-pattern/index.js +15 -12
  351. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  352. package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
  353. package/src/components/add-new-template/index.js +2 -2
  354. package/src/components/app/index.js +5 -2
  355. package/src/components/block-editor/editor-canvas.js +6 -26
  356. package/src/components/block-editor/resize-handle.js +30 -11
  357. package/src/components/block-editor/site-editor-canvas.js +2 -2
  358. package/src/components/block-editor/style.scss +12 -17
  359. package/src/components/create-template-part-modal/index.js +3 -0
  360. package/src/components/dataviews-actions/index.js +38 -0
  361. package/src/components/editor/index.js +117 -18
  362. package/src/components/editor/style.scss +6 -5
  363. package/src/components/global-styles/background-panel.js +17 -2
  364. package/src/components/global-styles/color-indicator-wrapper.js +2 -2
  365. package/src/components/global-styles/color-palette-panel.js +3 -4
  366. package/src/components/global-styles/font-library-modal/context.js +9 -3
  367. package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
  368. package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
  369. package/src/components/global-styles/font-library-modal/style.scss +17 -0
  370. package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  371. package/src/components/global-styles/gradients-palette-panel.js +1 -4
  372. package/src/components/global-styles/hooks.js +2 -1
  373. package/src/components/global-styles/icon-with-current-color.js +2 -2
  374. package/src/components/global-styles/preset-colors.js +18 -0
  375. package/src/components/global-styles/preview-colors.js +4 -7
  376. package/src/components/global-styles/screen-color-palette.js +4 -4
  377. package/src/components/global-styles/screen-colors.js +0 -2
  378. package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  379. package/src/components/global-styles/stories/index.story.js +2 -1
  380. package/src/components/global-styles/style-variations-container.js +11 -2
  381. package/src/components/global-styles/typography-example.js +2 -1
  382. package/src/components/global-styles/ui.js +5 -1
  383. package/src/components/global-styles/variations/style.scss +15 -31
  384. package/src/components/global-styles/variations/variation.js +13 -10
  385. package/src/components/global-styles/variations/variations-color.js +5 -8
  386. package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
  387. package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
  388. package/src/components/header-edit-mode/index.js +25 -184
  389. package/src/components/header-edit-mode/more-menu/index.js +8 -145
  390. package/src/components/header-edit-mode/style.scss +1 -271
  391. package/src/components/keyboard-shortcuts/register.js +0 -58
  392. package/src/components/layout/index.js +14 -10
  393. package/src/components/layout/router.js +66 -56
  394. package/src/components/layout/style.scss +2 -1
  395. package/src/components/page/index.js +2 -2
  396. package/src/components/page-pages/index.js +8 -28
  397. package/src/components/page-patterns/dataviews-pattern-actions.js +11 -101
  398. package/src/components/page-patterns/header.js +3 -1
  399. package/src/components/page-patterns/index.js +32 -110
  400. package/src/components/page-patterns/style.scss +14 -1
  401. package/src/components/page-patterns/use-patterns.js +1 -0
  402. package/src/components/{page-templates-template-parts → page-templates}/index.js +33 -75
  403. package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
  404. package/src/components/pagination/index.js +2 -2
  405. package/src/components/pattern-modal/duplicate.js +4 -3
  406. package/src/components/plugin-template-setting-panel/index.js +8 -0
  407. package/src/components/resizable-frame/index.js +20 -7
  408. package/src/components/revisions/index.js +2 -1
  409. package/src/components/save-panel/index.js +4 -4
  410. package/src/components/sidebar/index.js +61 -37
  411. package/src/components/sidebar-button/index.js +2 -5
  412. package/src/components/sidebar-dataviews/dataview-item.js +4 -7
  413. package/src/components/sidebar-navigation-item/index.js +3 -3
  414. package/src/components/sidebar-navigation-screen/index.js +7 -31
  415. package/src/components/sidebar-navigation-screen/style.scss +11 -9
  416. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  417. package/src/components/sidebar-navigation-screen-global-styles/index.js +2 -1
  418. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
  419. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
  420. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  421. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
  422. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +0 -10
  423. package/src/components/sidebar-navigation-screen-page/index.js +48 -9
  424. package/src/components/sidebar-navigation-screen-page/status-label.js +2 -2
  425. package/src/components/sidebar-navigation-screen-pattern/index.js +1 -12
  426. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  427. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  428. package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
  429. package/src/components/sidebar-navigation-screen-patterns/index.js +20 -39
  430. package/src/components/sidebar-navigation-screen-template/index.js +3 -2
  431. package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  432. package/src/components/sidebar-navigation-screen-templates-browse/index.js +8 -39
  433. package/src/components/site-hub/index.js +3 -3
  434. package/src/components/site-icon/index.js +2 -2
  435. package/src/components/style-book/index.js +7 -6
  436. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
  437. package/src/components/template-actions/index.js +1 -1
  438. package/src/components/template-part-converter/index.js +16 -3
  439. package/src/deprecated.js +42 -0
  440. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +71 -17
  441. package/src/index.js +2 -9
  442. package/src/style.scss +2 -16
  443. package/src/utils/constants.js +1 -1
  444. package/src/utils/get-is-list-page.js +1 -3
  445. package/src/utils/use-activate-theme.js +4 -4
  446. package/build/components/global-styles/global-styles-provider.js +0 -129
  447. package/build/components/global-styles/global-styles-provider.js.map +0 -1
  448. package/build/components/header-edit-mode/document-tools/index.js +0 -68
  449. package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
  450. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
  451. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  452. package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
  453. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  454. package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
  455. package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  456. package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
  457. package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  458. package/build/components/page-templates-template-parts/hooks.js.map +0 -1
  459. package/build/components/page-templates-template-parts/index.js.map +0 -1
  460. package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  461. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  462. package/build/components/sidebar-edit-mode/index.js +0 -146
  463. package/build/components/sidebar-edit-mode/index.js.map +0 -1
  464. package/build/components/sidebar-edit-mode/page-panels/index.js +0 -98
  465. package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  466. package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
  467. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  468. package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
  469. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  470. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
  471. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  472. package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
  473. package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  474. package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
  475. package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  476. package/build/components/sidebar-edit-mode/template-panel/index.js +0 -130
  477. package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  478. package/build/components/start-template-options/index.js +0 -191
  479. package/build/components/start-template-options/index.js.map +0 -1
  480. package/build/utils/math.js +0 -98
  481. package/build/utils/math.js.map +0 -1
  482. package/build-module/components/global-styles/global-styles-provider.js +0 -120
  483. package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
  484. package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
  485. package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
  486. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
  487. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  488. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  489. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  490. package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
  491. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  492. package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
  493. package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  494. package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
  495. package/build-module/components/page-templates-template-parts/index.js.map +0 -1
  496. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  497. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  498. package/build-module/components/sidebar-edit-mode/index.js +0 -137
  499. package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
  500. package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -90
  501. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  502. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
  503. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  504. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
  505. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  506. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -31
  507. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  508. package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
  509. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  510. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
  511. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  512. package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -122
  513. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  514. package/build-module/components/start-template-options/index.js +0 -184
  515. package/build-module/components/start-template-options/index.js.map +0 -1
  516. package/build-module/utils/math.js +0 -92
  517. package/build-module/utils/math.js.map +0 -1
  518. package/src/components/global-styles/global-styles-provider.js +0 -162
  519. package/src/components/header-edit-mode/document-tools/index.js +0 -68
  520. package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
  521. package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  522. package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
  523. package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
  524. package/src/components/sidebar-edit-mode/index.js +0 -162
  525. package/src/components/sidebar-edit-mode/page-panels/index.js +0 -105
  526. package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
  527. package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
  528. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -49
  529. package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
  530. package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
  531. package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
  532. package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
  533. package/src/components/sidebar-edit-mode/template-panel/index.js +0 -144
  534. package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
  535. package/src/components/start-template-options/index.js +0 -231
  536. package/src/components/start-template-options/style.scss +0 -55
  537. package/src/utils/math.js +0 -93
  538. /package/build/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  539. /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  540. /package/build-module/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  541. /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  542. /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  543. /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_element","_i18n","_components","_icons","_notices","_htmlEntities","_store","_isTemplateRemovable","_interopRequireDefault","_isTemplateRevertable","_renamePostMenuItem","_constants","TemplateActions","postType","postId","className","toggleProps","onRemove","template","useSelect","select","coreStore","getEntityRecord","removeTemplate","useDispatch","editSiteStore","isRemovable","isTemplateRemovable","isRevertable","isTemplateRevertable","_react","createElement","DropdownMenu","icon","moreVertical","label","__","onClose","MenuGroup","Fragment","default","post","DeleteMenuItem","title","rendered","ResetMenuItem","isModalOpen","setIsModalOpen","useState","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","noticesStore","revertAndSaveTemplate","allowUndo","type","id","sprintf","decodeEntities","error","fallbackErrorMessage","TEMPLATE_POST_TYPE","errorMessage","message","code","MenuItem","onClick","__experimentalConfirmDialog","isOpen","onConfirm","onCancel","confirmButtonText","isDestructive"],"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport RenamePostMenuItem from '../rename-post-menu-item';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nexport default function TemplateActions( {\n\tpostType,\n\tpostId,\n\tclassName,\n\ttoggleProps,\n\tonRemove,\n} ) {\n\tconst template = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', postType, postId ),\n\t\t[ postType, postId ]\n\t);\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName={ className }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenamePostMenuItem\n\t\t\t\t\t\t\t\tpost={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<DeleteMenuItem\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonRemove?.();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttitle={ template.title.rendered }\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\t{ isRevertable && (\n\t\t\t\t\t\t<ResetMenuItem\n\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction ResetMenuItem( { template, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst fallbackErrorMessage =\n\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t? __( 'An error occurred while reverting the template.' )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t );\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: fallbackErrorMessage;\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Reset' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Reset' ) }\n\t\t\t>\n\t\t\t\t{ __( 'Rese to default and clear all customizations?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nfunction DeleteMenuItem( { onRemove, title } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<MenuItem isDestructive onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Delete' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ onRemove }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: The template or template part's title.\n\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,qBAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,mBAAA,GAAAF,sBAAA,CAAAV,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAxBA;AACA;AACA;;AAeA;AACA;AACA;;AAOe,SAASc,eAAeA,CAAE;EACxCC,QAAQ;EACRC,MAAM;EACNC,SAAS;EACTC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IACPA,MAAM,CAAEC,eAAU,CAAC,CAACC,eAAe,CAAE,UAAU,EAAET,QAAQ,EAAEC,MAAO,CAAC,EACpE,CAAED,QAAQ,EAAEC,MAAM,CACnB,CAAC;EACD,MAAM;IAAES;EAAe,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EACvD,MAAMC,WAAW,GAAG,IAAAC,4BAAmB,EAAET,QAAS,CAAC;EACnD,MAAMU,YAAY,GAAG,IAAAC,6BAAoB,EAAEX,QAAS,CAAC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MAAM,EAAGvB,WAAa;IACtBwB,SAAS,EAAGA,CAAA,KAAM;MACjBhB,qBAAqB,CAAC,CAAC;MACvBjB,OAAO,CAAC,CAAC;IACV,CAAG;IACHkC,QAAQ,EAAGA,CAAA,KAAMxB,cAAc,CAAE,KAAM,CAAG;IAC1CyB,iBAAiB,EAAG,IAAApC,QAAE,EAAE,OAAQ;EAAG,GAEjC,IAAAA,QAAE,EAAE,+CAAgD,CACxC,CACd,CAAC;AAEL;AAEA,SAASM,cAAcA,CAAE;EAAEzB,QAAQ;EAAE0B;AAAM,CAAC,EAAG;EAC9C,MAAM,CAAEG,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACzD,OACC,IAAAlB,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAS,QAAA,QACC,IAAAT,MAAA,CAAAC,aAAA,EAAC7B,WAAA,CAAAgE,QAAQ;IAACO,aAAa;IAACN,OAAO,EAAGA,CAAA,KAAMpB,cAAc,CAAE,IAAK;EAAG,GAC7D,IAAAX,QAAE,EAAE,QAAS,CACN,CAAC,EACX,IAAAN,MAAA,CAAAC,aAAA,EAAC7B,WAAA,CAAAkE,2BAAa;IACbC,MAAM,EAAGvB,WAAa;IACtBwB,SAAS,EAAGrD,QAAU;IACtBsD,QAAQ,EAAGA,CAAA,KAAMxB,cAAc,CAAE,KAAM,CAAG;IAC1CyB,iBAAiB,EAAG,IAAApC,QAAE,EAAE,QAAS;EAAG,GAElC,IAAAsB,aAAO;EACR;EACA,IAAAtB,QAAE,EAAE,uCAAwC,CAAC,EAC7C,IAAAuB,4BAAc,EAAEhB,KAAM,CACvB,CACc,CACd,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_element","_i18n","_components","_icons","_notices","_htmlEntities","_store","_isTemplateRemovable","_interopRequireDefault","_isTemplateRevertable","_renamePostMenuItem","_constants","TemplateActions","postType","postId","className","toggleProps","onRemove","template","useSelect","select","coreStore","getEntityRecord","removeTemplate","useDispatch","editSiteStore","isRemovable","isTemplateRemovable","isRevertable","isTemplateRevertable","_react","createElement","DropdownMenu","icon","moreVertical","label","__","onClose","MenuGroup","Fragment","default","post","DeleteMenuItem","title","rendered","ResetMenuItem","isModalOpen","setIsModalOpen","useState","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","noticesStore","revertAndSaveTemplate","allowUndo","type","id","sprintf","decodeEntities","error","fallbackErrorMessage","TEMPLATE_POST_TYPE","errorMessage","message","code","MenuItem","onClick","__experimentalConfirmDialog","isOpen","onConfirm","onCancel","confirmButtonText","isDestructive"],"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport RenamePostMenuItem from '../rename-post-menu-item';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nexport default function TemplateActions( {\n\tpostType,\n\tpostId,\n\tclassName,\n\ttoggleProps,\n\tonRemove,\n} ) {\n\tconst template = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', postType, postId ),\n\t\t[ postType, postId ]\n\t);\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName={ className }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenamePostMenuItem\n\t\t\t\t\t\t\t\tpost={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<DeleteMenuItem\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonRemove?.();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttitle={ template.title.rendered }\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\t{ isRevertable && (\n\t\t\t\t\t\t<ResetMenuItem\n\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction ResetMenuItem( { template, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst fallbackErrorMessage =\n\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t? __( 'An error occurred while reverting the template.' )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t );\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: fallbackErrorMessage;\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Reset' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Reset' ) }\n\t\t\t>\n\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nfunction DeleteMenuItem( { onRemove, title } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<MenuItem isDestructive onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Delete' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ onRemove }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: The template or template part's title.\n\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,qBAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,mBAAA,GAAAF,sBAAA,CAAAV,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAxBA;AACA;AACA;;AAeA;AACA;AACA;;AAOe,SAASc,eAAeA,CAAE;EACxCC,QAAQ;EACRC,MAAM;EACNC,SAAS;EACTC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IACPA,MAAM,CAAEC,eAAU,CAAC,CAACC,eAAe,CAAE,UAAU,EAAET,QAAQ,EAAEC,MAAO,CAAC,EACpE,CAAED,QAAQ,EAAEC,MAAM,CACnB,CAAC;EACD,MAAM;IAAES;EAAe,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EACvD,MAAMC,WAAW,GAAG,IAAAC,4BAAmB,EAAET,QAAS,CAAC;EACnD,MAAMU,YAAY,GAAG,IAAAC,6BAAoB,EAAEX,QA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a;IACbC,MAAM,EAAGvB,WAAa;IACtBwB,SAAS,EAAGA,CAAA,KAAM;MACjBhB,qBAAqB,CAAC,CAAC;MACvBjB,OAAO,CAAC,CAAC;IACV,CAAG;IACHkC,QAAQ,EAAGA,CAAA,KAAMxB,cAAc,CAAE,KAAM,CAAG;IAC1CyB,iBAAiB,EAAG,IAAApC,QAAE,EAAE,OAAQ;EAAG,GAEjC,IAAAA,QAAE,EAAE,gDAAiD,CACzC,CACd,CAAC;AAEL;AAEA,SAASM,cAAcA,CAAE;EAAEzB,QAAQ;EAAE0B;AAAM,CAAC,EAAG;EAC9C,MAAM,CAAEG,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACzD,OACC,IAAAlB,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAS,QAAA,QACC,IAAAT,MAAA,CAAAC,aAAA,EAAC7B,WAAA,CAAAgE,QAAQ;IAACO,aAAa;IAACN,OAAO,EAAGA,CAAA,KAAMpB,cAAc,CAAE,IAAK;EAAG,GAC7D,IAAAX,QAAE,EAAE,QAAS,CACN,CAAC,EACX,IAAAN,MAAA,CAAAC,aAAA,EAAC7B,WAAA,CAAAkE,2BAAa;IACbC,MAAM,EAAGvB,WAAa;IACtBwB,SAAS,EAAGrD,QAAU;IACtBsD,QAAQ,EAAGA,CAAA,KAAMxB,cAAc,CAAE,KAAM,CAAG;IAC1CyB,iBAAiB,EAAG,IAAApC,QAAE,EAAE,QAAS;EAAG,GAElC,IAAAsB,aAAO;EACR;EACA,IAAAtB,QAAE,EAAE,uCAAwC,CAAC,EAC7C,IAAAuB,4BAAc,EAAEhB,KAAM,CACvB,CACc,CACd,CAAC;AAEL","ignoreList":[]}
@@ -31,7 +31,24 @@ function TemplatePartConverterMenuItem({
31
31
  clientIds,
32
32
  onClose
33
33
  }) {
34
- const blocks = (0, _data.useSelect)(select => select(_blockEditor.store).getBlocksByClientId(clientIds), [clientIds]);
34
+ const {
35
+ isContentOnly,
36
+ blocks
37
+ } = (0, _data.useSelect)(select => {
38
+ const {
39
+ getBlocksByClientId,
40
+ getBlockEditingMode
41
+ } = select(_blockEditor.store);
42
+ return {
43
+ blocks: getBlocksByClientId(clientIds),
44
+ isContentOnly: clientIds.length === 1 && getBlockEditingMode(clientIds[0]) === 'contentOnly'
45
+ };
46
+ }, [clientIds]);
47
+
48
+ // Do not show the convert button if the block is in content-only mode.
49
+ if (isContentOnly) {
50
+ return null;
51
+ }
35
52
 
36
53
  // Allow converting a single template part to standard blocks.
37
54
  if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_convertToRegular","_interopRequireDefault","_convertToTemplatePart","TemplatePartConverter","_react","createElement","BlockSettingsMenuControls","selectedClientIds","onClose","TemplatePartConverterMenuItem","clientIds","blocks","useSelect","select","blockEditorStore","getBlocksByClientId","length","name","default","clientId"],"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartConverter() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<TemplatePartConverterMenuItem\n\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction TemplatePartConverterMenuItem( { clientIds, onClose } ) {\n\tconst blocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds ),\n\t\t[ clientIds ]\n\t);\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn (\n\t\t\t<ConvertToRegularBlocks\n\t\t\t\tclientId={ clientIds[ 0 ] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASK,qBAAqBA,CAAA,EAAG;EAC/C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACN,YAAA,CAAAO,yBAAyB,QACvB,CAAE;IAAEC,iBAAiB;IAAEC;EAAQ,CAAC,KACjC,IAAAJ,MAAA,CAAAC,aAAA,EAACI,6BAA6B;IAC7BC,SAAS,EAAGH,iBAAmB;IAC/BC,OAAO,EAAGA;EAAS,CACnB,CAEwB,CAAC;AAE9B;AAEA,SAASC,6BAA6BA,CAAE;EAAEC,SAAS;EAAEF;AAAQ,CAAC,EAAG;EAChE,MAAMG,MAAM,GAAG,IAAAC,eAAS,EACrBC,MAAM,IACPA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,mBAAmB,CAAEL,SAAU,CAAC,EAC5D,CAAEA,SAAS,CACZ,CAAC;;EAED;EACA,IAAKC,MAAM,CAACK,MAAM,KAAK,CAAC,IAAIL,MAAM,CAAE,CAAC,CAAE,EAAEM,IAAI,KAAK,oBAAoB,EAAG;IACxE,OACC,IAAAb,MAAA,CAAAC,aAAA,EAACL,iBAAA,CAAAkB,OAAsB;MACtBC,QAAQ,EAAGT,SAAS,CAAE,CAAC,CAAI;MAC3BF,OAAO,EAAGA;IAAS,CACnB,CAAC;EAEJ;EACA,OAAO,IAAAJ,MAAA,CAAAC,aAAA,EAACH,sBAAA,CAAAgB,OAAqB;IAACR,SAAS,EAAGA,SAAW;IAACC,MAAM,EAAGA;EAAQ,CAAE,CAAC;AAC3E","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_blockEditor","_convertToRegular","_interopRequireDefault","_convertToTemplatePart","TemplatePartConverter","_react","createElement","BlockSettingsMenuControls","selectedClientIds","onClose","TemplatePartConverterMenuItem","clientIds","isContentOnly","blocks","useSelect","select","getBlocksByClientId","getBlockEditingMode","blockEditorStore","length","name","default","clientId"],"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartConverter() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<TemplatePartConverterMenuItem\n\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction TemplatePartConverterMenuItem( { clientIds, onClose } ) {\n\tconst { isContentOnly, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocksByClientId, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblocks: getBlocksByClientId( clientIds ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tclientIds.length === 1 &&\n\t\t\t\t\tgetBlockEditingMode( clientIds[ 0 ] ) === 'contentOnly',\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\t// Do not show the convert button if the block is in content-only mode.\n\tif ( isContentOnly ) {\n\t\treturn null;\n\t}\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn (\n\t\t\t<ConvertToRegularBlocks\n\t\t\t\tclientId={ clientIds[ 0 ] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASK,qBAAqBA,CAAA,EAAG;EAC/C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACN,YAAA,CAAAO,yBAAyB,QACvB,CAAE;IAAEC,iBAAiB;IAAEC;EAAQ,CAAC,KACjC,IAAAJ,MAAA,CAAAC,aAAA,EAACI,6BAA6B;IAC7BC,SAAS,EAAGH,iBAAmB;IAC/BC,OAAO,EAAGA;EAAS,CACnB,CAEwB,CAAC;AAE9B;AAEA,SAASC,6BAA6BA,CAAE;EAAEC,SAAS;EAAEF;AAAQ,CAAC,EAAG;EAChE,MAAM;IAAEG,aAAa;IAAEC;EAAO,CAAC,GAAG,IAAAC,eAAS,EACxCC,MAAM,IAAM;IACb,MAAM;MAAEC,mBAAmB;MAAEC;IAAoB,CAAC,GACjDF,MAAM,CAAEG,kBAAiB,CAAC;IAC3B,OAAO;MACNL,MAAM,EAAEG,mBAAmB,CAAEL,SAAU,CAAC;MACxCC,aAAa,EACZD,SAAS,CAACQ,MAAM,KAAK,CAAC,IACtBF,mBAAmB,CAAEN,SAAS,CAAE,CAAC,CAAG,CAAC,KAAK;IAC5C,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;;EAED;EACA,IAAKC,aAAa,EAAG;IACpB,OAAO,IAAI;EACZ;;EAEA;EACA,IAAKC,MAAM,CAACM,MAAM,KAAK,CAAC,IAAIN,MAAM,CAAE,CAAC,CAAE,EAAEO,IAAI,KAAK,oBAAoB,EAAG;IACxE,OACC,IAAAf,MAAA,CAAAC,aAAA,EAACL,iBAAA,CAAAoB,OAAsB;MACtBC,QAAQ,EAAGX,SAAS,CAAE,CAAC,CAAI;MAC3BF,OAAO,EAAGA;IAAS,CACnB,CAAC;EAEJ;EACA,OAAO,IAAAJ,MAAA,CAAAC,aAAA,EAACH,sBAAA,CAAAkB,OAAqB;IAACV,SAAS,EAAGA,SAAW;IAACE,MAAM,EAAGA;EAAQ,CAAE,CAAC;AAC3E","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.PluginMoreMenuItem = PluginMoreMenuItem;
8
+ exports.PluginSidebar = PluginSidebar;
9
+ exports.PluginSidebarMoreMenuItem = PluginSidebarMoreMenuItem;
10
+ var _react = require("react");
11
+ var _editor = require("@wordpress/editor");
12
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+
17
+ const deprecateSlot = name => {
18
+ (0, _deprecated.default)(`wp.editPost.${name}`, {
19
+ since: '6.6',
20
+ alternative: `wp.editor.${name}`
21
+ });
22
+ };
23
+
24
+ /* eslint-disable jsdoc/require-param */
25
+ /**
26
+ * @see PluginMoreMenuItem in @wordpress/editor package.
27
+ */
28
+ function PluginMoreMenuItem(props) {
29
+ deprecateSlot('PluginMoreMenuItem');
30
+ return (0, _react.createElement)(_editor.PluginMoreMenuItem, {
31
+ ...props
32
+ });
33
+ }
34
+
35
+ /**
36
+ * @see PluginSidebar in @wordpress/editor package.
37
+ */
38
+ function PluginSidebar(props) {
39
+ deprecateSlot('PluginSidebar');
40
+ return (0, _react.createElement)(_editor.PluginSidebar, {
41
+ ...props
42
+ });
43
+ }
44
+
45
+ /**
46
+ * @see PluginSidebarMoreMenuItem in @wordpress/editor package.
47
+ */
48
+ function PluginSidebarMoreMenuItem(props) {
49
+ deprecateSlot('PluginSidebarMoreMenuItem');
50
+ return (0, _react.createElement)(_editor.PluginSidebarMoreMenuItem, {
51
+ ...props
52
+ });
53
+ }
54
+ /* eslint-enable jsdoc/require-param */
55
+ //# sourceMappingURL=deprecated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_editor","require","_deprecated","_interopRequireDefault","deprecateSlot","name","deprecated","since","alternative","PluginMoreMenuItem","props","_react","createElement","PluginSidebar","PluginSidebarMoreMenuItem"],"sources":["@wordpress/edit-site/src/deprecated.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPluginMoreMenuItem as EditorPluginMoreMenuItem,\n\tPluginSidebar as EditorPluginSidebar,\n\tPluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,\n} from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\nconst deprecateSlot = ( name ) => {\n\tdeprecated( `wp.editPost.${ name }`, {\n\t\tsince: '6.6',\n\t\talternative: `wp.editor.${ name }`,\n\t} );\n};\n\n/* eslint-disable jsdoc/require-param */\n/**\n * @see PluginMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginMoreMenuItem( props ) {\n\tdeprecateSlot( 'PluginMoreMenuItem' );\n\treturn <EditorPluginMoreMenuItem { ...props } />;\n}\n\n/**\n * @see PluginSidebar in @wordpress/editor package.\n */\nexport function PluginSidebar( props ) {\n\tdeprecateSlot( 'PluginSidebar' );\n\treturn <EditorPluginSidebar { ...props } />;\n}\n\n/**\n * @see PluginSidebarMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginSidebarMoreMenuItem( props ) {\n\tdeprecateSlot( 'PluginSidebarMoreMenuItem' );\n\treturn <EditorPluginSidebarMoreMenuItem { ...props } />;\n}\n/* eslint-enable jsdoc/require-param */\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAQA,MAAMG,aAAa,GAAKC,IAAI,IAAM;EACjC,IAAAC,mBAAU,EAAG,eAAeD,IAAM,EAAC,EAAE;IACpCE,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG,aAAaH,IAAM;EAClC,CAAE,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACO,SAASI,kBAAkBA,CAAEC,KAAK,EAAG;EAC3CN,aAAa,CAAE,oBAAqB,CAAC;EACrC,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACZ,OAAA,CAAAS,kBAAwB;IAAA,GAAMC;EAAK,CAAI,CAAC;AACjD;;AAEA;AACA;AACA;AACO,SAASG,aAAaA,CAAEH,KAAK,EAAG;EACtCN,aAAa,CAAE,eAAgB,CAAC;EAChC,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACZ,OAAA,CAAAa,aAAmB;IAAA,GAAMH;EAAK,CAAI,CAAC;AAC5C;;AAEA;AACA;AACA;AACO,SAASI,yBAAyBA,CAAEJ,KAAK,EAAG;EAClDN,aAAa,CAAE,2BAA4B,CAAC;EAC5C,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACZ,OAAA,CAAAc,yBAA+B;IAAA,GAAMJ;EAAK,CAAI,CAAC;AACxD;AACA","ignoreList":[]}
@@ -6,14 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = useThemeStyleVariationsByProperty;
8
8
  exports.filterObjectByProperty = void 0;
9
+ exports.isVariationWithSingleProperty = isVariationWithSingleProperty;
9
10
  exports.removePropertyFromObject = removePropertyFromObject;
10
11
  exports.useCurrentMergeThemeStyleVariationsWithUserConfig = useCurrentMergeThemeStyleVariationsWithUserConfig;
11
12
  var _data = require("@wordpress/data");
12
13
  var _coreData = require("@wordpress/core-data");
13
14
  var _element = require("@wordpress/element");
14
15
  var _blockEditor = require("@wordpress/block-editor");
16
+ var _editor = require("@wordpress/editor");
15
17
  var _i18n = require("@wordpress/i18n");
16
- var _globalStylesProvider = require("../../components/global-styles/global-styles-provider");
17
18
  var _cloneDeep = _interopRequireDefault(require("../../utils/clone-deep"));
18
19
  var _lockUnlock = require("../../lock-unlock");
19
20
  /**
@@ -27,6 +28,9 @@ var _lockUnlock = require("../../lock-unlock");
27
28
  const {
28
29
  GlobalStylesContext
29
30
  } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
31
+ const {
32
+ mergeBaseAndUserConfigs
33
+ } = (0, _lockUnlock.unlock)(_editor.privateApis);
30
34
 
31
35
  /**
32
36
  * Removes all instances of a property from an object.
@@ -145,9 +149,14 @@ function useThemeStyleVariationsByProperty({
145
149
  return variations;
146
150
  }
147
151
  const clonedBaseVariation = typeof baseVariation === 'object' && Object.keys(baseVariation).length > 0 ? (0, _cloneDeep.default)(baseVariation) : null;
148
- let processedStyleVariations = variations.map(variation => {
152
+ let processedStyleVariations = variations.reduce((accumulator, variation) => {
153
+ const variationFilteredByProperty = filterObjectByProperty((0, _cloneDeep.default)(variation), property);
154
+ // Remove variations that are empty once the property is filtered out.
155
+ if (Object.keys(variationFilteredByProperty).length === 0) {
156
+ return accumulator;
157
+ }
149
158
  let result = {
150
- ...filterObjectByProperty((0, _cloneDeep.default)(variation), property),
159
+ ...variationFilteredByProperty,
151
160
  title: variation?.title,
152
161
  description: variation?.description
153
162
  };
@@ -156,14 +165,39 @@ function useThemeStyleVariationsByProperty({
156
165
  * Overwrites all baseVariation object `styleProperty` properties
157
166
  * with the theme variation `styleProperty` properties.
158
167
  */
159
- result = (0, _globalStylesProvider.mergeBaseAndUserConfigs)(clonedBaseVariation, result);
168
+ result = mergeBaseAndUserConfigs(clonedBaseVariation, result);
160
169
  }
161
- return result;
162
- });
170
+
171
+ // Detect if this is a duplicate variation.
172
+ const isDuplicate = accumulator.some(item => {
173
+ return JSON.stringify(item.styles) === JSON.stringify(result?.styles) && JSON.stringify(item.settings) === JSON.stringify(result?.settings);
174
+ });
175
+ if (isDuplicate) {
176
+ return accumulator;
177
+ }
178
+
179
+ // If the variation is not a duplicate, add it to the accumulator.
180
+ accumulator.push(result);
181
+ return accumulator;
182
+ }, [] // Initial accumulator value.
183
+ );
163
184
  if ('function' === typeof filter) {
164
185
  processedStyleVariations = processedStyleVariations.filter(filter);
165
186
  }
166
187
  return processedStyleVariations;
167
188
  }, [variations, property, baseVariation, filter]);
168
189
  }
190
+
191
+ /**
192
+ * Compares a style variation to the same variation filtered by a single property.
193
+ * Returns true if the variation contains only the property specified.
194
+ *
195
+ * @param {Object} variation The variation to compare.
196
+ * @param {string} property The property to compare.
197
+ * @return {boolean} Whether the variation contains only a single property.
198
+ */
199
+ function isVariationWithSingleProperty(variation, property) {
200
+ const variationWithProperty = filterObjectByProperty((0, _cloneDeep.default)(variation), property);
201
+ return JSON.stringify(variationWithProperty?.styles) === JSON.stringify(variation?.styles) && JSON.stringify(variationWithProperty?.settings) === JSON.stringify(variation?.settings);
202
+ }
169
203
  //# sourceMappingURL=use-theme-style-variations-by-property.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_i18n","_globalStylesProvider","_cloneDeep","_interopRequireDefault","_lockUnlock","GlobalStylesContext","unlock","blockEditorPrivateApis","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","filter","variationsFromTheme","useSelect","select","_variationsFromTheme","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","user","baseVariation","useContext","variations","useMemo","title","__","settings","styles","useThemeStyleVariationsByProperty","cloneDeep","filterObjectByProperty","newObject","forEach","newFilter","exports","clonedBaseVariation","processedStyleVariations","map","variation","result","description","mergeBaseAndUserConfigs"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from '../../components/global-styles/global-styles-provider';\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * A convenience wrapper for `useThemeStyleVariationsByProperty()` that fetches the current theme style variations,\n * and user-defined global style/settings object.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n\tfilter,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: baseVariation } = useContext( GlobalStylesContext );\n\n\tconst variations = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...variationsFromTheme,\n\t\t];\n\t}, [ variationsFromTheme ] );\n\n\treturn useThemeStyleVariationsByProperty( {\n\t\tvariations,\n\t\tproperty,\n\t\tfilter,\n\t\tbaseVariation: removePropertyFromObject(\n\t\t\tcloneDeep( baseVariation ),\n\t\t\tproperty\n\t\t),\n\t} );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Returns a new object with only the properties specified in `property`.\n * Optional merges the baseVariation object with the variation object.\n * Note: this function will only overwrite the specified property in baseVariation if it exists.\n * The baseVariation will not be otherwise modified. To strip a property from the baseVariation object, use `removePropertyFromObject`.\n * See useCurrentMergeThemeStyleVariationsWithUserConfig for an example of how to use this function.\n *\n * @param {Object} props Object of hook args.\n * @param {Object[]} props.variations The theme style variations to filter.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @param {Object} props.baseVariation Optional. Base or user settings to be updated with variation properties.\n * @return {Object[]|*} The merged object.\n */\nexport default function useThemeStyleVariationsByProperty( {\n\tvariations,\n\tproperty,\n\tfilter,\n\tbaseVariation,\n} ) {\n\treturn useMemo( () => {\n\t\tif ( ! property || ! variations || variations?.length === 0 ) {\n\t\t\treturn variations;\n\t\t}\n\n\t\tconst clonedBaseVariation =\n\t\t\ttypeof baseVariation === 'object' &&\n\t\t\tObject.keys( baseVariation ).length > 0\n\t\t\t\t? cloneDeep( baseVariation )\n\t\t\t\t: null;\n\n\t\tlet processedStyleVariations = variations.map( ( variation ) => {\n\t\t\tlet result = {\n\t\t\t\t...filterObjectByProperty( cloneDeep( variation ), property ),\n\t\t\t\ttitle: variation?.title,\n\t\t\t\tdescription: variation?.description,\n\t\t\t};\n\n\t\t\tif ( clonedBaseVariation ) {\n\t\t\t\t/*\n\t\t\t\t * Overwrites all baseVariation object `styleProperty` properties\n\t\t\t\t * with the theme variation `styleProperty` properties.\n\t\t\t\t */\n\t\t\t\tresult = mergeBaseAndUserConfigs( clonedBaseVariation, result );\n\t\t\t}\n\t\t\treturn result;\n\t\t} );\n\n\t\tif ( 'function' === typeof filter ) {\n\t\t\tprocessedStyleVariations =\n\t\t\t\tprocessedStyleVariations.filter( filter );\n\t\t}\n\n\t\treturn processedStyleVariations;\n\t}, [ variations, property, baseVariation, filter ] );\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAOA;AACA;AACA;;AAKA,MAAM;EAAES;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC5D,IAAK,CAAEA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,EAAG;MAC7D,OAAOa,UAAU;IAClB;IAEA,MAAMa,mBAAmB,GACxB,OAAOf,aAAa,KAAK,QAAQ,IACjCb,MAAM,CAACC,IAAI,CAAEY,aAAc,CAAC,CAACX,MAAM,GAAG,CAAC,GACpC,IAAAoB,kBAAS,EAAET,aAAc,CAAC,GAC1B,IAAI;IAER,IAAIgB,wBAAwB,GAAGd,UAAU,CAACe,GAAG,CAAIC,SAAS,IAAM;MAC/D,IAAIC,MAAM,GAAG;QACZ,GAAGT,sBAAsB,CAAE,IAAAD,kBAAS,EAAES,SAAU,CAAC,EAAEhC,QAAS,CAAC;QAC7DkB,KAAK,EAAEc,SAAS,EAAEd,KAAK;QACvBgB,WAAW,EAAEF,SAAS,EAAEE;MACzB,CAAC;MAED,IAAKL,mBAAmB,EAAG;QAC1B;AACJ;AACA;AACA;QACII,MAAM,GAAG,IAAAE,6CAAuB,EAAEN,mBAAmB,EAAEI,MAAO,CAAC;MAChE;MACA,OAAOA,MAAM;IACd,CAAE,CAAC;IAEH,IAAK,UAAU,KAAK,OAAO3B,MAAM,EAAG;MACnCwB,wBAAwB,GACvBA,wBAAwB,CAACxB,MAAM,CAAEA,MAAO,CAAC;IAC3C;IAEA,OAAOwB,wBAAwB;EAChC,CAAC,EAAE,CAAEd,UAAU,EAAEhB,QAAQ,EAAEc,aAAa,EAAER,MAAM,CAAG,CAAC;AACrD","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_editor","_i18n","_cloneDeep","_interopRequireDefault","_lockUnlock","GlobalStylesContext","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","editorPrivateApis","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","filter","variationsFromTheme","useSelect","select","_variationsFromTheme","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","user","baseVariation","useContext","variations","useMemo","title","__","settings","styles","useThemeStyleVariationsByProperty","cloneDeep","filterObjectByProperty","newObject","forEach","newFilter","exports","clonedBaseVariation","processedStyleVariations","reduce","accumulator","variation","variationFilteredByProperty","result","description","isDuplicate","some","item","JSON","stringify","push","isVariationWithSingleProperty","variationWithProperty"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * A convenience wrapper for `useThemeStyleVariationsByProperty()` that fetches the current theme style variations,\n * and user-defined global style/settings object.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n\tfilter,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: baseVariation } = useContext( GlobalStylesContext );\n\n\tconst variations = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...variationsFromTheme,\n\t\t];\n\t}, [ variationsFromTheme ] );\n\n\treturn useThemeStyleVariationsByProperty( {\n\t\tvariations,\n\t\tproperty,\n\t\tfilter,\n\t\tbaseVariation: removePropertyFromObject(\n\t\t\tcloneDeep( baseVariation ),\n\t\t\tproperty\n\t\t),\n\t} );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Returns a new object with only the properties specified in `property`.\n * Optional merges the baseVariation object with the variation object.\n * Note: this function will only overwrite the specified property in baseVariation if it exists.\n * The baseVariation will not be otherwise modified. To strip a property from the baseVariation object, use `removePropertyFromObject`.\n * See useCurrentMergeThemeStyleVariationsWithUserConfig for an example of how to use this function.\n *\n * @param {Object} props Object of hook args.\n * @param {Object[]} props.variations The theme style variations to filter.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @param {Object} props.baseVariation Optional. Base or user settings to be updated with variation properties.\n * @return {Object[]|*} The merged object.\n */\nexport default function useThemeStyleVariationsByProperty( {\n\tvariations,\n\tproperty,\n\tfilter,\n\tbaseVariation,\n} ) {\n\treturn useMemo( () => {\n\t\tif ( ! property || ! variations || variations?.length === 0 ) {\n\t\t\treturn variations;\n\t\t}\n\n\t\tconst clonedBaseVariation =\n\t\t\ttypeof baseVariation === 'object' &&\n\t\t\tObject.keys( baseVariation ).length > 0\n\t\t\t\t? cloneDeep( baseVariation )\n\t\t\t\t: null;\n\n\t\tlet processedStyleVariations = variations.reduce(\n\t\t\t( accumulator, variation ) => {\n\t\t\t\tconst variationFilteredByProperty = filterObjectByProperty(\n\t\t\t\t\tcloneDeep( variation ),\n\t\t\t\t\tproperty\n\t\t\t\t);\n\t\t\t\t// Remove variations that are empty once the property is filtered out.\n\t\t\t\tif ( Object.keys( variationFilteredByProperty ).length === 0 ) {\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}\n\n\t\t\t\tlet result = {\n\t\t\t\t\t...variationFilteredByProperty,\n\t\t\t\t\ttitle: variation?.title,\n\t\t\t\t\tdescription: variation?.description,\n\t\t\t\t};\n\n\t\t\t\tif ( clonedBaseVariation ) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Overwrites all baseVariation object `styleProperty` properties\n\t\t\t\t\t * with the theme variation `styleProperty` properties.\n\t\t\t\t\t */\n\t\t\t\t\tresult = mergeBaseAndUserConfigs(\n\t\t\t\t\t\tclonedBaseVariation,\n\t\t\t\t\t\tresult\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Detect if this is a duplicate variation.\n\t\t\t\tconst isDuplicate = accumulator.some( ( item ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tJSON.stringify( item.styles ) ===\n\t\t\t\t\t\t\tJSON.stringify( result?.styles ) &&\n\t\t\t\t\t\tJSON.stringify( item.settings ) ===\n\t\t\t\t\t\t\tJSON.stringify( result?.settings )\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tif ( isDuplicate ) {\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}\n\n\t\t\t\t// If the variation is not a duplicate, add it to the accumulator.\n\t\t\t\taccumulator.push( result );\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t[] // Initial accumulator value.\n\t\t);\n\n\t\tif ( 'function' === typeof filter ) {\n\t\t\tprocessedStyleVariations =\n\t\t\t\tprocessedStyleVariations.filter( filter );\n\t\t}\n\n\t\treturn processedStyleVariations;\n\t}, [ variations, property, baseVariation, filter ] );\n}\n\n/**\n * Compares a style variation to the same variation filtered by a single property.\n * Returns true if the variation contains only the property specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string} property The property to compare.\n * @return {boolean} Whether the variation contains only a single property.\n */\nexport function isVariationWithSingleProperty( variation, property ) {\n\tconst variationWithProperty = filterObjectByProperty(\n\t\tcloneDeep( variation ),\n\t\tproperty\n\t);\n\n\treturn (\n\t\tJSON.stringify( variationWithProperty?.styles ) ===\n\t\t\tJSON.stringify( variation?.styles ) &&\n\t\tJSON.stringify( variationWithProperty?.settings ) ===\n\t\t\tJSON.stringify( variation?.settings )\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,MAAM;EAAES;AAAoB,CAAC,GAAG,IA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C,KAC9BoB,IAAI,CAACC,SAAS,CAAEN,MAAM,EAAEf,QAAS,CAAC;MAErC,CAAE,CAAC;MACH,IAAKiB,WAAW,EAAG;QAClB,OAAOL,WAAW;MACnB;;MAEA;MACAA,WAAW,CAACU,IAAI,CAAEP,MAAO,CAAC;MAC1B,OAAOH,WAAW;IACnB,CAAC,EACD,EAAE,CAAC;IACJ,CAAC;IAED,IAAK,UAAU,KAAK,OAAO1B,MAAM,EAAG;MACnCwB,wBAAwB,GACvBA,wBAAwB,CAACxB,MAAM,CAAEA,MAAO,CAAC;IAC3C;IAEA,OAAOwB,wBAAwB;EAChC,CAAC,EAAE,CAAEd,UAAU,EAAEhB,QAAQ,EAAEc,aAAa,EAAER,MAAM,CAAG,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASqC,6BAA6BA,CAAEV,SAAS,EAAEjC,QAAQ,EAAG;EACpE,MAAM4C,qBAAqB,GAAGpB,sBAAsB,CACnD,IAAAD,kBAAS,EAAEU,SAAU,CAAC,EACtBjC,QACD,CAAC;EAED,OACCwC,IAAI,CAACC,SAAS,CAAEG,qBAAqB,EAAEvB,MAAO,CAAC,KAC9CmB,IAAI,CAACC,SAAS,CAAER,SAAS,EAAEZ,MAAO,CAAC,IACpCmB,IAAI,CAACC,SAAS,CAAEG,qBAAqB,EAAExB,QAAS,CAAC,KAChDoB,IAAI,CAACC,SAAS,CAAER,SAAS,EAAEb,QAAS,CAAC;AAExC","ignoreList":[]}
package/build/index.js CHANGED
@@ -4,24 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- Object.defineProperty(exports, "PluginMoreMenuItem", {
8
- enumerable: true,
9
- get: function () {
10
- return _editor.PluginMoreMenuItem;
11
- }
12
- });
13
- Object.defineProperty(exports, "PluginSidebar", {
14
- enumerable: true,
15
- get: function () {
16
- return _editor.PluginSidebar;
17
- }
18
- });
19
- Object.defineProperty(exports, "PluginSidebarMoreMenuItem", {
20
- enumerable: true,
21
- get: function () {
22
- return _editor.PluginSidebarMoreMenuItem;
23
- }
24
- });
7
+ var _exportNames = {
8
+ initializeEditor: true,
9
+ reinitializeEditor: true,
10
+ store: true,
11
+ PluginTemplateSettingPanel: true
12
+ };
25
13
  Object.defineProperty(exports, "PluginTemplateSettingPanel", {
26
14
  enumerable: true,
27
15
  get: function () {
@@ -49,6 +37,18 @@ require("./hooks");
49
37
  var _store = require("./store");
50
38
  var _app = _interopRequireDefault(require("./components/app"));
51
39
  var _pluginTemplateSettingPanel = _interopRequireDefault(require("./components/plugin-template-setting-panel"));
40
+ var _deprecated2 = require("./deprecated");
41
+ Object.keys(_deprecated2).forEach(function (key) {
42
+ if (key === "default" || key === "__esModule") return;
43
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
44
+ if (key in exports && exports[key] === _deprecated2[key]) return;
45
+ Object.defineProperty(exports, key, {
46
+ enumerable: true,
47
+ get: function () {
48
+ return _deprecated2[key];
49
+ }
50
+ });
51
+ });
52
52
  /**
53
53
  * WordPress dependencies
54
54
  */
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_app","_pluginTemplateSettingPanel","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\tPluginMoreMenuItem,\n\tPluginSidebar,\n\tPluginSidebarMoreMenuItem,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { PluginMoreMenuItem };\nexport { PluginSidebar };\nexport { PluginSidebarMoreMenuItem };\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAA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_element","_editor","_preferences","_widgets","_store","_app","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAQAA,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAN,sBAAA,CAAAJ,OAAA;AA2EA,IAAAW,2BAAA,GAAAP,sBAAA,CAAAJ,OAAA;AAEA,IAAAY,YAAA,GAAAZ,OAAA;AAAAa,MAAA,CAAAC,IAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,YAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AArGA;AACA;AACA;;AAiBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAASS,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAG;EAChD,MAAMC,MAAM,GAAGC,QAAQ,CA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;EAEH,IAAAhC,cAAQ,EAAEiC,YAAc,CAAC,CAACC,cAAc,CAAExC,QAAS,CAAC;;EAEpD;EACA;EACA;EACA;EACA,IAAAM,cAAQ,EAAEmC,aAAY,CAAC,CAACC,oBAAoB,CAAE;IAC7CC,oBAAoB,EAAE3C,QAAQ,CAAC2C,oBAAoB;IACnDC,wBAAwB,EAAE5C,QAAQ,CAAC4C;EACpC,CAAE,CAAC;;EAEH;EACAC,MAAM,CAACC,gBAAgB,CAAE,UAAU,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEH,MAAM,CAACC,gBAAgB,CAAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE5C,IAAI,CAAC6C,MAAM,CAAE,IAAAC,MAAA,CAAAC,aAAA,EAACpE,IAAA,CAAAqE,OAAG,MAAE,CAAE,CAAC;EAEtB,OAAOhD,IAAI;AACZ;AAEO,SAASiD,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = exports.TEMPLATE_PART_ALL_AREAS_CATEGORY = exports.TEMPLATE_ORIGINS = exports.POST_TYPE_LABELS = exports.PATTERN_USER_CATEGORY = exports.PATTERN_TYPES = exports.PATTERN_SYNC_TYPES = exports.PATTERN_DEFAULT_CATEGORY = exports.OPERATOR_IS_NOT = exports.OPERATOR_IS_NONE = exports.OPERATOR_IS_ANY = exports.OPERATOR_IS = exports.NAVIGATION_POST_TYPE = exports.LAYOUT_TABLE = exports.LAYOUT_LIST = exports.LAYOUT_GRID = exports.FOCUSABLE_ENTITIES = exports.EXCLUDED_PATTERN_SOURCES = exports.ENUMERATION_TYPE = void 0;
6
+ exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = exports.TEMPLATE_PART_ALL_AREAS_CATEGORY = exports.TEMPLATE_ORIGINS = exports.POST_TYPE_LABELS = exports.PATTERN_USER_CATEGORY = exports.PATTERN_TYPES = exports.PATTERN_SYNC_TYPES = exports.PATTERN_DEFAULT_CATEGORY = exports.OPERATOR_IS_NOT = exports.OPERATOR_IS_NONE = exports.OPERATOR_IS_ANY = exports.OPERATOR_IS = exports.NAVIGATION_POST_TYPE = exports.LAYOUT_TABLE = exports.LAYOUT_LIST = exports.LAYOUT_GRID = exports.FOCUSABLE_ENTITIES = exports.EXCLUDED_PATTERN_SOURCES = void 0;
7
7
  var _i18n = require("@wordpress/i18n");
8
8
  var _patterns = require("@wordpress/patterns");
9
9
  var _lockUnlock = require("../lock-unlock");
@@ -56,7 +56,6 @@ const POST_TYPE_LABELS = exports.POST_TYPE_LABELS = {
56
56
  const LAYOUT_GRID = exports.LAYOUT_GRID = 'grid';
57
57
  const LAYOUT_TABLE = exports.LAYOUT_TABLE = 'table';
58
58
  const LAYOUT_LIST = exports.LAYOUT_LIST = 'list';
59
- const ENUMERATION_TYPE = exports.ENUMERATION_TYPE = 'enumeration';
60
59
  const OPERATOR_IS = exports.OPERATOR_IS = 'is';
61
60
  const OPERATOR_IS_NOT = exports.OPERATOR_IS_NOT = 'isNot';
62
61
  const OPERATOR_IS_ANY = exports.OPERATOR_IS_ANY = 'isAny';
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","TEMPLATE_PART_ALL_AREAS_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","__","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","ENUMERATION_TYPE","OPERATOR_IS","OPERATOR_IS_NOT","OPERATOR_IS_ANY","OPERATOR_IS_NONE"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\nexport const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\nexport const ENUMERATION_TYPE = 'enumeration';\nexport const OPERATOR_IS = 'is';\nexport const OPERATOR_IS_NOT = 'isNot';\nexport const OPERATOR_IS_ANY = 'isAny';\nexport const OPERATOR_IS_NONE = 'isNone';\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACO,MAAMG,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,eAAe;;AAEnD;AACO,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,aAAa;AACxC,MAAMC,uBAAuB,GAAAF,OAAA,CAAAE,uBAAA,GAAG,kBAAkB;AAClD,MAAMC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AACM,MAAMC,mCAAmC,GAAAP,OAAA,CAAAO,mCAAA,GAAG,eAAe;AAC3D,MAAMC,gCAAgC,GAAAR,OAAA,CAAAQ,gCAAA,GAAG,WAAW;;AAE3D;AACO,MAAM;EACZC,aAAa;EACbC,wBAAwB;EACxBC,qBAAqB;EACrBC,wBAAwB;EACxBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAmB,CAAC;;AAEhC;AAAAf,OAAA,CAAAa,kBAAA,GAAAA,kBAAA;AAAAb,OAAA,CAAAY,wBAAA,GAAAA,wBAAA;AAAAZ,OAAA,CAAAW,qBAAA,GAAAA,qBAAA;AAAAX,OAAA,CAAAU,wBAAA,GAAAA,wBAAA;AAAAV,OAAA,CAAAS,aAAA,GAAAA,aAAA;AACO,MAAMO,kBAAkB,GAAAhB,OAAA,CAAAgB,kBAAA,GAAG,CACjCd,uBAAuB,EACvBH,oBAAoB,EACpBU,aAAa,CAACQ,IAAI,CAClB;AAEM,MAAMC,gBAAgB,GAAAlB,OAAA,CAAAkB,gBAAA,GAAG;EAC/B,CAAEjB,kBAAkB,GAAI,IAAAkB,QAAE,EAAE,UAAW,CAAC;EACxC,CAAEjB,uBAAuB,GAAI,IAAAiB,QAAE,EAAE,eAAgB,CAAC;EAClD,CAAEV,aAAa,CAACQ,IAAI,GAAI,IAAAE,QAAE,EAAE,SAAU,CAAC;EACvC,CAAEpB,oBAAoB,GAAI,IAAAoB,QAAE,EAAE,YAAa;AAC5C,CAAC;;AAED;AACO,MAAMC,WAAW,GAAApB,OAAA,CAAAoB,WAAA,GAAG,MAAM;AAC1B,MAAMC,YAAY,GAAArB,OAAA,CAAAqB,YAAA,GAAG,OAAO;AAC5B,MAAMC,WAAW,GAAAtB,OAAA,CAAAsB,WAAA,GAAG,MAAM;AAC1B,MAAMC,gBAAgB,GAAAvB,OAAA,CAAAuB,gBAAA,GAAG,aAAa;AACtC,MAAMC,WAAW,GAAAxB,OAAA,CAAAwB,WAAA,GAAG,IAAI;AACxB,MAAMC,eAAe,GAAAzB,OAAA,CAAAyB,eAAA,GAAG,OAAO;AAC/B,MAAMC,eAAe,GAAA1B,OAAA,CAAA0B,eAAA,GAAG,OAAO;AAC/B,MAAMC,gBAAgB,GAAA3B,OAAA,CAAA2B,gBAAA,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","TEMPLATE_PART_ALL_AREAS_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","__","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","OPERATOR_IS","OPERATOR_IS_NOT","OPERATOR_IS_ANY","OPERATOR_IS_NONE"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\nexport const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\n\nexport const OPERATOR_I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AG;EAC/B,CAAEjB,kBAAkB,GAAI,IAAAkB,QAAE,EAAE,UAAW,CAAC;EACxC,CAAEjB,uBAAuB,GAAI,IAAAiB,QAAE,EAAE,eAAgB,CAAC;EAClD,CAAEV,aAAa,CAACQ,IAAI,GAAI,IAAAE,QAAE,EAAE,SAAU,CAAC;EACvC,CAAEpB,oBAAoB,GAAI,IAAAoB,QAAE,EAAE,YAAa;AAC5C,CAAC;;AAED;AACO,MAAMC,WAAW,GAAApB,OAAA,CAAAoB,WAAA,GAAG,MAAM;AAC1B,MAAMC,YAAY,GAAArB,OAAA,CAAAqB,YAAA,GAAG,OAAO;AAC5B,MAAMC,WAAW,GAAAtB,OAAA,CAAAsB,WAAA,GAAG,MAAM;AAE1B,MAAMC,WAAW,GAAAvB,OAAA,CAAAuB,WAAA,GAAG,IAAI;AACxB,MAAMC,eAAe,GAAAxB,OAAA,CAAAwB,eAAA,GAAG,OAAO;AAC/B,MAAMC,eAAe,GAAAzB,OAAA,CAAAyB,eAAA,GAAG,OAAO;AAC/B,MAAMC,gBAAgB,GAAA1B,OAAA,CAAA0B,gBAAA,GAAG,QAAQ","ignoreList":[]}
@@ -20,7 +20,7 @@ function getIsListPage({
20
20
  categoryType,
21
21
  categoryId
22
22
  }, isMobileViewport) {
23
- return ['/wp_template', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
23
+ return ['/wp_template', '/pages'].includes(path) || path === '/patterns' && (
24
24
  // Don't treat "/patterns" without categoryType and categoryId as a
25
25
  // list page in mobile because the sidebar covers the whole page.
26
26
  !isMobileViewport || !!categoryType && !!categoryId);
@@ -1 +1 @@
1
- {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template', '/wp_template_part/all', '/pages' ].includes(\n\t\t\tpath\n\t\t) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,cAAc,EAAE,uBAAuB,EAAE,QAAQ,CAAE,CAACC,QAAQ,CAC7DJ,IACD,CAAC,IACCA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE","ignoreList":[]}
1
+ {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template', '/pages' ].includes( path ) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,cAAc,EAAE,QAAQ,CAAE,CAACC,QAAQ,CAAEJ,IAAK,CAAC,IAC3CA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE","ignoreList":[]}
@@ -29,7 +29,9 @@ const {
29
29
  */
30
30
  function useActivateTheme() {
31
31
  const history = useHistory();
32
- const location = useLocation();
32
+ const {
33
+ params
34
+ } = useLocation();
33
35
  const {
34
36
  startResolution,
35
37
  finishResolution
@@ -40,11 +42,12 @@ function useActivateTheme() {
40
42
  startResolution('activateTheme');
41
43
  await window.fetch(activationURL);
42
44
  finishResolution('activateTheme');
43
- const {
44
- wp_theme_preview: themePreview,
45
- ...params
46
- } = location.params;
47
- history.replace(params);
45
+ // Remove the wp_theme_preview query param: we've finished activating
46
+ // the queue and are switching to normal Site Editor.
47
+ history.replace({
48
+ ...params,
49
+ wp_theme_preview: undefined
50
+ });
48
51
  }
49
52
  };
50
53
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_data","_router","_lockUnlock","_isPreviewingTheme","useHistory","useLocation","unlock","routerPrivateApis","useActivateTheme","history","location","startResolution","finishResolution","useDispatch","coreStore","isPreviewingTheme","activationURL","currentlyPreviewingTheme","window","WP_BLOCK_THEME_ACTIVATE_NONCE","fetch","wp_theme_preview","themePreview","params","replace"],"sources":["@wordpress/edit-site/src/utils/use-activate-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from './is-previewing-theme';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * This should be refactored to use the REST API, once the REST API can activate themes.\n *\n * @return {Function} A function that activates the theme.\n */\nexport function useActivateTheme() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst { startResolution, finishResolution } = useDispatch( coreStore );\n\n\treturn async () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tconst activationURL =\n\t\t\t\t'themes.php?action=activate&stylesheet=' +\n\t\t\t\tcurrentlyPreviewingTheme() +\n\t\t\t\t'&_wpnonce=' +\n\t\t\t\twindow.WP_BLOCK_THEME_ACTIVATE_NONCE;\n\t\t\tstartResolution( 'activateTheme' );\n\t\t\tawait window.fetch( activationURL );\n\t\t\tfinishResolution( 'activateTheme' );\n\t\t\tconst { wp_theme_preview: themePreview, ...params } =\n\t\t\t\tlocation.params;\n\t\t\thistory.replace( params );\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAM;EAAEK,UAAU;EAAEC;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAAG;EAClC,MAAMC,OAAO,GAAGL,UAAU,CAAC,CAAC;EAC5B,MAAMM,QAAQ,GAAGL,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEM,eAAe;IAAEC;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,eAAU,CAAC;EAEtE,OAAO,YAAY;IAClB,IAAK,IAAAC,oCAAiB,EAAC,CAAC,EAAG;MAC1B,MAAMC,aAAa,GAClB,wCAAwC,GACxC,IAAAC,2CAAwB,EAAC,CAAC,GAC1B,YAAY,GACZC,MAAM,CAACC,6BAA6B;MACrCR,eAAe,CAAE,eAAgB,CAAC;MAClC,MAAMO,MAAM,CAACE,KAAK,CAAEJ,aAAc,CAAC;MACnCJ,gBAAgB,CAAE,eAAgB,CAAC;MACnC,MAAM;QAAES,gBAAgB,EAAEC,YAAY;QAAE,GAAGC;MAAO,CAAC,GAClDb,QAAQ,CAACa,MAAM;MAChBd,OAAO,CAACe,OAAO,CAAED,MAAO,CAAC;IAC1B;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_data","_router","_lockUnlock","_isPreviewingTheme","useHistory","useLocation","unlock","routerPrivateApis","useActivateTheme","history","params","startResolution","finishResolution","useDispatch","coreStore","isPreviewingTheme","activationURL","currentlyPreviewingTheme","window","WP_BLOCK_THEME_ACTIVATE_NONCE","fetch","replace","wp_theme_preview","undefined"],"sources":["@wordpress/edit-site/src/utils/use-activate-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from './is-previewing-theme';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * This should be refactored to use the REST API, once the REST API can activate themes.\n *\n * @return {Function} A function that activates the theme.\n */\nexport function useActivateTheme() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { startResolution, finishResolution } = useDispatch( coreStore );\n\n\treturn async () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tconst activationURL =\n\t\t\t\t'themes.php?action=activate&stylesheet=' +\n\t\t\t\tcurrentlyPreviewingTheme() +\n\t\t\t\t'&_wpnonce=' +\n\t\t\t\twindow.WP_BLOCK_THEME_ACTIVATE_NONCE;\n\t\t\tstartResolution( 'activateTheme' );\n\t\t\tawait window.fetch( activationURL );\n\t\t\tfinishResolution( 'activateTheme' );\n\t\t\t// Remove the wp_theme_preview query param: we've finished activating\n\t\t\t// the queue and are switching to normal Site Editor.\n\t\t\thistory.replace( { ...params, wp_theme_preview: undefined } );\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAM;EAAEK,UAAU;EAAEC;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAAG;EAClC,MAAMC,OAAO,GAAGL,UAAU,CAAC,CAAC;EAC5B,MAAM;IAAEM;EAAO,CAAC,GAAGL,WAAW,CAAC,CAAC;EAChC,MAAM;IAAEM,eAAe;IAAEC;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,eAAU,CAAC;EAEtE,OAAO,YAAY;IAClB,IAAK,IAAAC,oCAAiB,EAAC,CAAC,EAAG;MAC1B,MAAMC,aAAa,GAClB,wCAAwC,GACxC,IAAAC,2CAAwB,EAAC,CAAC,GAC1B,YAAY,GACZC,MAAM,CAACC,6BAA6B;MACrCR,eAAe,CAAE,eAAgB,CAAC;MAClC,MAAMO,MAAM,CAACE,KAAK,CAAEJ,aAAc,CAAC;MACnCJ,gBAAgB,CAAE,eAAgB,CAAC;MACnC;MACA;MACAH,OAAO,CAACY,OAAO,CAAE;QAAE,GAAGX,MAAM;QAAEY,gBAAgB,EAAEC;MAAU,CAAE,CAAC;IAC9D;EACD,CAAC;AACF","ignoreList":[]}
@@ -58,6 +58,7 @@ export default function AddNewPageModal({
58
58
  }, createElement(VStack, {
59
59
  spacing: 3
60
60
  }, createElement(TextControl, {
61
+ __next40pxDefaultSize: true,
61
62
  label: __('Page title'),
62
63
  onChange: setTitle,
63
64
  placeholder: __('No title'),
@@ -66,9 +67,11 @@ export default function AddNewPageModal({
66
67
  spacing: 2,
67
68
  justify: "end"
68
69
  }, createElement(Button, {
70
+ __next40pxDefaultSize: true,
69
71
  variant: "tertiary",
70
72
  onClick: onClose
71
73
  }, __('Cancel')), createElement(Button, {
74
+ __next40pxDefaultSize: true,
72
75
  variant: "primary",
73
76
  type: "submit",
74
77
  isBusy: isCreatingPage,
@@ -1 +1 @@
1
- {"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useState","store","coreStore","noticesStore","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","createPage","event","preventDefault","newPage","status","slug","throwOnError","rendered","type","error","errorMessage","message","code","createElement","onRequestClose","onSubmit","spacing","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tnewPage.title?.rendered || title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPage( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal title={ __( 'Draft a new page' ) } onRequestClose={ onClose }>\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Page title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\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T,EAAE,CAAE,QAAS,CACR,CAAC,EACT8B,aAAA,CAACrC,MAAM;IACN8C,OAAO,EAAC,SAAS;IACjBd,IAAI,EAAC,QAAQ;IACbgB,MAAM,EAAG/B,cAAgB;IACzB,iBAAgBA;EAAgB,GAE9BV,EAAE,CAAE,cAAe,CACd,CACD,CACD,CACH,CACA,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useState","store","coreStore","noticesStore","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","createPage","event","preventDefault","newPage","status","slug","throwOnError","rendered","type","error","errorMessage","message","code","createElement","onRequestClose","onSubmit","spacing","__next40pxDefaultSize","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tnewPage.title?.rendered || title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPage( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal title={ __( 'Draft a new page' ) } onRequestClose={ onClose }>\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Page title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"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