@wordpress/edit-site 5.9.0 → 5.10.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 (426) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +21 -6
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/new-template-part.js +8 -2
  5. package/build/components/add-new-template/new-template-part.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +6 -3
  7. package/build/components/add-new-template/new-template.js.map +1 -1
  8. package/build/components/app/index.js +8 -2
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/back-button.js +10 -3
  11. package/build/components/block-editor/back-button.js.map +1 -1
  12. package/build/components/block-editor/editor-canvas.js +39 -6
  13. package/build/components/block-editor/editor-canvas.js.map +1 -1
  14. package/build/components/editor/index.js +43 -9
  15. package/build/components/editor/index.js.map +1 -1
  16. package/build/components/editor-canvas-container/index.js +18 -4
  17. package/build/components/editor-canvas-container/index.js.map +1 -1
  18. package/build/components/global-styles/block-preview-panel.js +1 -1
  19. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  20. package/build/components/global-styles/border-panel.js +3 -1
  21. package/build/components/global-styles/border-panel.js.map +1 -1
  22. package/build/components/global-styles/color-palette-panel.js +14 -3
  23. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  24. package/build/components/global-styles/dimensions-panel.js +17 -18
  25. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  26. package/build/components/global-styles/gradients-palette-panel.js +14 -3
  27. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  28. package/build/components/global-styles/root-menu.js +61 -0
  29. package/build/components/global-styles/root-menu.js.map +1 -0
  30. package/build/components/global-styles/screen-block-list.js +3 -1
  31. package/build/components/global-styles/screen-block-list.js.map +1 -1
  32. package/build/components/global-styles/screen-block.js +158 -7
  33. package/build/components/global-styles/screen-block.js.map +1 -1
  34. package/build/components/global-styles/screen-colors.js +9 -26
  35. package/build/components/global-styles/screen-colors.js.map +1 -1
  36. package/build/components/global-styles/screen-css.js +20 -15
  37. package/build/components/global-styles/screen-css.js.map +1 -1
  38. package/build/components/global-styles/screen-layout.js +4 -17
  39. package/build/components/global-styles/screen-layout.js.map +1 -1
  40. package/build/components/global-styles/screen-revisions/index.js +148 -0
  41. package/build/components/global-styles/screen-revisions/index.js.map +1 -0
  42. package/build/components/global-styles/screen-revisions/revisions-buttons.js +132 -0
  43. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  44. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +130 -0
  45. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  46. package/build/components/global-styles/screen-root.js +2 -2
  47. package/build/components/global-styles/screen-root.js.map +1 -1
  48. package/build/components/global-styles/screen-typography-element.js +0 -3
  49. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  50. package/build/components/global-styles/screen-typography.js +11 -39
  51. package/build/components/global-styles/screen-typography.js.map +1 -1
  52. package/build/components/global-styles/style-variations-container.js +3 -8
  53. package/build/components/global-styles/style-variations-container.js.map +1 -1
  54. package/build/components/global-styles/typography-panel.js +7 -11
  55. package/build/components/global-styles/typography-panel.js.map +1 -1
  56. package/build/components/global-styles/ui.js +61 -108
  57. package/build/components/global-styles/ui.js.map +1 -1
  58. package/build/components/global-styles/variations-panel.js +4 -28
  59. package/build/components/global-styles/variations-panel.js.map +1 -1
  60. package/build/components/header-edit-mode/index.js +1 -1
  61. package/build/components/header-edit-mode/index.js.map +1 -1
  62. package/build/components/keyboard-shortcuts/register.js +1 -1
  63. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  64. package/build/components/layout/index.js +13 -7
  65. package/build/components/layout/index.js.map +1 -1
  66. package/build/components/list/index.js +9 -3
  67. package/build/components/list/index.js.map +1 -1
  68. package/build/components/list/table.js +1 -1
  69. package/build/components/list/table.js.map +1 -1
  70. package/build/components/plugin-template-setting-panel/index.js +44 -0
  71. package/build/components/plugin-template-setting-panel/index.js.map +1 -0
  72. package/build/components/revisions/index.js +95 -0
  73. package/build/components/revisions/index.js.map +1 -0
  74. package/build/components/routes/link.js +17 -2
  75. package/build/components/routes/link.js.map +1 -1
  76. package/build/components/routes/use-title.js +8 -2
  77. package/build/components/routes/use-title.js.map +1 -1
  78. package/build/components/save-button/index.js +31 -6
  79. package/build/components/save-button/index.js.map +1 -1
  80. package/build/components/save-hub/index.js +14 -31
  81. package/build/components/save-hub/index.js.map +1 -1
  82. package/build/components/save-panel/index.js +20 -7
  83. package/build/components/save-panel/index.js.map +1 -1
  84. package/build/components/secondary-sidebar/list-view-sidebar.js +2 -7
  85. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  86. package/build/components/sidebar/index.js +16 -2
  87. package/build/components/sidebar/index.js.map +1 -1
  88. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  89. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  90. package/build/components/sidebar-edit-mode/index.js +9 -2
  91. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  92. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
  93. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  94. package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
  95. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  96. package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
  97. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  98. package/build/components/sidebar-navigation-item/index.js +5 -7
  99. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  100. package/build/components/sidebar-navigation-screen/index.js +14 -4
  101. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  102. package/build/components/sidebar-navigation-screen-main/index.js +24 -7
  103. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  105. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -5
  107. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  109. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-page/index.js +67 -0
  111. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
  112. package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
  113. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  114. package/build/components/sidebar-navigation-screen-templates/index.js +5 -3
  115. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  116. package/build/components/sidebar-navigation-subtitle/index.js +18 -0
  117. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
  118. package/build/components/site-hub/index.js +36 -6
  119. package/build/components/site-hub/index.js.map +1 -1
  120. package/build/components/start-template-options/index.js +12 -16
  121. package/build/components/start-template-options/index.js.map +1 -1
  122. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  123. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  124. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
  125. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  126. package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
  127. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  128. package/build/components/template-details/template-areas.js +9 -3
  129. package/build/components/template-details/template-areas.js.map +1 -1
  130. package/build/hooks/template-part-edit.js +8 -2
  131. package/build/hooks/template-part-edit.js.map +1 -1
  132. package/build/index.js +8 -0
  133. package/build/index.js.map +1 -1
  134. package/build/utils/is-previewing-theme.js +27 -0
  135. package/build/utils/is-previewing-theme.js.map +1 -0
  136. package/build/utils/use-activate-theme.js +46 -0
  137. package/build/utils/use-activate-theme.js.map +1 -0
  138. package/build-module/components/add-new-template/add-custom-template-modal.js +21 -6
  139. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  140. package/build-module/components/add-new-template/new-template-part.js +5 -1
  141. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  142. package/build-module/components/add-new-template/new-template.js +4 -1
  143. package/build-module/components/add-new-template/new-template.js.map +1 -1
  144. package/build-module/components/app/index.js +6 -2
  145. package/build-module/components/app/index.js.map +1 -1
  146. package/build-module/components/block-editor/back-button.js +6 -1
  147. package/build-module/components/block-editor/back-button.js.map +1 -1
  148. package/build-module/components/block-editor/editor-canvas.js +37 -6
  149. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  150. package/build-module/components/editor/index.js +45 -11
  151. package/build-module/components/editor/index.js.map +1 -1
  152. package/build-module/components/editor-canvas-container/index.js +21 -6
  153. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  154. package/build-module/components/global-styles/block-preview-panel.js +1 -1
  155. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  156. package/build-module/components/global-styles/border-panel.js +3 -1
  157. package/build-module/components/global-styles/border-panel.js.map +1 -1
  158. package/build-module/components/global-styles/color-palette-panel.js +13 -3
  159. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  160. package/build-module/components/global-styles/dimensions-panel.js +17 -18
  161. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  162. package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
  163. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  164. package/build-module/components/global-styles/root-menu.js +47 -0
  165. package/build-module/components/global-styles/root-menu.js.map +1 -0
  166. package/build-module/components/global-styles/screen-block-list.js +4 -2
  167. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  168. package/build-module/components/global-styles/screen-block.js +151 -7
  169. package/build-module/components/global-styles/screen-block.js.map +1 -1
  170. package/build-module/components/global-styles/screen-colors.js +9 -25
  171. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  172. package/build-module/components/global-styles/screen-css.js +20 -15
  173. package/build-module/components/global-styles/screen-css.js.map +1 -1
  174. package/build-module/components/global-styles/screen-layout.js +4 -16
  175. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  176. package/build-module/components/global-styles/screen-revisions/index.js +128 -0
  177. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
  178. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +121 -0
  179. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  180. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +116 -0
  181. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  182. package/build-module/components/global-styles/screen-root.js +2 -2
  183. package/build-module/components/global-styles/screen-root.js.map +1 -1
  184. package/build-module/components/global-styles/screen-typography-element.js +0 -3
  185. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  186. package/build-module/components/global-styles/screen-typography.js +11 -37
  187. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  188. package/build-module/components/global-styles/style-variations-container.js +3 -7
  189. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  190. package/build-module/components/global-styles/typography-panel.js +7 -11
  191. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  192. package/build-module/components/global-styles/ui.js +61 -105
  193. package/build-module/components/global-styles/ui.js.map +1 -1
  194. package/build-module/components/global-styles/variations-panel.js +3 -22
  195. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  196. package/build-module/components/header-edit-mode/index.js +2 -2
  197. package/build-module/components/header-edit-mode/index.js.map +1 -1
  198. package/build-module/components/keyboard-shortcuts/register.js +1 -1
  199. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  200. package/build-module/components/layout/index.js +9 -3
  201. package/build-module/components/layout/index.js.map +1 -1
  202. package/build-module/components/list/index.js +5 -1
  203. package/build-module/components/list/index.js.map +1 -1
  204. package/build-module/components/list/table.js +1 -1
  205. package/build-module/components/list/table.js.map +1 -1
  206. package/build-module/components/plugin-template-setting-panel/index.js +35 -0
  207. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
  208. package/build-module/components/revisions/index.js +77 -0
  209. package/build-module/components/revisions/index.js.map +1 -0
  210. package/build-module/components/routes/link.js +13 -1
  211. package/build-module/components/routes/link.js.map +1 -1
  212. package/build-module/components/routes/use-title.js +5 -1
  213. package/build-module/components/routes/use-title.js.map +1 -1
  214. package/build-module/components/save-button/index.js +28 -6
  215. package/build-module/components/save-button/index.js.map +1 -1
  216. package/build-module/components/save-hub/index.js +13 -32
  217. package/build-module/components/save-hub/index.js.map +1 -1
  218. package/build-module/components/save-panel/index.js +19 -7
  219. package/build-module/components/save-panel/index.js.map +1 -1
  220. package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -8
  221. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  222. package/build-module/components/sidebar/index.js +11 -1
  223. package/build-module/components/sidebar/index.js.map +1 -1
  224. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  225. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  226. package/build-module/components/sidebar-edit-mode/index.js +10 -5
  227. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  228. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
  229. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  230. package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
  231. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  232. package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
  233. package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  234. package/build-module/components/sidebar-navigation-item/index.js +6 -8
  235. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-screen/index.js +13 -5
  237. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen-main/index.js +25 -8
  239. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  240. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  241. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  242. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +13 -3
  243. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  244. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  245. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  246. package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
  247. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
  248. package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
  249. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  250. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -3
  251. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
  253. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
  254. package/build-module/components/site-hub/index.js +34 -6
  255. package/build-module/components/site-hub/index.js.map +1 -1
  256. package/build-module/components/start-template-options/index.js +13 -17
  257. package/build-module/components/start-template-options/index.js.map +1 -1
  258. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -1
  259. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  260. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
  261. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  262. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
  263. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  264. package/build-module/components/template-details/template-areas.js +5 -1
  265. package/build-module/components/template-details/template-areas.js.map +1 -1
  266. package/build-module/hooks/template-part-edit.js +5 -1
  267. package/build-module/hooks/template-part-edit.js.map +1 -1
  268. package/build-module/index.js +1 -0
  269. package/build-module/index.js.map +1 -1
  270. package/build-module/utils/is-previewing-theme.js +17 -0
  271. package/build-module/utils/is-previewing-theme.js.map +1 -0
  272. package/build-module/utils/use-activate-theme.js +36 -0
  273. package/build-module/utils/use-activate-theme.js.map +1 -0
  274. package/build-style/style-rtl.css +199 -78
  275. package/build-style/style.css +199 -78
  276. package/package.json +36 -34
  277. package/src/components/add-new-template/add-custom-template-modal.js +31 -8
  278. package/src/components/add-new-template/new-template-part.js +4 -1
  279. package/src/components/add-new-template/new-template.js +3 -1
  280. package/src/components/add-new-template/style.scss +52 -48
  281. package/src/components/app/index.js +6 -3
  282. package/src/components/block-editor/back-button.js +4 -1
  283. package/src/components/block-editor/editor-canvas.js +36 -8
  284. package/src/components/block-editor/style.scss +15 -8
  285. package/src/components/editor/index.js +48 -7
  286. package/src/components/editor-canvas-container/index.js +30 -17
  287. package/src/components/global-styles/block-preview-panel.js +1 -1
  288. package/src/components/global-styles/border-panel.js +3 -1
  289. package/src/components/global-styles/color-palette-panel.js +9 -0
  290. package/src/components/global-styles/dimensions-panel.js +15 -15
  291. package/src/components/global-styles/gradients-palette-panel.js +8 -0
  292. package/src/components/global-styles/root-menu.js +66 -0
  293. package/src/components/global-styles/screen-block-list.js +2 -2
  294. package/src/components/global-styles/screen-block.js +184 -7
  295. package/src/components/global-styles/screen-colors.js +9 -16
  296. package/src/components/global-styles/screen-css.js +21 -21
  297. package/src/components/global-styles/screen-layout.js +5 -9
  298. package/src/components/global-styles/screen-revisions/index.js +177 -0
  299. package/src/components/global-styles/screen-revisions/revisions-buttons.js +131 -0
  300. package/src/components/global-styles/screen-revisions/style.scss +99 -0
  301. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +125 -0
  302. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +103 -0
  303. package/src/components/global-styles/screen-root.js +2 -2
  304. package/src/components/global-styles/screen-typography-element.js +1 -3
  305. package/src/components/global-styles/screen-typography.js +44 -79
  306. package/src/components/global-styles/style-variations-container.js +4 -10
  307. package/src/components/global-styles/style.scss +1 -23
  308. package/src/components/global-styles/typography-panel.js +12 -13
  309. package/src/components/global-styles/ui.js +72 -101
  310. package/src/components/global-styles/variations-panel.js +3 -26
  311. package/src/components/header-edit-mode/index.js +5 -2
  312. package/src/components/keyboard-shortcuts/register.js +1 -1
  313. package/src/components/layout/index.js +7 -3
  314. package/src/components/layout/style.scss +2 -4
  315. package/src/components/list/index.js +4 -1
  316. package/src/components/list/style.scss +4 -0
  317. package/src/components/list/table.js +3 -1
  318. package/src/components/plugin-template-setting-panel/index.js +33 -0
  319. package/src/components/revisions/index.js +104 -0
  320. package/src/components/routes/link.js +16 -1
  321. package/src/components/routes/use-title.js +4 -1
  322. package/src/components/save-button/index.js +27 -6
  323. package/src/components/save-hub/index.js +17 -35
  324. package/src/components/save-panel/index.js +15 -3
  325. package/src/components/secondary-sidebar/list-view-sidebar.js +2 -6
  326. package/src/components/sidebar/index.js +12 -1
  327. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +9 -7
  328. package/src/components/sidebar-edit-mode/index.js +17 -6
  329. package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
  330. package/src/components/sidebar-edit-mode/style.scss +10 -0
  331. package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
  332. package/src/components/sidebar-navigation-item/index.js +13 -14
  333. package/src/components/sidebar-navigation-item/style.scss +8 -1
  334. package/src/components/sidebar-navigation-screen/index.js +26 -5
  335. package/src/components/sidebar-navigation-screen-main/index.js +43 -22
  336. package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
  337. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +13 -1
  338. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  339. package/src/components/sidebar-navigation-screen-page/index.js +59 -0
  340. package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
  341. package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
  342. package/src/components/sidebar-navigation-screen-templates/index.js +5 -1
  343. package/src/components/sidebar-navigation-subtitle/index.js +5 -0
  344. package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
  345. package/src/components/site-hub/index.js +89 -58
  346. package/src/components/site-hub/style.scss +8 -0
  347. package/src/components/start-template-options/index.js +19 -27
  348. package/src/components/start-template-options/style.scss +29 -21
  349. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
  350. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
  351. package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
  352. package/src/components/template-details/template-areas.js +4 -1
  353. package/src/hooks/template-part-edit.js +4 -1
  354. package/src/index.js +1 -0
  355. package/src/store/test/actions.js +6 -14
  356. package/src/style.scss +4 -1
  357. package/src/utils/is-previewing-theme.js +18 -0
  358. package/src/utils/use-activate-theme.js +38 -0
  359. package/build/components/global-styles/context-menu.js +0 -126
  360. package/build/components/global-styles/context-menu.js.map +0 -1
  361. package/build/components/global-styles/custom-css.js +0 -113
  362. package/build/components/global-styles/custom-css.js.map +0 -1
  363. package/build/components/global-styles/effects-panel.js +0 -53
  364. package/build/components/global-styles/effects-panel.js.map +0 -1
  365. package/build/components/global-styles/filters-panel.js +0 -50
  366. package/build/components/global-styles/filters-panel.js.map +0 -1
  367. package/build/components/global-styles/screen-border.js +0 -61
  368. package/build/components/global-styles/screen-border.js.map +0 -1
  369. package/build/components/global-styles/screen-effects.js +0 -61
  370. package/build/components/global-styles/screen-effects.js.map +0 -1
  371. package/build/components/global-styles/screen-filters.js +0 -46
  372. package/build/components/global-styles/screen-filters.js.map +0 -1
  373. package/build/components/global-styles/screen-variations.js +0 -71
  374. package/build/components/global-styles/screen-variations.js.map +0 -1
  375. package/build/components/routes/index.js +0 -60
  376. package/build/components/routes/index.js.map +0 -1
  377. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  378. package/build/hooks/commands/index.js +0 -19
  379. package/build/hooks/commands/index.js.map +0 -1
  380. package/build/hooks/commands/use-navigation-commands.js +0 -126
  381. package/build/hooks/commands/use-navigation-commands.js.map +0 -1
  382. package/build/hooks/commands/use-wp-admin-commands.js +0 -97
  383. package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
  384. package/build/utils/history.js +0 -41
  385. package/build/utils/history.js.map +0 -1
  386. package/build-module/components/global-styles/context-menu.js +0 -107
  387. package/build-module/components/global-styles/context-menu.js.map +0 -1
  388. package/build-module/components/global-styles/custom-css.js +0 -98
  389. package/build-module/components/global-styles/custom-css.js.map +0 -1
  390. package/build-module/components/global-styles/effects-panel.js +0 -43
  391. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  392. package/build-module/components/global-styles/filters-panel.js +0 -40
  393. package/build-module/components/global-styles/filters-panel.js.map +0 -1
  394. package/build-module/components/global-styles/screen-border.js +0 -44
  395. package/build-module/components/global-styles/screen-border.js.map +0 -1
  396. package/build-module/components/global-styles/screen-effects.js +0 -44
  397. package/build-module/components/global-styles/screen-effects.js.map +0 -1
  398. package/build-module/components/global-styles/screen-filters.js +0 -33
  399. package/build-module/components/global-styles/screen-filters.js.map +0 -1
  400. package/build-module/components/global-styles/screen-variations.js +0 -54
  401. package/build-module/components/global-styles/screen-variations.js.map +0 -1
  402. package/build-module/components/routes/index.js +0 -47
  403. package/build-module/components/routes/index.js.map +0 -1
  404. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  405. package/build-module/hooks/commands/index.js +0 -10
  406. package/build-module/hooks/commands/index.js.map +0 -1
  407. package/build-module/hooks/commands/use-navigation-commands.js +0 -109
  408. package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
  409. package/build-module/hooks/commands/use-wp-admin-commands.js +0 -81
  410. package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
  411. package/build-module/utils/history.js +0 -31
  412. package/build-module/utils/history.js.map +0 -1
  413. package/src/components/global-styles/context-menu.js +0 -175
  414. package/src/components/global-styles/custom-css.js +0 -131
  415. package/src/components/global-styles/effects-panel.js +0 -40
  416. package/src/components/global-styles/filters-panel.js +0 -39
  417. package/src/components/global-styles/screen-border.js +0 -35
  418. package/src/components/global-styles/screen-effects.js +0 -35
  419. package/src/components/global-styles/screen-filters.js +0 -27
  420. package/src/components/global-styles/screen-variations.js +0 -46
  421. package/src/components/routes/index.js +0 -53
  422. package/src/hooks/commands/index.js +0 -10
  423. package/src/hooks/commands/use-navigation-commands.js +0 -112
  424. package/src/hooks/commands/use-wp-admin-commands.js +0 -79
  425. package/src/utils/history.js +0 -39
  426. /package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +0 -0
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _components = require("@wordpress/components");
11
+
12
+ var _icons = require("@wordpress/icons");
13
+
14
+ var _i18n = require("@wordpress/i18n");
15
+
16
+ var _blockEditor = require("@wordpress/block-editor");
17
+
18
+ var _navigationButton = require("./navigation-button");
19
+
20
+ var _privateApis = require("../../private-apis");
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ const {
30
+ useHasDimensionsPanel,
31
+ useHasTypographyPanel,
32
+ useHasColorPanel,
33
+ useGlobalSetting,
34
+ useSettingsForBlockElement
35
+ } = (0, _privateApis.unlock)(_blockEditor.privateApis);
36
+
37
+ function RootMenu() {
38
+ const [rawSettings] = useGlobalSetting('');
39
+ const settings = useSettingsForBlockElement(rawSettings);
40
+ const hasTypographyPanel = useHasTypographyPanel(settings);
41
+ const hasColorPanel = useHasColorPanel(settings);
42
+ const hasDimensionsPanel = useHasDimensionsPanel(settings);
43
+ const hasLayoutPanel = hasDimensionsPanel;
44
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalItemGroup, null, hasTypographyPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
45
+ icon: _icons.typography,
46
+ path: "/typography",
47
+ "aria-label": (0, _i18n.__)('Typography styles')
48
+ }, (0, _i18n.__)('Typography')), hasColorPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
49
+ icon: _icons.color,
50
+ path: "/colors",
51
+ "aria-label": (0, _i18n.__)('Colors styles')
52
+ }, (0, _i18n.__)('Colors')), hasLayoutPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
53
+ icon: _icons.layout,
54
+ path: "/layout",
55
+ "aria-label": (0, _i18n.__)('Layout styles')
56
+ }, (0, _i18n.__)('Layout'))));
57
+ }
58
+
59
+ var _default = RootMenu;
60
+ exports.default = _default;
61
+ //# sourceMappingURL=root-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/root-menu.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasColorPanel","useGlobalSetting","useSettingsForBlockElement","blockEditorPrivateApis","RootMenu","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasDimensionsPanel","hasLayoutPanel","typography","color","layout"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,qBAFK;AAGLC,EAAAA,gBAHK;AAILC,EAAAA,gBAJK;AAKLC,EAAAA;AALK,IAMF,yBAAQC,wBAAR,CANJ;;AAQA,SAASC,QAAT,GAAoB;AACnB,QAAM,CAAEC,WAAF,IAAkBJ,gBAAgB,CAAE,EAAF,CAAxC;AACA,QAAMK,QAAQ,GAAGJ,0BAA0B,CAAEG,WAAF,CAA3C;AACA,QAAME,kBAAkB,GAAGR,qBAAqB,CAAEO,QAAF,CAAhD;AACA,QAAME,aAAa,GAAGR,gBAAgB,CAAEM,QAAF,CAAtC;AACA,QAAMG,kBAAkB,GAAGX,qBAAqB,CAAEQ,QAAF,CAAhD;AACA,QAAMI,cAAc,GAAGD,kBAAvB;AAEA,SACC,qDACC,4BAAC,mCAAD,QACGF,kBAAkB,IACnB,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGI,iBADR;AAEC,IAAA,IAAI,EAAC,aAFN;AAGC,kBAAa,cAAI,mBAAJ;AAHd,KAKG,cAAI,YAAJ,CALH,CAFF,EAUGH,aAAa,IACd,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGI,YADR;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,kBAAa,cAAI,eAAJ;AAHd,KAKG,cAAI,QAAJ,CALH,CAXF,EAmBGF,cAAc,IACf,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGG,aADR;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,kBAAa,cAAI,eAAJ;AAHd,KAKG,cAAI,QAAJ,CALH,CApBF,CADD,CADD;AAiCA;;eAEcT,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { typography, color, layout } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasColorPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n} = unlock( blockEditorPrivateApis );\n\nfunction RootMenu() {\n\tconst [ rawSettings ] = useGlobalSetting( '' );\n\tconst settings = useSettingsForBlockElement( rawSettings );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ hasTypographyPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\tpath=\"/typography\"\n\t\t\t\t\t\taria-label={ __( 'Typography styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasColorPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ color }\n\t\t\t\t\t\tpath=\"/colors\"\n\t\t\t\t\t\taria-label={ __( 'Colors styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasLayoutPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\tpath=\"/layout\"\n\t\t\t\t\t\taria-label={ __( 'Layout styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default RootMenu;\n"]}
@@ -76,6 +76,8 @@ function useSortedBlockTypes() {
76
76
  }
77
77
 
78
78
  function useBlockHasGlobalStyles(blockName) {
79
+ var _useBlockVariations;
80
+
79
81
  const [rawSettings] = useGlobalSetting('', blockName);
80
82
  const settings = useSettingsForBlockElement(rawSettings, blockName);
81
83
  const hasTypographyPanel = useHasTypographyPanel(settings);
@@ -83,7 +85,7 @@ function useBlockHasGlobalStyles(blockName) {
83
85
  const hasBorderPanel = useHasBorderPanel(settings);
84
86
  const hasDimensionsPanel = useHasDimensionsPanel(settings);
85
87
  const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
86
- const hasVariationsPanel = (0, _variationsPanel.useHasVariationsPanel)(blockName);
88
+ const hasVariationsPanel = !!((_useBlockVariations = (0, _variationsPanel.useBlockVariations)(blockName)) !== null && _useBlockVariations !== void 0 && _useBlockVariations.length);
87
89
  const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel;
88
90
  return hasGlobalStyles;
89
91
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","blockEditorPrivateApis","useSortedBlockTypes","blockItems","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","useBlockHasGlobalStyles","blockName","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","hasGlobalStyles","BlockMenuItem","hasBlockMenuItem","navigationButtonLabel","title","encodeURIComponent","icon","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAiBA;AACA;AACA;AAMA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,qBAFK;AAGLC,EAAAA,iBAHK;AAILC,EAAAA,gBAJK;AAKLC,EAAAA,0BALK;AAMLC,EAAAA;AANK,IAOF,yBAAQC,wBAAR,CAPJ;;AASA,SAASC,mBAAT,GAA+B;AAC9B,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,aAAtB,EADI,EAElB,EAFkB,CAAnB,C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0B,CAmB1B;;AACA,0BAAW,MAAM;AAChB,QAAK,CAAER,WAAP,EAAqB;AACpB;AACA,KAHe,CAIhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,UAAMS,KAAK,GAAGD,iBAAiB,CAACE,OAAlB,CAA0BC,iBAAxC;AACA,UAAMC,mBAAmB,GAAG;AAC3B;AACA,kBAAI,kBAAJ,EAAwB,mBAAxB,EAA6CH,KAA7C,CAF2B,EAG3BA,KAH2B,CAA5B;AAKAP,IAAAA,cAAc,CAAEU,mBAAF,EAAuBH,KAAvB,CAAd;AACA,GAnBD,EAmBG,CAAET,WAAF,EAAeE,cAAf,CAnBH;AAqBA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,qEADa;AAFf,IADD,EAOC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,8BAFX;AAGC,IAAA,QAAQ,EAAGD,cAHZ;AAIC,IAAA,KAAK,EAAGD,WAJT;AAKC,IAAA,KAAK,EAAG,cAAI,mBAAJ,CALT;AAMC,IAAA,WAAW,EAAG,cAAI,QAAJ;AANf,IAPD,EAeC;AACC,IAAA,GAAG,EAAGQ,iBADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,kBAAkB,CAACQ,GAAnB,CAA0B1C,KAAF,IACzB,4BAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACI;AAFjC,IADC,CAJH,CAfD,CADD;AA6BA;;eAEcuB,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useHasVariationsPanel } from './variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( blockName );\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t__( '%s block styles' ),\n\t\tblock.title\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst isMatchingSearchTerm = useSelect(\n\t\t( select ) => select( blocksStore ).isMatchingSearchTerm,\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn sortedBlockTypes;\n\t\t}\n\t\treturn sortedBlockTypes.filter( ( blockType ) =>\n\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t);\n\t}, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search for blocks' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ blockTypesListRef }\n\t\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","blockEditorPrivateApis","useSortedBlockTypes","blockItems","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","useBlockHasGlobalStyles","blockName","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","length","hasGlobalStyles","BlockMenuItem","hasBlockMenuItem","navigationButtonLabel","title","encodeURIComponent","icon","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAiBA;AACA;AACA;AAMA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,qBAFK;AAGLC,EAAAA,iBAHK;AAILC,EAAAA,gBAJK;AAKLC,EAAAA,0BALK;AAMLC,EAAAA;AANK,IAOF,yBAAQC,wBAAR,CAPJ;;AASA,SAASC,mBAAT,GAA+B;AAC9B,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,aAAtB,EADI,EAElB,EAFkB,CAAnB,CAD8B,CAK9B;AACA;AACA;AACA;AACA;;AACA,QAAMC,WAAW,GAAG,CAAEC,MAAF,EAAUC,KAAV,KAAqB;AACxC,UAAM;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,QAAoBH,MAA1B;AACA,UAAMI,IAAI,GAAGH,KAAK,CAACI,IAAN,CAAWC,UAAX,CAAuB,OAAvB,IAAmCJ,IAAnC,GAA0CC,OAAvD;AACAC,IAAAA,IAAI,CAACG,IAAL,CAAWN,KAAX;AACA,WAAOD,MAAP;AACA,GALD;;AAMA,QAAM;AAAEE,IAAAA,IAAI,EAAEM,SAAR;AAAmBL,IAAAA,OAAO,EAAEM;AAA5B,MAA6Cd,UAAU,CAACe,MAAX,CAClDX,WADkD,EAElD;AAAEG,IAAAA,IAAI,EAAE,EAAR;AAAYC,IAAAA,OAAO,EAAE;AAArB,GAFkD,CAAnD;AAIA,SAAO,CAAE,GAAGK,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Ff,IADD,EAOC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,8BAFX;AAGC,IAAA,QAAQ,EAAGD,cAHZ;AAIC,IAAA,KAAK,EAAGD,WAJT;AAKC,IAAA,KAAK,EAAG,cAAI,mBAAJ,CALT;AAMC,IAAA,WAAW,EAAG,cAAI,QAAJ;AANf,IAPD,EAeC;AACC,IAAA,GAAG,EAAGQ,iBADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,kBAAkB,CAACQ,GAAnB,CAA0B3C,KAAF,IACzB,4BAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACI;AAFjC,IADC,CAJH,CAfD,CADD;AA6BA;;eAEcwB,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useBlockVariations } from './variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = !! useBlockVariations( blockName )?.length;\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t__( '%s block styles' ),\n\t\tblock.title\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst isMatchingSearchTerm = useSelect(\n\t\t( select ) => select( blocksStore ).isMatchingSearchTerm,\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn sortedBlockTypes;\n\t\t}\n\t\treturn sortedBlockTypes.filter( ( blockType ) =>\n\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t);\n\t}, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search for blocks' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ blockTypesListRef }\n\t\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
@@ -11,12 +11,26 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _blocks = require("@wordpress/blocks");
13
13
 
14
- var _contextMenu = _interopRequireDefault(require("./context-menu"));
14
+ var _blockEditor = require("@wordpress/block-editor");
15
+
16
+ var _data = require("@wordpress/data");
17
+
18
+ var _coreData = require("@wordpress/core-data");
19
+
20
+ var _components = require("@wordpress/components");
21
+
22
+ var _i18n = require("@wordpress/i18n");
15
23
 
16
24
  var _header = _interopRequireDefault(require("./header"));
17
25
 
18
26
  var _blockPreviewPanel = _interopRequireDefault(require("./block-preview-panel"));
19
27
 
28
+ var _privateApis = require("../../private-apis");
29
+
30
+ var _subtitle = _interopRequireDefault(require("./subtitle"));
31
+
32
+ var _variationsPanel = require("./variations-panel");
33
+
20
34
  /**
21
35
  * WordPress dependencies
22
36
  */
@@ -24,19 +38,156 @@ var _blockPreviewPanel = _interopRequireDefault(require("./block-preview-panel")
24
38
  /**
25
39
  * Internal dependencies
26
40
  */
41
+ const {
42
+ useHasDimensionsPanel,
43
+ useHasTypographyPanel,
44
+ useHasBorderPanel,
45
+ useGlobalSetting,
46
+ useSettingsForBlockElement,
47
+ useHasColorPanel,
48
+ useHasEffectsPanel,
49
+ useHasFiltersPanel,
50
+ useGlobalStyle,
51
+ BorderPanel: StylesBorderPanel,
52
+ ColorPanel: StylesColorPanel,
53
+ TypographyPanel: StylesTypographyPanel,
54
+ DimensionsPanel: StylesDimensionsPanel,
55
+ EffectsPanel: StylesEffectsPanel,
56
+ FiltersPanel: StylesFiltersPanel,
57
+ AdvancedPanel: StylesAdvancedPanel
58
+ } = (0, _privateApis.unlock)(_blockEditor.privateApis);
59
+
27
60
  function ScreenBlock(_ref) {
28
61
  let {
29
- name
62
+ name,
63
+ variation
30
64
  } = _ref;
65
+ let prefixParts = [];
66
+
67
+ if (variation) {
68
+ prefixParts = ['variations', variation].concat(prefixParts);
69
+ }
70
+
71
+ const prefix = prefixParts.join('.');
72
+ const [style] = useGlobalStyle(prefix, name, 'user', {
73
+ shouldDecodeEncode: false
74
+ });
75
+ const [inheritedStyle, setStyle] = useGlobalStyle(prefix, name, 'all', {
76
+ shouldDecodeEncode: false
77
+ });
78
+ const [rawSettings, setSettings] = useGlobalSetting('', name);
79
+ const settings = useSettingsForBlockElement(rawSettings, name);
31
80
  const blockType = (0, _blocks.getBlockType)(name);
81
+ const blockVariations = (0, _variationsPanel.useBlockVariations)(name);
82
+ const hasTypographyPanel = useHasTypographyPanel(settings);
83
+ const hasColorPanel = useHasColorPanel(settings);
84
+ const hasBorderPanel = useHasBorderPanel(settings);
85
+ const hasDimensionsPanel = useHasDimensionsPanel(settings);
86
+ const hasEffectsPanel = useHasEffectsPanel(settings);
87
+ const hasFiltersPanel = useHasFiltersPanel(settings);
88
+ const hasVariationsPanel = !!(blockVariations !== null && blockVariations !== void 0 && blockVariations.length) && !variation;
89
+ const {
90
+ canEditCSS
91
+ } = (0, _data.useSelect)(select => {
92
+ var _globalStyles$_links$, _globalStyles$_links;
93
+
94
+ const {
95
+ getEntityRecord,
96
+ __experimentalGetCurrentGlobalStylesId
97
+ } = select(_coreData.store);
98
+
99
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
100
+
101
+ const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
102
+ return {
103
+ canEditCSS: (_globalStyles$_links$ = !!(globalStyles !== null && globalStyles !== void 0 && (_globalStyles$_links = globalStyles._links) !== null && _globalStyles$_links !== void 0 && _globalStyles$_links['wp:action-edit-css'])) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : false
104
+ };
105
+ }, []);
106
+ const currentBlockStyle = variation ? blockVariations.find(s => s.name === variation) : null; // These intermediary objects are needed because the "layout" property is stored
107
+ // in settings rather than styles.
108
+
109
+ const inheritedStyleWithLayout = (0, _element.useMemo)(() => {
110
+ return { ...inheritedStyle,
111
+ layout: settings.layout
112
+ };
113
+ }, [inheritedStyle, settings.layout]);
114
+ const styleWithLayout = (0, _element.useMemo)(() => {
115
+ return { ...style,
116
+ layout: settings.layout
117
+ };
118
+ }, [style, settings.layout]);
119
+
120
+ const onChangeDimensions = newStyle => {
121
+ const updatedStyle = { ...newStyle
122
+ };
123
+ delete updatedStyle.layout;
124
+ setStyle(updatedStyle);
125
+
126
+ if (newStyle.layout !== settings.layout) {
127
+ setSettings({ ...rawSettings,
128
+ layout: newStyle.layout
129
+ });
130
+ }
131
+ };
132
+
32
133
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
33
- title: blockType.title
134
+ title: variation ? currentBlockStyle.label : blockType.title
34
135
  }), (0, _element.createElement)(_blockPreviewPanel.default, {
136
+ name: name,
137
+ variation: variation
138
+ }), hasVariationsPanel && (0, _element.createElement)("div", {
139
+ className: "edit-site-global-styles-screen-variations"
140
+ }, (0, _element.createElement)(_components.__experimentalVStack, {
141
+ spacing: 3
142
+ }, (0, _element.createElement)(_subtitle.default, null, (0, _i18n.__)('Style Variations')), (0, _element.createElement)(_variationsPanel.VariationsPanel, {
35
143
  name: name
36
- }), (0, _element.createElement)(_contextMenu.default, {
37
- parentMenu: '/blocks/' + encodeURIComponent(name),
38
- name: name
39
- }));
144
+ }))), hasColorPanel && (0, _element.createElement)(StylesColorPanel, {
145
+ inheritedValue: inheritedStyle,
146
+ value: style,
147
+ onChange: setStyle,
148
+ settings: settings
149
+ }), hasTypographyPanel && (0, _element.createElement)(StylesTypographyPanel, {
150
+ inheritedValue: inheritedStyle,
151
+ value: style,
152
+ onChange: setStyle,
153
+ settings: settings
154
+ }), hasDimensionsPanel && (0, _element.createElement)(StylesDimensionsPanel, {
155
+ inheritedValue: inheritedStyleWithLayout,
156
+ value: styleWithLayout,
157
+ onChange: onChangeDimensions,
158
+ settings: settings,
159
+ includeLayoutControls: true
160
+ }), hasBorderPanel && (0, _element.createElement)(StylesBorderPanel, {
161
+ inheritedValue: inheritedStyle,
162
+ value: style,
163
+ onChange: setStyle,
164
+ settings: settings
165
+ }), hasEffectsPanel && (0, _element.createElement)(StylesEffectsPanel, {
166
+ inheritedValue: inheritedStyleWithLayout,
167
+ value: styleWithLayout,
168
+ onChange: onChangeDimensions,
169
+ settings: settings,
170
+ includeLayoutControls: true
171
+ }), hasFiltersPanel && (0, _element.createElement)(StylesFiltersPanel, {
172
+ inheritedValue: inheritedStyleWithLayout,
173
+ value: styleWithLayout,
174
+ onChange: onChangeDimensions,
175
+ settings: { ...settings,
176
+ color: { ...settings.color,
177
+ customDuotone: false //TO FIX: Custom duotone only works on the block level right now
178
+
179
+ }
180
+ },
181
+ includeLayoutControls: true
182
+ }), canEditCSS && (0, _element.createElement)(_components.PanelBody, {
183
+ title: (0, _i18n.__)('Advanced'),
184
+ initialOpen: false
185
+ }, (0, _element.createElement)("p", null, (0, _i18n.sprintf)( // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
186
+ (0, _i18n.__)('Add your own CSS to customize the appearance of the %s block.'), blockType === null || blockType === void 0 ? void 0 : blockType.title)), (0, _element.createElement)(StylesAdvancedPanel, {
187
+ value: style,
188
+ onChange: setStyle,
189
+ inheritedValue: inheritedStyle
190
+ })));
40
191
  }
41
192
 
42
193
  var _default = ScreenBlock;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"names":["ScreenBlock","name","blockType","title","encodeURIComponent"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKA,SAASA,WAAT,OAAiC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAChC,QAAMC,SAAS,GAAG,0BAAcD,IAAd,CAAlB;AAEA,SACC,qDACC,4BAAC,eAAD;AAAc,IAAA,KAAK,EAAGC,SAAS,CAACC;AAAhC,IADD,EAEC,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGF;AAA1B,IAFD,EAGC,4BAAC,oBAAD;AACC,IAAA,UAAU,EAAG,aAAaG,kBAAkB,CAAEH,IAAF,CAD7C;AAEC,IAAA,IAAI,EAAGA;AAFR,IAHD,CADD;AAUA;;eAEcD,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ContextMenu from './context-menu';\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\n\nfunction ScreenBlock( { name } ) {\n\tconst blockType = getBlockType( name );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ blockType.title } />\n\t\t\t<BlockPreviewPanel name={ name } />\n\t\t\t<ContextMenu\n\t\t\t\tparentMenu={ '/blocks/' + encodeURIComponent( name ) }\n\t\t\t\tname={ name }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","AdvancedPanel","StylesAdvancedPanel","blockEditorPrivateApis","ScreenBlock","name","variation","prefixParts","concat","prefix","join","style","shouldDecodeEncode","inheritedStyle","setStyle","rawSettings","setSettings","settings","blockType","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasVariationsPanel","length","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","undefined","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","label","title","color","customDuotone"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAYA;AACA;AACA;AAOA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,qBAFK;AAGLC,EAAAA,iBAHK;AAILC,EAAAA,gBAJK;AAKLC,EAAAA,0BALK;AAMLC,EAAAA,gBANK;AAOLC,EAAAA,kBAPK;AAQLC,EAAAA,kBARK;AASLC,EAAAA,cATK;AAULC,EAAAA,WAAW,EAAEC,iBAVR;AAWLC,EAAAA,UAAU,EAAEC,gBAXP;AAYLC,EAAAA,eAAe,EAAEC,qBAZZ;AAaLC,EAAAA,eAAe,EAAEC,qBAbZ;AAcLC,EAAAA,YAAY,EAAEC,kBAdT;AAeLC,EAAAA,YAAY,EAAEC,kBAfT;AAgBLC,EAAAA,aAAa,EAAEC;AAhBV,IAiBF,yBAAQC,wBAAR,CAjBJ;;AAmBA,SAASC,WAAT,OAA4C;AAAA,MAAtB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAsB;AAC3C,MAAIC,WAAW,GAAG,EAAlB;;AACA,MAAKD,SAAL,EAAiB;AAChBC,IAAAA,WAAW,GAAG,CAAE,YAAF,EAAgBD,SAAhB,EAA4BE,MAA5B,CAAoCD,WAApC,CAAd;AACA;;AACD,QAAME,MAAM,GAAGF,WAAW,CAACG,IAAZ,CAAkB,GAAlB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AFT;AAGC,IAAA,QAAQ,EAAGC,kBAHZ;AAIC,IAAA,QAAQ,EAAG1B,QAJZ;AAKC,IAAA,qBAAqB;AALtB,IA/CF,EAuDGQ,eAAe,IAChB,4BAAC,kBAAD;AACC,IAAA,cAAc,EAAGe,wBADlB;AAEC,IAAA,KAAK,EAAGE,eAFT;AAGC,IAAA,QAAQ,EAAGC,kBAHZ;AAIC,IAAA,QAAQ,EAAG,EACV,GAAG1B,QADO;AAEV+B,MAAAA,KAAK,EAAE,EACN,GAAG/B,QAAQ,CAAC+B,KADN;AAENC,QAAAA,aAAa,EAAE,KAFT,CAEgB;;AAFhB;AAFG,KAJZ;AAWC,IAAA,qBAAqB;AAXtB,IAxDF,EAsEGrB,UAAU,IACX,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ,CAAnB;AAAsC,IAAA,WAAW,EAAG;AAApD,KACC,uCACG,oBACD;AACA,gBACC,+DADD,CAFC,EAKDV,SALC,aAKDA,SALC,uBAKDA,SAAS,CAAE6B,KALV,CADH,CADD,EAUC,4BAAC,mBAAD;AACC,IAAA,KAAK,EAAGpC,KADT;AAEC,IAAA,QAAQ,EAAGG,QAFZ;AAGC,IAAA,cAAc,EAAGD;AAHlB,IAVD,CAvEF,CADD;AA2FA;;eAEcT,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../private-apis';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ style, settings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== settings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...settings.color,\n\t\t\t\t\t\t\tcustomDuotone: false, //TO FIX: Custom duotone only works on the block level right now\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"]}
@@ -21,8 +21,6 @@ var _palette = _interopRequireDefault(require("./palette"));
21
21
 
22
22
  var _blockPreviewPanel = _interopRequireDefault(require("./block-preview-panel"));
23
23
 
24
- var _utils = require("./utils");
25
-
26
24
  var _privateApis = require("../../private-apis");
27
25
 
28
26
  /**
@@ -39,38 +37,23 @@ const {
39
37
  ColorPanel: StylesColorPanel
40
38
  } = (0, _privateApis.unlock)(_blockEditor.privateApis);
41
39
 
42
- function ScreenColors(_ref) {
43
- let {
44
- name,
45
- variation = ''
46
- } = _ref;
47
- const variationClassName = (0, _utils.getVariationClassName)(variation);
48
- let prefixParts = [];
49
-
50
- if (variation) {
51
- prefixParts = ['variations', variation].concat(prefixParts);
52
- }
53
-
54
- const prefix = prefixParts.join('.');
55
- const [style] = useGlobalStyle(prefix, name, 'user', false);
56
- const [inheritedStyle, setStyle] = useGlobalStyle(prefix, name, 'all', {
40
+ function ScreenColors() {
41
+ const [style] = useGlobalStyle('', undefined, 'user', {
42
+ shouldDecodeEncode: false
43
+ });
44
+ const [inheritedStyle, setStyle] = useGlobalStyle('', undefined, 'all', {
57
45
  shouldDecodeEncode: false
58
46
  });
59
- const [rawSettings] = useGlobalSetting('', name);
60
- const settings = useSettingsForBlockElement(rawSettings, name);
47
+ const [rawSettings] = useGlobalSetting('');
48
+ const settings = useSettingsForBlockElement(rawSettings);
61
49
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
62
50
  title: (0, _i18n.__)('Colors'),
63
51
  description: (0, _i18n.__)('Manage palettes and the default color of different global elements on the site.')
64
- }), (0, _element.createElement)(_blockPreviewPanel.default, {
65
- name: name,
66
- variation: variationClassName
67
- }), (0, _element.createElement)("div", {
52
+ }), (0, _element.createElement)(_blockPreviewPanel.default, null), (0, _element.createElement)("div", {
68
53
  className: "edit-site-global-styles-screen-colors"
69
54
  }, (0, _element.createElement)(_components.__experimentalVStack, {
70
55
  spacing: 10
71
- }, (0, _element.createElement)(_palette.default, {
72
- name: name
73
- }), (0, _element.createElement)(StylesColorPanel, {
56
+ }, (0, _element.createElement)(_palette.default, null), (0, _element.createElement)(StylesColorPanel, {
74
57
  inheritedValue: inheritedStyle,
75
58
  value: style,
76
59
  onChange: setStyle,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-colors.js"],"names":["useGlobalStyle","useGlobalSetting","useSettingsForBlockElement","ColorPanel","StylesColorPanel","blockEditorPrivateApis","ScreenColors","name","variation","variationClassName","prefixParts","concat","prefix","join","style","inheritedStyle","setStyle","shouldDecodeEncode","rawSettings","settings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA,MAAM;AACLA,EAAAA,cADK;AAELC,EAAAA,gBAFK;AAGLC,EAAAA,0BAHK;AAILC,EAAAA,UAAU,EAAEC;AAJP,IAKF,yBAAQC,wBAAR,CALJ;;AAOA,SAASC,YAAT,OAAkD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACjD,QAAMC,kBAAk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{ __ } from '@wordpress/i18n';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport Palette from './palette';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassName } from './utils';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseGlobalStyle,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tColorPanel: StylesColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenColors( { name, variation = '' } ) {\n\tconst variationClassName = getVariationClassName( variation );\n\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', false );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Colors' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage palettes and the default color of different global elements on the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\n\t\t\t<div className=\"edit-site-global-styles-screen-colors\">\n\t\t\t\t<VStack spacing={ 10 }>\n\t\t\t\t\t<Palette name={ name } />\n\n\t\t\t\t\t<StylesColorPanel\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenColors;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-colors.js"],"names":["useGlobalStyle","useGlobalSetting","useSettingsForBlockElement","ColorPanel","StylesColorPanel","blockEditorPrivateApis","ScreenColors","style","undefined","shouldDecodeEncode","inheritedStyle","setStyle","rawSettings","settings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAKA;AACA;AACA;AAMA,MAAM;AACLA,EAAAA,cADK;AAELC,EAAAA,gBAFK;AAGLC,EAAAA,0BAHK;AAILC,EAAAA,UAAU,EAAEC;AAJP,IAKF,yBAAQC,wBAAR,CALJ;;AAOA,SAASC,YAAT,GAAwB;AACvB,QAAM,CAAEC,KAAF,IAAYP,cAAc,CAAE,EAAF,EAAMQ,SAAN,EAAiB,MAAjB,EAAyB;AACxDC,IAAAA,kBAAkB,EAAE;AADoC,GAAzB,CAAhC;AAGA,QAAM,CAAEC,cAAF,EAAkBC,QAAlB,IAA+BX,cAAc,CAAE,EAAF,EAAMQ,SAAN,EAAiB,KAAjB,EAAwB;AAC1EC,IAAAA,kBAAkB,EAAE;AADsD,GAAxB,CAAnD;AAGA,QAAM,CAAEG,WAAF,IAAkBX,gBAAgB,CAAE,EAAF,CAAxC;AACA,QAAMY,QAAQ,GAAGX,0BAA0B,CAAEU,WAAF,CAA3C;AAEA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,iFADa;AAFf,IADD,EAQC,4BAAC,0BAAD,OARD,EAUC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,gBAAD,OADD,EAGC,4BAAC,gBAAD;AACC,IAAA,cAAc,EAAGF,cADlB;AAEC,IAAA,KAAK,EAAGH,KAFT;AAGC,IAAA,QAAQ,EAAGI,QAHZ;AAIC,IAAA,QAAQ,EAAGE;AAJZ,IAHD,CADD,CAVD,CADD;AAyBA;;eAEcP,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport Palette from './palette';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseGlobalStyle,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tColorPanel: StylesColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenColors() {\n\tconst [ style ] = useGlobalStyle( '', undefined, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( '', undefined, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ rawSettings ] = useGlobalSetting( '' );\n\tconst settings = useSettingsForBlockElement( rawSettings );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Colors' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage palettes and the default color of different global elements on the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel />\n\n\t\t\t<div className=\"edit-site-global-styles-screen-colors\">\n\t\t\t\t<VStack spacing={ 10 }>\n\t\t\t\t\t<Palette />\n\n\t\t\t\t\t<StylesColorPanel\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenColors;\n"]}
@@ -13,11 +13,11 @@ var _i18n = require("@wordpress/i18n");
13
13
 
14
14
  var _components = require("@wordpress/components");
15
15
 
16
- var _blocks = require("@wordpress/blocks");
16
+ var _blockEditor = require("@wordpress/block-editor");
17
17
 
18
- var _header = _interopRequireDefault(require("./header"));
18
+ var _privateApis = require("../../private-apis");
19
19
 
20
- var _customCss = _interopRequireDefault(require("./custom-css"));
20
+ var _header = _interopRequireDefault(require("./header"));
21
21
 
22
22
  /**
23
23
  * WordPress dependencies
@@ -26,16 +26,19 @@ var _customCss = _interopRequireDefault(require("./custom-css"));
26
26
  /**
27
27
  * Internal dependencies
28
28
  */
29
- function ScreenCSS(_ref) {
30
- let {
31
- name
32
- } = _ref;
33
- // If name is defined, we are customizing CSS at the block level.
34
- // Display the block title in the description.
35
- const blockType = (0, _blocks.getBlockType)(name);
36
- const title = blockType === null || blockType === void 0 ? void 0 : blockType.title;
37
- const description = title !== undefined ? (0, _i18n.sprintf)( // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
38
- (0, _i18n.__)('Add your own CSS to customize the appearance of the %s block.'), title) : (0, _i18n.__)('Add your own CSS to customize the appearance and layout of your site.');
29
+ const {
30
+ useGlobalStyle,
31
+ AdvancedPanel: StylesAdvancedPanel
32
+ } = (0, _privateApis.unlock)(_blockEditor.privateApis);
33
+
34
+ function ScreenCSS() {
35
+ const description = (0, _i18n.__)('Add your own CSS to customize the appearance and layout of your site.');
36
+ const [style] = useGlobalStyle('', undefined, 'user', {
37
+ shouldDecodeEncode: false
38
+ });
39
+ const [inheritedStyle, setStyle] = useGlobalStyle('', undefined, 'all', {
40
+ shouldDecodeEncode: false
41
+ });
39
42
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
40
43
  title: (0, _i18n.__)('CSS'),
41
44
  description: (0, _element.createElement)(_element.Fragment, null, description, (0, _element.createElement)(_components.ExternalLink, {
@@ -44,8 +47,10 @@ function ScreenCSS(_ref) {
44
47
  }, (0, _i18n.__)('Learn more about CSS')))
45
48
  }), (0, _element.createElement)("div", {
46
49
  className: "edit-site-global-styles-screen-css"
47
- }, (0, _element.createElement)(_customCss.default, {
48
- blockName: name
50
+ }, (0, _element.createElement)(StylesAdvancedPanel, {
51
+ value: style,
52
+ onChange: setStyle,
53
+ inheritedValue: inheritedStyle
49
54
  })));
50
55
  }
51
56
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-css.js"],"names":["ScreenCSS","name","blockType","title","description","undefined"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,SAASA,SAAT,OAA+B;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC9B;AACA;AACA,QAAMC,SAAS,GAAG,0BAAcD,IAAd,CAAlB;AACA,QAAME,KAAK,GAAGD,SAAH,aAAGA,SAAH,uBAAGA,SAAS,CAAEC,KAAzB;AAEA,QAAMC,WAAW,GAChBD,KAAK,KAAKE,SAAV,GACG,oBACA;AACA,gBACC,+DADD,CAFA,EAKAF,KALA,CADH,GAQG,cACA,uEADA,CATJ;AAaA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,KAAJ,CADT;AAEC,IAAA,WAAW,EACV,qDACGC,WADH,EAEC,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAC,kDADN;AAEC,MAAA,SAAS,EAAC;AAFX,OAIG,cAAI,sBAAJ,CAJH,CAFD;AAHF,IADD,EAeC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AAAkB,IAAA,SAAS,EAAGH;AAA9B,IADD,CAfD,CADD;AAqBA;;eAEcD,S","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { ExternalLink } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport CustomCSSControl from './custom-css';\n\nfunction ScreenCSS( { name } ) {\n\t// If name is defined, we are customizing CSS at the block level.\n\t// Display the block title in the description.\n\tconst blockType = getBlockType( name );\n\tconst title = blockType?.title;\n\n\tconst description =\n\t\ttitle !== undefined\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block.'\n\t\t\t\t\t),\n\t\t\t\t\ttitle\n\t\t\t )\n\t\t\t: __(\n\t\t\t\t\t'Add your own CSS to customize the appearance and layout of your site.'\n\t\t\t );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'CSS' ) }\n\t\t\t\tdescription={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref=\"https://wordpress.org/documentation/article/css/\"\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-css-help-link\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about CSS' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-css\">\n\t\t\t\t<CustomCSSControl blockName={ name } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenCSS;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-css.js"],"names":["useGlobalStyle","AdvancedPanel","StylesAdvancedPanel","blockEditorPrivateApis","ScreenCSS","description","style","undefined","shouldDecodeEncode","inheritedStyle","setStyle"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,cAAF;AAAkBC,EAAAA,aAAa,EAAEC;AAAjC,IAAyD,yBAC9DC,wBAD8D,CAA/D;;AAIA,SAASC,SAAT,GAAqB;AACpB,QAAMC,WAAW,GAAG,cACnB,uEADmB,CAApB;AAGA,QAAM,CAAEC,KAAF,IAAYN,cAAc,CAAE,EAAF,EAAMO,SAAN,EAAiB,MAAjB,EAAyB;AACxDC,IAAAA,kBAAkB,EAAE;AADoC,GAAzB,CAAhC;AAGA,QAAM,CAAEC,cAAF,EAAkBC,QAAlB,IAA+BV,cAAc,CAAE,EAAF,EAAMO,SAAN,EAAiB,KAAjB,EAAwB;AAC1EC,IAAAA,kBAAkB,EAAE;AADsD,GAAxB,CAAnD;AAIA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,KAAJ,CADT;AAEC,IAAA,WAAW,EACV,qDACGH,WADH,EAEC,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAC,kDADN;AAEC,MAAA,SAAS,EAAC;AAFX,OAIG,cAAI,sBAAJ,CAJH,CAFD;AAHF,IADD,EAeC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,mBAAD;AACC,IAAA,KAAK,EAAGC,KADT;AAEC,IAAA,QAAQ,EAAGI,QAFZ;AAGC,IAAA,cAAc,EAAGD;AAHlB,IADD,CAfD,CADD;AAyBA;;eAEcL,S","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink } from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport ScreenHeader from './header';\n\nconst { useGlobalStyle, AdvancedPanel: StylesAdvancedPanel } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenCSS() {\n\tconst description = __(\n\t\t'Add your own CSS to customize the appearance and layout of your site.'\n\t);\n\tconst [ style ] = useGlobalStyle( '', undefined, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( '', undefined, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'CSS' ) }\n\t\t\t\tdescription={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref=\"https://wordpress.org/documentation/article/css/\"\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-css-help-link\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about CSS' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-css\">\n\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenCSS;\n"]}
@@ -19,8 +19,6 @@ var _header = _interopRequireDefault(require("./header"));
19
19
 
20
20
  var _blockPreviewPanel = _interopRequireDefault(require("./block-preview-panel"));
21
21
 
22
- var _utils = require("./utils");
23
-
24
22
  var _privateApis = require("../../private-apis");
25
23
 
26
24
  /**
@@ -36,24 +34,13 @@ const {
36
34
  useSettingsForBlockElement
37
35
  } = (0, _privateApis.unlock)(_blockEditor.privateApis);
38
36
 
39
- function ScreenLayout(_ref) {
40
- let {
41
- name,
42
- variation = ''
43
- } = _ref;
44
- const [rawSettings] = useGlobalSetting('', name);
45
- const settings = useSettingsForBlockElement(rawSettings, name);
37
+ function ScreenLayout() {
38
+ const [rawSettings] = useGlobalSetting('');
39
+ const settings = useSettingsForBlockElement(rawSettings);
46
40
  const hasDimensionsPanel = useHasDimensionsPanel(settings);
47
- const variationClassName = (0, _utils.getVariationClassName)(variation);
48
41
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
49
42
  title: (0, _i18n.__)('Layout')
50
- }), (0, _element.createElement)(_blockPreviewPanel.default, {
51
- name: name,
52
- variation: variationClassName
53
- }), hasDimensionsPanel && (0, _element.createElement)(_dimensionsPanel.default, {
54
- name: name,
55
- variation: variation
56
- }));
43
+ }), (0, _element.createElement)(_blockPreviewPanel.default, null), hasDimensionsPanel && (0, _element.createElement)(_dimensionsPanel.default, null));
57
44
  }
58
45
 
59
46
  var _default = ScreenLayout;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-layout.js"],"names":["useHasDimensionsPanel","useGlobalSetting","useSettingsForBlockElement","blockEditorPrivateApis","ScreenLayout","name","variation","rawSettings","settings","hasDimensionsPanel","variationClassName"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA,qBAAF;AAAyBC,EAAAA,gBAAzB;AAA2CC,EAAAA;AAA3C,IACL,yBAAQC,wBAAR,CADD;;AAGA,SAASC,YAAT,OAAkD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACjD,QAAM,CAAEC,WAAF,IAAkBN,gBAAgB,CAAE,EAAF,EAAMI,IAAN,CAAxC;AACA,QAAMG,QAAQ,GAAGN,0BAA0B,CAAEK,WAAF,EAAeF,IAAf,CAA3C;AACA,QAAMI,kBAAkB,GAAGT,qBAAqB,CAAEQ,QAAF,CAAhD;AACA,QAAME,kBAAkB,GAAG,kCAAuBJ,SAAvB,CAA3B;AACA,SACC,qDACC,4BAAC,eAAD;AAAc,IAAA,KAAK,EAAG,cAAI,QAAJ;AAAtB,IADD,EAEC,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGD,IAA1B;AAAiC,IAAA,SAAS,EAAGK;AAA7C,IAFD,EAGGD,kBAAkB,IACnB,4BAAC,wBAAD;AAAiB,IAAA,IAAI,EAAGJ,IAAxB;AAA+B,IAAA,SAAS,EAAGC;AAA3C,IAJF,CADD;AASA;;eAEcF,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DimensionsPanel from './dimensions-panel';\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassName } from './utils';\nimport { unlock } from '../../private-apis';\n\nconst { useHasDimensionsPanel, useGlobalSetting, useSettingsForBlockElement } =\n\tunlock( blockEditorPrivateApis );\n\nfunction ScreenLayout( { name, variation = '' } ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst variationClassName = getVariationClassName( variation );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Layout' ) } />\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<DimensionsPanel name={ name } variation={ variation } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenLayout;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-layout.js"],"names":["useHasDimensionsPanel","useGlobalSetting","useSettingsForBlockElement","blockEditorPrivateApis","ScreenLayout","rawSettings","settings","hasDimensionsPanel"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;;AAIA;AACA;AACA;AAMA,MAAM;AAAEA,EAAAA,qBAAF;AAAyBC,EAAAA,gBAAzB;AAA2CC,EAAAA;AAA3C,IACL,yBAAQC,wBAAR,CADD;;AAGA,SAASC,YAAT,GAAwB;AACvB,QAAM,CAAEC,WAAF,IAAkBJ,gBAAgB,CAAE,EAAF,CAAxC;AACA,QAAMK,QAAQ,GAAGJ,0BAA0B,CAAEG,WAAF,CAA3C;AACA,QAAME,kBAAkB,GAAGP,qBAAqB,CAAEM,QAAF,CAAhD;AACA,SACC,qDACC,4BAAC,eAAD;AAAc,IAAA,KAAK,EAAG,cAAI,QAAJ;AAAtB,IADD,EAEC,4BAAC,0BAAD,OAFD,EAGGC,kBAAkB,IAAI,4BAAC,wBAAD,OAHzB,CADD;AAOA;;eAEcH,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DimensionsPanel from './dimensions-panel';\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../private-apis';\n\nconst { useHasDimensionsPanel, useGlobalSetting, useSettingsForBlockElement } =\n\tunlock( blockEditorPrivateApis );\n\nfunction ScreenLayout() {\n\tconst [ rawSettings ] = useGlobalSetting( '' );\n\tconst settings = useSettingsForBlockElement( rawSettings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Layout' ) } />\n\t\t\t<BlockPreviewPanel />\n\t\t\t{ hasDimensionsPanel && <DimensionsPanel /> }\n\t\t</>\n\t);\n}\n\nexport default ScreenLayout;\n"]}