@wordpress/edit-site 5.34.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 (371) hide show
  1. package/CHANGELOG.md +9 -3
  2. package/build/components/add-new-template/index.js +2 -2
  3. package/build/components/add-new-template/index.js.map +1 -1
  4. package/build/components/app/index.js +4 -2
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/block-editor/editor-canvas.js +4 -18
  7. package/build/components/block-editor/editor-canvas.js.map +1 -1
  8. package/build/components/block-editor/site-editor-canvas.js +2 -2
  9. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  10. package/build/components/dataviews-actions/index.js +46 -0
  11. package/build/components/dataviews-actions/index.js.map +1 -0
  12. package/build/components/editor/index.js +68 -12
  13. package/build/components/editor/index.js.map +1 -1
  14. package/build/components/global-styles/background-panel.js +13 -1
  15. package/build/components/global-styles/background-panel.js.map +1 -1
  16. package/build/components/global-styles/color-indicator-wrapper.js +2 -2
  17. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  18. package/build/components/global-styles/color-palette-panel.js +5 -2
  19. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  20. package/build/components/global-styles/gradients-palette-panel.js +1 -2
  21. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  22. package/build/components/global-styles/hooks.js +5 -2
  23. package/build/components/global-styles/hooks.js.map +1 -1
  24. package/build/components/global-styles/icon-with-current-color.js +2 -2
  25. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  26. package/build/components/global-styles/preset-colors.js +29 -0
  27. package/build/components/global-styles/preset-colors.js.map +1 -0
  28. package/build/components/global-styles/preview-colors.js +3 -7
  29. package/build/components/global-styles/preview-colors.js.map +1 -1
  30. package/build/components/global-styles/screen-color-palette.js +5 -5
  31. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  32. package/build/components/global-styles/screen-colors.js +1 -4
  33. package/build/components/global-styles/screen-colors.js.map +1 -1
  34. package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  35. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  36. package/build/components/global-styles/typography-example.js +5 -2
  37. package/build/components/global-styles/typography-example.js.map +1 -1
  38. package/build/components/global-styles/ui.js +4 -1
  39. package/build/components/global-styles/ui.js.map +1 -1
  40. package/build/components/global-styles/variations/variation.js +12 -6
  41. package/build/components/global-styles/variations/variation.js.map +1 -1
  42. package/build/components/global-styles/variations/variations-color.js +5 -5
  43. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  44. package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  45. package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
  46. package/build/components/global-styles-sidebar/index.js.map +1 -0
  47. package/build/components/header-edit-mode/index.js +20 -120
  48. package/build/components/header-edit-mode/index.js.map +1 -1
  49. package/build/components/layout/index.js +3 -6
  50. package/build/components/layout/index.js.map +1 -1
  51. package/build/components/layout/router.js +69 -14
  52. package/build/components/layout/router.js.map +1 -1
  53. package/build/components/page/index.js +2 -2
  54. package/build/components/page/index.js.map +1 -1
  55. package/build/components/page-pages/index.js +4 -15
  56. package/build/components/page-pages/index.js.map +1 -1
  57. package/build/components/page-patterns/dataviews-pattern-actions.js +4 -80
  58. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  59. package/build/components/page-patterns/index.js +9 -20
  60. package/build/components/page-patterns/index.js.map +1 -1
  61. package/build/components/page-templates/index.js +6 -14
  62. package/build/components/page-templates/index.js.map +1 -1
  63. package/build/components/pagination/index.js +2 -2
  64. package/build/components/pagination/index.js.map +1 -1
  65. package/build/components/resizable-frame/index.js +11 -3
  66. package/build/components/resizable-frame/index.js.map +1 -1
  67. package/build/components/revisions/index.js +5 -2
  68. package/build/components/revisions/index.js.map +1 -1
  69. package/build/components/save-panel/index.js +4 -4
  70. package/build/components/save-panel/index.js.map +1 -1
  71. package/build/components/sidebar/index.js +61 -31
  72. package/build/components/sidebar/index.js.map +1 -1
  73. package/build/components/sidebar-button/index.js +2 -2
  74. package/build/components/sidebar-button/index.js.map +1 -1
  75. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  76. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  77. package/build/components/sidebar-navigation-item/index.js +5 -3
  78. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  79. package/build/components/sidebar-navigation-screen/index.js +6 -32
  80. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  81. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  82. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  83. package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -1
  84. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  85. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
  86. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  87. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
  88. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  89. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  90. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  91. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
  92. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  93. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
  94. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  95. package/build/components/sidebar-navigation-screen-page/status-label.js +2 -2
  96. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  97. package/build/components/sidebar-navigation-screen-pattern/index.js +4 -9
  98. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  99. package/build/components/sidebar-navigation-screen-patterns/index.js +4 -14
  100. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  101. package/build/components/sidebar-navigation-screen-template/index.js +4 -1
  102. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  103. package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -1
  104. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  105. package/build/components/site-hub/index.js +3 -3
  106. package/build/components/site-hub/index.js.map +1 -1
  107. package/build/components/site-icon/index.js +2 -2
  108. package/build/components/site-icon/index.js.map +1 -1
  109. package/build/components/style-book/index.js +10 -7
  110. package/build/components/style-book/index.js.map +1 -1
  111. package/build/components/template-part-converter/index.js +18 -1
  112. package/build/components/template-part-converter/index.js.map +1 -1
  113. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +5 -2
  114. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  115. package/build/utils/get-is-list-page.js +1 -1
  116. package/build/utils/get-is-list-page.js.map +1 -1
  117. package/build/utils/use-activate-theme.js +9 -6
  118. package/build/utils/use-activate-theme.js.map +1 -1
  119. package/build-module/components/add-new-template/index.js +2 -2
  120. package/build-module/components/add-new-template/index.js.map +1 -1
  121. package/build-module/components/app/index.js +4 -2
  122. package/build-module/components/app/index.js.map +1 -1
  123. package/build-module/components/block-editor/editor-canvas.js +4 -18
  124. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  125. package/build-module/components/block-editor/site-editor-canvas.js +2 -2
  126. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  127. package/build-module/components/dataviews-actions/index.js +38 -0
  128. package/build-module/components/dataviews-actions/index.js.map +1 -0
  129. package/build-module/components/editor/index.js +69 -13
  130. package/build-module/components/editor/index.js.map +1 -1
  131. package/build-module/components/global-styles/background-panel.js +12 -1
  132. package/build-module/components/global-styles/background-panel.js.map +1 -1
  133. package/build-module/components/global-styles/color-indicator-wrapper.js +2 -2
  134. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  135. package/build-module/components/global-styles/color-palette-panel.js +4 -2
  136. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  137. package/build-module/components/global-styles/gradients-palette-panel.js +1 -2
  138. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  139. package/build-module/components/global-styles/hooks.js +4 -1
  140. package/build-module/components/global-styles/hooks.js.map +1 -1
  141. package/build-module/components/global-styles/icon-with-current-color.js +2 -2
  142. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  143. package/build-module/components/global-styles/preset-colors.js +22 -0
  144. package/build-module/components/global-styles/preset-colors.js.map +1 -0
  145. package/build-module/components/global-styles/preview-colors.js +3 -7
  146. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  147. package/build-module/components/global-styles/screen-color-palette.js +5 -5
  148. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  149. package/build-module/components/global-styles/screen-colors.js +1 -4
  150. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  151. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  152. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  153. package/build-module/components/global-styles/typography-example.js +4 -1
  154. package/build-module/components/global-styles/typography-example.js.map +1 -1
  155. package/build-module/components/global-styles/ui.js +4 -1
  156. package/build-module/components/global-styles/ui.js.map +1 -1
  157. package/build-module/components/global-styles/variations/variation.js +11 -5
  158. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  159. package/build-module/components/global-styles/variations/variations-color.js +6 -6
  160. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  161. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  162. package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
  163. package/build-module/components/global-styles-sidebar/index.js.map +1 -0
  164. package/build-module/components/header-edit-mode/index.js +20 -120
  165. package/build-module/components/header-edit-mode/index.js.map +1 -1
  166. package/build-module/components/layout/index.js +3 -6
  167. package/build-module/components/layout/index.js.map +1 -1
  168. package/build-module/components/layout/router.js +69 -15
  169. package/build-module/components/layout/router.js.map +1 -1
  170. package/build-module/components/page/index.js +2 -2
  171. package/build-module/components/page/index.js.map +1 -1
  172. package/build-module/components/page-pages/index.js +4 -15
  173. package/build-module/components/page-pages/index.js.map +1 -1
  174. package/build-module/components/page-patterns/dataviews-pattern-actions.js +4 -80
  175. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  176. package/build-module/components/page-patterns/index.js +10 -21
  177. package/build-module/components/page-patterns/index.js.map +1 -1
  178. package/build-module/components/page-templates/index.js +6 -14
  179. package/build-module/components/page-templates/index.js.map +1 -1
  180. package/build-module/components/pagination/index.js +2 -2
  181. package/build-module/components/pagination/index.js.map +1 -1
  182. package/build-module/components/resizable-frame/index.js +12 -4
  183. package/build-module/components/resizable-frame/index.js.map +1 -1
  184. package/build-module/components/revisions/index.js +4 -1
  185. package/build-module/components/revisions/index.js.map +1 -1
  186. package/build-module/components/save-panel/index.js +4 -4
  187. package/build-module/components/save-panel/index.js.map +1 -1
  188. package/build-module/components/sidebar/index.js +62 -32
  189. package/build-module/components/sidebar/index.js.map +1 -1
  190. package/build-module/components/sidebar-button/index.js +2 -2
  191. package/build-module/components/sidebar-button/index.js.map +1 -1
  192. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  193. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  194. package/build-module/components/sidebar-navigation-item/index.js +5 -3
  195. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  196. package/build-module/components/sidebar-navigation-screen/index.js +6 -32
  197. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  198. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  199. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  200. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -1
  201. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  202. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
  203. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  204. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
  205. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  206. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  207. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  208. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
  209. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  210. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
  211. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  212. package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -2
  213. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  214. package/build-module/components/sidebar-navigation-screen-pattern/index.js +4 -9
  215. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  216. package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -14
  217. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  218. package/build-module/components/sidebar-navigation-screen-template/index.js +4 -1
  219. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  220. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -1
  221. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  222. package/build-module/components/site-hub/index.js +3 -3
  223. package/build-module/components/site-hub/index.js.map +1 -1
  224. package/build-module/components/site-icon/index.js +2 -2
  225. package/build-module/components/site-icon/index.js.map +1 -1
  226. package/build-module/components/style-book/index.js +9 -6
  227. package/build-module/components/style-book/index.js.map +1 -1
  228. package/build-module/components/template-part-converter/index.js +18 -1
  229. package/build-module/components/template-part-converter/index.js.map +1 -1
  230. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +4 -1
  231. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  232. package/build-module/utils/get-is-list-page.js +1 -1
  233. package/build-module/utils/get-is-list-page.js.map +1 -1
  234. package/build-module/utils/use-activate-theme.js +9 -6
  235. package/build-module/utils/use-activate-theme.js.map +1 -1
  236. package/build-style/style-rtl.css +144 -374
  237. package/build-style/style.css +144 -374
  238. package/package.json +43 -45
  239. package/src/components/add-new-template/index.js +2 -2
  240. package/src/components/app/index.js +5 -2
  241. package/src/components/block-editor/editor-canvas.js +6 -26
  242. package/src/components/block-editor/site-editor-canvas.js +2 -2
  243. package/src/components/block-editor/style.scss +2 -2
  244. package/src/components/dataviews-actions/index.js +38 -0
  245. package/src/components/editor/index.js +76 -16
  246. package/src/components/editor/style.scss +0 -4
  247. package/src/components/global-styles/background-panel.js +17 -2
  248. package/src/components/global-styles/color-indicator-wrapper.js +2 -2
  249. package/src/components/global-styles/color-palette-panel.js +3 -4
  250. package/src/components/global-styles/gradients-palette-panel.js +1 -4
  251. package/src/components/global-styles/hooks.js +2 -1
  252. package/src/components/global-styles/icon-with-current-color.js +2 -2
  253. package/src/components/global-styles/preset-colors.js +18 -0
  254. package/src/components/global-styles/preview-colors.js +4 -7
  255. package/src/components/global-styles/screen-color-palette.js +4 -4
  256. package/src/components/global-styles/screen-colors.js +0 -2
  257. package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  258. package/src/components/global-styles/stories/index.story.js +2 -1
  259. package/src/components/global-styles/typography-example.js +2 -1
  260. package/src/components/global-styles/ui.js +5 -1
  261. package/src/components/global-styles/variations/style.scss +15 -31
  262. package/src/components/global-styles/variations/variation.js +13 -10
  263. package/src/components/global-styles/variations/variations-color.js +5 -8
  264. package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
  265. package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
  266. package/src/components/header-edit-mode/index.js +25 -164
  267. package/src/components/header-edit-mode/style.scss +1 -199
  268. package/src/components/layout/index.js +3 -8
  269. package/src/components/layout/router.js +65 -15
  270. package/src/components/layout/style.scss +2 -1
  271. package/src/components/page/index.js +2 -2
  272. package/src/components/page-pages/index.js +8 -38
  273. package/src/components/page-pages/style.scss +0 -11
  274. package/src/components/page-patterns/dataviews-pattern-actions.js +3 -92
  275. package/src/components/page-patterns/index.js +16 -35
  276. package/src/components/page-templates/index.js +10 -29
  277. package/src/components/pagination/index.js +2 -2
  278. package/src/components/resizable-frame/index.js +16 -4
  279. package/src/components/revisions/index.js +2 -1
  280. package/src/components/save-panel/index.js +4 -4
  281. package/src/components/sidebar/index.js +61 -37
  282. package/src/components/sidebar-button/index.js +2 -5
  283. package/src/components/sidebar-dataviews/dataview-item.js +4 -7
  284. package/src/components/sidebar-navigation-item/index.js +3 -3
  285. package/src/components/sidebar-navigation-screen/index.js +7 -31
  286. package/src/components/sidebar-navigation-screen/style.scss +11 -9
  287. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  288. package/src/components/sidebar-navigation-screen-global-styles/index.js +2 -1
  289. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
  290. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
  291. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  292. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
  293. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +0 -10
  294. package/src/components/sidebar-navigation-screen-page/status-label.js +2 -2
  295. package/src/components/sidebar-navigation-screen-pattern/index.js +2 -8
  296. package/src/components/sidebar-navigation-screen-patterns/index.js +2 -13
  297. package/src/components/sidebar-navigation-screen-template/index.js +2 -1
  298. package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -1
  299. package/src/components/site-hub/index.js +3 -3
  300. package/src/components/site-icon/index.js +2 -2
  301. package/src/components/style-book/index.js +7 -6
  302. package/src/components/template-part-converter/index.js +16 -3
  303. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -1
  304. package/src/style.scss +1 -11
  305. package/src/utils/get-is-list-page.js +1 -3
  306. package/src/utils/use-activate-theme.js +4 -4
  307. package/build/components/global-styles/global-styles-provider.js +0 -129
  308. package/build/components/global-styles/global-styles-provider.js.map +0 -1
  309. package/build/components/header-edit-mode/document-tools/index.js +0 -68
  310. package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
  311. package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  312. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  313. package/build/components/sidebar-edit-mode/index.js +0 -147
  314. package/build/components/sidebar-edit-mode/index.js.map +0 -1
  315. package/build/components/sidebar-edit-mode/page-panels/index.js +0 -129
  316. package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  317. package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
  318. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  319. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -46
  320. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  321. package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
  322. package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  323. package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
  324. package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  325. package/build/components/sidebar-edit-mode/template-panel/index.js +0 -127
  326. package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  327. package/build/components/start-template-options/index.js +0 -191
  328. package/build/components/start-template-options/index.js.map +0 -1
  329. package/build/utils/math.js +0 -98
  330. package/build/utils/math.js.map +0 -1
  331. package/build-module/components/global-styles/global-styles-provider.js +0 -120
  332. package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
  333. package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
  334. package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
  335. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  336. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  337. package/build-module/components/sidebar-edit-mode/index.js +0 -138
  338. package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
  339. package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -121
  340. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  341. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
  342. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  343. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
  344. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  345. package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
  346. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  347. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
  348. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  349. package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -119
  350. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  351. package/build-module/components/start-template-options/index.js +0 -184
  352. package/build-module/components/start-template-options/index.js.map +0 -1
  353. package/build-module/utils/math.js +0 -92
  354. package/build-module/utils/math.js.map +0 -1
  355. package/src/components/global-styles/global-styles-provider.js +0 -162
  356. package/src/components/header-edit-mode/document-tools/index.js +0 -68
  357. package/src/components/sidebar-edit-mode/index.js +0 -173
  358. package/src/components/sidebar-edit-mode/page-panels/index.js +0 -133
  359. package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
  360. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -61
  361. package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
  362. package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
  363. package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
  364. package/src/components/sidebar-edit-mode/template-panel/index.js +0 -134
  365. package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
  366. package/src/components/start-template-options/index.js +0 -231
  367. package/src/components/start-template-options/style.scss +0 -55
  368. package/src/utils/math.js +0 -93
  369. /package/build/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  370. /package/build-module/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  371. /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
@@ -1,92 +0,0 @@
1
- /**
2
- * @typedef {Object} WPPoint
3
- * @property {number} x The horizontal coordinate.
4
- * @property {number} y The vertical coordinate.
5
- */
6
-
7
- /**
8
- * Clamps a value to a range. Uses the CSS `clamp()` ordering for arguments.
9
- *
10
- * @param {number} min Minimum range.
11
- * @param {number} value Value to clamp.
12
- * @param {number} max Maximum range.
13
- *
14
- * @return {number} Clamped value.
15
- */
16
- function clamp(min, value, max) {
17
- return Math.max(min, Math.min(value, max));
18
- }
19
-
20
- /**
21
- * Evaluates a linear function passing through two points at the given x value.
22
- *
23
- * Example:
24
- * f(x)
25
- * │ ╲
26
- * │ * (p0)
27
- * │ ╲
28
- * │ ╲
29
- * │ (p1) *
30
- * │ ╲
31
- * └──────────── x
32
- *
33
- * @param {WPPoint} p0 First point.
34
- * @param {WPPoint} p1 Second point.
35
- * @param {number} x Value to evaluate at.
36
- *
37
- * @return {number} Result of the two-point linear function at x.
38
- */
39
- function twoPointLinearFn(p0, p1, x) {
40
- return (p1.y - p0.y) / (p1.x - p0.x) * (x - p0.x) + p0.y;
41
- }
42
-
43
- /**
44
- * Evaluates a two-point linear function at a given x value, clamped to the range of the points.
45
- *
46
- * Example:
47
- * f(x)
48
- * │ ───* (p0)
49
- * │ ╲
50
- * │ ╲
51
- * │ (p1) *───
52
- * └──────────── x
53
- *
54
- * @param {WPPoint} p0 First point.
55
- * @param {WPPoint} p1 Second point.
56
- * @param {number} x Value to evaluate at.
57
- *
58
- * @return {number} Result of the two-point linear function clamped to the range of the points.
59
- */
60
- function clampedTwoPointLinearFn(p0, p1, x) {
61
- return clamp(Math.min(p0.y, p1.y), twoPointLinearFn(p0, p1, x), Math.max(p0.y, p1.y));
62
- }
63
-
64
- /**
65
- * Computes the iframe scale using a start and end width/scale pair and the current width.
66
- *
67
- * The scale is clamped outside the points and is linearly interpolated between.
68
- *
69
- * Example:
70
- * scale
71
- * │ ───* (start)
72
- * │ ╲
73
- * │ ╲
74
- * │ (end) *───
75
- * └──────────── width
76
- *
77
- * @param {Object} start First width and scale pair.
78
- * @param {Object} end Second width and scale pair.
79
- * @param {number} currentWidth Current width.
80
- *
81
- * @return {number} The scale of the current width between the two points.
82
- */
83
- export function computeIFrameScale(start, end, currentWidth) {
84
- return clampedTwoPointLinearFn({
85
- x: start.width,
86
- y: start.scale
87
- }, {
88
- x: end.width,
89
- y: end.scale
90
- }, currentWidth);
91
- }
92
- //# sourceMappingURL=math.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["clamp","min","value","max","Math","twoPointLinearFn","p0","p1","x","y","clampedTwoPointLinearFn","computeIFrameScale","start","end","currentWidth","width","scale"],"sources":["@wordpress/edit-site/src/utils/math.js"],"sourcesContent":["/**\n * @typedef {Object} WPPoint\n * @property {number} x The horizontal coordinate.\n * @property {number} y The vertical coordinate.\n */\n\n/**\n * Clamps a value to a range. Uses the CSS `clamp()` ordering for arguments.\n *\n * @param {number} min Minimum range.\n * @param {number} value Value to clamp.\n * @param {number} max Maximum range.\n *\n * @return {number} Clamped value.\n */\nfunction clamp( min, value, max ) {\n\treturn Math.max( min, Math.min( value, max ) );\n}\n\n/**\n * Evaluates a linear function passing through two points at the given x value.\n *\n * Example:\n * f(x)\n * │ ╲\n * │ * (p0)\n * │ ╲\n * │ ╲\n * │ (p1) *\n * │ ╲\n * └──────────── x\n *\n * @param {WPPoint} p0 First point.\n * @param {WPPoint} p1 Second point.\n * @param {number} x Value to evaluate at.\n *\n * @return {number} Result of the two-point linear function at x.\n */\nfunction twoPointLinearFn( p0, p1, x ) {\n\treturn ( ( p1.y - p0.y ) / ( p1.x - p0.x ) ) * ( x - p0.x ) + p0.y;\n}\n\n/**\n * Evaluates a two-point linear function at a given x value, clamped to the range of the points.\n *\n * Example:\n * f(x)\n * │ ───* (p0)\n * │ ╲\n * │ ╲\n * │ (p1) *───\n * └──────────── x\n *\n * @param {WPPoint} p0 First point.\n * @param {WPPoint} p1 Second point.\n * @param {number} x Value to evaluate at.\n *\n * @return {number} Result of the two-point linear function clamped to the range of the points.\n */\nfunction clampedTwoPointLinearFn( p0, p1, x ) {\n\treturn clamp(\n\t\tMath.min( p0.y, p1.y ),\n\t\ttwoPointLinearFn( p0, p1, x ),\n\t\tMath.max( p0.y, p1.y )\n\t);\n}\n\n/**\n * Computes the iframe scale using a start and end width/scale pair and the current width.\n *\n * The scale is clamped outside the points and is linearly interpolated between.\n *\n * Example:\n * scale\n * │ ───* (start)\n * │ ╲\n * │ ╲\n * │ (end) *───\n * └──────────── width\n *\n * @param {Object} start First width and scale pair.\n * @param {Object} end Second width and scale pair.\n * @param {number} currentWidth Current width.\n *\n * @return {number} The scale of the current width between the two points.\n */\nexport function computeIFrameScale( start, end, currentWidth ) {\n\treturn clampedTwoPointLinearFn(\n\t\t{ x: start.width, y: start.scale },\n\t\t{ x: end.width, y: end.scale },\n\t\tcurrentWidth\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAKA,CAAEC,GAAG,EAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,OAAOC,IAAI,CAACD,GAAG,CAAEF,GAAG,EAAEG,IAAI,CAACH,GAAG,CAAEC,KAAK,EAAEC,GAAI,CAAE,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,gBAAgBA,CAAEC,EAAE,EAAEC,EAAE,EAAEC,CAAC,EAAG;EACtC,OAAS,CAAED,EAAE,CAACE,CAAC,GAAGH,EAAE,CAACG,CAAC,KAAOF,EAAE,CAACC,CAAC,GAAGF,EAAE,CAACE,CAAC,CAAE,IAAOA,CAAC,GAAGF,EAAE,CAACE,CAAC,CAAE,GAAGF,EAAE,CAACG,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,uBAAuBA,CAAEJ,EAAE,EAAEC,EAAE,EAAEC,CAAC,EAAG;EAC7C,OAAOR,KAAK,CACXI,IAAI,CAACH,GAAG,CAAEK,EAAE,CAACG,CAAC,EAAEF,EAAE,CAACE,CAAE,CAAC,EACtBJ,gBAAgB,CAAEC,EAAE,EAAEC,EAAE,EAAEC,CAAE,CAAC,EAC7BJ,IAAI,CAACD,GAAG,CAAEG,EAAE,CAACG,CAAC,EAAEF,EAAE,CAACE,CAAE,CACtB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,kBAAkBA,CAAEC,KAAK,EAAEC,GAAG,EAAEC,YAAY,EAAG;EAC9D,OAAOJ,uBAAuB,CAC7B;IAAEF,CAAC,EAAEI,KAAK,CAACG,KAAK;IAAEN,CAAC,EAAEG,KAAK,CAACI;EAAM,CAAC,EAClC;IAAER,CAAC,EAAEK,GAAG,CAACE,KAAK;IAAEN,CAAC,EAAEI,GAAG,CAACG;EAAM,CAAC,EAC9BF,YACD,CAAC;AACF","ignoreList":[]}
@@ -1,162 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import deepmerge from 'deepmerge';
5
- import { isPlainObject } from 'is-plain-object';
6
-
7
- /**
8
- * WordPress dependencies
9
- */
10
- import { useMemo, useCallback } from '@wordpress/element';
11
- import { useSelect, useDispatch } from '@wordpress/data';
12
- import { store as coreStore } from '@wordpress/core-data';
13
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
- import { unlock } from '../../lock-unlock';
19
-
20
- const { GlobalStylesContext, cleanEmptyObject } = unlock(
21
- blockEditorPrivateApis
22
- );
23
-
24
- export function mergeBaseAndUserConfigs( base, user ) {
25
- return deepmerge( base, user, {
26
- // We only pass as arrays the presets,
27
- // in which case we want the new array of values
28
- // to override the old array (no merging).
29
- isMergeableObject: isPlainObject,
30
- } );
31
- }
32
-
33
- function useGlobalStylesUserConfig() {
34
- const { globalStylesId, isReady, settings, styles } = useSelect(
35
- ( select ) => {
36
- const { getEditedEntityRecord, hasFinishedResolution } =
37
- select( coreStore );
38
- const _globalStylesId =
39
- select( coreStore ).__experimentalGetCurrentGlobalStylesId();
40
- const record = _globalStylesId
41
- ? getEditedEntityRecord(
42
- 'root',
43
- 'globalStyles',
44
- _globalStylesId
45
- )
46
- : undefined;
47
-
48
- let hasResolved = false;
49
- if (
50
- hasFinishedResolution(
51
- '__experimentalGetCurrentGlobalStylesId'
52
- )
53
- ) {
54
- hasResolved = _globalStylesId
55
- ? hasFinishedResolution( 'getEditedEntityRecord', [
56
- 'root',
57
- 'globalStyles',
58
- _globalStylesId,
59
- ] )
60
- : true;
61
- }
62
-
63
- return {
64
- globalStylesId: _globalStylesId,
65
- isReady: hasResolved,
66
- settings: record?.settings,
67
- styles: record?.styles,
68
- };
69
- },
70
- []
71
- );
72
-
73
- const { getEditedEntityRecord } = useSelect( coreStore );
74
- const { editEntityRecord } = useDispatch( coreStore );
75
- const config = useMemo( () => {
76
- return {
77
- settings: settings ?? {},
78
- styles: styles ?? {},
79
- };
80
- }, [ settings, styles ] );
81
-
82
- const setConfig = useCallback(
83
- ( callback, options = {} ) => {
84
- const record = getEditedEntityRecord(
85
- 'root',
86
- 'globalStyles',
87
- globalStylesId
88
- );
89
- const currentConfig = {
90
- styles: record?.styles ?? {},
91
- settings: record?.settings ?? {},
92
- };
93
- const updatedConfig = callback( currentConfig );
94
- editEntityRecord(
95
- 'root',
96
- 'globalStyles',
97
- globalStylesId,
98
- {
99
- styles: cleanEmptyObject( updatedConfig.styles ) || {},
100
- settings: cleanEmptyObject( updatedConfig.settings ) || {},
101
- },
102
- options
103
- );
104
- },
105
- [ globalStylesId ]
106
- );
107
-
108
- return [ isReady, config, setConfig ];
109
- }
110
-
111
- function useGlobalStylesBaseConfig() {
112
- const baseConfig = useSelect( ( select ) => {
113
- return select(
114
- coreStore
115
- ).__experimentalGetCurrentThemeBaseGlobalStyles();
116
- }, [] );
117
-
118
- return [ !! baseConfig, baseConfig ];
119
- }
120
-
121
- function useGlobalStylesContext() {
122
- const [ isUserConfigReady, userConfig, setUserConfig ] =
123
- useGlobalStylesUserConfig();
124
- const [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();
125
- const mergedConfig = useMemo( () => {
126
- if ( ! baseConfig || ! userConfig ) {
127
- return {};
128
- }
129
- return mergeBaseAndUserConfigs( baseConfig, userConfig );
130
- }, [ userConfig, baseConfig ] );
131
- const context = useMemo( () => {
132
- return {
133
- isReady: isUserConfigReady && isBaseConfigReady,
134
- user: userConfig,
135
- base: baseConfig,
136
- merged: mergedConfig,
137
- setUserConfig,
138
- };
139
- }, [
140
- mergedConfig,
141
- userConfig,
142
- baseConfig,
143
- setUserConfig,
144
- isUserConfigReady,
145
- isBaseConfigReady,
146
- ] );
147
-
148
- return context;
149
- }
150
-
151
- export function GlobalStylesProvider( { children } ) {
152
- const context = useGlobalStylesContext();
153
- if ( ! context.isReady ) {
154
- return null;
155
- }
156
-
157
- return (
158
- <GlobalStylesContext.Provider value={ context }>
159
- { children }
160
- </GlobalStylesContext.Provider>
161
- );
162
- }
@@ -1,68 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useViewportMatch } from '@wordpress/compose';
5
- import { store as blockEditorStore } from '@wordpress/block-editor';
6
- import { useSelect, useDispatch } from '@wordpress/data';
7
- import { __ } from '@wordpress/i18n';
8
- import { chevronUpDown } from '@wordpress/icons';
9
- import { Button, ToolbarItem } from '@wordpress/components';
10
- import {
11
- store as editorStore,
12
- privateApis as editorPrivateApis,
13
- } from '@wordpress/editor';
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
- import { unlock } from '../../../lock-unlock';
19
-
20
- const { DocumentTools: EditorDocumentTools } = unlock( editorPrivateApis );
21
-
22
- export default function DocumentTools( {
23
- blockEditorMode,
24
- hasFixedToolbar,
25
- isDistractionFree,
26
- } ) {
27
- const { isVisualMode } = useSelect( ( select ) => {
28
- const { getEditorMode } = select( editorStore );
29
-
30
- return {
31
- isVisualMode: getEditorMode() === 'visual',
32
- };
33
- }, [] );
34
- const { __unstableSetEditorMode } = useDispatch( blockEditorStore );
35
- const { setDeviceType } = useDispatch( editorStore );
36
- const isLargeViewport = useViewportMatch( 'medium' );
37
- const isZoomedOutViewExperimentEnabled =
38
- window?.__experimentalEnableZoomedOutView && isVisualMode;
39
- const isZoomedOutView = blockEditorMode === 'zoom-out';
40
-
41
- return (
42
- <EditorDocumentTools
43
- disableBlockTools={ ! isVisualMode }
44
- listViewLabel={ __( 'List View' ) }
45
- >
46
- { isZoomedOutViewExperimentEnabled &&
47
- isLargeViewport &&
48
- ! isDistractionFree &&
49
- ! hasFixedToolbar && (
50
- <ToolbarItem
51
- as={ Button }
52
- className="edit-site-header-edit-mode__zoom-out-view-toggle"
53
- icon={ chevronUpDown }
54
- isPressed={ isZoomedOutView }
55
- /* translators: button label text should, if possible, be under 16 characters. */
56
- label={ __( 'Zoom-out View' ) }
57
- onClick={ () => {
58
- setDeviceType( 'Desktop' );
59
- __unstableSetEditorMode(
60
- isZoomedOutView ? 'edit' : 'zoom-out'
61
- );
62
- } }
63
- size="compact"
64
- />
65
- ) }
66
- </EditorDocumentTools>
67
- );
68
- }
@@ -1,173 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- createSlotFill,
6
- privateApis as componentsPrivateApis,
7
- } from '@wordpress/components';
8
- import { isRTL, __ } from '@wordpress/i18n';
9
- import { drawerLeft, drawerRight } from '@wordpress/icons';
10
- import { useCallback, useContext, useEffect, useRef } from '@wordpress/element';
11
- import { useSelect, useDispatch } from '@wordpress/data';
12
- import { store as blockEditorStore } from '@wordpress/block-editor';
13
- import { store as coreStore } from '@wordpress/core-data';
14
- import {
15
- PageAttributesPanel,
16
- PostDiscussionPanel,
17
- PostLastRevisionPanel,
18
- PostTaxonomiesPanel,
19
- privateApis as editorPrivateApis,
20
- } from '@wordpress/editor';
21
-
22
- /**
23
- * Internal dependencies
24
- */
25
- import DefaultSidebar from './default-sidebar';
26
- import GlobalStylesSidebar from './global-styles-sidebar';
27
- import SettingsHeader from './settings-header';
28
- import PagePanels from './page-panels';
29
- import TemplatePanel from './template-panel';
30
- import { store as editSiteStore } from '../../store';
31
- import { unlock } from '../../lock-unlock';
32
-
33
- const { Tabs } = unlock( componentsPrivateApis );
34
- const { interfaceStore, useAutoSwitchEditorSidebars, PatternOverridesPanel } =
35
- unlock( editorPrivateApis );
36
- const { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(
37
- 'EditSiteSidebarInspector'
38
- );
39
- export const SidebarInspectorFill = InspectorFill;
40
-
41
- const FillContents = ( { tabName, isEditingPage, supportsGlobalStyles } ) => {
42
- const tabListRef = useRef( null );
43
- // Because `DefaultSidebar` renders a `ComplementaryArea`, we
44
- // need to forward the `Tabs` context so it can be passed through the
45
- // underlying slot/fill.
46
- const tabsContextValue = useContext( Tabs.Context );
47
-
48
- // This effect addresses a race condition caused by tabbing from the last
49
- // block in the editor into the settings sidebar. Without this effect, the
50
- // selected tab and browser focus can become separated in an unexpected way.
51
- // (e.g the "block" tab is focused, but the "post" tab is selected).
52
- useEffect( () => {
53
- const tabsElements = Array.from(
54
- tabListRef.current?.querySelectorAll( '[role="tab"]' ) || []
55
- );
56
- const selectedTabElement = tabsElements.find(
57
- // We are purposefully using a custom `data-tab-id` attribute here
58
- // because we don't want rely on any assumptions about `Tabs`
59
- // component internals.
60
- ( element ) => element.getAttribute( 'data-tab-id' ) === tabName
61
- );
62
- const activeElement = selectedTabElement?.ownerDocument.activeElement;
63
- const tabsHasFocus = tabsElements.some( ( element ) => {
64
- return activeElement && activeElement.id === element.id;
65
- } );
66
- if (
67
- tabsHasFocus &&
68
- selectedTabElement &&
69
- selectedTabElement.id !== activeElement?.id
70
- ) {
71
- selectedTabElement?.focus();
72
- }
73
- }, [ tabName ] );
74
-
75
- return (
76
- <>
77
- <DefaultSidebar
78
- identifier={ tabName }
79
- title={ __( 'Settings' ) }
80
- icon={ isRTL() ? drawerLeft : drawerRight }
81
- closeLabel={ __( 'Close Settings' ) }
82
- header={
83
- <Tabs.Context.Provider value={ tabsContextValue }>
84
- <SettingsHeader ref={ tabListRef } />
85
- </Tabs.Context.Provider>
86
- }
87
- headerClassName="edit-site-sidebar-edit-mode__panel-tabs"
88
- // This classname is added so we can apply a corrective negative
89
- // margin to the panel.
90
- // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049
91
- className="edit-site-sidebar__panel"
92
- isActiveByDefault
93
- >
94
- <Tabs.Context.Provider value={ tabsContextValue }>
95
- <Tabs.TabPanel
96
- tabId="edit-post/document"
97
- focusable={ false }
98
- >
99
- { isEditingPage ? <PagePanels /> : <TemplatePanel /> }
100
- <PostLastRevisionPanel />
101
- <PostTaxonomiesPanel />
102
- <PostDiscussionPanel />
103
- <PageAttributesPanel />
104
- <PatternOverridesPanel />
105
- </Tabs.TabPanel>
106
- <Tabs.TabPanel tabId="edit-post/block" focusable={ false }>
107
- <InspectorSlot bubblesVirtually />
108
- </Tabs.TabPanel>
109
- </Tabs.Context.Provider>
110
- </DefaultSidebar>
111
- { supportsGlobalStyles && <GlobalStylesSidebar /> }
112
- </>
113
- );
114
- };
115
-
116
- export function SidebarComplementaryAreaFills() {
117
- useAutoSwitchEditorSidebars();
118
- const { tabName, supportsGlobalStyles, isEditingPage } = useSelect(
119
- ( select ) => {
120
- const sidebar =
121
- select( interfaceStore ).getActiveComplementaryArea( 'core' );
122
-
123
- const _isEditorSidebarOpened = [
124
- 'edit-post/block',
125
- 'edit-post/document',
126
- ].includes( sidebar );
127
- let _tabName = sidebar;
128
- if ( ! _isEditorSidebarOpened ) {
129
- _tabName = !! select(
130
- blockEditorStore
131
- ).getBlockSelectionStart()
132
- ? 'edit-post/block'
133
- : 'edit-post/document';
134
- }
135
-
136
- return {
137
- tabName: _tabName,
138
- supportsGlobalStyles:
139
- select( coreStore ).getCurrentTheme()?.is_block_theme,
140
- isEditingPage: select( editSiteStore ).isPage(),
141
- };
142
- },
143
- []
144
- );
145
- const { enableComplementaryArea } = useDispatch( interfaceStore );
146
-
147
- // `newSelectedTabId` could technically be falsey if no tab is selected (i.e.
148
- // the initial render) or when we don't want a tab displayed (i.e. the
149
- // sidebar is closed). These cases should both be covered by the `!!` check
150
- // below, so we shouldn't need any additional falsey handling.
151
- const onTabSelect = useCallback(
152
- ( newSelectedTabId ) => {
153
- if ( !! newSelectedTabId ) {
154
- enableComplementaryArea( 'core', newSelectedTabId );
155
- }
156
- },
157
- [ enableComplementaryArea ]
158
- );
159
-
160
- return (
161
- <Tabs
162
- selectedTabId={ tabName }
163
- onSelect={ onTabSelect }
164
- selectOnMove={ false }
165
- >
166
- <FillContents
167
- tabName={ tabName }
168
- isEditingPage={ isEditingPage }
169
- supportsGlobalStyles={ supportsGlobalStyles }
170
- />
171
- </Tabs>
172
- );
173
- }
@@ -1,133 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { PanelBody } from '@wordpress/components';
5
- import { __, sprintf } from '@wordpress/i18n';
6
- import { useSelect, useDispatch } from '@wordpress/data';
7
- import { store as coreStore } from '@wordpress/core-data';
8
- import {
9
- PluginDocumentSettingPanel,
10
- store as editorStore,
11
- privateApis as editorPrivateApis,
12
- } from '@wordpress/editor';
13
- import { privateApis as routerPrivateApis } from '@wordpress/router';
14
- import { useCallback } from '@wordpress/element';
15
- import { store as noticesStore } from '@wordpress/notices';
16
-
17
- /**
18
- * Internal dependencies
19
- */
20
- import { store as editSiteStore } from '../../../store';
21
- import PageContent from './page-content';
22
- import PageSummary from './page-summary';
23
-
24
- import { unlock } from '../../../lock-unlock';
25
-
26
- const { PostCardPanel, PostActions } = unlock( editorPrivateApis );
27
- const { useHistory } = unlock( routerPrivateApis );
28
-
29
- export default function PagePanels() {
30
- const { id, type, hasResolved, status, date, password, renderingMode } =
31
- useSelect( ( select ) => {
32
- const { getEditedPostContext } = select( editSiteStore );
33
- const { getEditedEntityRecord, hasFinishedResolution } =
34
- select( coreStore );
35
- const { getRenderingMode } = select( editorStore );
36
- const context = getEditedPostContext();
37
- const queryArgs = [ 'postType', context.postType, context.postId ];
38
- const page = getEditedEntityRecord( ...queryArgs );
39
- return {
40
- hasResolved: hasFinishedResolution(
41
- 'getEditedEntityRecord',
42
- queryArgs
43
- ),
44
- id: page?.id,
45
- type: page?.type,
46
- status: page?.status,
47
- date: page?.date,
48
- password: page?.password,
49
- renderingMode: getRenderingMode(),
50
- };
51
- }, [] );
52
- const { createSuccessNotice } = useDispatch( noticesStore );
53
- const history = useHistory();
54
- const onActionPerformed = useCallback(
55
- ( actionId, items ) => {
56
- switch ( actionId ) {
57
- case 'move-to-trash':
58
- {
59
- history.push( {
60
- path: '/' + items[ 0 ].type,
61
- postId: undefined,
62
- postType: undefined,
63
- canvas: 'view',
64
- } );
65
- }
66
- break;
67
- case 'duplicate-post':
68
- {
69
- const newItem = items[ 0 ];
70
- const title =
71
- typeof newItem.title === 'string'
72
- ? newItem.title
73
- : newItem.title?.rendered;
74
- createSuccessNotice(
75
- sprintf(
76
- // translators: %s: Title of the created post e.g: "Post 1".
77
- __( '"%s" successfully created.' ),
78
- title
79
- ),
80
- {
81
- type: 'snackbar',
82
- id: 'duplicate-post-action',
83
- actions: [
84
- {
85
- label: __( 'Edit' ),
86
- onClick: () => {
87
- history.push( {
88
- path: undefined,
89
- postId: newItem.id,
90
- postType: newItem.type,
91
- canvas: 'edit',
92
- } );
93
- },
94
- },
95
- ],
96
- }
97
- );
98
- }
99
- break;
100
- }
101
- },
102
- [ history, createSuccessNotice ]
103
- );
104
-
105
- if ( ! hasResolved ) {
106
- return null;
107
- }
108
-
109
- return (
110
- <>
111
- <PostCardPanel
112
- actions={
113
- <PostActions onActionPerformed={ onActionPerformed } />
114
- }
115
- />
116
- <PanelBody title={ __( 'Summary' ) }>
117
- <PageSummary
118
- status={ status }
119
- date={ date }
120
- password={ password }
121
- postId={ id }
122
- postType={ type }
123
- />
124
- </PanelBody>
125
- <PluginDocumentSettingPanel.Slot />
126
- { renderingMode !== 'post-only' && (
127
- <PanelBody title={ __( 'Content' ) }>
128
- <PageContent />
129
- </PanelBody>
130
- ) }
131
- </>
132
- );
133
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
- import {
6
- store as blockEditorStore,
7
- privateApis as blockEditorPrivateApis,
8
- } from '@wordpress/block-editor';
9
-
10
- /**
11
- * Internal dependencies
12
- */
13
- import { unlock } from '../../../lock-unlock';
14
-
15
- const { BlockQuickNavigation } = unlock( blockEditorPrivateApis );
16
-
17
- const PAGE_CONTENT_BLOCKS = [
18
- 'core/post-content',
19
- 'core/post-featured-image',
20
- 'core/post-title',
21
- ];
22
-
23
- export default function PageContent() {
24
- const clientIds = useSelect( ( select ) => {
25
- const { getBlocksByName } = select( blockEditorStore );
26
- return getBlocksByName( PAGE_CONTENT_BLOCKS );
27
- }, [] );
28
- return <BlockQuickNavigation clientIds={ clientIds } />;
29
- }